Liferay control panel to code - java

I'm new to Liferay but I have to update (fix bug and add some enhancement) a site made with Liferay 6.1.1
I have a form that create an organization and a blank site for it.
The problem is that currently, an admin have to go to the control panel, change the public site template, change the name in the template to organization's name, check an option to merge with the main site public pages, then give admin rights for their site to the user who create it.
This task have no variant so I'm quite sure it can be done automatically when the user create the organization. I find the java files which create the organization from the form, but I have no idea where I should look for to make previous task automatic, or how to add it to the code...
Anybody can help me plz ?

Suggestion I can give you is some tip, how to look for specified classes allowing you to do some work. Each time you want to start to creating, modifying, removing some Liferay objects, just look for this pattern:
${MODEL_NAME}LocalServiceUtil.java
Here are few examples:
If you are looking for Liferay API allowing you to create some User, just look for class UserLocalServiceUtil.java
If you want modify some Layout look for LayoutLocalServiceUtil.java
and so on with rest. Most of time Liferay serve such classes with plenty useful static methods, which means you can use them immediately in your code.
Your work doesn't seem to be very hard, try to look for such util services and you should be able to achieve your goals easly. Good luck! ;-)

tomic answer's help me well to start the work. I just want to add an other link I just find with some usefull information close to what I try to do :
https://blog.ancud.de/home/-/blogs/creating-sites-and-users-programmatically
Also there is a "definition" part in it wich is very usefull when you are new to Liferay :
To start with we have to know the right terms:
A site in Liferay is a Group with a special site flag set to 'true',
a page is called Layout and
a site template is called LayoutSetPrototype.

Related

Remove Default WMS Layer From WorldWind Java

How do you remove the default WMS Layer from a basic WorldWind Java application? If I remove it like so, my application is still trying to reach the public WorldWind WMS servers:
import gov.nasa.worldwind.Model;
Model testModel = new BasicModel();
testModel.getLayers().clear(); // Makes default geo invisible, but still queries server in background.
// Add my own layers, here
Oh wow - thanks for reminding me about an old love !
However, regarding your question:
If you want to work completely offline, use property
gov.nasa.worldwind.avkey.OfflineMode
(answer found here)
If you want to remove individual layers, take a look at the config folder.
config/worlwind.layers.xml contains the layer config, just comment out layer you do not want to use.
The folder resides in worldwind.jar when using the standard build, but you can specify a different location - take a look at the Configuration class on how to do that.
There is also another interesting file there, DataFileStore.xml, which lets you define the cache location. If you fill the cache with your area of interest while being online, this data will also be used when in offline mode. Once there were also Cachepacks available but it seem these are not available anymore.
I think there was also a tool to select an area and download the data into the cache for offline mode.
Have fun !

How to create a Build-your-own xy using Java

I am looking to build a web app that allows you to pick from options like color and size, essentially custom building your own item. Similar to this: http://www.mangobikes.co.uk/bikes/custom/custom-build-your-single-speed-bike
It needs to allow me to display different pictures depending on the choices, and its supposed to have 5 dropdown menus with options. Those options also have submenus to pick colors from.
I am new to Java, and not sure where to start. Is there maybe a good how-to somewhere on the internet? And if not, any hints on how to set it all up?
Thank you
It is quite difficult to answer such a broad question (and that's why it is downvoted), but sometimes it is also difficult for beginners to know where to look.
So some pointers then:
The first thing you want: "display different pictures depending on the choices, and its supposed to have 5 dropdown menus with options" is a matter of web user interface, so you can solve it with basic javascript and HTML (see Change image source with javascript as an example). You can do that in an offline html file (you don't need java for it).
Then I assume that you need some kind of backend to send the selected values and do whatever you need with them. Without more information and assuming you want to do it with java, maybe a good alternative to prototype it could be the spark java framework.

JSP/Tomcat: Navigation system with sub-folders but one page

My JSP project is the back-end of a fairly simple site with the purpose to show many submissions which I want to present on the website. They are organized in categories, basically similar to a typical forum.
The content is loaded entirely from a database since making separate files for everything would be extremely redundant.
However, I want to give the users the possibility to navigate properly on my site and also give unique links to each submission.
So for example a link can be: site.com/category1/subcategory2/submission3.jsp
I know how to generate those links, but is there a way to automatically redirect all the theoretically possible links to the main site.com/index.jsp ?
The Java code of the JSP needs access to the original link of course.
Hope someone has an idea..
Big thanks in advance! :)
Alright, in case someone stumbles across this one day...
The way I've been able to solve this was by using a Servlet. Eclipse allows their creation directly in the project and the wizard even allows you to set the url-mapping, for example /main/* so you don't have to mess with the web.xml yourself.
The doGet function simply contains the redirection as follows:
request.getRequestDispatcher("/index.jsp").forward(request,response);
This kind of redirection unfortunately causes all relative links in the webpage to fail. This can be solved by hardlinking to the root directory for example though. See the neat responses here for alternatives: Browser can't access/find relative resources like CSS, images and links when calling a Servlet which forwards to a JSP

Add an Eclipse 4.4 Perspective in existing Eclipse 3 Application

I have an existing Eclipse 3 RCP application (the compatibility layer is already added to the existing application) in which I would like to add a perspective (of course containing parts, toolbars, menus..) developed with Eclipse 4.4 (Luna).
1) Is this possible ?
2) If, yes could you please give me more information on how to do that and perhaps links containing more informations ?
UPDATE : So I finally manage it to make it work so for those of you who had the same questions here are the answers. So yes it is possible to mix Eclipse 3 and Eclipse 4(some complications but you can manage it :) ) for more information on how I did you can go to the link I left in a comment down below. Hope this going to be helpfull :)
You can likely do something close. You could implement the 'createInitialPerspective' method of the your IPerspectiveFactory to downCast the given IPageLayout to its underlying class "ModeledPageLayout". This will give you access to the new MPerspective's model (as well as the useful utility methods). Then you're off to the races and can set the model for your perspective up as you desire (as long as the result can be rendered).
I tried something that Alexander adviced me to do and it worked perfectly :) The only issue that I have now, is how to add the perspective added to the perspective switcher. (The method I followed enabled me to add the perspective but when I run the application it is displayed in the tool bar and I don't want it to be like that I want it to be only present in the perspective switcher). Anyway here's the link for the solution I tried. Hope this gona be help full.
https://www.eclipse.org/forums/index.php/m/1690630/#msg_1690630

Instructions Package for Java

I want to make a help/instructions page for my Java program but I really don't want to have to go through and program all the frames and searching and such. Is there a package or program that I can just insert the data into and it will read it and create the dialog? I couldn't seem to find anything about it on Google.
It doesn't have to look like this at all but I like having the table of contents and the search at least.
alt text http://www.freeimagehosting.net/uploads/752f287397.png
Thanks
Java help system : https://javahelp.dev.java.net/
The windows help dialog you show is part of the Window Help subsystem. You could easily create a help file for that and launch it from your Java application, but it would be platform specific. If you want to implement cross-platform help functionality, you're probably going to have to implement it yourself, but you could probably do it simply by including a set of HTML resources and using an embedded lucene index to supply search functionalty.
Have you consider using a simple HTML based manual and/or website where all that information may be accessed through?
Pretty much like http://java.sun.com/javase/6/docs/ for instance where you have a main page and you can navigate the topics from there?
If that's a website ( rather than a local /doc directory ) you can have the extra benefit from having a full featured search engine index it for you.
See also: Google is the Help menu
After all, how many times do you use these help systems instead of searching the web?

Categories