text;
stringlengths
5
32.6k
synchronous messaging occurs when the sender blocks, waiting for a response from during this block, the sender cannot process any additional this means that the thread the message is sent from is effectively locked until it receives a response. you should therefore use synchronous messaging only in cases where it is absolutely necessary that a response is you can think of this as a sort of high priority read this tutorial uses such a case to illustrate the steps required to set up and use synchronous messaging between two portlets in a a rock concert requires many things to be set up before the show can go on. the amplifiers, sound system, lighting, and any other stage effects have to be installed and tested for the show to be naturally, the tour manager has chosen liferay portal for managing the manager has a tasks portlet for submitting setup tasks, which then need to go to the roadies' setup portlet on a separate page. manager also needs confirmation, before moving on with other things, that the roadies' setup portlet has received each request. you first need to figure out what your destination keys will be. keys serve as the specific locations where messages are sent. them as the mailing addresses of the message bus system. are included with the message and registered as destinations in in this example, the destination keys are chosen to reflect the package names of the two portlets the following table shows the destination keys, senders, and receivers for the tasks and setup portlets described above the receiver sends its response messages to a destination where the sender this way, a full-bodied response message is sent back to the sender along with the response object. now that you know what your destination keys are, you can use them when writing the code that sends and receives the you'll start with the message sender first now it's time to write the message sender code. this code goes in the method of your application that you want it to be called with. sender code for the tour manager's tasks portlet is in the updatetask method this is because a synchronous message needs to be sent each time the tour manager adds a new task to the portlet the sender takes the following steps creates the message using liferay's message class stuffs the message with keyvalue pairs using the put method. example, keyvalue pairs of a task entity are added sets a response id and response destination for listeners to use in replying sends the message to the destination with a timeout value of 10,000 this is how long the sender blocks for while waiting for a if no response is received, then a messagebusexception is thrown make sure to add the following imports to your message sender file now that you've got your message sender implemented, it's time to head to the next stop on the message busthe message listener! implementing the message listener is slightly more involved than implementing to implement the listener, you need to make a class that implements liferay's messagelistener interface. the tour manager's tasks portlet here the listener class takes the following steps implements the receivemessage message method of the extracts values from the message parameter by getting values associated for example, this example gets the name key that was creates and sends a response message object based on the message received accesses the response destination name from the message variable and sets the destination of the response message. in this example, the payload is set to received, which is in turn used by the original sender to display a sends the response message to the response destination make sure to add the following imports to your message listener file now you have both a sender and a listener implemented for your messages! just one more thing to take care of before you're done for the message bus to direct messages from destinations to listeners successfully, you must register the listeners by configuring the appropriate mappings in your plugin's url file warning you should only do this after implementing any senders and tools like liferay ide and liferay developer studio automatically deploy plugins as you save changes. listener classes that don't yet exist, exceptions will be thrown when your create the url file if it's not already for example, here's the configuration for the custom tasks and this configuration specifies the following beans now you just need to register this url file in your to do so, place the following code just above the closing tag in the url file save and redeploy your portlet. your plugin should now send and receive messages in the case of the tour manager, the tasks portlet now displays the success message when a setup task is added figure 2 the response to the synchronous message is successful! likewise, the roadies' setup portlet now gets any new tasks added by the road figure 3 the task was created in the roadies' setup portlet you've completed your first trip on the message bus! developing with the plugins sdk developing plugins with liferay ide;;
asynchronous messaging consists of sending a message and then continuing with the sender doesn't block and wait for an immediate response. allows the sender to continue with other tasks. to allow the listener to respond to the sender. the sender implements a call-back by stuffing the message with a destination key that lets the listener know where to send its response. think of this as a return address of sorts. asynchronous messaging with call-backs by showing you how to implement it between one sending and two listening portlets in a plugin project. the code for this example plugin project here a rock concert requires many things to be done the amplifiers, sound system, lighting, and any other stage effects have to be set up properly for the show to be successful. naturally, the tour manager has chosen liferay portal for managing all these the manager has a tasks portlet for submitting items that need to be set the tasks then need to go to the roadies' setup portlet and the inventory the manager also wants a response from these however, the manager is very busy. it wouldn't be practical to put everything else on hold while waiting for responses from each setup task. asynchronous messaging with call-backs is an ideal solution. the messages sent by the tasks portlet to the setup and inventory portlets are sent in series instead of in parallel. now it's time to hop on the message bus! figure 1 asynchronous messaging with serial dispatching you first need to figure out what your destination keys will be. keys are the locations where messages are sent. mailing addresses of the message bus system. the destination keys need to be included with the message and registered as destinations in in this example, the destination keys are chosen to reflect the package names of the two portlets the following table shows the destination keys, senders, and listeners for the tasks, setup, and inventory portlets described above now that you know what your destination keys are, you can use them when writing the code for sending and receiving messages. sender in the tasks portlet first to get the wheels on the message bus rolling, you need to start with the initial in this example, the initial sender is inside the method of the tasks portlet that is responsible for adding new setup tasks. the messages need to be sent each time the tour manager adds a new setup task. a sender for an asynchronous message with a call-back does the following things creates a jsonobject to serve as the message uses the put method to stuff the message with keyvalue pairs. example, some keyvalue pairs of a task entity are added adds the call-back destination key sends the message to the destination you also need to be sure that you add the following import now that you've implemented your initial sender, you can implement your you need to have one or more message listeners implemented to receive messages each listener is a class that implements liferay's in this example there are three listeners, one for you can find the example listeners here asynchronous listeners with call-backs do the following things implements the receivemessage message method of the gets the message payload and cast it to a string creates a jsonobject from the payload string gets values from the jsonobject using its getter methods. the values that were added by the sender. also note that the destination key from the sender is retrieved for use in the call-back creates a jsonobject to use as the response message stuffs the response message with keyvalue pairs sends the message back to the sender make sure that you add the following imports to your listener classes any other listeners you need can be implemented using the same steps. you'll configure your listeners and destinations for use with the message bus now that you've implemented your message senders and listeners, you need to configure them in your plugin's url create this file if it doesn't yet exist warning you should only do this after implementing any senders and tools like liferay ide and liferay developer studio automatically deploy plugins as you save changes. listener classes in the configuration file that don't yet exist, exceptions will be thrown when your application is deployed for example, here's the configuration file for the tasks, setup, and inventory this configuration specifies the following beans now you just need to register this url file in your to do so, place the following code just above the closing tag in the url file save and redeploy your portlet. your plugin should now send and receive messages in the case of the tour manager, the tasks portlet now shows replies from the setup and inventory portlets figure 2 responses from the setup and inventory portlets show in the tasks portlet now you know how to use message bus to send asynchronous messages with developing with the plugins sdk developing plugins with liferay ide;;
asynchronous messaging occurs when the sender sends a message and then continues in the send and forget model of asynchronous messaging, the sender's messages don't contain any response information. think of it this wayif you got a letter in the mail without any kind of return address or other information telling you who sent it, how could you send a reply? this tutorial shows you how to implement messaging in this fashion between one sending and two receiving portlets. can find the code for this example plugin project here even though there are many cases where you want to include some sort of response information in your messages, there are times where leaving out a response such is the case with a prolific yet distinguished an insult writer definitely doesn't want a reply from anyone on the receiving end of their insults. portletsone for writing the insults, one for logging them, and one for displaying them to the insulted. the message bus is used to send an insult to the logging and insulted portlets as soon as the insult writer writes it. also makes sense for each message to be dispatched in parallel instead of in this way, both messages go out at the same time. it's time to load up the message bus with insults! figure 1 asynchronous messaging with parallel dispatching as with other types of messaging in the message bus, the first thing you need to do is specify where you'll send messages. destination keys are the locations where messages are sent. of them as the mailing addresses of the message bus system. must be included with the message and registered as destinations in in this example, there's just one both of the receiving portlets are configured to listen on this destination key, and no response is required now that you know what your destination keys are, you can use them when writing the code that sends the messages writing the message sender is a fairly straightforward task. sending code in the method of your application in which it should be called. there's also not much code involved. in this example, the message sender is placed in the insult writer portlet's updateinsultwriter method. sent out each time a new insult is written, which is precisely what the insult a sender for an asynchronous send and forget message does the following things creates a jsonobject to serve as the message uses the put method to stuff the message with keyvalue pairs. example, some keyvalue pairs of an insult are added sends the message to the destination make sure that you add the following imports now that you've implemented your sender, you can implement any listeners that you need to have one or more message listeners implemented to receive messages each listener is a class that implements liferay's in this example there are two listeners, one for you can find the example listeners here asynchronous listeners for send and forget messages do the following things implement the receivemessage message method of the get the message payload and cast it to a string create a jsonobject from the payload string get values from the jsonobject using its getter methods. the values that were added by the sender make sure that you add the following imports to your listener classes any other listeners you need can be implemented using the same steps. you'll configure your listeners and destinations for use with the message bus now that you've implemented your message senders and listeners, you need to configure them in your plugin's url create this file if it doesn't yet exist warning you should only do this after implementing any senders and tools like liferay ide and liferay developer studio automatically deploy plugins as you save changes. listener classes in the configuration file that don't yet exist, exceptions will be thrown when your application is deployed for example, here's the configuration file for the insult writer, insult log, this configuration specifies the following beans now you just need to register this url file in your to do so, place the following code just above the closing tag in the url file save and redeploy your portlet. your plugin should now send and receive messages according to its configuration. in the case of the insult writer, the insult log and insulted portlets now show each insult figure 2 message bus carries the insult to the receiving portlets now you know how to use message bus to send asynchronous send and forget developing with the plugins sdk developing plugins with liferay ide;;
"applications accepting user created content usually need to support an approval process so that low quality, objectionable, or otherwise undesirable data is liferay portal includes a workflow engine called kaleo. administrators to set up workflows for their organization's needs; the workflow calls users to participate in processes designed for them. called process definitions, are essentially xml documents. host of xml element types to trigger decisive actions in your business process you can fine-tune your process definition's logic by incorporating the kaleo forms ee app from marketplace includes liferay's kaleo workflow designer that lets you create and modify portal workflows in your browser. kaleo designer for java, you can design and publish kaleo workflows from liferay figure 1 kaleo designer for java gives you a powerful environment for designing, modifying, and publishing kaleo workflows additionally, if you have a liferay portal enterprise subscription, you have access to the kaleo designer directly from liferay portal control panel kaleo designer for java is a workflow development tool that can be accessed in providing workflow developers with a robust set of functionality a graphical workflow editor to visualize the workflow as it's developed, and the ability to toggle between the source xml and the graphical editor drag and drop capability for adding workflow nodes, with easy access to the a freemarker template editor for creating detailed workflow notifications a javagroovy editor for scripting that lets you delegate workflow decisions to your custom business logic apis, or access liferay's apis although kaleo designer for java is the tool of choice for ee workflow designers, ce workflow designers can write kaleo workflows too. limited to writing them in their favorite xml editor. definitions must follow the schema we'll cover the following workflow topics";;
if your portlets target an international audience, you can localize your to localize a portlet, you need to create language properties files, also called resource bundles, for each language you wish to you can translate language properties manually or use a web service to conveniently, all of the translated messages used by liferay portal are also accessible to plugin projects. addition to portal's localized messages, you must create language keys in one or more resource bundles within your plugin project. localization, you should consider the following questions are there messages that portal uses that you'd like to use in your portlets? does your plugin contain multiple portlets? if so, do any of its portlets need to be available for administrative purposes in the control panel? portlets need to be in the control panel, you should create separate resource bundles for each of these portlets. otherwise, your portlets should share the same resource bundle so that you can leverage liferay's language building capabilities from liferay ide and the plugins sdk. localize your portlets in all of these scenarios;;
liferay specifies a host of language keys in its core url this file can be found in two different places. from an existing runtime, you can find it in the content folder of your portal tomcat-versionwebappsrootweb-inflib directory of liferay portal bundled with tomcat or the web-inflib folder of the liferay.war file. get it from the liferay source code, you can find it in portal-implsrccontent of your liferay portal source tree. portal's core language keys saves you time, since these keys always have up to date translations for multiple languages. additionally, your portlet blends better into liferay's ui conventions for this tutorial, you'll implement a custom greeting for a portal user. you're finished with this tutorial, a user can view the following greeting in figure 1 the portal user's name is used in the welcome language key before you get started implementing our own language key, you'll want to learn the components of a liferay ui language key you can use a language key in your jsp via a tag you specify the message key corresponding to the language key in the url file you want to display. in his or her language, specify the message key named welcome this key maps to the word welcome in your translation of it to the here is the welcome language key from liferay's now that you know some basics, it's time to implement the welcome language key for a to use the welcome language key in the portlet's ui, insert the following the word welcome, from url, now precedes your greeting! note, in order to use the tag, or any of the liferay-ui tags, you must include the following line in your jsp. the tag also supports passing strings as arguments to for example, the welcome-x key expects one argument. the welcome-x key from the url file it references 0, which denotes the first argument of the argument list. arbitrary number of arguments can be passed in via a message tag, but only those arguments expected by the language key are used. the arguments are referenced in order as 0, 1, etc. given this information, you now know how to pass in the user's screen name as an argument to the welcome-x language key in your you can compare your portlet's url to the completed for reference after you've completed the following steps open the url file and add the following lines the first line imports the liferay-theme tag library. defines the library's objects, providing access to the user object holding replace the current welcome message tag and exclamation point,!, in the jsp with the following code your portlet now greets you by your screen name! figure 2 by passing the user's screen name as an argument to liferay's welcome-x language key, we're able to display a personalized greeting that's all you need to do to leverage liferay's core localization keys. tutorial, you learned about liferay core language keys, and how to implement in overriding language properties using a hook;;
in this tutorial, you'll learn how liferay facilitates generating language key files and translating the keys to languages you want to support. user to see a message in his own locale, the message value must be specified in a resource bundle file with a name ending in his locale's two character code. for example, a resource bundle file named url containing a message property with key welcome must be present with a spanish translation don't worry, the plugins sdk provides a means for you to it's time to get started by doing the initial setup for the microsoft translator service for translating the language properties the plugins sdk uses the microsoft translator service translate all the resources in your url file to multiple since it's a machine-generated translation, you can use it as a base translation for you to start with. to create base translations using the microsoft translator service, you'll need to do the following register your portlet as an application in the azure marketplace. this from the developers screen in my account. match the project name of the portlet. accept the default client secret. make sure to save the client id and client secret for later use create a build.username.properties file in your plugins sdk root directory, if you don't already have one. this build.username.properties file must reference a liferay bundle. if you have a liferay tomcat bundle, for example, your reference should look like this liferay home refers to your bundle's root directory make sure that you have a url file in your liferay home adding the following two lines replaced with your values for the microsoft translator client id and client secret next, you'll make the necessary changes to your portlet so that it can leverage the microsoft translator service now that you've done the initial setup for the microsoft translator, you're ready to add support for translations to your portlet for example, you may enter a key like this one translations are only generated for properties that have not been translated make use of your language keys in your jsps. language keys in tags, as demonstrated in the tags like the above tag look up the value of the language key for the current locale and render it for the user for example jsp code that references language keys, see build the language keys, by either right-clicking on the url file liferay build languages in liferay idedeveloper studio or by running ant build-lang from your plugin project's directory in your terminal when the build completes, you'll find the generated files with all the translations in language.properties files in the same folder as your note that many of the language properties files this is because they are intentionally disabled. we decided to do this because several of the translations are suboptimal, rude, hilarious, or wrong, according to this ticket. you've been warned it is a machine-generated translation switch your portal's locale to the language for which you want to see the spanish by adding es after localhost8080 notice how your portlet shows your translated figure 1 liferay automatically translates your portlet's language properties to different languages after you've generated an initial translation for a language property i.e., keyvalue pair, the assumption is that you'll manually make any updates that on subsequent builds of the language properties, the language builder intentionally leaves existing language property translation values alone, so as to not overwrite any of your manual translation that said, if you want to generate new translations of an existing property you must first remove that property from url, build the languages to remove the property from the language.properties files, re-add that property and its new value to url, and build the at this point, microsoft translator generates translations based on your property's new value note if you're mavenizing your portlet, you must manually copy the translations to your deployed application. copy your content folder into your portlet's by using the plugins sdk's language building capability, you can keep all created translations synchronized with your default url. can run it any time during development. it significantly reduces the time spent on the maintenance of translations. however, remember that a machine translation is generated by the microsoft translator. often come across as odd, rude, or unintentionally humorous. someone fluent in each language should review the translations before the translations are deployed to a production environment in this tutorial you learned to leverage the plugins sdk to generate translations for your portlets using the microsoft translator overriding language properties using a hook;;
your plugin project may have site administration portlets that are missing super-fancy, must-have titles and descriptions that other admin portlets have. or if you've already provided titles and descriptions, you may be wondering how to localize them, to cater to your users' differing language needs. liferay makes it easy to implement these cool looking features to your portlets to offer localized portlets within site administration, you can create specially tailored descriptions and title keys in separate url files for the following figure displays an example of localizing portlets to spanish figure 1 you can localize portlets' titles and descriptions in site administration to any language, including spanish next, you'll configure your project's portlets to display in site administration, and then you'll localize its title and description. create one resource bundle for the title and another one for the description note if your project only has one portlet, it's best to put your resource bundle directly in the content specifying your bundle in the file url lets you leverage the plugins sdk's language building capabilities, via languages in developer studio or executing ant build-lang from the terminal specify and localize a title and description for each of your project's portlets configure each portlet to display in site administration. you can display a portlet in site administration's content category and you can give your portlet an arbitrary weight value for determining where it's to be placed in the column with respect to other portlets. each portlet's category and weight values in the elements for each portlet in your project's url file for example, the following xml from a url file specifies content as the portlet's category, making the portlet available in the content section of the site administration menu figure 2 notice that the lower the weighted number, the higher the portlet is listed in the specified menu create a namespaced folder to hold each portlet's resource bundle. best practice to name each resource bundle folder based on each portlet's for example, you'd create a resource bundle folder docrootweb-infsrccontentyourportlet if one of your project's portlet's create a url file in each resource bundle folder you just language keyvalues in each of these url files for example, you could add the following properties to each url file and replace their values specify the resource bundle for each portlet in the portlet's element in the project's url file. snippet below demonstrates specifying the resource bundle for a portlet named go to site administration content and select one of your portlets. notice that the portlet's title and description match what you specified in figure 3 notice that your portlet title and description are visible in site administration to provide your portlet in liferay's supported languages, you'll need to build your portlet's languages. to do this in liferay ide, right-click your portlet's contentportletname url file and select you can also accomplish the same thing from the terminal by executing ant build-lang note in order to generate translations of resource bundles automatically, you must configure your environment to use otherwise, liferay's build-lang target simply generates a language.properties file copying the original contents of url, for each language that liferay supports. unless you configure to use bing translator, you must manually translate the values in the generated language.properties files. languages using the bing translator for details on using the automatic now that you have the languages built, you can specify language key values for each of the supported language files that were generated. the spanish translation for the title and description of a portlet named yourportlet could be designated inside the url file as to switch the portal to a specific language, add the code of that language to for example, to interface with the portal in spanish, you'd add es to the portal context in the url like this the site administration page displays your portlet's localized title figure 4 it's easy to localize titles and descriptions for multiple portlets in your project you're becoming an expert localizer! tip do you know how your portlet if your portlet doesn't define a resource bundle or url, the portal container next checks the and inner node in the url descriptor. missing too, the node value is rendered as the portlet title note be aware that using a struts portlet and referring to a strutsresource bundle in your url engages a different title and description algorithm. pulled using the following respective keys you've configured your plugin's portlets to show in the site administration page, created resource bundles specifically for each portlet, built your portlets' language translation files, and have verified your portlets' translated titles and descriptions! overriding language properties using a hook;;
how many times have you deleted something only to realize it was a mistake? the app you're working on have a delete function? ability to move items into a recycle bin. have you been looking for an easy way to implement this capability in your app? fortunately, you can, with liferay's the recycle bin tutorials use code from liferay's jukebox portlet to demonstrate implementing the recycle bin in an app. plugin encompasses three portlets songs, albums, and artists. work together, letting the jukebox user upload songs to the portal. categorize the songs by album and artist. you can move the jukebox portlet's songs and albums to and from the recycle bin using the jukebox portlet as an example, you'll learn to implement recycling capabilities in your application.;;
the servicecontext class is a parameter class used for passing contextual using a parameter class lets you consolidate many different methods with different sets of optional parameters into a single, the class also aggregates information necessary for features used throughout liferay's core portlets, such as permissions, tagging, in this section, you'll examine the service context fields, learn how to create and populate a service context, and learn to access service context data. let's look at the fields of the servicecontext class the servicecontext class has many fields. the best field descriptions are here, you can review a categorical listing of the fields are you wondering how the servicecontext fields get populated? although all the servicecontext class fields are optional, services that store any kind of scopeable data need to at least specify the scope group id. simple example of creating a servicecontext instance and passing it as a if you invoke the service from a servlet, a struts action, or any other front-end end class which has access to the portletrequest, use one of the servicecontext object from the request and automatically populate its fields with all the values specified in the request. the above example looks different if you invoke the service from a servlet you can see an example of populating a servicecontext with information from a request object in the code of the url... the methods demonstrate how to set parameters like scope group id, company id, language id, and more. they also demonstrate how to access and populate more complex context parameters like tags, categories, asset links, headers, and the attributes parameter. url classname, portletrequest portletrequest, you can assure that your expando bridge attributes are set on expandos are the back-end implementation of custom fields liferay's api can be invoked in languages other than java, such as beanshell, groovy, javascript, python, and ruby. some methods of liferay's api require or allow a servicecontext parameter. if you're invoking such a method via liferay's json web services, you might want to create and populate a creating a servicecontext object in javascript is no different from creating any other object in javascript before examining a json web service invocation that uses a servicecontext object, it helps to see a simple json web service example in javascript if you run this code, the email user json object is logged to the the liferay.service... function takes three arguments the callback function takes the result of the service invocation as an argument the liferay json web services page its url is locally on port 8080 generates example code for invoking web services. the generated code for a particular service, click on the name of the service, enter the required parameters, and click invoke. there are multiple ways to invoke liferay's json web services click on javascript example to see how to invoke the web service via javascript, click on curl example to see how to invoke the web service via curl, or click on url example to see how to invoke the web service via a url figure 1 when you invoke a service from liferay's json web services page, you can view the result of your service invocation as well as example code for invoking the service via javascript, curl, or url to learn more about liferay's json web services, please see the for an example of how to create and populate a servicecontext object in javascript and how to pass it as a parameter to a liferay json web service all the sample jsonws portlet's functionality is provided in its url the portlet displays a button that, when clicked, creates a new user by invoking liferay's json web services. let's examine the json web service the add user service requires a lot of parameters. you can use it with the add user service to specify tags to be applied to the user that's being created. in the example above, the servicecontext parameter specifies that the tag test should be applied to the user that's being created to test the service invocation with the servicecontext parameter, deploy the add it to a page, and click on the create user button. control panel, click on users and organizations, edit the newly created user, click on categorization, and confirm that the specified tag has been applied figure 2 to test invoking a liferay json web service, deploy the sample jsonws portlet, add it to a page, click on create user, and confirm that the tag test has been applied to the newly created user important to invoke liferay web services via javascript, your javascript in the sample jsonws portlet, the javascript code in url was wrapped in the and the node and event modules were required to only the base aui is required to invoke a liferay json the tag was made available to the url page if you're not working in a jsp, you won't have access to taglibs. you can create an alloy context manually. next, you'll learn how to access information from a servicecontext object in this section, you'll find code snippets from demonstrates how to access information from a servicecontext and provides an example of how the context information can be used as mentioned above, services for scopeable entities need to get a scope group id from the servicecontext object. this is true for the blogs entry service because the scope group id provides the scope of the blogs entry the entity for the blogs entry, the scope group id is used in the here are the corresponding code snippets can servicecontext be used to access the uuid of the blog entry? can you use servicecontext to set the time the blog entry was added? can servicecontext be used in setting permissions on resources? adding a blog entry, you can add new permissions or apply existing permissions servicecontext helps apply categories, tag names, and the link entry ids to asset links are the back-end term for related assets in does servicecontext also play a role in starting a workflow instance for the the snippet above also demonstrates the trackbacks attribute, a standard attribute for the blogs entry service. there may be cases where you need to pass in custom attributes to your blogs entry service. carry custom attributes along in your servicecontext. set on the added blogs entry like this you can see that the servicecontext can be used to transfer lots of useful understanding how servicecontext is used in liferay helps you determine when and how to use servicecontext in your own liferay application development;;
the heart of your service is its localserviceimpl class. entity's local service extension point. local services can be invoked within your application or by other liferay applications running on the same liferay remote services differ from local services in that remote services can be invoked from any application that can access your liferay instance e.g., over the internet and has permission to do so. application's core business logic for working with your entity model or models should be added as methods of your localserviceimpl class. adding any custom service methods, you should review the initial service classes that service builder generated during its initial run best practice if your application needs both local and remote services, determine the service methods that your application needs for working with your add these service methods to localserviceimpl. corresponding remote services methods in serviceimpl. to the remote service methods and make the remote service methods invoke the the remote service methods can have the same names as the local service methods that they call. within your application, only call the this ensures that your service methods are secured and that you don't have to duplicate permissions code note that service builder creates a localservice class which is the interface it contains the signatures of every method in localservicebaseimpl and localserviceimpl. localservicebaseimpl contains some automatically generated methods that provide functionality that's since the localservice class is generated, you if you do, your changes will be overwritten the next all custom code should be placed in localserviceimpl, where it will not be overwritten the event listing project's eventlocalserviceimpl class demonstrates the kinds of service methods that applications commonly need for working with an entity eventlocalserviceimpl includes the following local service methods remember to import the required classes. in order to add an event to the database, you need an id for the event. provides a counter service which you call to obtain a unique id for each new it's possible to use the increment method of liferay's counterlocalserviceutil class but service builder already makes a counterlocalservice instance available to eventlocalservicebaseimpl via since your eventlocalserviceimpl class extends eventlocalservicebaseimpl, you can access this counterlocalservice instance. see eventlocalservicebaseimpl for a list of all the beans that spring makes these include the following beans you can use either the injected class's increment method or you can call liferay's counterlocalservice's increment method directly the event listing project uses the generated eventid as the id for the new eventpersistence is one of the spring beans injected into eventlocalservicebaseimpl by service builder next, the event listing project sets the attribute fields that were specified first, the name and description of the event need to be then the event's date needs to be specified. it's also important to assign values to the audit fields. project, the group of the entity is set first. an entity's group determines its in the example, the group is the site. the company and user are specified the company represents the portal instance and the user is the user who created the event. the event listing project sets the createdate and modifieddate of the event to the current time. the generated addevent method of eventlocalservicebaseimpl is called to add lastly, the event is added as a resource so that permissions can be applied to it later. for more information about adding the event listing project creates local services for location entities as well here are the custom service methods that were added to the locationlocalserviceimpl class in the event listing project locationlocalserviceimpl uses the following imports before you can use any custom methods that you added to your localserviceimpl class, you must run service builder again. the method signatures of your custom service methods to your localservice interface and updates your localserviceutil class using developer studio to run service builder from liferay ide or developer studio, open your url file and make sure you are in the alternatively, right-click on your project in the package explorer and then select liferay build services or, equivalently, liferay using the terminal navigate to your portlet's directory in your plugins sdk, and run the following command service builder looks through your localserviceimpl class and automatically copies the signatures of each method into the corresponding localservice after running service builder, you can test that your services are working as intended by invoking one the methods that service builder added to for example, if you were developing the event listing project, you could make the following service invocation to make sure that your service was working as intended service builder generates methods in your localserviceutil class that correspond to the methods you implemented in your localserviceimpl class. utility service methods invoke the implementation service methods that you in addition to all of the java classes and interfaces, service builder url file and how to configure it, please refer to the configuring url to learn how to invoke local services, please refer to the running service builder and understanding the generated code;;
the java portlet standard defines a simple security scheme using portlet roles and their mapping to portal roles. on top of this, liferay provides a fine-grained permissions system that you can use to implement access security here, you'll find an overview of the standard java security system, liferay's permission system, and you'll learn how to use them in your this section's tutorials cover the following topics using portal roles in a portlet adding permissions to resources exposing the permission interface to users developing plugins with liferay ide;;
a role, a role, my portal for a role! don't worry, using portal roles in your roles in liferay portal are the primary means for granting or restricting access to content. when a role is assigned to a user, the user is granted the permissions that have been defined for the role. on to learn how to use portal roles in your application! the jsr 286 portlet specification defines a means to specify roles used by portlets in their url descriptors. themselves, however, are not standardized. when these portlets run in liferay, you'll recognize familiar role names. for example, consider the guestbook the guestbook project is the sample project that you create by following the steps of liferay's the guestbook project contains two portlets the guestbook portlet and the notice that guestbook project's url file references the administrator, guest, power-user, and user roles your url roles must be mapped to specific roles in the portal. these mappings allow the portal to resolve conflicts between roles with the same name that are from different portlets e.g. portlets from different developers note each role named in a portlet's element is given permission to add the portlet to a page to map the roles to liferay portal, you'll have to use the url liferay-specific configuration file. an example, see the mapping defined in the guestbook project's many liferay projects use identical role mappings if a portlet definition references the role power-user, that portlet is mapped to the liferay role called power user that's already in liferay's database as stated above, there is no standardization with portal role names. deploy a portlet with role names different from the above default liferay names, you must add the names to the url property in your this prevents roles from being created accidentally once roles are mapped to the portal, you can use methods as defined in the for example, you can use the following code to check if the current user has by default, liferay doesn't use the isuserinrole method in any built-in liferay uses its own permission system directly to achieve more if you don't intend on deploying your portlets to other portal servers, we recommend using liferay's permission system, because it offers a much more robust way of tailoring your application's permissions developing plugins with liferay ide;;
public bulletin boards are great. anyone can inform others of just about on the other hand, anyone can post just about anything on the some of this content might not be relevant to the community. other content might be inappropriate. thus, you sometimes need a way to restrict fortunately, no matter what your portlet does, access to it and to its content can be controlled with permissions. read on to learn about liferay's permissions system and how add permissions to your application liferay's permission system uses a flexible mechanism that defines the actions that a given user can perform within the context of the portal or a specific portal and portlet developers break down the operations that can be performed in the portal or portlet into distinct actions. the ability to perform an action to a specific role is the act of granting a in liferay, permissions are not granted to directly to users. instead, permissions are granted to roles. roles, in turn, can be assigned to specific users, sites, organizations, or user groups developers need to define the different types of operations that are required to suit the business logic of their applications. which users will receive which permissions. determined and configured, portal administrators can grant permissions to perform those actions to users, sites, organizations, or user groups by administrators can use the portal's administration tools to grant permissions to roles or they can use the permissions uis of individual in this article, you'll learn how a liferay application developer can use liferay's permissions system to provide the portal administrator the same level of control over permissions that she has over the default liferay applications before proceeding, make sure you understand these critical terms action an operation that can be performed by a portal user. actions that be performed on the guestbook portlet include addtopage, actions that can be performed on a guestbook entity include addentry, delete, permissions, update, and view resource a generic representation of any portlet or entity in the portal on which an action can be performed. resources are used for permission for example, resources within a liferay portal instance could include the rss portlet with instance id hf5f, a globally scoped wiki page, a guestbook entry of the site x, and the message boards post with id 5052 permission an action that can be performed on a resource. database, resources and actions are saved in pairs. resourceaction table contains both the name of a portlet or entity and the for example, the view action with respect to viewing the guestbook portlet is associated with the guestbookwarguestbookportlet the view actions with respect to viewing a guestbook or viewing a guestbook entry are associated with the there are two kinds of resources in liferay portlet resources and model resources are the portlet ids from the portlets' url files or in the case of core portlets, liferay's url. refer to entities within liferay. the names of model resources are the fully qualified class names of the entities they represent. below, permission implementations are first defined for the portlet resource and then for the model resources note for each resource, there are four scopes to which the permissions can be applied company, group, group-template, or individual. you can add permissions to your custom portlets using four easy steps also d efine all resources and their permissions. r egister all defined resources in the permissions system. this step is discussed in the tutorial a ssociate the necessary permissions with resources. discussed in the tutorial exposing the permission interface to users the tutorial checking permissions the first step is to define your resources and the actions that can be defined the guestbook portlet is used here to demonstrate how to define portlet open the url file in the guestbook portlet's docrootweb-infsrcresource-actions directory and you'll see the following mapping of resources to actions the tag is used to define actions that can be taken with for the guestbook portlet, such actions include all the supported actions are defined in the tag, a sub-tag of the tag which is itself a sub-tag of the the default permissions for site members are defined in the in the case of the guestbook portlet, site members can view any guestbook portlet in the site similarly, the default permissions for guests are defined in the guests can also view any guestbook portlet in the site the tag specifies permissions forbidden to guests. aren't any forbidden guestbook portlet for guests however, guests are forbidden from adding guestbooks and guestbook entries, for example, see the following entry in the first tag the tag is used to define actions that can be performed with respect to models, also known as entities. there are two kinds of actions in liferay top-level actions and resource actions. applied to a particular resource. for example, the action of adding a new entity is not applied to a particular resource, so it's considered a top-level action. the first tag defines adding guestbook and guestbook entry resources as top-level actions the second and third tags define resource actions that can be applied to the guestbook, and guestbookentry entities, respectively. example, the permissions for the following actions are defined with respect to the resource associated with the guestbook entity similarly, the permissions for the following actions are defined with respect to the resource associated with the guestbookentry entity in each tag, notice that the model name must be defined. must be either the fully-qualified name of a package or of an for example, url is the name of a package and url.guestbook is the name of an using a package is the recommended convention for permissions that refer to top-level actions the addguestbook and addentry permissions are defined this way since for resource actions, the entity class is specified the element comes next and contains a sub-tag the value of references the name of the portlet to which the it's possible for a model resource to belong to multiple portlets referenced with multiple elements, but this is tags work the same way in the tag as list of supported actions that require permission to perform. tag and the tags define default permissions for site members and guests, respectively. tag specifies permissions forbidden to guests after defining resource permissions for your portlet, you need to point liferay to the resource-actions xml file that contains your definitions. url for the guestbook project. in liferay's core, there are multiple permissions xml definition files for various core liferay portlets in the portalportal-implsrcresource-actions the url file contains pointers to the definition files of this excerpt from url references the resource permission definition files for all built-in liferay portlets your plugin's permissions xml file should be named url and should be placed in a directory in your project's classpath. docrootweb-infsrcresource-actions is the standard location. project's url file has been created, you should create a properties file named url that contains a reference to your permissions in your url file, create a property named url with the relative path to your portlet's property specification might look like your permissions xml file must contain a root resource-action-mapping element. check out a copy of the liferay source code from the to see how resources and permissions are defined for core liferay portlets. start by looking at the definition files found in the for a simple example of defining permissions in the context of a portlet plugin, check out the and examine the portlet sample-permissions-portlet developing plugins with liferay ide;;
liferay provides a system that allows you to implement permissions for your the first step in implementing permissions is to define all resources and the actions that can be performed on them. you're ready to register these resource-action pairs in the permissions system. in liferay, a permission is represented as a resource-action pair. permissions with liferay is also known as adding resources. d efine all resources and their permissions r egister all defined resources in the permissions system a ssociate the necessary permissions with resources this tutorial explains how to both add and delete resources. you can find it in the liferay docs repository read on to find out how to add and delete resources! before proceeding, make sure you understand these critical terms action an operation that can be performed by a portal user resource a generic representation of any portlet or entity in the portal on which an action can be performed permission an action that can be performed on a resource for further explanation and examples, please see the adding permissions to resources tutorial resources should be added at the same time that entities are added to the to do this, you must invoke liferay service methods to manage liferay adding resources is as easy as calling the addresources... method of liferay's resourcelocalserviceutil class. here's an overview of the parameters of the addresources method companyid the primary key of the entity's portal instance groupid the primary key of the entity's site userid the primary key of the user who's adding the entity name the fully qualified java class name for the entity being added primkey the primary key of the entity portletactions a boolean parameter that should be set to true if you're addgrouppermissions a boolean parameter that should be set to true if the default permissions should be added to the current group addguestpermissions a boolean parameter that should be set to true if the default permissions should be added to the guest group any entity that should have permission-controlled actions must be added as a for example, every time a user adds a new guestbook, call the addresources... method to add a corresponding resource to the resource here's the call from the guestbook project's guestbooklocalserviceimpl in this example, portletactions is false because a model resource, not a portlet resource, is being added. addgrouppermissions and addguestpermissions are true since the default permissions should be you can let your users choose whether to add the default group permissions andor the default guest permissions for your portlet resources liferay has a jsp tag called that you can use to add that to use it, insert the tag into the appropriate jsp, and the checkboxes appear on that page. make sure that the tag is inside the appropriate to see an example of the tag in action, access the form for adding a new web content folder log in to your liferay portal instance as an administrator and click on admin the jsp fragment that's responsible for rendering the permissions selector is notice that this tag appears within an when you remove an entity from the database, you should remove permissions that were mapped directly to the entity. this prevents dead resources from taking up remember to delete resources when deleting entities. here's an example from the guestbooklocalserviceimpl's deleteguestbook... now you know how to work with resource permissions! developing plugins with liferay ide;;
"imagine that you bought a really nice electric guitar. bought an even nicer amplifier to go along with it. to the chagrin of your neighbors, you get ready to rock! chagrin, however, your neighbors' ears are saved. plug the guitar into the amplifier. this is essentially what happens when you add permissions to your portlet but don't expose the ui to users the permissions exist but they're not configurable on the portlet level, no code needs to be written in order to have the permission system work for your portlet. if you've defined any permissions supported actions in your configuration file's portlet-resource tag, they're automatically added to a list of permissions that are displayed by liferay's what good, however, are permissions that exist but can't be this tutorial covers exposing your portlet permissions to users. note the guestbook project is used in this tutorial to illustrate exposing you can find it in the liferay docs repository here to allow permissions to be configured for model resources, you must add the permissions interface to the ui. just add these two liferay ui tags to your jsp returns a url to the permission settings configuration page shows an icon to the user. theme and one of them see below is used for permissions this example demonstrates the use of both tags; it comes from the url file of the guestbook portlet modelresource the fully qualified class name of the entity class. class name gets translated into a more readable name as specified in url the entity class in the example above is the guestbook entry class for which the fully qualified class name is modelresourcedescription you can enter anything that best describes this in the example above, the guestbook entry message is used for resourceprimkey the primary key of your entity var specifies the name of the variable to which the resulting url string the variable is then passed to the tag so the permission icon has the proper url link there's an optional attribute called redirect that's available if you want to override the default behavior of the upper right arrow link. users can configure the permission settings for model resources! developing plugins with liferay ide";;
when implementing permissions for a custom portlet, your last step is to ensure that the configured permissions are enforced. permission checks to your application. check for permission before deleting a resource, or your user interface can hide a button that adds an entity e.g. a guestbook or guestbook entry if the user note the guestbook project is used in this tutorial to illustrate how to you can find it in the liferay docs repository here once you've defined permissions in your url file, you need to implement in the guestbook portlet, one supported action is there are two places in the source code where you might want to check for this permission in the user interface and in the business logic. user interface is implemented in jsp files, while the business logic is implemented at the portlet layer and service layer. to wrap certain elements in permission checks so they only appear for users with permission to interact with those elements. for example, the presence of the add guestbook button is contingent on whether the user has permission to add a here's how the addguestbook action is wrapped in a permission the second place to check for the addguestbook permission is in the business the url... method invokes the only needs to be implemented at the service layer. implement permission checking in the guestbookserviceimpl class if the check fails, a principalexception is thrown and the addguestbook guestbookmodelpermission is a helper class. the permissionchecker class is a liferay class. method that checks whether a user attempting to perform an action on a resource if the user isn't signed in i.e., is a guest user, it checks for guest permissions. here's an overview of the parameters of this method groupid represents the scope where the permission check is performed. liferay, several scopes are available, including global company scope, group site scope, group template scope, and individual scope. because a user may be allowed to add blog entries in one site, but not in for resources that don't belong to a scope extremely rare and unlikely, set the value of this parameter to 0. can obtain the groupid of the current scope in a jsp that uses the tag, there's an implicit in a business logic class, if you're using the servicecontext pattern, you can obtain the groupid by using url. if you're not using the servicecontext pattern, you can obtain the groupid from the theme display request object name the name of the resource as specified in your primkey the primary key of the resource. in guestbook example, the resource doesn't exist as an entry in the database, so the groupid is used again. you're checking for a permission on an existing guestbook, you'd use the primary key of that guestbook instead actionid the name of the action as it appears in your url file. to simplify searching for usages, consider creating a helper class that has constants for all the actions defined the examples above, assume there's a variable called permissionchecker already liferay automatically creates a permissionchecker instance that has the necessary information from the user for every request. the security checks to boost performance. there are several ways to obtain a variable called permissionchecker with service builder, every service implementation class can access the permissionchecker instance by using the method getpermissionchecker if you're not using service builder, permissionchecker can be obtained from the theme display request object next, you'll look at how to create helper classes for permission checking. helper classes makes it easier to invoke permission checks. permissions helper classes, you won't have to invoke the permissionchecker and the names of the resources for a specific portlet. is especially useful when there are complex parent-child relationships, or if your permission logic calls for checking multiple action types. guestbookpermission and guestbookmodelpermission from the guestbook project are examples of permission helper classes. guestbookmodelpermission should be used when checking permissions for top-level resource actions whereas guestbookpermission should be used for checking permissions on guestbook model in the previous section, you saw the guestbookmodelpermisson class and some examples of how it was used. guestbookpermission helper class and use it to learn how to create to start, consider how guestbookpermission is used in a jsp now take a look at how the guestbookserviceimpl class uses the url..., a call is made to check whether the incoming request has permission to delete a guestbook. the helper class guestbookpermission. if the check fails, it throws a principalexception, and the delete entry request aborts here's the full contents of the guestbookpermission helper class notice that both the check and contains methods take three parameters a long representing the primary key of the entity on which the action is to a string representing the action id of the action to be performed on the compare these parameters to the three parameters required by the check and contains methods of guestbookmodelpermission a long representing the primary key of the group in which the action is to a string representing the action id of the action to be performed in the these parameters make it clear that guestbookmodelpermission should be used for checking for top-level action permissions and guestbookpermission should be used for checking resource action permissions. helper classes, the check method should throw an exception when a permission check fails, and the contains method should return a boolean indicating whether the user has permission to perform the specified action on the specified when you're creating your own permissions helper classes, remember to make one helper class for your portlet's top-level actions and one permissions remember also that your helper classes should contain check and contains methods similar to those described above notice the parameters passed into the check... method. getpermissionchecker method is readily available in all serviceimpl the guestbook id is available from the servicecontext. guestbook id for the permission check indicates that the permission check is the action id is used to indicate the action requiring the permission check. you're encouraged to use custom portlet action keys like the actionkeys.delete string used above developing plugins with liferay ide;;
suppose you're developing a data-driven application. application will have to store a huge number of database records. provide some canned queries to your users, but you know you can't mind-read every way they'll want to find their data. why not create an index for your custom entities so they can search against the index? indexing functionality is provided by lucene, a java search framework. works by converting searchable entities into documents. documents in the ordinary english sense of the word. objects that correspond to searchable entities. when a lucene index is searched, a hits object is returned that contains pointers to the documents that match the searching for guestbook entries using an index can be faster than searching for entities in the database. if an indexed document contains the data you're interested in, you can avoid having to make a database query altogether suppose, for example, that you want to retrieve custom entities that have specific values in specific fields. without an index, you'd have to retrieve all of the custom entities from the database and check the specific fields of each entity for the specific values. with an index, you just have to search the indexed documents' specific fields for the specific values. matching documents in the index, you can retrieve the values of any other fields if you need to, you can run a database query to retrieve the entities that correspond to the indexed documents. query should be much less expensive than a query that has to retrieve all the in this section of tutorials, you'll explore liferay's search and indexing apis and learn how to use them in your applications.;;
"liferay's search and indexing functionality is provided by apache lucene, a to implement search and indexing functionality for an entity, you need to follow these three steps create an indexer class in your portlet project and register this class in update your entity's service layer so that the index is updated upon the creation, modification, or deletion of an entity provide a mechanism to perform a search. for example, you could create one jsp in your portlet project for entering search queries and another jsp for or you could simply configure liferay's search portlet to search for your entities you'll explore each of these steps in the following sections. make sure you're familiar with the following search and indexing terminology a search index contains a collection of documents. documents in the ordinary english sense of the word. objects that represent entities that have been saved to the database a document contains a collection of fields and their values. fields represent the metadata about each document. etc. a document's fields do not necessarily have to correspond to the a field can be single-valued or multi-valued. a multi-valued field can have multiple terms. is a single, non-whitespaced value that can be searched a phrase is a series of terms separated by spaces. phrase as a term in a search is to surround it with double quotes the result of a search is a collection of hits. documents that match the search query indexer classes are responsible for creating the lucene documents that represent when creating an indexer class, you need to decide which fields your documents should contain and how they should be populated. recommended that your indexer class extend url.baseindexer or at least implement this makes it possible to aggregate your entities with portal entities assets and allows your entities to use existing portal frameworks such as faceted search. your entities, creating an indexer for them is a necessary step. creating an indexer class, you can use the indexer classes that correspond to journalarticleindexer, wikipageindexer, etc. you can refer to the search and indexing learning path for another example recommended, you need to override or provide implementations for the following it's also recommended to define a public static final string classnames constant and a public static final string portletid constant. should contain the names of the entity classes and the name of the associated liferay's indexer classes follow this convention. constants in your plugin ensures that you are consistently using the correct class names and portlet id throughout your indexing code. search and indexing learning path referenced above explains how to implement the required methods. indexer classes also provide good examples once you've written an indexer class for your entity, you need to register this to do so, open your portlet project's url file and add an entry like this if you're working in a newly generated url file, the entry should be added just below the element inside of the element that corresponds to the portlet to which you're adding the indexer. you're working in a url file with lots of entries, please figure out where the indexer class entry should be added. after you've added the element to url so that liferay registers your indexer with your portlet if you'd like to review the contents of your portal's indexer registry, you can execute the following groovy script from liferay's script console. uses liferay's indexerregistryutil class to retrieve a list of registered then it prints the associated portlet id and classnames for each to access the script console, go to admin control panel, then click on server administration, then script. language, and then enter the following script caution before executing any script on a production liferay instance, make review the script, then click execute check your console to find a list of portlet ids and their associated indexer check that your portlet and the indexer class that you registered if you're creating a data-driven application, you've presumably written code for adding, updating, and deleting your entities. corresponding to your entities in liferay's lucene index to accurately reflect the entities themselves, you need to make sure that you're instructing your indexer to reindex any added or updated entities. deleted, you need to remove the corresponding document from the index. an instance of your indexer class, use liferay's indexerregistryutil class. this class includes a getindexer method as well as a nullsafegetindexer both of these methods can take either a class argument e.g. url or a string representing the class name e.g. myentity . you use getindexer and no indexer in the registry matches the argument, null however, if you use nullsafegetindexer and no indexer matches the argument, a dummy indexer is returned. returning a dummy indexer is safer than returning null since returning null might throw exceptions that could render once you've obtained the indexer that corresponds to your entity, you need to invoke the appropriate indexing operation. whenever a new entity is added, a corresponding document should be added to the index. is updated, the corresponding document should be updated. indexing and reindexing, can be accomplished by invoking the reindex method of you can provide the object to be indexed as an argument, or you can provide the entity's class name and primary when an entity is deleted, its corresponding document should be removed you can do this by invoking your indexer's delete method. like reindex, delete is overloaded, and can take an object or the entity's class name and primary key as arguments if you're using service builder for your portlet project's service layer, you know that custom business logic should be added to your entity's if you've integrated your application with liferay's permissions system, you probably have addentity, updateentity, and deleteentity methods which invoke various methods of resourcelocalservice to add, update, and delete entity resources. asset-enabled your entity, you've used assetentrylocalservice and assetlinklocalservice to add, update, and delete your entity's asset entries and asset links related assets. you'll use a similar procedure to add and remove entities from the index. to do this, add the following lines inside your addentity and updateentity methods and add the following lines inside your deleteentity method of course, in both of the above snippets, replace entity with the name of save your entity url file and redeploy your use your portlet to add and update some entities to test your indexer. it's working correctly, your indexer should add documents to liferay's index for each entity that's added or updated. by default, liferay's index data is stored in the liferay homedatalucene folder. this folder contains sub-folders corresponding to each of your portal instances. portal instance has a company id of 10154, there should be a folder called 10154 in your liferay homedatalucene. the contents of the 10154 folder are in binary format; they're not human-readable. third-party tool, such as luke, to browse the lucene indexes luke is a development tool which allows you to browse and modify existing lucene it is provided as free and open-source software. to start luke, open a command line or terminal, navigate to the directory which contains the.jar file, and run the following command if you have a newer version of luke, replace the version above with your once luke is running, you want to check liferay's lucene indexes to make sure that your entities have been indexed. lucene index and enter the path to the folder of the portal instance whose e.g., if your portal instance's company is 10154, check the following boxes to make sure that you can open the indexes and that you won't accidentally modify the indexes as you're browsing if you click on luke's documents tab, you can browse all the indexed documents by document number. if you click on luke's search tab, you can click on search, and luke displays a list of all use luke to check that the entities you added via your portlet appear in liferay's lucene index. search query syntax, please refer to lucene's now that your indexer has been registered and the index is updated whenever an entity is added, updated, or deleted, it's time to create a search mechanism. the easiest way to allow users to search for your entities is via by default, liferay's search portlet only allows searching for out-of-the-box liferay assets it's easy to configure the search portlet to search for additional asset types. to do so, add the search portlet to a page and open the configuration window. the setup tab, click on advanced to reveal the search configuration text area. search through the json configuration for the following block of code append your entity to this list so that it looks like this of course, replace the package path and entity name with your entities to the search portlet's configuration this way. information on the json configuration of the search portlet, please refer to the search portlet's documentation searching for content in liferay however, you don't have to use liferay's search portlet. learn how to use liferay's api to create a search mechanism in your own you can create one jsp for entering a search query and another jsp for when implementing search and indexing in a portlet, the following liferay classes are important to execute a search query in liferay, you need a searchcontext object. search context provides such details as the company instance to search, the user invoking the search, the locale, the timezone, etc. since this class has a wide variety of context properties to deal with, the most effective way to get an instance of it is to call the getinstance request method of searchcontextfactory like this once you have a searchcontext object, you can populate various values such as the keywords to search for, the pagination type, the start and end values, etc. for example, you could use these values the keywords value is the most important search context attribute since it represents the term or phrase for which you're searching. searchcontext attributes, please refer to the earlier, you saw how to use indexerregistryutil to obtain an instance of your you can use any of the following four methods remember that when you deployed your plugin project, liferay registered your when you invoke one of the above methods, liferay returns an instance of the indexer class that corresponds to the class or class name argument that also, remember that your indexer class should extend the indexer interface defines a searchsearchcontext searchcontext method that returns a hits object. baseindexer abstract class provides an implementation of this method that while it's possible to use a specific indexer to perform a search, it's also possible to perform a search using url directly. searchengineutil handles all the intricacies of the search engine all traffic to and from the search engine implementation passes if you're debugging a problem with your application's search and indexing functionality, it can be beneficial to enable debug level logging the result of invoking either an indexer's searchsearchcontext searchcontext method or of invoking url directly is a hits a hits object contains the lucene documents that match the search the lucene documents, which are document objects, can be retrieved from the hits object in either array or list form. for example, suppose you have an indexer for an entity called myentity. suppose further that you have a search context object called searchcontext that contains the keywords string containing that phrase for which you want to search. to obtain a hits object like this if you want to use url directly instead of using an indexer to search, you need to create your own search query and make sure that your search context is configured appropriately. associated with specific entities. when you use an indexer to search, only the specified entities are searched. url, which lets you specify the entities you want to search for by invoking the url you should also specify the scope of the search by invoking the url and url this method to use is url searchcontext, query query. to use this method, you need to construct your own query. provides the base query interface as well as several others which extend it, liferay also provides several query implementations and factory classes. liferay's query factory classes to instantiate query implementation classes. example, suppose you want to use liferay's search engine to search for indexed documents containing the term liferay in the title field. if you want to search for indexed documents with field values within a certain range, you can use term range queries. for example, suppose you wanted to construct a query that searches for indexed documents that were modified on a certain day, such as december 4, 2014. to construct such a query, you could use to programmatically construct more complex queries, you can use boolean queries. for example, suppose you wanted construct a query that searches for indexed documents containing the term liferay in the title field but not lucene in the description field and that were modified on december 4, 2014. such a query, you could use the following code in addition to booleanquery, termrangequery, and termquery, liferay provides a stringquery implementation class. this query implementation allows faceted search and customized search filtering tutorial for an example that uses a stringquery. search and have obtained a hits object, you can retrieve the corresponding documents in array form like this or you can retrieve the documents in list form to display the search results, you have to iterate over the array or list of each document is essentially a hash map of the indexed fields and search and indexing learning path for an explanation of how to create a portlet user interface that facilitates searching and viewing search results. in that learning path's example, a search bar is added to the jsp that renders the main portlet view. is submitted, the phrase entered by the user is submitted as a keywords string to the jsp that renders the search results. the jsp that renders the search results contains the code that creates and populates a search context, obtains an indexer, uses the indexer to search, and retrieves the entities that correspond to the hits resulting from the search. you could pull all of this logic out of the jsp and into a portlet action method or into a portlet service method that's invoked by in this tutorial, you've learned how to create and register an indexer for an entity in your portlet project. you've learned how to update your service layer so that your indexer is invoked whenever an add, update, or delete operation is performed on an entity. you've also seen how to use liferay's search api to configure a search context, perform a search, and obtain a list of to explore more features of liferay's search api, please see the tutorial on faceted search and customized search filtering";;
faceted search is a search mechanism that allows search results to be narrowed down by applying a set of filters to the result of a search query. search portlet supports faceted search. its default configuration contains several facets including site, asset type, tag, category, folder, user, and when you use liferay's search portlet to perform a search, a you can refine your search by clicking on one or more facets to apply a search filter. for example, the search portlet displays results from any site, by default. in the search portlet, you can click on the name of a specific site to filter the search to display only results from the in addition to using faceted search in the search portlet, liferay transparently uses faceted search in other places throughout the portal in this tutorial, you'll learn how to create custom facets and configure them in you'll also learn how to use liferay's search api to create custom search filters that aren't suited to being implemented as facets. before proceeding, make sure you're familiar with the following terminology a facet is a combination of information about a specific indexed field its facets are typically named after the field in the number of times a given term appears within a set of documents is called a list of terms and their frequencies for a specific field is called a term in other words, a term result list is a list of information some facets have a property called frequency threshold. the minimum frequency required for terms to appear in the term result list. for example, if the frequency threshold of a facet is set to 3, a term appearing only twice won't appear in the term result list some facets have a property called max terms. maximum number of terms that are included in the term result list regardless of how many actual matching terms are found for the facet. max terms property can keep the number of search results under control so that users are not overwhelmed by too much information the order property determines the default ordering used for the term result there are two possible modes order hits descending, or order value the first, order hits descending, means that results will be ordered by frequency in a descending order. the second, order value ascending, means that the results will be ordered by value i.e., by term in ascending both modes fall back to the other mode as a secondary sort order this means that many terms with the same frequency a range defines an interval within which all the matching terms' frequencies this means that if a facet defines a term range for the createdate field between the years 2008 to 2010, and another for 2012 to 2014, all matching documents having a creation time within one of these specified ranges are returned as a sum for that range. documents in the first range and 18 documents in the second range. cannot be used with multi-value fields there are two ways to configure custom facets for search in liferay configure custom facets in liferay's search portlet json configuration use liferay's search api to programmatically create facets and add them to a setting up facet configurations using a json definition is the most flexible solution since the configuration can be dynamically changed at runtime. this option is only available in liferay's search portlet. adding facets to a search context allows developers to tightly control how the this option is available to developers of custom liferay suppose you need to provide a means for users to search only for images in you can easily configure custom facets in liferay's search portlet to to configure the search portlet to search only for images, open the search portlet's configuration window. add the following two facets to its to learn how to configure liferay's search portlet, including an explanation of this example, please refer to the faceted search in liferay is not restricted to liferay's search portlet. you're implementing a search feature for a custom liferay portlet, you can still implement faceted search by programmatically creating facets and adding them to a liferay provides several facet implementation classes that developers can instantiate and use for custom portlet development. implementation classes belong to liferay's simplefacet, multivaluefacet, and rangefacet extend basefacet. basefacet is an abstract class that implements the facet interface. simplefacet, multivaluefacet, and rangefacet are facet implementation classes that can be re-used with any indexed fields. simplefacet when you're interested in filtering on a single-valued field and multivaluefacet when you're interested in filtering a multi-valued field. rangefacet when you're interested in filtering by specifying a range of values assetentriesfacet and scopefacet extend multivaluefacet and operate on specific indexed fields. assetentriesfacet operates on the entryclassname field and scopefacet operates on the groupid or modifiedfacet extends rangefacet and operates on another specific indexed field modifieddate suppose, for example, that you're developing a custom search portlet that should only search for a specific types of assets in specific sites. example shows how you can configure your search context to achieve this remember that assetentriesfacet only operates on the entryclassname field and scopefacet only operates on the groupid or scopegroupid field. recall from the search portlet documentation that static facets are not rendered in the ui. rather than inputs dynamically applied by users. configuring facets that aren't configurable by users, you should declare the since users can't configure static facets, you need to specify the types of assets and group ids that should be searched. this, you populate the entryclassnames and groupids arrays and add them to the search context via url... and any indexed document whose asset type name does not belong to the entryclassname array is filtered out of the likewise, any indexed document whose groupid does not belong to the groupids array is filtered out of the search results sometimes, you might be required to implement very specific kinds of search for example, suppose you need to search both web content articles and only pdf files from the documents and media library. not suited to a facet implementation. since facets are metrics that are calculated across an entire result set, using facets' ability to drill down as a means of filtering may lead to poor performance and overly complex drilling down means manually applying filters to a figure 1 here, the user has drilled down filtered the search results by manually selecting the liferay site and the document asset type if you need specific filters that are not suited to being implemented as facets, you can still use liferay's search api. instead of adding facets to a search context, you can set boolean clauses on the search context. using url facet, you would use allows you to pass any number of filter criteria to the search context as an filtering implemented this way is several times more efficient than anything done via the facet api. another advantage of the boolean clause api is that it supports features like exclusions e.g., -fieldnotthisvalue which are not supported by facets consider again the case where you need to search both web content articles and search portlet to satisfy this use case but it's easier to customize the search the following steps explain how to create a jsp hook to customize the search portlet to satisfy this use case hook plugin type, then click finish if you're using liferay ide, right-click on your project in the package explorer and select new liferay hook configuration. leave the custom jsp folder set to customjsps and click add from liferay... next to jsp files to override. if you're not using liferay ide, create a url file in your project's docrootweb-inf folder and add the following contents to it then create a htmlportletsearchcustomjsps directory in your project's url files into this folder from liferay's add the following lines just below the line above in the query that you construct above, you're specifying that you're searching for indexed documents with either an entryclassname equal to journalarticle or both an entryclassname equal to dlfileentry and an please refer to lucene's documentation then edit your url file to add when you're finished following the above steps, deploy your hook plugin and test check that it only returns web content articles or documents and media files with the.pdf file extension as search results. only want your search portlet customizations to apply to a single site, use an;;
namespacing ensures that a given portlet's name is uniquely associated with elements in request parameters it sends to the portal. conflicts with other elements on the portal page and with elements from other namespacing your portlet elements is easy. tag to produce a unique value for your portlet's the following example code uses the tag to reference the portlet's fm form during submission to illustrate the benefits of namespacing an element, such as the fm form from the example code above, suppose you have portlets named a and b in your portal and they both have a form named fm. without portlet namespacing, the portal would be unable to differentiate between the two forms and, likewise, would be unable to determine their associated portlets. but, submitting both portlet a's form and portlet b's form as fm would distinguish the forms as afm and bfm, respectively. liferay associates each namespaced element, such as these namespaced forms, with the portlet that produced it by default, liferay only allows namespaced parameters to access portlets. however, many third-party portlets send unnamespaced parameters. liferay gives you the option to turn off the unnamespaced parameters filter for portlets, to avoid third-party portlets from breaking. for a portlet, navigate to the portlet's url file and enter turning this filter off is on a per portlet basis, so you'll need to set the tag to false for every third-party portlet that sends unnamespaced parameters you now know how portlet namespacing is implemented for liferay portlets. lastly, we learned when and why to use unnamespaced parameters in your;;
do you want to develop mvc-based portlets using the java ee standard? want to use a portlet development framework with a ui component model that makes it easy to develop sophisticated, rich uis? web apps using jsf that you'd like to use in liferay portal? to any of these questions, you're in luck! liferay faces provides all of these liferay faces is an umbrella project that provides support for the javaservertm faces jsf standard within liferay portal. if you're new to jsf, you probably want to know its strengths, its weaknesses, and how it stacks up to developing portlets with cssjavascript. information on jsf and liferay faces to help you decide what framework is best here are some good reasons to use jsf and liferay faces there are some reasons not to use jsf. front-end developer who makes heavy use of htmlcssjavascript, you might find that jsf ui components render html in a manner that gives you less control over so, sticking with javascript and leveraging or, perhaps standards aren't a major consideration for you or you may simply prefer developing portlets using your whether you develop your next portlet application with jsf and liferay faces or with htmlcssjavascript is entirely up to you. more about liferay faces and try it out for yourself. tutorials, you'll learn how the liferay faces bridge works, examine using liferay ui components and utilities in jsf applications, leverage alloyui components using liferay faces alloy, migrate an existing project to liferay faces, and build liferay faces from source.;;
"liferay supports developing and deploying jsf portlets on liferay portal by the bridge supports deploying jsf web applications as portlets on any jsr 286 portlet 2.0 compliant portlet container, like liferay portal 5.2, 6.0, 6.1, and 6.2. liferay faces bridge makes developing jsf portlets as similar as possible to jsf web app development. you'll learn the portlet development process and how to leverage liferay faces bridge's full potential with your jsf portlets. to implement portlets using jsf liferay ide, with its powerful portlet plugin wizard, provides you with a great environment to create a jsf portlet project. component suite that's right for your project, including jsf's standard ui component suite, icefaces, liferay faces alloy, primefaces, and richfaces. course, you can use any development environment you like for building jsf portlets, but liferay ide is hard to beat. next, you'll use liferay ide to in this tutorial, you'll create a jsf portlet project using liferay idedeveloper studio, so you can see just how easy it is. developing apps with liferay ide learning path for full details. if you do have it installed, launch it in the project creation wizard's first window, you'll name your project and specify its development and runtime environments 2.1 fill in the project name and display name. have any spaces and it's best to specify them in lowercase. name, however, can have spaces. you should specify the portlet's display name just as you want it displayed to the user leave the use default location checkbox checked. default location is set to your current plugins sdk. change where your plugin project is saved in your file system, uncheck the box and specify your alternate location select the ant liferay-plugins-sdk option for your build type. you'd like to use maven for your build type, navigate to the your configured sdk and liferay runtime should already be selected. if you haven't yet pointed liferay ide to a plugins sdk, click configure sdks to open the installed plugin sdks management wizard. can also access the new server runtime environment wizard if you need to set up your runtime server; just click the new liferay runtime button next to the liferay portal runtime dropdown menu select portlet as your plugin type and click next in this window, you'll select the portlet framework for your portlet and a 3.1 select the jsf 2.x portlet framework immediately, the wizard lists the available jsf component suites in the the list of component suites includes the jsf standard suite, icefaces, liferay faces alloy, primefaces, and richfaces select the ui component suite you'd like to use and click finish your new jsf portlet plugin project is ready for you to develop jsf figure 1 liferay faces supports using the most popular component suites with your jsf portlets to access components from a component suite, make sure to declare that suite as an xml namespace attribute in the element of your facelet file. example, if you'd selected primefaces as your project's ui component suite, you'd add a namespace for it e.g., xmlnsp url in now that you've created a generic or modified jsf portlet, it's time to deploy your jsf portlet to the portal and see what it liferay provides a mechanism called auto-deploy that makes deploying jsf portlets and any other plugin types a breeze. plugin's.war file into the deploy directory, and the portal makes the necessary changes specific to liferay and then deploys the plugin to the this is a common method of deployment used throughout the note liferay supports a wide variety of many, such as tomcat and jboss, provide a simple way to deploy web applications by just copying a file into a folder and liferay's auto-deploy mechanism takes advantage of that ability. though, that some application servers, such as websphere or weblogic, require the use of specific tools to deploy web applications; liferay's auto-deploy for this part of the tutorial, you'll learn how to deploy a jsf portlet using idedeveloper studio and the terminal deploying in developer studio drag your portlet project onto your server. when deploying your plugin, your server displays messages indicating that your plugin was read, registered and is now available for use if at any time you need to redeploy your jsf portlet while in developer studio, right-click your portlet located underneath your server and select redeploy deploying in the terminal open a terminal window in your portlet's project directory and enter the following command a build successful message indicates that ant built your portlet's war file and that it's now being deployed. if you switch to the terminal window running liferay, within a few seconds you should see a message, like the following message, indicating that your plugin is available to use in the portal if you don't see such a message, double-check your plugin's configuration in your web browser, log in to the portal. click the add button, which appears as a plus symbol in the top right hand section of your browser. applications, find the portlet in the sample category, and click add. portlet appears on the page, but liferay faces lets you know when a ui component requires a page refresh to render the first time. it's just that easy to create and deploy jsf portlet plugins! developing liferay faces portlets with maven using portlet preferences with jsf";;
the liferay faces bridge enables you to deploy jsf web apps as portlets without it also contains innovative features that make it possible to leverage the power of jsf 2.x inside a portlet application liferay faces bridge is distributed in a.jar file. bridge as a dependency to your portlet projects, in order to deploy your jsf web applications as portlets within jsr 286 portlet 2.0 compliant portlet the liferay faces bridge project home page can be found to fully understand liferay faces bridge, you must first understand the portlet because the portlet 1.0 and jsf 1.0 specs were being created at essentially the same time, the expert group eg for the jsf specification constructed the jsf framework to be compliant with portlets. method returns an object instead of an when this method is used in a portal, the object can be cast to a despite the eg's consciousness of portlet compatibility within the design of jsf, the gap between the portlet and jsf lifecycles had to be bridged portlet bridge standards and implementations evolved over time starting in 2004, several different jsf portlet bridge implementations were developed in order to provide jsf developers with the ability to deploy their in 2006, the jcp formed the portlet bridge 1.0 jsr bridge api, as well as detailed requirements for bridge implementations. was released in 2010, targeting portlet 1.0 and jsf 1.2 when the portlet 2.0 jsr 286 standard was released in 2008, it became necessary for the jcp to form the 329 was also released in 2010, targeting portlet 2.0 and jsf 1.2 after the jsr 314 eg released jsf 2.0 in 2009 and jsf 2.1 in 2010, it became evident that a portlet bridge 3.0 in 2015 the jcp formed jsr 378 bridge for portlet 3.0 and jsf 2.2. there are also variants of liferay faces bridge that support portlet 2.0 and jsf 1.22.12.2 liferay faces bridge is the reference implementation ri of the portlet bridge it also contains innovative features that make it possible to leverage the power of jsf 2.x inside a portlet application now that you're familiar with some of the history of the portlet bridge standards, you'll learn about the responsibilities required of the portlet a jsf portlet bridge aligns the correct phases of the jsf lifecycle with each phase of the portlet lifecycle. for instance, if a browser sends an http get request to a portal page with a jsf portlet in it, the renderphase is perfomed in the portlet's lifecycle. the jsf portlet bridge then initiates the restoreview and renderresponse phases in the jsf lifecycle. an http post is executed on a portlet and the portlet enters the actionphase, then the full jsf lifecycle is initiated by the bridge figure 1 the different phases of the jsf lifecycle are executed depending on which phase of the portlet lifecycle is being executed besides ensuring that the two lifecycles connect correctly, the jsf portlet bridge also acts as a mediator between the portal url generator and jsf jsf portlet bridges ensure that urls created by the portal comply with jsf navigation rules, so that a jsf portlet is able to switch to the jsr 329378 standards defines several configuration options prefixed with liferay faces bridge defines additional implementation-specific options prefixed with the url with the main aspects of jsf portlet bridges described, you can learn how a jsf application uses the bridge in the next, you'll learn how to configure liferay faces bridge, starting with configuring its scope behavior for this part of the tutorial, you'll step through requirements, drawbacks, assumptions, and behaviors for configuring the bridge request scope one of the key requirements in creating a jsf portlet bridge is managing jsf request-scoped data within the portlet lifecycle. as the bridge request scope by jsr 329378. the lifespan of the bridge request actionrequest eventrequest bridgerequestscope begins renderrequest bridgerequestscope is preserved subsequent renderrequest bridgerequestscope is reused subsequent actionrequest eventrequest bridgerequestscope ends, and a if the session expires or is invalidated, then similar to the portletsession scope, all bridgerequestscope instances associated with the session are made available for garbage collection by the jvm the main use-case for having the bridgerequestscope preserved in step 2 above is for re-rendering portlets. consider the following example that suppose two or more jsf portlets are placed on a portal page portlets x and y, and those portlets are not using fajax for form submission. case, if the user were to submit a form via full actionrequest postback in portlet x, and then submit a form in portlet y, then portlet x should be re-rendered with its previously submitted form data with the advent of jsf 2.x and ajax, there were four drawbacks for continuing to support this use-case as the default behavior as result, liferay faces bridge was designed for jsf 2.x, and keeps ajax in the liferay faces bridge makes the following assumptions consequently, the default behavior of liferay faces bridge is to cause the bridgerequestscope to end at the end of the renderrequest if you prefer the standard behavior over liferay faces bridge's default behavior, then you can place the following option in your portlet's param is false, meaning that liferay faces bridge causes the bridgerequestscope to end after the renderphase of the portlet lifecycle. setting the value to true causes liferay faces bridge to allow the bridgerequestscope to last until the next actionphase or eventphase of the default value of the url.maxmanagedrequestscopes param it defines the maximum number of bridgerequestscope instances to keep in memory on the server if the bridgerequestscopepreserved option is can be specified on a portlet-by-portlet basis in the url now you know the two options for bridge request scope behavior. the outlined assumptions and drawbacks, you should be able to make an educated decision about how you'd like to implement the bridge request scope behavior liferay faces bridge can be run in a variety of portlet containers liferay, pluto, etc. and is aware of some of the abilities or limitations of these for this part of the tutorial, you'll see how to configure a portlet liferay faces bridge enables you to configure the abilities of the portlet container in the portlet project's url descriptor an example of configuring the abilities of the portlet container can be found in the default value of the context-param depends on which portlet container the the value determines whether or not the bridge resource handler attempts to set the status code of downloaded resources to values like by configuring portlet container capabilities, you can take advantage of your portlet container's specific strengths while using liferay faces bridge liferay faces bridge lets you enable or disable xml validation for all this part of the tutorial shows you how! by default, validation is disabled. url file entities, you can set the option to true in the you now know how to toggle xml entity validation using liferay faces liferay faces bridge lets you set the size of the buffer used to load resources into memory, as file contents are copied to the response. tutorial demonstrates how to configure this setting you can configure the resource buffer size in the portlet project's the default value of this context-param is 1024 1kb alternatively, you can specify the url value on a portlet-by-portlet basis in the portlet project's liferay portal gives you the ability to specify whether or not request attributes are shared among portlets. element in the portlet project's the default value of this option is true, meaning that request attributes are not shared among portlets this non-shared feature, however, only works for request attributes that are present in the request map and that have a non-null value. problem for jsf managed-beans in request scope. specifically, the problem arises when a portal page has two or more portlets that have a request scope managed for example, suppose portlet x and portlet y each have a class named runtime is asked to resolve an el-expression backingbean, there is no guarantee that the correct instance will be resolved. problem, liferay faces bridge provides a configuration option that can be specified in the portlet project's url. managed beans to be distinct for each portlet the default value of this context-param is false. managed beans are resolved correctly for each portlet, set this you can now configure distinct request scoped managed beans with liferay in the case of a portlet renderrequest, section 5.2.6 of the jsr 329378 spec requires that the bridge only executes the restoreview and renderresponse in addition, section 6.4 requires that a phaselistener be used to skip the applyrequestvalues, processvalidations, updatemodelvalues, and invokeapplication phases. these requirements are valid for jsf 1.2, but for jsf 2.x view parameters, the presence of fmetadata and fviewparam in a facelet view, makes the entire liferay faces bridge enables support for view parameters by default, but provides a configuration option that you can specify in the portlet project's url descriptor to disable the feature the param's default value is true. if you're using jsf 1.2, you should set you've learned another jsf portlet bridge standard and how to configure several key options in liferay faces bridge creating and deploying jsf portlets developing liferay faces portlets with maven specifying and using portlet preferences with jsf;;
liferay faces portal is distributed in a.jar file. faces portal as a dependency for your portlet projects to use its liferay-specific utilities and ui components. included in a jsf portlet project, the url.version.jar file resides in the portlet's library figure 1 the required .jar files are downloaded for your jsf portlet based on the jsf ui component suite you configured some of the features included in liferay faces portal are utilities provides the liferayportlethelperutil which contains a variety portlet-api and liferay-specific convenience methods jsf components provides a set of jsf equivalents for popular liferay portal expression language adds a set of el keywords such as liferay for getting liferay-specific info, and i18n for integration with out-of-the-box liferay you now have an understanding of what liferay faces portal is, and what it accomplishes in your jsf application creating and deploying jsf portlets developing liferay faces portlets with maven;;
liferay faces alloy is distributed in a.jar file. alloy as a dependency to your portlet projects, in order to use alloyui in a way that is consistent with jsf development during the creation of a jsf portlet in liferay idedeveloper studio, you have the option of choosing the portlet's jsf component suite. richfaces, and liferay faces alloy. if you selected the liferay faces alloy jsf component suite during your portlet's setup, the.jar file is included in your portlet project using maven the liferay faces alloy project provides a set of ui components that utilize for example, a brief list of some of the supported aui tags are if you want to utilize liferay's alloyui technology based on yui3, you must include the liferay faces alloy.jar file in your jsf portlet project. selected liferay faces alloy during your jsf portlet's setup, you have liferay faces alloy preconfigured in your project, so you're automatically able to use as you can see, it's extremely easy to configure your jsf application to use creating and deploying jsf portlets developing liferay faces portlets with maven;;
in this article, you'll learn which liferay faces artifacts should be used with your portlet and explore the liferay faces versioning scheme by discovering what each component of a version means. for liferay portal 6.2, there are two the first older version scheme is supported from previous liferay versions up to liferay portal 6.2. supported by all liferay faces releases up to liferay faces ga6 the newer version scheme is supported for liferay 6.2 and all future releases of any liferay faces release after liferay faces ga6 will follow the liferay faces archetype portlet can be used to determine the liferay faces artifacts and versions that you should include in component suite optional, and build tool, and the portlet will provide you with both a command to generate your portlet from a maven archetype and a list of dependencies that can be copied into your build files. you'll be provided with compatibility information about each version of the liferay faces artifacts after ga6 in this section, you'll learn about the versioning scheme for each component of liferay faces for releases following liferay faces ga6. versioning scheme mastered, you can view several example configurations provides a suite of jsf components that utilize alloyui provides the ability to deploy jsf web applications as portlets within apache pluto, the reference implementation for jsr 286 portlet 2.0 and jsr 362 portlet 3.0 extension to liferay faces bridge that provides compatibility with liferay portal and also takes advantage of liferay-specific features such as friendly urls provides a suite of jsf components that utilize url library that contains general purpose jsf utilities to support many of the sub-projects that comprise liferay faces now that you know all about the liferay faces versioning scheme, you may be curious as to how these components interact with each other. following figure to view the liferay faces dependency diagram figure 1 the liferay faces dependency diagram helps visualize how components interact and depend on each other next, you can view some example configurations to see the new versioning scheme follows a major1.major2.minor-type versioning scheme note some permutations of this versioning scheme are not supported, see table below for specific information on supported versions of jsf and liferay the following table displays the liferay faces version and its compatible liferay portal and jsf versions while liferay faces bridge is theoretically compatible with any portal that implements the portlet 2.0 standard, it has been carefully tested for use with liferay portal versions 5.2, 6.0, 6.1, and 6.2 and has several optimizations that provide increased performance on liferay if you've developed portlets that use the portletfaces bridge, you'll need to migrate them to liferay faces in order to deploy them using the liferay faces bridgedon't worry, it's very straightforward creating and deploying jsf portlets developing liferay faces portlets with maven using portlet preferences with jsf;;
for an introduction to liferay's service builder tool, please refer to the writing a data-driven application this learning path demonstrates how to create easy-to-maintain data-driven applications that use service builder to generate locally accessible locally accessible services can be invoked by other liferay applications running on the same liferay instance as your application. how to use service builder to generate remotely accessible services for your application, please refer to the creating web services for your application remotely accessible services can be invoked from any application that can access your liferay instance e.g., over the internet and has if, for example, you want mobile application developers to be able to create clients that can interact with your application, you should generate remote services for your application. this section's tutorials build on the basics covered in the learning paths. they provide more details on service builder's features, the code it generates, and liferay services.;;
"in this tutorial, you'll learn how to define an object relational map for your application so that it can persist data. the example code in this tutorial, as well as the example code in the other service builder and services tutorials, comes from the event listing project, which you can find on github the event listing project is an example portlet project that an organization can the event-listing-portlet project allows administrators to manage and list these events. entities, or model types, to represent an organization's events and the locations at which the events can take place. these entities are called events the event entity represents a social event that can be scheduled, while the location entity represents a location at which a social since an event must have a location, the event entity references a location entity as one of its attributes if you want to display entity data in a liferay application, you're free to create any kind of user interface that you can imagine. to learn how to create simple user interfaces for liferay service builder applications, please see the implementing a ui with liferay taglibs figure 1 the event listing and location listing portlets let you add and modify social events and locations. the portlets rely on the event and location entities and the service infrastructure that liferay service builder builds around them note if you're looking for a fully-functional portlet application that can manage events, please use liferay's calendar portlet instead. described in this section is only intended to demonstrate how to use service the calendar portlet provides many more features than the simple example application described here. for information about the calendar portlet, managing events and calendar resources with liferay's calendar portlet section as with any portlet project, the event-listing-portlet project's java sources reside in the docrootweb-infsrc folder. they act as the controllers in the mvc pattern. these classes contain the business logic that invokes the service builder generated event and location services that you'll learn how to create in this the application's view layer is implemented in the jsps in the the first step in using service builder is to define your model classes and their attributes in a url file in your project's docrootweb-inf in service builder terminology, your model classes events and locations are called entities. the requirements for the event and location events should have the following attributes locations should have the following attributes service builder reads a single file called url that's used for once you create the file, you can then define your entities. liferay ide makes it very easy to define entities in your application's to define a custom entity, follow these steps create the url file in your project's docrootweb-inf folder, if one does not already exist there define global information for the service define the columns attributes for each service entity define relationships between entities define a default order for the entity instances to be retrieved from the define finder methods that retrieve objects from the database based on let's examine these steps in detail, starting with creating a url to define a service for your portlet project, you must create a url the dtd document type declaration file specifies the format and requirements of the xml to use. url file manually, following the dtd, or you can use liferay ide. liferay ide helps you build the url file piece-by-piece, taking the guesswork out of creating xml that adheres to the dtd if a default url file already exists in your docrootweb-infsrc folder, check to see if it has an element named foo. the foo entity, remove the entire... the liferay ide project wizard creates the foo entity as an example. if you don't already have a url file, it's easy to create one using simply select your event-listing-portlet project in the package explorer and then select file new liferay service builder. liferay ide creates a url file in your docrootweb-infsrc folder and displays the file in overview mode liferay ide also provides a diagram mode and a source mode to give you different perspectives of the service information in your url file. diagram mode is helpful for creating and visualizing relationships between source mode brings up the url file's raw xml content you can switch between these modes as you wish next, you can start filling out the global information for your service a service's global information applies to all of its entities, so it's a good in liferay ide, select the service builder node in the upper left corner of the overview mode of your url file. the view now shows the service builder form in which you can enter your the fields include the service's package path, here are the values used for the event-listing the package path specifies the package in which the service and persistence the package path defined above ensures that the service classes are generated in the url package under the docrootweb-infservice folder. generated in a package of that name under the docrootweb-infsrc folder. complete file paths for the service and persistence classes are docrootweb-infservicecomliferaydocseventlisting and running service builder and understanding the generated code tutorial for a description of the contents of these packages service builder uses the service namespace in naming the database tables it enter event as the namespace for your example service builder uses the namespace in the following sql scripts it generates in your docrootweb-infsql folder liferay portal uses these scripts to create database tables for all the entities service builder prepends the namespace since the namespace value above is event, the names of the database tables created for the entities start with event as the namespace for each service builder project must be unique. separate plugins should use separate namespaces and should not use a namespace already used by liferay such as users or groups . liferay's database if you're wondering which namespaces are already in use as the last piece of global information, enter your name as the service's service builder adds annotations with the specified name to all of the generated java classes and interfaces. save your url file to preserve the information you added. add entities for your service's events and locations entities are the heart and soul of a service. entities represent the map between the model objects in java and the fields and tables in your database. entities are defined, service builder handles the mapping automatically, giving you a facility for taking java objects and persisting them. listing example, two entities were createdone for events and one for here's a summary of the information that was used for the event entity and here's what was used for the location entity to create your entities using liferay ide, select the entities node under the service builder node in the outline on the left side of the url editor in the main part of the view, notice that the entities table create an entity by clicking on the add entity icon a green plus sign to the right of the table. enter event for your entity's name and select both the local service and the remote service options. entity named location and select the local service and the remote service figure 2 adding service entities is easy with liferay ide's overview mode of your url file an entity's name is used to name the database table for persisting instances the actual name of the database table is prefixed with the namespace; the event listing example creates one database table named eventevent and another named eventlocation setting the local service attribute to true instructs service builder to generate local interfaces for the entity's services. local services can only be invoked from the liferay server the event listing portlet will be deployed to your so the service will be local from your liferay server's point of setting the remote service attribute to true instructs service builder to generate remote interfaces for the service. the default value for remote service you could build a fully-functional event listing application without in that case, you could set local service to true and remote service to false for both of your entities. to enable remote access to your application's services, you should set both local service and remote service to true tip suppose you have an existing dao service for an entity built using some you can set local service to false and remote service to true so that the methods of your remote -impl class can call the this enables your entity to integrate with liferay's permission-checking system and provides access to the web service apis this is a very handy, quite powerful, and often now that you've seen how to create the event and location entities, you'll learn how to describe their attributes using entity columns each entity is described by its columns, which represent an entity's attributes. these attributes map on the one side to fields in a table and on the other side to attributes of a java object. to add attributes for the event entity, you need to drill down to its columns in the overview mode outline of the from the outline, expand the entities node and expand the table of the event entity's columns service builder creates a database field for each column you add to the it maps a database field type appropriate to the java type specified for each column, and it does this across all the databases liferay once service builder runs, it generates a hibernate configuration that handles the object-relational mapping. automatically generates gettersetter methods in the model class for these the column's name specifies the name used in the getters and setters that are created for the entity's java field. the column's type indicates the java type of this field for the entity. if a column's primary i.e., primary key attribute value is set to true, then the column becomes part of the an entity's primary key is a unique identifier for if only one column has primary set to true, then that column represents the entire primary key for the entity. however, it's possible to use multiple columns as the primary in this case, the combination of columns makes up a compound similar to the way you used the form table for adding entities, add attribute columns for each of your entities. here are the attributes used for the event create each attribute by clicking on the add icon. the attribute, select its type, and specify whether it is a primary key for the while your cursor is in a column's type field, an option icon appears. click this icon to select the appropriate type for the column. for each attribute of your event entity. repeat the steps to create columns for each attribute of your location entity in addition to columns for your entity's primary key and attributes, it's recommended to add columns for portal instance id and site id. portlet to support the multi-tenancy features of liferay, so that each portal instance and each site in a portal instance can have independent sets of portlet to hold the site's id, add a column called groupid of type long. hold the portal instance's id, add a column called companyid of type long. add both of these columns to your event and location entities you'll also want to know who owns each entity instance. add a column called userid of type long lastly, add columns to help audit your entities. of type date to note the date an entity instance was created. named modifieddate of type date to track the last time an entity instance your entities are set with the columns that not only represent their attributes, but also support multi-tenancy and entity auditing. specify the relationship between the event entity and the location entity often you'll want to reference one type of entity in the context of another that is, you'll want to relate the entities. demonstrates entity relationships as mentioned earlier, each event must have a location. entity must relate to a location entity. url makes relating entities easy. first, select diagram mode for the then select the relationship option under connections in the palette on the right side of the view. this relationship tool helps you draw relationships between entities in the diagram. click the event entity and move your cursor over the location entity. liferay ide draws a dashed line from the click the location entity to complete drawing the liferay ide turns the dashed line into a solid line, with an arrow pointing to the location entity. their relationship should show in diagram mode and look similar to that of the figure below figure 3 relating entities is a snap in liferay ide's diagram mode for url switch to source mode in the editor for your url file and note that liferay ide created a column element in the event entity to hold the id of the location entity instance reference now that your entity columns are in place, you can specify the default order in which the entity instances are retrieved from the database often, you want to retrieve multiple instances of a given entity and list them liferay lets you specify the default order of the suppose you want to return event entities in order by date, earliest to latest, and you want to return location entities alphabetically by name. mode in the editor for your url file. under the event entity node in the outline on the left side of the view. displays a form for ordering the event entity. checkbox to show the form for specifying the ordering. clicking the add icon a green plus sign to the right of the table. date for the column name to use in ordering the event entity. browse icon to the right of the by field and choose the asc option. orders the event entity by ascending date. to specify ordering for location entity instances, follow similar steps but specify name as the column and the last thing to do is to define the finder methods for retrieving entity finder methods retrieve entity objects from the database based on specified you'll probably want to create at least one finder method for each entity you create in your services. service builder generates several methods based on each finder you create for an entity. find, remove, and count entity instances based on the finder's parameters for the event listing project, it's important to be able to find event and you can specify these finders using liferay ide's select the finders node under the event entity node in the outline on the left side of the screen. finders table in the main part of the view. create a new finder by clicking the add icon a green plus sign to the right of the table. groupid and enter collection as its return type. naming convention when naming finders since the finder's name is used to name the methods that service builder creates. the ide creates a new groupid node under the finders node in the outline. next, you'll learn how to specify the finder column for this group id node under the new groupid node, the ide created a finder columns node. the finder columns node to specify the columns for your finder's parameters. create a new finder column by clicking the add icon a green plus sign and specifying groupid as the column's name. keep in mind that you can specify if you're creating site-scoped entities entities whose data should be unique to each site, you should follow the steps described above to create finders by groupid for retrieving your entities. remember to save your url file after editing it to preserve the finders you define when you run service builder, it generates finder-related methods your entities in the persistence and persistenceimpl classes. the first of these classes is the interface; the second is its implementation. the event and location entity's finder methods are generated in the folder and the -persistenceimpl classes in the now you know to configure service builder to create finder methods for your for your convenience, you can view the complete url content of the event listing project below. highlight the service's various elements. you can refer to the event listing project's url file's when you're creating your own remember that you can view the complete event listing portlet project on github";;
this tutorial explains how to run service builder and provides an overview of the code that service builder generates. if you'd like to use service builder in your application but haven't yet created a url file, please see the defining an object-relational map with service builder tutorial and then come back to this one to build a service from a url file, you can use liferay ide, liferay developer studio, or use a terminal window. to the event listing example project that's referenced throughout the liferay you can find the event listing example project on note on windows, your liferay portal instance and your plugins sdk must be on the same drive in order to build services. instance is on your c drive, your plugins sdk must also be on your c drive in order for service builder to be able to run successfully now let's learn how to run service builder using liferay ide or developer studio from the package explorer, open the url file from your plugin-projectdocrootweb-inf folder. default, the file opens up in the service builder editor. then click the build services button near the top-right corner the build services button has an image of a document with the numerical sequence 010 in front of it make sure to click the build services button and not the build wsdd button building the wsdds won't hurt anything, but you'll generate files for the remote service instead of the local one. about wsdds web service deployment descriptors, please refer to the figure 1 the overview mode in the editor provides a nested outline which you can expand, a form for editing basic service builder attributes, and buttons for building services or building web service deployment descriptors another simple way to run service builder is to right-click on your project's name in the package explorer and then to select liferay build services or, equivalently, liferay sdk build-service when you run service builder from liferay ide or developer studio, your ide generates a build.username.properties file in your plugins sdk, where username is your operating system username. this file is used to specify the location of a liferay instance. your plugins sdk needs to be configured with the location of a liferay instance since it needs to compile your code against classes on liferay's classpath. here's a sample build.username.properties after running service builder, the plugins sdk prints messages listing the generated files and a message stating build successful. the generated files appears below using the terminal open a terminal window and navigate to your plugins if a build.username.properties does not exist in your plugins don't edit the url file itself. build.username.properties file can override any of the properties specified if you're using a liferay tomcat bundle, it's usually not necessary to override all of the properties that liferay ide and developer studio override. the value of the url property suffices as long you haven't changed the relative locations of the url. directories tip one potentially useful property that's not automatically configured by liferay ide or developer studio is the url property. liferay's auto-deploy directory, i.e., the directory into which the plugins sdk will copy plugins war files to be deployed. before deploying and exploding them to the url if you customize the value of the url property in your plugins sdk, make sure you also configure liferay to scan the new directory. e.g., in url to point to the same directory that you specified via the url property of your plugins sdk's when you've finished configuring your build.username.properties file, navigate to your portletsevent-listing-project-portlet directory and enter when the service has been successfully generated, a build successful message appears in your terminal window. you should also see that a large number of files have been generated in your project. these files include a model layer, service layer, and persistence layer. don't worry about the number of generated filesyou'll never have to customize more than three of them. code that service builder generates for your entities, see the next section let's examine the files service builder generates for your entity. files listed under local service and remote service below are only generated for an entity that has both local-service and remote-service attributes set to service builder generates services for these entities in two locations these locations use the package path that you specified in your for the event listing project, these two locations are the the docrootweb-infservicecomliferaydocseventlisting package contains utility classes and interfaces for the event listing project. classes and interfaces in the service folder are packaged in a.jar file this.jar file is generated whenever you run it's possible to place this.jar file on your application server's global classpath to make your project's services available to other this practice, however, is not recommended. portlets in different project, for example, to create, update, and delete entity you should seriously consider the security implications of placing your project's service.jar file on your application server's do you really want to allow other plugins to access your the docrootweb-infsrccomliferaydocseventlisting package contains the implementation of the interfaces defined in the to the event listing project's classpath but is not available outside the event service builder generates classes and interfaces belonging to the persistence layer, service layer, and model layer in the docrootweb-infservicecomliferaydocseventlisting and the classes and interfaces generated for events. you won't have to customize more than three classes for these customizable classes are localserviceimpl, serviceimpl, figure 2 service builder generates these persistence classes and interfaces. you shouldn't and you won't need to customize any of these classes or interfaces local service generated for an entity only if an entity's local-service attribute is set to true in url figure 3 service builder generates these service classes and interfaces. only eventlocalserviceimpl allows custom methods to be added to the service layer remote service generated for an entity only if an entity's remote-service attribute is not set to false in url figure 4 service builder generates these model classes and interfaces. only eventimpl allows custom methods to be added to the service layer each file that service builder generates is assembled from an associated you can find service builder's freemarker templates in the for example, if you want to find out how a url file is generated, just look at the url of all the classes generated by service builder, only three should be manually modified localserviceimpl, serviceimpl and impl. modify the other classes, your changes are overwritten the next time you run whenever you add methods to, remove methods from, or change a method signature of a localserviceimpl class, serviceimpl class, or impl class, you should run service builder again to regenerate the affected running service builder and understanding the generated code;;
to create liferay plugins using maven, you'll need the archives required by liferay e.g., required jar and war files. provides them as maven artifacts. this tutorial explains how to install the maven artifacts required for liferay plugin development so how do you get the liferay artifacts? the exact process depends on whether you're building plugins for liferay ee or liferay ce. for liferay ee, you'll have to install the liferay artifacts manually from a zip you can do the same if you're building plugins for liferay ce, but there's a simpler option available you can automatically install ce artifacts from the alternatively for liferay ce, if you absolutely must have the latest pre-release changes from the liferay ce source repository, you can build the liferay ce artifacts yourself this tutorial demonstrates the following three ways of installing liferay's installing artifacts from a zip file installing artifacts from the liferay repository installing artifacts from the central repository first, consider the manual process of downloading and installing liferay whether you're building plugins for liferay ee or ce, you can get the liferay artifacts by manually installing them from a zip file. means to install the artifacts to a maven repository of your choice you can download the liferay ee artifacts package from liferay's customer portal by following these steps go to the customer portal by clicking your profile picture in the dockbar select liferay portal from the downloads panel inside filter by, select the appropriate liferay version in the first field and select the for developers value in the second field figure 1 you can download the liferay maven ee artifacts from the liferay customer portal click download under the desired liferay portal version maven the liferay maven ee artifacts package downloads to your machine you can download liferay ce artifacts from sourceforge by following these steps open your browser to liferay portal on sourceforge select the liferay version for which you need maven artifacts. figure 2 after selecting the liferay version, select the liferay portal maven zip file to download select the appropriate zip file. the liferay maven ce artifacts package downloads to your machine you can extract the liferay artifacts package zip file anywhere you like. the zip file not only includes the liferay artifacts, but also includes a convenient script to install and deploy the artifacts to your repositories if you're using liferay ce and you want the latest pre-release artifacts from the liferay ce source repository, you can get thembut you'll have to build if you're interesting in building the artifacts from liferay's source code, please see the building maven artifacts once you've downloaded liferay release artifacts as a zip file or built them from source, you'll need to install them to your maven repository. follow these steps to install the liferay release artifacts to your local maven if you downloaded a liferay artifacts zip file, navigate to the extracted from the liferay artifacts zip file. from source, navigate to the time-stamped directory containing the artifacts in your local liferay portal ce source project's root directory, e.g., to install the artifacts to your local repository, execute your console shows output from the artifacts being installed from the liferay maven package into your local repository, typically located in your userhome.m2repository directory your local repository now contains the liferay artifacts required to build if you want to share your liferay artifacts with teammates, you'll have to deploy them to a release repository server you may find it worthwhile to share your liferay artifacts with teammates make sure you've created a repository server to hold the liferay maven if you haven't, see the managing maven repositories section of make sure the repository that will hold your liferay artifacts is specified as a server in maven's url file. configuring local maven settings section of the tutorial for instructions on adding an entry for the server here's an example setting for a repository server named liferay-releases navigate to the directory holding the liferay artifacts you want to install if you unzipped the artifacts from a downloaded zip file, the artifacts are in a directory that follows the naming yourself, they'll be in a time-stamped directory in your liferay-portal create a build.user name.properties file in this directory. these refer to your repository's id and url, here are some example property values note if you created a repository in nexus, as demonstrated in the managing maven repositories section of the to deploy to your release repository server, execute the following command your console shows output from the artifacts being deployed into your to verify your artifacts are deployed, navigate to the repositories page of your nexus server and select your repository. a window appears below displaying the liferay artifacts now deployed to your repository figure 3 your repository server now provides access to your liferay maven artifacts you've downloaded the liferay artifacts, installed them to your local repository, and deployed them to your release repository server for did you know that liferay has its own maven repository for artifacts? learn how to install artifacts from liferay's repository next if you'd like to access liferay's ce artifacts without downloading and installing a.zip file, you can configure maven to automatically download and install them from liferay's own repository you use maven to compile a liferay plugin project, maven automatically downloads the required artifacts from the liferay maven repository into your local repository, if they're not found in your local repository or any of your you'll see it happen when you package your in order to access artifacts from the liferay maven repository, you'll need to configure maven to look for them there first, specify the liferay repository's credentials in your project's parent important do not leave the liferay repository configured when publishing you must comment out the liferay repository credentials when publishing your artifacts next, when interacting with the liferay repository, you'll need to use specialized commands to access it. use the following command to access the ce liferay makes its artifacts available on maven's central repository as well. with using liferay's maven repository, the maven's central repository enables you to automatically download and install liferay maven artifacts. note sometimes, the liferay maven artifacts for a release are not immediately available on maven's central repository. might still be synced to a previous release of liferay. download the liferay maven artifacts from liferay's repository. liferay offers an option for automatic download and installation of liferay maven artifacts publicly available on the central repository, located at with liferay releases e.g., 6.0.6, 6.1.1, 6.1.2, 6.1.20, 6.1.30, 6.2.0-rc5, the first time you use maven to compile a liferay plugin project, maven automatically downloads the required artifacts from the central repository into your local repository if they're not found in your local repository or any of your configured repository servers.;;
wouldn't it be nice if you could manage your liferay maven projects from liferay liferay ide 2.0 introduces the maven project configurator m2e-liferay , or the added support of configuring maven projects as full this tutorial explains what the maven project configurator does, how to install it, and how to install its dependencies. you read through it, you'll examine the structure of liferay maven projects and explore some configuration options in order to properly support maven projects in the ide, you first need a mechanism to recognize maven projects as liferay ide projects. recognized in eclipse as faceted web projects that include the appropriate therefore, all ide projects are also eclipse web projects faceted projects with the web facet installed. in order for the ide to recognize the maven project and for it to be able to leverage java ee tooling features e.g., the servers view with the project, the project must be a flexible web liferay ide relies on the following eclipse plugins to provide this the m2e-core plugin provides the standard maven tooling support for eclipse. it provides dependency resolution classpath management and an abstract project the m2e-wtp plugin provides project configuration mappings between the maven models, described in the maven project's poms, and the corresponding flexible web project supported in eclipse. this allows a liferay maven project to be recognized as a flexible web project. the m2e-liferay plugin installation includes these plugins and installs them by with these integration features in place, the only remaining requirement is making sure that the m2e-core plugin can recognize the extra lifecycle metadata mappings necessary for supporting liferay's custom goals. let's break down the lifecycle mappings just a bit to get a better understanding both maven and eclipse have their own standard build project lifecycles that are for both to work together and run seamlessly within liferay ide, a lifecycle mapping is required to link both lifecycles into one normally, this would have to be done manually by the user. fortunately, the m2e-liferay plugin combines the lifecycle metadata mapping and eclipse build lifecycles, to provide a seamless user experience. lifecycle mappings for your project can be viewed by right-clicking your project and selecting properties maven lifecycle mapping figure 1 you can view your project's lifecycle mappings when first installing liferay ide, the installation startup screen lets you select whether you'd like to install the maven plugins automatically. worry if you missed this during setup. to install the required maven plugins, navigate to help install new software. figure 2 you can install the m2e-liferay plugin by searching for software on liferay ide's repository if the m2e-liferay plugin does not appear, then it's already installed. verify that it's installed, uncheck the hide items that are already installed checkbox and look for m2e-liferay in the list of installed plugins. you'd like to view everything that is bundled with the m2e-liferay plugin, uncheck the group items by category checkbox the required maven plugins are installed and your ide instance is ready next, you'll learn how to configure an existing maven project now that your liferay ide is maven-ready, you can examine the anatomy of a note, you don't need to have an existing liferay maven however, if you'd like to create a new liferay maven portlet project in the ide before proceeding, you can do so by following developing liferay portlets with maven. alternatively, you can import an existing maven project by navigating to file import maven and selecting the location of maven project's note due to the lifecycle mapping of eclipse and maven, it is unsafe to manually insert or overwrite the.classpath file,.project file, and.settings folder. generates these files when a project is imported and updates them appropriately the m2e-core plugin delegates your liferay maven plugin's project configuration to the m2e-liferay project configurator. configurator then converts your liferay war package into an eclipse flexible web next, the m2e-liferay configurator looks for the liferay maven plugin to be registered on the pom effective model for war type packages. maven plugin is configured on the effective pom for the project, project if the plugin is configured, the project configurator validates your project's configuration, checking it's pom, parent pom, and the the configurator detects invalid properties and reports them as errors in the ide's pom editor. there are a list of key properties that your project must specify in order for it to become a valid liferay ide project. tutorial identifies these properties and explains how they are used liferay ide's quick fix features provide two options for resolving missing liferay maven properties in a liferay maven plugin project. fix dialog, right-click the error and select quick fix. quick fix option 1 creating a new maven profile based on a liferay runtime after you select this fix and click finish. dialog appears with a profile that was generated automatically based on your the profile location is set to the project url by default. alternatively select your local url file figure 3 liferay ide's quick fix feature lets you create a new maven profile based on a liferay runtime environment quick fix option 2 selecting an existing maven profile after you select this fix, the select active profile dialog appears. profiles in profile id column on the left are read from your local add one or more active profiles to the profile id column on the right and click finish to apply the profiles figure 4 liferay ide's quick fix feature also lets you select any existing active maven profile to attach to your project you can also manually specify required liferay properties in either the maven profile of the global url file recommended, in the user url file, in the parent url, or in the project url global url provides configuration for all plugins belonging to user url provides configuration for all plugins belonging to a parent url provides configuration for all modules in the parent project url provides configuration for the single plugin project you can think of these choices as a hierarchy for how your maven plugins receive the project url overrides the parent url, the parent url overrides the user url file, and the user url file overrides the global url file note that if a profile is active from your user url, its values override your properties in a pom. if you'd like to specify the properties in a here's an example of what a maven profile looks like inside the url once you've configured a maven profile in your user url file, you can activate the profile by right-clicking on your project properties maven and entering the profile ids that supply the necessary settings into the active maven profiles text field. profile and properties we listed above, you'd enter sample for the active once you've specified all the values, the configurator m2e-liferay validates the properties. if there are errors in the url file, the configurator marks them in liferay ide's pom editor. project error, update the project to persist the fix by right-clicking your project maven update project after your pom configuration meets the requirements, the configurator installs the liferay plugin facet and your maven project is officially a liferay ide you can execute maven goals such as liferaybuild-lang or liferaybuild-db. you can access and execute any of your project's maven goals by right-clicking your project liferay maven and select the goal you want to to learn more about maven's build lifecycle and plugin goals, visit when working with your url file in the ide, you'll notice that the editor has several each mode is described in the following listing overview provides a graphical interface where you can add to and edit the dependencies provides a graphical interface for adding and editing dependencies in your project, as well as modifying the dependencymanagement effective pom provides a read-only version of your project pom merged with its parent poms, url, and the settings in eclipse for maven dependency hierarchy provides a hierarchical view of project dependencies and an interactive listing of resolved dependencies url provides an editor for your pom's source xml the figure below, shows the url file editor and its modes figure 5 liferay ide provides five interactive modes to help you edit and organize your pom by taking advantage of these interactive modes, modifying and organizing your pom and its dependencies has never been easier! creating liferay maven plugins from liferay ide deploying liferay plugins with maven setting up liferay maven facets in existing liferay maven plugin projects;;
maven supports project inheritance. you can create a parent project that contains properties that child projects inherit. don't need to specify those properties in each project. projects easier to maintain since if you have to change the value of a property belonging to each of your projects, you only need to change it in the parent if you develop more than one project, it makes sense to leverage project inheritance so that all projects can share properties they have in this tutorial demonstrates maven inheritance with a liferay maven project that includes a parentchild relationship. whether or not you're going to leverage maven's project inheritance capabilities when you build your liferay plugins with maven, the process is the same for creating any liferay plugin with maven's for more information on project inheritance, see maven's if you'll be creating multiple liferay plugins, you should create a parent project and then specify the general settings needed to build your plugins for the parent project functions similarly to the project root of the its url file specifies information to be used by any child plugin projects that refer to it. of course, you can always specify information in each individual plugin's pom, but it's more convenient to use the parent project's pom for sharing common information follow these steps to create a liferay maven parent plugin project create a directory for your parent plugin project in your new parent plugin project directory, create a pom file named for example, here's pom xml code for a parent plugin project named the pom starts by specifying the model version that maven supports, your your project's name, and your company's url next, the pom specifies some key liferay property elements that your plugins require in order to be deployed to your liferay portal. specify these values in a parent project for all of your child plugin a plugin project can override any of its parent's properties by specifying the desired property explicitly in the child plugin if you use contents from the above example pom, make sure to replace url and other dereferenced liferay. properties with the appropriate value based on your liferay environment each key liferay property is described below here's an example of specifying these properties for liferay bundled with apache tomcat in a directory cliferay-portal-6.2 you can also specify these key properties in your global or user to learn more about this method, visit the configuring your liferay maven project section of the the liferay plugins that you develop depend on several liferay artifacts. you can include them in individual dependency elements within the pom's all of your parent project's modules i.e., projects that refer to this parent can leverage these dependencies include such dependencies in the pom of each of your plugin projects, but specifying them in a parent project makes them accessible to child projects you've configured your parent plugin project developing plugins with liferay ide;;
in order for a plugin to affect the portal it must be deployed to it. develop plugins you'll want to test them on a portal. their plugins on a portal instance on their machine. instance is non-restrictive and easy to do. eventually, however, you'll need to deploy your plugins to remote test servers and, finally, to production servers. no matter what stage of development you're in, it's important for you and your portal administrators to know the plugin deployment options available. section of tutorials explains the deployment options and how they work.;;
liferay ide provides multiple options for deploying plugins you can drag and drop your project onto the server or right click the server and select add and it's almost as easy using an ant target directly from the plugins simply open a terminal window, navigate to your project's directory e.g., portletsportlet name in your plugins sdk and enter a build successful message indicates that ant built your portlet's war file and if you switch to the terminal window running liferay, within a few seconds you should see a message, like the following message, indicating that your plugin is available to use in the portal if you don't see such a message, double-check your plugin's configuration adding newly deployed portlet plugins from within liferay portal is easy. your web browser, log in to the portal. click on the add icon on the left side of the page and select the applications tab. sample is the default category, and then click add next to portlet your portlet appears in the page deploying liferay plugins with maven using liferay ide's remote server adapter;;
"the remote server adapter lets you deploy local plugin projects to remote you can use it to deploy apps you're developing to a test server for your qa team or to a beta server for your users. your server administrator installs liferay version 6.1 or newer, installs the remote ide connector app from liferay marketplace, and creates a portal administrator account for you. you simply make sure you have the same version of liferay installed and you connect to the remote server using the remote server adapter built into your figure 1 liferay ide's remote server adapter lets you deploy plugins to remote servers, such as your test server or beta server of course, it's possible to install the remote ide connector application on a production server, but it creates an unnecessary security risk, so we don't on a production server, you shouldn't update, or hot-fix, plugins using the adapter; your portal system administrator should use normal mechanism to apply plugin updates and fixes this tutorial uses the remote server adapter on liferay portal bundled with apache tomcat, but you can use the adapter with liferay portal running on any now you're ready to configure and use the remote server adapter! to configure and use the remote server adapter, follow these steps make sure your remote liferay portal instance is running and that you can log in as a portal administrator with your account launch liferay ide and open the new server wizard by clicking file new other; select server in the server category and click select remote liferay server liferay 6.1 in the liferay, inc. enter the ip address of the remote liferay portal host into the server's enter an arbitrary name for the server name, like liferay ipaddressofremoteserver, then click next figure 2 configure the remote liferay server's information next, you must define the liferay portal runtime stub. plugin projects to use the runtime stub for satisfying their jar file select the liferay bundle type based on the version of your local liferay bundle, browse to the liferay bundle directory, select it, and on the next page of the wizard, configure your connection to the remote the liferay portal context path and server manager context path default values reflect the defaults set in liferay portal if a portal administrator changed these values on the remote portal instance, enter those new values instead. default values set in the wizard click the validate connection button; if no warnings or errors appear, if you get any warning or error messages in the configuration wizard, check your connection settings once liferay ide connects to your remote liferay portal instance, click finish in the remote liferay server configuration wizard the new remote server appears in liferay ide's servers tab. appears in the bottom left corner of the liferay ide if you're using the the ide connects to your remote server and displays the remote liferay portal instance's logs in the console. is in debug mode, the adapter attaches eclipse's java debugger to the remote you can change the remote server settings at any time to change the settings, double-click on your remote server instance in the servers tab to open the configuration editor, where you can modify the the configuration editor also contains settings for publishing you can choose to publish resources automatically after changes are made, automatically publish resources after a build event, or never to figure 3 the remote server's configuration editor lets you modify remote settings, specify how resources are published, and set time limits for server operations as you desire, deploy plugins to the remote portal instance as you deploy plugins to the remote server, your console displays messages as you make changes to your plugin project, you can republish the project so the changes take effect on the remote server. to manually publish changes, right click on the server in the servers view and now that you know how to use liferay ide to deploy plugin projects to remote servers, you can more easily integrate your remote portal instances into";;
as you develop plugins you'll want to deploy them to your test servers and as you finish developing plugins you'll want to deploy them to your production there are hot deploy and auto deploy options to use in deploying most people confuse the two concepts, believing them to be one and in reality, liferay has two completely separate and different concepts this tutorial gives you a brief synopsis of go ahead and get started by learning about the hot the first deployment method you'll explore is hot deployment. familiar with hot deployment in the context of java ee application servers. summary, you place an application artifact war or ear file into a specifically configured directory, your application server tomcat, websphere, weblogic, etc. picks up that artifact, deploys it within the application server, and this model works really well for development purposes, since a server restart is not required to view updates from your code changes. single node production deployments however, this model completely breaks down when you deploy to a multi-node in a multi-node environment, you have many more constraints to deal with, that require you to most application servers solve these constraints by using a masterslave type of design an admin server with multiple managed servers. plugin, you use the admin server's user interface, or vendor console tool like wsadmin, to add the archive, select which managed servers should deploy it, and start the application. server vendors often have different names and tools for these modes and tools these modes and tools reside completely outside of liferay portal and are strictly in the application server's realm. however, liferay piggybacks off the application server's hot deploy capability and performs additional initialization after a given application starts e.g., via there are some specific liferay capabilities that won't work unless your application server has hot deployment capabilities. custom jsps in hooks won't work, because liferay's jsp hook overriding capabilities depend on the application server's ability to application servers running in production and domain modes cannot support these abilities, because in these deployment models, most servers don't use as such, these application servers don't support jsp reloadingrecompilation in these modes. even for tomcat, it's generally so what do you do if you use hooks to override liferay jsps and you must use the answer is simple inject a pre-processing stage as part of your build process. you deploy the hooks, allowing them to make changes to the portal war file. then you rebundle the portal war file and deploy it using the application server's deployment tools. deploy your hook as well, but you no longer need to worry about the jsp overrides not being loaded by your application server hopefully this whets your appetite for doing hot deployments. it's time to explore auto deployment next the liferay auto deployment feature is a mostly optional feature that works in conjunction with the hot deployment capabilities of your application server. where liferay's hot deploy leverages the hot deploy capabilities of your app server and performs additional initializations, auto deploy injects the required jar files and descriptors into your application's archive file. ant deploy invokes both hot deployment and auto deployment tasks for your so how does auto deployment work with liferay plugins? by relying on auto deployment to complete these tasks automatically, you save time and you don't even have to learn all of liferay's deployment descriptors. however, this feature is incompatible with application server farms and so now you're probably wondering how to configure your application server in the answer is simple do not use the auto deployment method at the liferay plugins sdk allows you to preprocess your archives and inject all you therefore bypass the auto deployer at runtime. simply need to call the following ant task the direct-deploy ant task creates an exploded war from which you can easily the location of the exploded war depends on the deployment directory of the application server you've configured in your plugins sdk developing with the plugins sdk tutorials for instructions on configuring the plugins sdk for your app server. the plugins sdk's url provides a default deployment directory value for each supported app server. but you can override the default value by specifying your desired value for the url.type url replace type with your app server type in your build.username.properties file if you choose not to use the liferay plugins sdk to do direct deployment, you can examine the url file in the plugins sdk to see how liferay you now know the differences between hot deploy and auto deploy. understanding what's going on during the deployment of your plugins is crucial for troubleshooting anything that goes wrong, and can help you simplify your deployment process and make it more efficient deploying liferay plugins with maven using liferay ide's remote server adapter;;
portlets are the most basic, most commonly used type of liferay plugin you'll think of your liferay portal as a pizza crust sit down, you can go liferay comes with some basic toppings that make for a pretty good pizza out of the box i.e., the core portlets and built-in of course, your boss might demand anchovies, and liferay definitely doesn't come with anchovies. get some anchovies your app's source code, and integrate them with the pizza in these tutorials you'll learn how to develop portlet projects to top your liferay pizza in such a way that the end-user won't be able to tell the difference between your custom portlet and liferay's core portlets in liferay, you're free to use any framework you prefer to develop your portlets, including struts, spring mvc, jsf, and vaadin. liferay mvc portlet framework, because it's simple, lightweight, and easy to jsf portlets with liferay faces;;
"portlets can be created in a plugins sdk project or a liferay maven liferay ide lets you create either project type using command line tools ant in the plugins sdk or maven archetype in maven in this tutorial, you'll learn how to create mvc portlets in a plugins sdk project, using liferay ide and ant. to learn how to create liferay maven creating liferay maven plugins from ide creating liferay maven plugins from the command line. if you're completely new to liferay, you may first want to go through the first up is creating a portlet with liferay ide, so go ahead and get fill in the project name and display name. spaces and it's a best practice to specify them in lowercase. display name, however, can have spaces. portlet's display name just as you want it displayed to the user leave the use default location checkbox checked. default location is set to your plugins sdk. your plugin project is saved in your file system, uncheck the box and figure 1 creating portlet projects with liferay ide is easy select the ant liferay-plugins-sdk option for your build type your configured sdk and liferay runtime should already be selected. haven't yet pointed liferay ide to a plugins sdk, click the configure sdks button to the right of the plugins sdk dropdown menu to open the installed plugin sdks management wizard. new server runtime environment wizard if you need to set up your runtime server; just click the new liferay runtime button next to the liferay select portlet as your plugin type. service builder portlet if you know you want to use liferay's service if you want to launch the new portlet wizard after your project is created, select the checkbox of that name. the new portlet wizard guides you in click next if you selected portlet as your plugin type. service builder portlet as your plugin type, then click finish if you selected portlet as your plugin type, make sure that the liferay mvc framework is selected in the next window and click finish with liferay ide, you can create a new plugin project or if you already have a project, create a new plugin in an existing project. next you'll see how the same process is done using navigate to the portlets directory in the terminal and enter the appropriate command for your operating system you should get a build successful message from ant, and there will now be a new folder inside of the portlets folder in your plugins sdk. this is where you will be implementing your own notice that the plugins sdk automatically appends -portlet to the project name when creating this folder alternatively, if you will not be using the plugins sdk to house your portlet projects, you can copy your newly created portlet project into your ide of if you do this, you will need to make sure the project references some.jar files from your liferay installation, or you may since the ant scripts in the plugins sdk do this for you automatically, you don't get these errors when working with the plugins sdk to resolve the dependencies for portlet projects, see the classpath entries in the url file in the plugins sdk project. the url and url entries, which.jar files are necessary to build your newly created portlet project. configuration, and it is encouraged that you keep your projects in the plugins control system such as subversion, cvs, mercurial, git, etc., this might be a good moment to do an initial check-in of your changes. plugin for deployment, several additional files will be generated that should not be handled by the source control system a portlet project is made up of at least three components when using liferay's plugins sdk, these files are stored in a standard directory by default, new portlets use the mvcportlet framework, a light framework that hides part of the complexity of portlets and makes the most common operations the default mvcportlet project uses separate jsps for each portlet mode each of the registered portlet modes has a corresponding jsp with the for example,' url' is for edit mode and' url' the java source is stored in the docrootweb-infsrc folder the configuration files are stored in the docrootweb-inf folder. stored here include the standard jsr-286 portlet configuration file url, as well as three optional liferay-specific configuration files. the liferay-specific configuration files, while optional, are important if your portlets will be deployed on a liferay portal server. client side files are the.jsp,.css, and.js files that you write to implement your portlet's user interface. these files should go in the docroot folder;.jsp files can be placed in the root of the folder, while.css and.js files are given their own subfolders in docroot. you're only dealing with a portion of the html document that is getting returned any html code in your client side files must be free of global additionally, namespace all css classes and element ids to prevent conflicts with other portlets. tools, a taglib and api methods, to generate a namespace for you. tutorial to learn more about namespacing now you understand the basic structure of liferay mvc portlets and you have two handy ways to create them in your bag o'trix! writing a data-driven application creating liferay maven plugins from ide creating liferay maven plugins from the command line";;
portlet preferences are properties for storing basic portlet configuration data. administrators often use preferences to provide a customized view of a portlet to subsets of users or even all of a portlet's users. controls are sometimes made accessible to users themselves for configuring portlets just the way they like them. in this tutorial, you'll learn how to create a default configuration jsp page and how to add a portlet preference figure 1 shows what a configurable portlet preference looks like in a portlet's configuration menu figure 1 portlet preferences, such as this portlet's checkbox for showing location addresses, let you customize your portlet in many different ways first, you'll learn how to create the default setup tab for your portlet's before you can begin adding configurable portlet preferences, you must first create a place for them to reside in your portlet's configuration menu. following steps explain how you can put preference controls in a setup tab in the configuration menu for your portlet preference here's an example snippet to show you where it goes in the context of your url file notice that you've specified the default configuration action class. update this tag with a custom configuration class, as demonstrated later in this if you redeploy your portlet and open your portlet's configuration page, you'll find the new setup tab figure 2 simply by specifying liferay's default configuration action class in your portlet's url file, you provide your portlet with a setup tab for adding your portlet's configuration setup options the setup tab is empty for now, but you can add a portlet preference control to now that you have your setup tab in the configuration menu, you can add a custom in order to add a configurable portlet preference to the portlet, you must do you can specify a configuration jsp file, first your portlet needs a way to display configuration options to the user. checks to see if your portlet specifies a configuration jsp via a open the url file and declare your initialization parameters with the... tags within your portlet's element. here's an example code snippet that sets a portlet's configuration jsp path to next, you can create the configuration jsp file that you just specified you must create a configuration jsp file and write javascript to let the user create the jsp file in a location matching the path you specified for the add an action url for the configuration. for example, you can specify one retrieve the current value of your portlet preference and save it to a local for example, you could retrieve a portlet preference named somepreferencekey and save it to a local java variable with the following class provides helpful methods for processing values from portlet add a form to present the current setup and to enable the user to submit any changes via the action url that you specified in step 2. specify the form using an with a submit button. which you could present the portlet preference for the user to control the sample code above passes the value of a generic variable named constants.cmd to signify that this form's action is an update to the you must add your portlet preference control within your configuration you can use an tag to display the control and get the in order for the value to be persisted, the tag's name attribute value must follow the naming convention preferences--somepreferencekey--, where you'd replace somepreferencekey with the name of your portlet preference for example, here is an input checkbox that lets the user set the value of a note make sure to declare directives for any taglibs your configuration jsp requires, or declare the directives in one of the jsps that the configuration you may also need to declare the tag to access this tag provides useful portlet variables such as renderrequest, portletconfig, and portletpreferences. your configuration jsp is all set to display your portlet preference options. you're ready to implement a custom class to handle the configuration action. you don't need to use the portlet preference in your portlet's controller logic, then you can skip the next step you can create a custom configuration action class for accessing the portlet preference and invoking any preference handling logic that you want. you can optionally override defaultconfigurationaction's processaction method to add any processing logic for the portlet preference. could override the method and access your preference with code similar to this the super-class's processaction method is responsible for reading the portlet preferences from the configuration form and storing them in the usually, you'd add appropriate validation logic for the parameters portlet preferences by calling url since they're automatically stored in the defaultconfigurationaction class, which your configuration class another common method to override in a custom configuration action class is the the render method is invoked when the user clicks the no matter what methods you override, make sure to import any classes you need. here are some common classes you may need to import lastly, you must specify your new custom configuration class in the replace the value of the existing... with your custom configuration class' fully qualified class name. where it goes in the context of the url file since your configuration action implementation is ready to process your portlet preference, you can update your portlet's view jsp to respond to the portlet in your view jsp, you can implement logic to display your portlet based on its you can access portlet preferences via the implicit to access this variable, make sure to include the here's an example of accessing a boolean value stored in a portlet preference file to see an example of handling portlet preference inside a view jsp. retrieves the value of a portlet preference named showlocationaddress and if the preference's value is true, all of the location's fields are displayed. it is false, then the address fields are omitted figure 3 liferay portal makes it easy to customize a portlet ui. privileged users can adjust the preference settings within the portlet's configuration page you've created a custom configuration page and added a portlet to see the configuration page and portlet preference in action! portlet's configuration page to see the portlet preference control that you figure 4 your new portlet preference is available in your portlet's configuration page you added a new setup tab to your portlet's configuration page and you added a configurable portlet preference to that page. use liferay's portlet preferences in the portlets you develop user interfaces with the liferay ui taglib;;
java developers use a wide variety of tools and development environments. liferay makes every effort to remain tool agnostic, so you can choose the tools plugins software development kit sdk but you can use the liferay plugins sdk the plugins sdk leverages apache ant as its build tool and can be used along with any text editor or integrated development environment ide.;;
"this tutorial explains how to install and configure the liferay plugins sdk and the plugins sdk requires liferay portal. if you haven't already installed a liferay bundle, follow the instructions in the chapter of the deployment guide. many people use the tomcat bundle for development, as it's small, fast, and takes up fewer resources than most other although you can use any application server supported by liferay portal for development, our examples use the tomcat bundle note liferay developer studio bundles and configures liferay portal enterprise edition ee and the plugins sdk out-of-the-box, so both are ready to to install the plugins sdk, follow these steps and find your desired 6.2.x version of liferay portal e.g., 6.2.5 ga6 . then select the liferay-plugins-sdk-6.2-ce-version.zip link. downloads the plugins sdk to your local machine unzip the archive to a folder of your choosing. systems have trouble running java applications from folders with names containing spaces, avoid using spaces when naming your folder on windows, to build a plugin's services, the plugins sdk and liferay portal instance must be on the same drive. portal instance is on your c drive, your plugins sdk must also be on your c drive in order for service builder to be able to run tip by default, liferay portal community edition comes bundled with many it's common to remove them to optimize the server's startup time. navigate to the liferay-portal-versiontomcat-tomcat-versionwebapps directory and remove any plugins that you don't need. root is the liferay application itself. marketplace-portlet since you can use the marketplace portlet to download any plugins that you decide to use in the future building projects in the plugins sdk requires that you install ant version 1.7 download the latest version of ant from extract the archive's contents into a folder of your now that ant is installed, create an anthome environment variable to capture your ant installation location. doing this on unix-like systems unix, linux, or mac os x and windows is demonstrated next on unix-like systems, if your ant installation directory is javaapache-ant-version and your shell is bash, set anthome and adjust your path by specifying the following in.bashprofile or from your terminal on windows, if your ant installation folder is cjavaapache-ant-version, set your anthome and path environment variables appropriately in your system select start, then right-select computer properties in the advanced tab, click environment variables... in the system variables section, click new... set the anthome variable to the path of your apache ant installation also in the system variables section, select your path variable and click insert anthomebin; after javahomebin; and click ok click ok to close all system property windows open a new command prompt for your new environment variables to take affect to verify ant is in your path, execute ant -version from your terminal to make sure your output looks similar to this if the version information doesn't display, make sure your ant installation is now that you've installed the plugins sdk and you've configured ant, it's time to configure your plugins sdk environment your plugins sdk needs to know the location of our liferay installation so it can compile plugins against liferay's jar files and deploy plugins to your the plugins sdk contains a url file that contains the default settings about the location of your liferay installation you can use this file as a reference, but you shouldn't modify it directly in fact, you will see the message do not edit this file at the top if you open it. in order to override the default settings, create a new file named build.username.properties in the same folder, where username is your user id on your machine. user name is jbloggs, your file name would be url edit this file and add the following lines if you're using liferay portal bundled with tomcat 7.0.42 and your bundle is in your cliferay-portal-6.2 folder, you'd specify the following lines since the example properties above use the tomcat application server, tomcat is specified as the app server type and the url property is see the plugins sdk's url for the name of the app server property that matches your app server note liferay's plugins sdk 6.2 was designed to compile classes using java if you prefer to use java 8, you must set the following property in once this is added, you can successfully use java 8 to build liferay portal 6.2 you're set to start using your liferay plugins sdk! developing plugins with liferay ide";;
this tutorial describes the plugins sdk's directory structure and project ant targets, demonstrates how to create plugin projects, and shows how to deploy by learning the sdk's directory structure, you'll know where to initiate creating the different project types, know its build files, and know where plugins archives are held for distribution. the plugins sdk tour is up next each folder in the plugins sdk contains scripts for creating new plugins of that here is the directory structure of the plugins sdk new plugins are placed in their own subdirectory of the appropriate plugin type. for instance, a new portlet called greeting-portlet would reside in there's an ant build file called url in each of the plugins here are some ant targets you'll commonly use in developing your next, you'll learn how to create a plugin using liferay sdk from a terminal liferay ide makes it easy to create and deploy liferay plugin projects since it includes a bundled liferay sdk. if you don't want to use eclipse, you can still leverage the sdk to create your liferay plugins navigate to the portlets folder of your plugins sdk and follow these steps your terminal displays a build successful message from ant, and a new project containing your portlet plugin's directory structure is created inside of the portlets folder in your plugins sdk. this is where you'll work to implement note that the plugins sdk automatically appends -portlet to the project name when creating its directory if the project name you specified doesn't end in -portlet figure 1 the plugins sdk's ant targets enable you to create a new plugin project with a single command control system such as subversion, cvs, mercurial, git, etc., this would be a good moment to do an initial check-in of your changes. for deployment, several additional files will be generated that should not be managed by a source control system lastly, consider some common practices used in developing plugins with the sdk. the plugins sdk can house all of your plugin projects enterprise-wide, or you can have separate plugins sdk projects for each plugin. an internal intranet using liferay with some custom portlets, you can keep those portlets and themes in their own plugins sdk project in your source code or, you can further separate your projects by having a different plugins sdk project for each portlet or theme project now you know how to create all types of liferay plugin projects using liferay's foundational development tool the plugins sdk deploying plugins to a local portal instance;;
the best liferay-specific development tool is liferay ide, a fully featured integrated development environment ide based on eclipse. grizzled veteran java developer, consider using liferay ide when you're doing a lot of development for your liferay portal instance. with the plugins sdk or maven and a liferay runtime environment, you have a one stop development environment where you can develop your liferay plugins, build them, and deploy them to your liferay instance liferay ide is an extension for eclipse ide and supports development of plugin projects for the liferay portal platform. you can install liferay ide bundled with eclipse or as a set of eclipse plugins from an update site. version of liferay ide supports development of portlets, hooks, layout templates, themes, and ext plugins. to use liferay ide, you need the eclipse developing applications with liferay ide for instructions on installing and setting up liferay ide in this section's tutorials you'll learn how to set up projects for your applications and deploy them to your portal.;;
if you want to create new plugin projects for liferay portal, then liferay ide the new project wizard in liferay idedeveloper studio guides you through the process of creating new plugin projects. you're not very fond of wizards, you'll quickly discover that the new project wizard isn't your typical wizardit gives you plenty of control over the creation of your new plugin project. you're able to choose the plugin's type, build system, location, and much more. this tutorial shows you how to create new projects in liferay ide using this wizard. to create a new liferay plugin with the new project wizard, select file the first screen of the wizard contains the bulk of the settings for your new plugin project. the first section lets you specify your project's name, display name, and location. once you give your project a name, the location field is then automatically populated with a file path appropriate for your project's build framework. this is the default file path of your new plugin to use a different location, uncheck the use default location checkbox and enter your preferred location. you can browse for a location by clicking the icon to the right of the location field figure 1 the first section of the initial new project wizard screen lets you specify your project's name, display name, and location on the file system the next section of this initial screen lets you choose the build type for your you can select either ant or maven from the build type selector. rest of the fields in this section depend on the build type that you choose. you select ant, then you need to select a liferay plugins sdk and liferay if you select maven, then you need to enter the artifact version, group id, and the active profile that you want to use. use the buttons to the right of the active profiles field to select or create any active profiles that you create here can be found in the figure 2 when you select ant as the build type, you must also specify a liferay plugins sdk and liferay runtime figure 3 when you select maven as the build type, you must enter an artifact version and group id, and you can specify active profiles the third section of the new project wizard contains settings for the specific type of plugin project that you're creating. first select the plugin type from you can select portlet, service builder portlet, hook, layout template, theme, ext, or web figure 4 the plugin type selector lets you specify the type of plugin project to create the new project wizard gives you some additional options if you select the portlet or service builder portlet plugin type. with both portlet types, you can use the include sample code check box to instruct the new project wizard to add some basic sample code to your plugin. if you select portlet, then you also get a check box for instructing the wizard to launch the new portlet wizard after the the new portlet wizard guides you in the creation of a the final option in this section of the initial new project wizard screen is a check box that lets you add your project to an eclipse figure 5 when portlet is selected from the selector, options for including sample code and launching a new portlet wizard appear unless you're creating a portlet or theme, you're donejust click finish and get started developing your plugin in liferay ide! or theme, click next to move on to the next step in the new project wizard the only two plugin types that require additional steps in the new project wizard are portlet and theme plugin types. if you're creating a portlet, the second step of the wizard is where you select the portlet's framework. selected the include sample code check box on the first step of the wizard, then the second step also lets you enter the portlet's name and display name. portlet's framework, you can select liferay mvc, jsf 2.x, or vaadin. select jsf 2.x here, you must then click next to go to the third step of the wizard where you select a jsf component suite to use. standard, icefaces, liferay faces alloy, primefaces, or richfaces component figure 6 when creating a portlet, step two of the new project wizard lets you select a portlet framework to use in the project figure 7 you can develop jsf 2.x portlets using several popular component suites if you're creating a theme, the second step of the new project wizard is for selecting the theme parent and theme framework. you choose the unstyled, styled, or classic theme as the parent. theme framework selector lets you choose velocity, freemarker, or jsp template frameworks to use in your theme figure 8 when creating a theme, step two of the new project wizard lets you select the theme's parent and framework once you've completed the above selections for your portlet or theme, click finish and get started developing your plugin in liferay ide! the new project wizard isn't so scary after all. anytime you want to create new plugin projects for your liferay portal developing with the plugins sdk;;
"do you want to import one or more liferay projects into your liferay ide workspace from a liferay plugins sdk? the projects already contain.project or.classpath files, the process used in this tutorial assures they get imported into your workspace first, consider the steps for importing a single liferay project from a plugins sdk project into your workspace note this section assumes that you've created projects with the plugins sdk and are familiar with the directory structure used by the plugins sdk. for these steps, it's assumed that you haven't yet configured your plugins sdk in liferay ide, go to file new project... you can invoke the same wizard from the liferay shortcut bar; just click the new button and select liferay project from existing source figure 2.12 as an alternative to clicking file new to create a new liferay project from an existing source, you can click the button shown above from liferay ide's shortcut bar in the new liferay project window, click the browse button and navigate to the project folder of the plugin you'd like to import. must be a subfolder of one of the sdk's plugin type folders e.g., portlets, hooks, themes, etc; otherwise, liferay ide reports an error message stating that your liferay project location is invalid on selecting the plugin project folder, the liferay plugin type and liferay plugin sdk version values are updated. outdated or you entered an incorrect project type, its field gets marked select the liferay target runtime for the plugin project. have a liferay portal runtime, use the new... button to create one now click finish to complete the import you've imported your liferay project into your workspace! next, you'll learn how to import multiple projects from a liferay plugins sdk you've already set up in liferay ide. liferay projects from plugins sdk figure 2.13 to import projects from a plugins sdk, choose liferay projects from plugins sdk from the import menu in the import liferay projects window, use the dropdown list to select the liferay plugins sdk from which you're importing plugins note if your plugins sdk isn't configured in liferay ide i.e., it's not in the dropdown list of the import projects window, use the to configure a plugins sdk from the installed sdks window, just click add and then browse to the plugins sdk's root liferay ide automatically fills in the liferay plugin sdk location and liferay plugin sdk version fields, as long as they're valid; invalid the list of projects that are available for import are displayed in a list. any projects already in the workspace are disabled. import have an empty check box. select each project you'd like to import select the liferay runtime for the imported projects. liferay runtime, you can add one now by clicking the new... button congratulations on importing multiple liferay projects into your workspace! setting up liferay maven facets in existing liferay maven plugin projects";;
liferay ide lets you import non-liferay projects in your eclipse workspace i.e., you can see them in eclipse's project explorer and convert them to this tutorial shows the steps required to accomplish this move the project into a liferay plugins sdk, if it is not already in one. to import the project, select file import... and then follow the import instructions that appear in eclipse's project explorer, right-click on the project and select available, either the project is already a liferay ide project or it is not faceted i.e., java and dynamic web project facets are not yet configured for instructions on resolving these issues, see the faceting a plugin project for liferay ide in the convert project wizard, your project is selected and the sdk location and sdk version of your project are displayed figure 1 the convert project wizard detects your plugin's sdk's the location and version select a liferay runtime to use for the project. liferay runtime defined, define one now by clicking new... now that you've imported and converted your project, you can work with it just as you would any other liferay project;;
when you drag your plugin project onto your liferay server in liferay ide, is is there no l overlay image on your project's icon these are symptoms of an unfaceted plugin project. order for a plugin project to work properly in liferay ide, it must have dynamic web, java, and liferay plugin facets. don't worry, they're easy to configure in this tutorial, you'll learn how to facet your plugin project into a bonafide to facet your plugin project properly, follow these steps in the package explorer, right click your project's name if the project facets window reports that the project is not configured to use project facets, click the link figure 1 it's easy to enable your project to use facets in liferay ide select the dynamic web module, java, and javascript required if your expand the liferay plugins facet type and select the plugin type matching figure 2 make sure to select the plugin type matching your project's plugin type your plugin project is now faceted for liferay ide!;;
"once you've imported a project, you can verify that liferay ide correctly recognizes it as a liferay project here's how you verify that your project imported correctly as a liferay project once the project is imported, you should see a new project inside eclipse and it should have an l overlay image; the l is for liferay! figure 1 look for an l overlay image to verify that the project imported successfully as a liferay project if your project doesn't have the l overlay image, it needs to be faceted for liferay andor it needs to be targeted for a liferay runtime if it needs faceting, follow steps in the tutorial faceting a plugin project for liferay ide check the project's target runtime and facets to make sure they're configured properly for your plugin project in the package explorer, right click your project's name and select properties targeted runtimes. in the targeted runtimes section, make sure that the proper liferay runtime is selected check the project's facets to make sure they're configured properly for a in the properties window, click project facets and make sure that the liferay plugin facets are properly configured. faceted, you can follow the tutorial faceting a plugin project for liferay ide to add the necessary facets figure 2 make sure that your project's liferay plugin facets are properly configured congratulations on verifying that your project imported properly! setting up liferay maven facets in existing liferay maven plugin projects";;
"this tutorial explains how to install and configure maven and nexus. maven repository management server. using nexus for maven repository management is convenient but not required. once you've installed and configured maven and, optionally, nexus in your development environment, you'll be ready to install the liferay plugin artifacts which enable you to develop liferay plugins with you should be aware that one of our technical writers was recently reading edgar allen poe's the raven, and adapted some of his verses for our maven read all of the tutorials to follow the story of our fictional protagonist's cat, lenore ii, who was introduced in our introduction to maven straight i wheeled a cushioned seat in front of computer desk once more; then, upon the velvet falling, i betook to maven installing... you can download maven from url. maven installation's bin directory in your system's path facilitates running the maven executable mvn from your command prompt the following sections explain the types of repositories you can use with maven wouldn't it be nice to install and deploy your liferay artifacts to a maven lets you install your artifacts both to local and this means that you can share maven repositories privately with your team or with the public. your local repository holds your downloaded artifacts and the artifacts you install to it. sharing artifacts either privately e.g., within your development team or to learn more about using artifact repositories see maven also lets you configure a proxy server; it mediates your requests to public maven repositories and caches artifacts locally. proxyrepository helps you build projects faster and more reliably. this for two reasons accessing remote repositories is slower, and remote repositories are sometimes unavailable. most maven proxy servers can also host private repositories that hold only your private artifacts. in running your repository behind a proxy, see now that you've been introduced to maven repositories and proxy servers, you may want to consider using a repository management server to create and manage your you'll frequently want to share liferay artifacts and plugins with teammates, or manage your repositories using a gui. you might find sonatype nexus to be a valuable tool for managing your repositories. it's a maven repository management server that facilitates creating and managing release servers, snapshot servers, release servers hold software that has met the software provider's criteria for planned features and quality. software that is in a state of development. if you're not interested in using nexus as a repository management server, feel free to skip this section to create a maven repository using nexus, first download nexus from url and follow instructions at if you're using windows, you must start nexus from a command prompt with administrator privileges to create a repository using nexus, follow these steps open your web browser; navigate to your nexus repository server e.g., and log in. default username is admin with password admin123 click on repositories and navigate to add... hosted repository figure 2.20 adding a repository to hold your liferay artifacts is easy with nexus oss type of nexus repository, read sonatype's managing repositories at enter repository properties appropriate for the type of artifacts it will if you're installing release version artifacts into the repository, specify release as the repository policy. you just created a maven repository accessible from your nexus oss repository it's also useful to create a maven repository to hold snapshots of each liferay creating a snapshot repository is almost identical to the only difference is that you specify snapshot as its repository policy go to your nexus repository server in your web browser specify repository properties like the following you not only have a repository for your liferay releases i.e., liferay-releases , you also have a repository for your liferay plugin next, you can configure your new repository servers in your maven environment to enable you to install artifacts to them before using your repository servers andor any repository mirrors, you must specify them in your maven environment settings. maven to find the repository and get access to it for retrieving and installing note you only need to configure a repository server if you're installing downloaded liferay ceee artifacts from a zip file or if you want to share artifacts e.g., liferay artifacts andor your plugins with others. automatically installing liferay ce artifacts from the central repository and aren't interested in sharing artifacts, you don't need a repository server specified in your maven settings however, configuring a mirror in your maven settings is recommended as a best get more information on mirrors and their purpose in maven's guide on to configure your maven environment to access your liferay-releases repository navigate to your userhome.m2 directory. if it doesn't yet exist, create it provide settings for your repository servers. url file that has liferay-releases and liferay-snapshots note the username admin and password admin123 are the credentials of if you changed these credentials for your nexus server, make sure to update url with these changes now that your repositories are configured, they're ready to receive all the liferay maven artifacts you'll download and the liferay plugin artifacts you'll developing with the plugins sdk developing plugins with liferay ide";;
as a developer, you want your site to communicate your ideas clearly and you don't want the design of your site to inhibit users from this is where themes come into play. you to take creative control and tell the story you want to tell with your site. they give you control over the look and feel of your site, down to the tiniest as you approach the theme's design, keep in mind the target audience, the message you are trying to communicate, and the site's purpose. design helps answer these questions this learning path takes you through developing a theme for liferay's lunar resort using the freemarker template language. theme with css, how to make it responsive for mobile devices, how to leverage bootstrap's and font awesome's icons in your theme, and how to implement before you start, make sure you have a liferay development environment installed. you can learn how to install liferay ide or liferay developer studio in the you can use other tools for development, but liferay's development tools are the most natural to use, since they're designed for because you'll be deploying a lot of changes throughout this learning path, make sure you also have developer mode enabled in your portal. you can learn how to enable developer mode for your portal in the using developer mode with themes;;
in this portion of the learning path, you'll create the foundation for the lunar you'll learn the proper workflow and directory structure needed to finally, you'll modify the default url and url templates to match the lunar resort mock up a theme mock up serves as a guide for what the finished theme will look like figure 1 by the end of this learning path, you'll have developed this theme you'll need to go through each exercise and unzip them to a folder of your now you can go ahead and jump right into creating the theme project!;;
the rest of this learning path assumes you've followed the instructions for if you've done that, you're ready to begin! in the project wizard, enter lunar-resort-theme for the project name and lunar resort theme for the display name. leave the build type as ant and select the proper plugins sdk and matching liferay runtime select theme for the plugin type and click next leave the theme parent and theme framework as styled and freemarker figure 1 the project wizard makes it easy to build a theme note the first time you create a project, make sure you're online. background, liferay's plugins sdk downloads several necessary jar files. keeps the initial plugins sdk download small, but it may take several minutes to subsequent projects are created almost instantly you'll now see your project in the package explorer on the left. just done is create a blank liferay theme based off of liferay's styled rather than build a theme from scratch, it is best practice to use a liferay base theme as a starting point to ensure full compatibility. make to the theme override the default settings of the styled theme you can learn about the theme's anatomy next.;;
this was mentioned in the introduction to this step your theme's directory structure should reflect the one below when it is themes are based on differences from the themes they are based on. created the project, you selected the styled theme. code, therefore, exists in most of these folders. default styling for all elements of the page. as you write your theme, you'll define only the differences between what you want and what the underlying theme your edits should be made to the files in the diffs directory, which then transfer to the files in the parent directory. for this reason, the directory in the diffs folder must mirror the parent directory. match, the changes you make will not be applied. unaltered, you should only add the files you want to edit to the diffs as a best practice, all of your css styling should go in a url file because it is loaded last, all the styles placed in url override styles in the parent base theme. styles in one file, maintenance becomes an easier process now that you're familiar with the theme structure and development workflow, you can begin working on your theme right-click the diffs folder in the package explorer and select with the diffs folder selected, enter css for the folder name and repeat steps 1 and 2 to create the remaining images, and templates copy the url file from the docrootcss directory to your all the changes you make to the url file in your diffs directory get applied to the mirrored file copy the url to the diffscss copy url, url, and url from the docroottemplates directory to the diffstemplates directory you now have the starting point for your theme. housekeeping items to take care of before you move on to the next section open url and add the following variables to the top copy the url from the images directory of the code folder into the diffsimages directory of the theme finally, install the url file developed in the by copying it into your liferay bundle's deploy directory. if you haven't gone through the mvc learning path, you should check it out if you are interested in developing applications for liferay now that the housekeeping is finished, you can examine the html for;;
the url file is a template through which all the portlets on a look at the figure below to see what the finished html structure will look figure 1 the html is broken up into sections the html structure is broken up into three main sections banner, content, and the banner contains the logo for the site, its name, the page title, and the content holds the breadcrumbs for the site and finally, the footer holds the'powered-by liferay' and the three main sections are all contained within a wrapper that's used to adjust the width of the site now that you are familiar with the html structure, you can make some modifications to the theme templates next.;;
in this section, you'll add some touches to url and url to match the finished mock up for the lunar resort replace it with the following code your theme now has the modern dockbar that's in liferay's classic theme find the following code and remove it from url the default sign in link has been removed, but you'll replace it in the statement and the closing tag that wraps it the updated code now displays the dockbar whether you are logged in or not. if you're logged out, the dockbar is simplified, and shows a sign in link. this will come in handy later in the learning path when the theme is made insert the following code just above the closing tag for the content this adds a link to make a reservation for the lunar resort on every page, at the moment you only have the default welcome page so you may be scratching your head. the remaining pages later, using the resources importer. a reservation using the link, you'll be greeted with an error, but this is next, it's time to update your navigation open url and replace the contents with the following code the updated code is a duplicate of the old code with some additions. main change is the updated child menu classes child menu items are now additionally, a class called.active highlights the current you have the templates nicely wrapped up, so you can move on to deploying once your server is started, select the theme from the package explorer, drag it down, and drop it on top of the server to deploy your theme once your theme has been deployed, log in to the portal and goto admin make sure public pages is selected and scroll down to the available select the radio button for the lunar resort theme and click save before you look at it though, you need to take care of a few more housekeeping items select logo in the menu on the right and uncheck show site name click browse and select the url in the diffsimages directory of the lunar resort theme once you've received the success message, navigate back to the welcome you'll now see your new theme is in place. it should look similar to the figure figure 1 liferay's styled base theme is a good starting point the theme appears broken at the moment, but this is to be expected. sections that follow, you'll fix this. this shows you the starting point the you've successfully installed and applied your new theme! you'll learn how to import resources for your theme.;;
users expect to access portal content from their mobile devices. developer, you naturally want to turn these expectations into reality. thankfully, liferay provides a way for your mobile apps to access portal screens contains native components called screenlets that can call liferay portal's remote services and display the results in your app. comes complete with its own fully pluggable ui that you can customize to your although the screenlets included with screens only work with liferay portal's built-in remote services, you can write your own screenlets that work with your custom portlets' remote services if you're an experienced android developer but need a start-to-finish guide on how to integrate android apps with liferay portal, you're in the right place. this learning path walks you through the creation of an android app that interacts with the guestbook portlet developed in the since this is a custom portlet, you'll write your own screenlets that let your app retrieve and display guestbooks and their entries you should note that although this learning path provides complete code snippets of the app, not every aspect of android development is explained in detail. focus is instead placed on the code that leverages liferay screens. you must have significant android development experience before attempting otherwise, you'll likely be confused. extensive documentation of the android apis as well as some basic tutorials on experience in android development is all you need to start working. have completed the liferay mvc learning path to obtain a working guestbook the complete guestbook portlet's war package is provided for installation into your local liferay portal instance now that you know what you'll be doing here, it's time to move on to the first series of articles beginning android development for your portal. articles walk you through the steps required to get started developing an android app that interacts with liferay portal.;;
getting started with liferay screens for android is a straightforward process. this series of learning path articles walks you through creating an android app and preparing it to work with the guestbook portlet developed in the since liferay screens uses the liferay mobile sdk to make remote service calls, you'll build a mobile sdk capable of calling the guestbook portlet's remote services the guestbook mobile sdk. you'll then install this mobile sdk and screens into your android project. you'll also learn about the android app's design and implement authentication with this section of the learning path covers these topics when you finish, you'll be ready to start developing your first screenlet.;;
before you begin developing the guestbook app for android, you must set up the guestbook portlet in a liferay portal instance. to do this, follow these steps to get started, you must have jdk 8 installed. you can download and install the this page also has links to the jdk installation instructions first, download a liferay portal 6.2 tomcat bundle from and follow the instructions to install the bundle. should create a bundles folder and unzip it there. folder is referred to as liferay home and is named according to the version, edition, and specific liferay portal release. downloaded liferay portal 6.2 ce ga6 and unzipped it to a bundles folder on your machine, that bundle's liferay home folder path is now you're ready to start liferay portal! start the bundle as described in the if you're on mac or linux you should also run tail -f url immediately after the url command this ensures that the server log prints to the terminal. isn't necessary on windows because the server log automatically opens in another after a minute or two, liferay portal starts up and automatically takes you to on this page, you need to provide some basic information about how to set up enter a name for your instance, select the default language, and then uncheck the add sample data box. last name, and email address of the default administrative user. purposes of this learning path, these don't have to be real. connect liferay portal to a separate database such as mysql or postgresql, you can configure that connection here. note that although the default embedded database is fine for development on your local machine, it isn't optimized for click finish configuration when you're done. message appears, click go to my portal. then set a password and a password your liferay portal instance then next, you'll deploy the guestbook portlet to your liferay portal now that your portal is set up, you can deploy the guestbook portlet to it. download the guestbook portlet's.war package from and place it in the liferay homedeploy folder. in your console indicating that the guestbook portlet has been successfully on your portal's default site, click the icon on the left side of the screen and then click applications at the top of the menu that slides out. open the sample category and drag guestbook onto the page. portlet should now appear with the default main guestbook. in the portlet and an entry or two to each. android app, this ensures there's some content to display in it. portlet on your site should now look like this figure 1 the guestbook portlet, with a new guestbook and some entries you've successfully set up a liferay portal installation and added now you're ready to get started with the liferay;;
"once you've deployed the guestbook portlet, you're ready to build the guestbook you might be asking yourself, why do i have to build a separate can't i just use the pre-built mobile sdk that liferay already the reason is that liferay's pre-built mobile sdk doesn't have the classes it needs to call the guestbook portlet's remote the pre-built mobile sdk includes only the framework necessary to make server calls to the remote services of liferay portal's core apps. also referred to as out-of-the-box apps are those included with every since you're calling services of an app the default mobile sdk doesn't know about the guestbook portlet, you must build a mobile sdk that can call its services. now put on your hard hat, because it's time to liferay provides a mobile sdk builder that you can use to build your own mobile for the builder to generate the classes that can call a non-core app's remote services, those services must be available and accompanied by a web to learn how the guestbook portlet's remote services and wsdd were generated, see the article creating web services for your application. since the guestbook portlet's web services already exist, you don't need to just remember that you must generate web services when developing to build the guestbook mobile sdk, first download the mobile sdk builder by unzip the file to a location on your machine where you want the mobile sdk this location is purely personal preference; the builder works the same no matter where you put it. once unzipped, the mobile sdk builder is in the liferay-mobile-sdk-builder-6.2.0.18 folder now you're ready to build the guestbook mobile sdk. builder to generate a separate module for the guestbook portlet. contains a convenient command line wizard to assist you in this. navigate to the liferay-mobile-sdk-builder-6.2.0.18 directory and run the the wizard launches and asks you to enter your project's properties. first provide the context property. this is the context path of the remote services the builder will generate classes and methods for. liferay portal instance's remote service context paths, go to on the page's upper left, there's a menu for selecting the context path. guestbook-portlet, which is the guestbook portlet's context path. updates to show only the remote services available in the selected context path. return to the terminal and enter guestbook-portlet for the context property figure 1 the guestbook portlet's context path guestbook-portlet on the server next, the wizard needs the package name property. the classes the builder generates. the wizard then asks for the pom description technically, you only need this if you want to publish your mobile sdk since the builder requires it, however, enter guestbook sdk. following screenshot shows these properties entered in the wizard figure 2 to build your mobile sdk, you must enter values for the context, package name, and pom description properties. the blue values in square brackets are defaults once you enter the final property, the builder runs and generates a now that the builder contains a guestbook-portlet module, you must generate that module's remote services. navigate to the following folder then run the following command as before, the builder runs and generates a build successful message. you're probably wondering what just happened, though. source classes you'll use in your android app to interact with the guestbook you can find these source classes in the following folder in the also note that the source classes are in the package path you specified when generating the module, with an additional folder that denotes the liferay portal the full path to the generated source classes is this folder has two subfolders that correspond to each entity in the guestbook each subfolder contains that entity's source class, guestbookservice and entryservice, respectively there's one last thing to do before you can use these classes in your android to do this, make sure you're still in the modulesguestbook-portlet folder on the command line and run....gradlew jar. generates a jar file in modulesguestbook-portletbuildlibs that contains the guestbook portlet's service classes. generates a custom-built version of liferay's pre-built mobile sdk in you just built the guestbook mobile sdk. accomplishment worth writing in a guestbook. all you need now is an android app in which to install this mobile sdk. the next article shows you how to create";;
now that you've built the guestbook mobile sdk, you're ready to create the this article walks you through the steps required to create the app's project in android studio. install the guestbook mobile sdk and liferay screens. make sure you've installed android's development tools this learning path uses android studioandroid's official ideto develop the as an android developer, you're likely very familiar with android if you need help setting up and using android studio, see the following topics in android studio's documentation once android studio is up and running, you're ready to create the guestbook app! when you start android studio, it presents a welcome screen containing a quick click start a new android studio project in this menu. launches the create new project wizard, which asks you to enter the app name, company domain, and project location. enter liferay guestbook as the app name and url as the company domain. android studio uses these values to autofill your app's package name and project location. name url, and choose a project location that's figure 1 the first screen of android studio's create new project wizard asks you to enter your app's name and company domain the next screen asks you to specify your app's supported form factors and make sure that only the phone and tablet checkbox is in the minimum sdk menu, select api 15 android 4.0.3 android studio gives you an estimate of the percentage of devices active on the google play store that can run the selected api level. can view a graphical representation of these estimates by clicking the help me choose link in the text below the minimum sdk menu. figure 2 the second screen of android studio's create new project wizard lets you select your app's form factors and minimum android api level you must now specify your app's first activity. activity to authenticate users to your liferay portal instance, don't select login screenlet contains everything your users need to authenticate to a liferay portal instance, including the ui. figure 3 the third screen of android studio's create new project wizard lets you specify an activity for your app the final screen of the new project wizard asks you to enter the activity's name and the name of its layout file. accept the defaults and click finish figure 4 in the final screen of android studio's create new project wizard, accept the default values for the activity and layout name a progress indicator appears that indicates your project is building. studio then opens the project with the activity's class and layout ready to the project's structure appears on the left side of the screen figure 5 android studio shows your project's structure you successfully created the guestbook app's project. to put the guestbook mobile sdk and liferay screens to work!;;
for your android app to interact with the guestbook portlet, you must install the following libraries in your android project liferay's pre-built mobile sdk this mobile sdk contains the classes that call liferay portal's core remote services. necessary for any mobile sdk to make server calls the guestbook mobile sdk this mobile sdk contains only the classes that call the guestbook portlet's remote services liferay screens screens contains the screenlet framework and because these built-in screenlets interact with liferay portal's core apps, they make their server calls with liferay's pre-built note that all screenlets, including those that make server calls with a custom-built mobile sdk, must use the framework in liferay's pre-built mobile sdk to issue their calls since liferay's pre-built mobile sdk is a dependency of liferay screens, installing screens automatically installs this mobile sdk. install the guestbook mobile sdk manually this article walks you through the installation of the guestbook mobile sdk and when you finish, you'll be ready to start developing the app the mobile sdk builder generated two separate jar files in your the first jar file is the guestbook mobile sdk. the second jar file is a custom built version of liferay's pre-built mobile sdk. pre-built mobile sdk, you don't need to install the second jar file. however, install the first jar file. folder the default location for your android app is to install liferay screens, you must edit your app's url file. that your project has two url files one for the project, and another you can find them under gradle scripts in your android this screenshot highlights the app module's url file figure 1 the app module's url file in the app module's url file, add the following lines of code inside this adds the liferay-screens and liferay-material-viewset dependencies. although only the liferay-screens dependency is necessary to install screens, adding other view sets, like the material view set, gives you flexibility when designing your app's look and feel. for more information on views in liferay screens once you edit url, a message appears at the top of the file that asks you to sync your app with its gradle files. syncing with the gradle files is required to incorporate any changes you make to them. installs any new dependencies, like those you just added. now by clicking the sync now link in the message note that after syncing, your url may show an error similar to this if this occurs, you must manually add the correct version of the for example, the app in this learning path currently uses version 25.3.1 of the url libraries. requires that you manually add the following dependencies to the app's after adding these inside the dependencies element, click sync now again. the error message should be gone once the sync completes figure 2 after editing the app module's url file, click sync now to incorporate the changes in your app now you're ready to test your screens and mobile sdk installations to check your screens and mobile sdk installations, first open your project's mainactivity class in android studio. then add the following imports to if android studio recognizes these imports, then you're good to go! once you've verified that they're valid. next, there's one final small but important task to complete point your app at the correct liferay portal for screens to work properly with your app, you must point it to your liferay you do this by adding a url file in your create this file and add the following code as the comment indicates, change the values to match those of your liferay the server address is suitable for testing with android studio's emulator, because it corresponds to localhost8080 through the emulator. the liferay portal instance you set up earlier should be running on localhost8080 the liferaycompanyid value is your liferay portal instance's id. find it in the control panel configuration portal instances your portal instance's id is in the instance id column. this value from your portal to the liferaycompanyid value in the liferaygroupid value is the id of the site your app needs to communicate since the app needs to communicate with the guestbook portlet, navigate to the site you put the guestbook portlet on. admin site administration configuration from the dockbar. the site id is listed on the site settings tab. from your portal to the liferaygroupid value in url next, you'll learn the app's basic design.;;
a popular way to develop liferay applications is to use the if you're a battle-tested developer, you're likely familiar with to make things simpler, liferay has developed its own mvc framework. might now be thinking, simpler? how does yet another mvc implementation make i'm tired of redundant frameworks! however, provides many time-saving benefits that streamline liferay development. unlike many java mvc implementations, it's a lightweight framework. hides part of the complexity of portlets and makes common operations easier. what's more, liferay's own developers use it to develop portlets. there are many robust examples to reference when you need to design or liferay also provides tooling that makes creating liferay mvc applications a snap. you'll quickly find that learning and using liferay mvc saves you time over trying to implement your application with here, you'll use liferay mvc to develop a liferay portlet from start to finish. this includes installing liferay's development tools, generating your persistence layer, integrating with liferay features like search and indexing, generating remote services, and much more.;;
if you're just getting started with liferay development, liferay's learning we start at the beginning installing a liferay development though you can use anything from a text editor and the command line to any java ide that's out there, liferay provides two development tools that make it easier to write code on liferay's platform liferay ide and liferay developer studio are nearly identical development environments designed for creating liferay projects. if you're a liferay enterprise edition subscriber or interested in liferay's premier development environment, begin with developing applications with liferay developer studio if you want to use liferay's free development environment or want to leverage it on top of an existing eclipse installation, skip over to developing applications with liferay ide note to follow liferay's learning paths, you must have a liferay portal 6.2 you must also have the java 7 jdk installed.;;
to develop an application, you need a developer environment. great environment with liferay developer studio let's get your liferay development environment installed download and install the java 7 jdk. on java, so you need to install it before everything else installing it is easy unzip it to a convenient location on your system launch developer studio by running the developerstudio executable the first start wizard appears next. this leads you through the process of getting your liferay portal runtime installed. with the defaults leave configure liferay portal ee bundled with the studio installation checked and click next browse to select your activation key provided by liferay and click next though liferay portal ships with an embedded database, as a developer, you'll want to use a database you can query with your own tools. reason, the next page lets you connect the liferay runtime to any database create the database in your dbms of choice before completing note that after the wizard completes, you may need to copy your database's jdbc driver into the libext folder of the liferay bundle that figure 1 the first start wizard makes it easy to configure the runtime that ships with liferay developer studio next, you can connect studio to liferay's javadocs and source, for code browse to the javadocs or paste in the url to where they're stored online pictured. downloaded.zip of the source code or a version checked out from a code figure 2 pointing studio to the javadocs and liferay source can help with debugging your code after this, the wizard completes, and you have a fully configured development environment, ready to begin work! if you don't have a liferay enterprise edition activation key or if you want to use an existing installation of eclipse, continue with the next tutorial on developing apps with liferay ide. writing your first liferay application.;;
to develop an application, you need a development environment. a great environment with liferay ide liferay ide is a plugin for eclipse that brings many liferay-specific features you can install it into your existing eclipse environment, or liferay provides a bundled version you'll need it to run everything else. because you'll be developing apps for liferay portal in liferay ide, the java development kit jdk is required. is an enhanced version of the java environment, used for developing new java you can download the java se jdk from the java installing it is easy unzip it to a convenient location on your system if you already have an eclipse environment that you're using for other things, it's easy to add liferay ide to your existing eclipse installation copy the url to the update site you're interested in stable or figure 1 liferay provides two update sites stable for those who want a well-tested environment, and milestone for those who like the bleeding edge go back to eclipse and click the add button to add a repository type liferay ide into the name field and paste the url into the location you'll see the liferay ide components in the list below. accept the terms of the agreements and click next, and liferay ide is like other eclipse plugins you'll have to restart eclipse to to install liferay ide into eclipse from a.zip file, follow these steps under other downloads, select the liferay ide version update archive site option and click download in eclipse, go to help install new software... in the add site dialog, click the archive button and browse to the location of the downloaded liferay ide.zip file liferay ide needs a liferay portal runtime on which to run and debug code. under the hood, it also works with liferay's plugins sdk, a barebones, command line driven development environment you can use with any ide or text because of this, your next task is to get both of these installed you'll use in your development environment to run your applications. just as easy as installing liferay ide unzip it to your system. creating a bundles folder and unzipping it there liferay's plugins sdk is a basic, command-line driven development environment that the ide uses behind the scenes to manage your liferay projects. just as easy as installing everything else unzip it to your system. recommend unzipping it next to the bundles folder you created in the last figure 2 the directory structure for liferay development is pretty simple when you've finished installing everything, you should have a folder structure next, you need to get all these components talking to each use window open perspective liferay to switch to the the tab on the low left corner is labeled servers. figure 3 the servers tab has no servers by default in the dialog that appears, select the server that matches the runtime you figure 4 select the liferay server runtime you downloaded browse to the tomcat folder inside the runtime and click finish select the runtime and click the green play button. liferay starts up inside your ide. by the way, you could've clicked the bug button, and that would have started liferay in debug mode when liferay starts, your console window should show info server startup in xxx ms. shows liferay portal's setup wizard. if you want to connect liferay to a separate database such as mysql, postgresql, or similar, you can configure it if you want to start quickly, the embedded database is fine for your local machine but it's not optimized for production, so don't use it there. sure you uncheck the add sample data box, and then click finish you then get to set up the administrative password. password liferay does nicely, answer the security question, and you're done next, you need to register your plugins sdk browse to the folder where you unzipped the plugins sdk and you've now registered your plugins sdk, and you are ready to begin developing liferay applications!;;
"getting started with your first liferay application takes only minutes. guide you through the step-by-step process of creating your project and deploying your application to liferay. before you know it, you'll have your application deployed alongside of the applications that come with liferay your first application is simple you'll build a guestbook application that figure 1 you'll create this simple application by default, it shows guestbook messages that various users have left on your to add a message, you click the add entry button to show a form you can use to enter and save a message ready to write your first liferay application now that everything's configured, let's jump right in and create your first applications in liferay portal are called portlets, so you'll create a figure 2 liferay idedeveloper studio's new project wizard makes it easy to create liferay projects fill in the project name and the display name. guestbook-portlet and the display name guestbook check launch new portlet wizard after project is created note the first time you create a project, in the background, liferay's plugins sdk downloads several jar files that it needs in order to operate. plugins sdk download small but means that it may take several minutes to create subsequent projects are created almost instantly your project now appears in the package explorer on the left. done is create a blank liferay project. projects can have any number of applications called portlets in them. your next step is to create the portlet, which the new portlet wizard helps you to do figure 3 the new portlet wizard can be used at any time to create portlets in projects for the portlet class, enter the name guestbookportlet all classes in java should be properly namespaced to avoid conflicts with other classes that could have similar names. liferay idedeveloper studio creates the portlet class in the proper package in the src folder and creates a new folder structure for your application's jsp it then opens your portlet class in an editor when you access a web site, you interact with an application. may be simple it may only show you information, such as an article. application may be complex you may be doing your taxes online, inputting lots of data into an application that calculates whether you owe or are due a refund. these applications run on a platform that provides application developers the building blocks they need to make applications figure 4 many liferay applications can run at the same time on the same page liferay portal is a platform, and its applications are called portlets. difference between a liferay application and an application built on another platform is that liferay portal can serve many applications at the same time on usually, a web application takes up the entire page, and if you want, you can do this with liferay as well. but liferay has the added benefit of being able to run many applications on the same page. find that the framework takes this into account at every step. up front, because you'll be experiencing this soon, and we want you to know why certain things, like platform-generated urls, are necessary with all of that said, the next thing to do is to jump in and create your a guestbook application is pretty simple, right? their names and a brief message, and then post it for you. entries that others posted, and they can post entries themselves the first thing, therefore, that we need is a landing page that displays entries and that has a button on it that allows users to add an entry. created when you created your project you'll find it in the docroothtmlguestbook folder of your project. you'll see there's some content in it already liferay ide generates a fully functional sample portlet, but the only thing it does is display the message you let's give it some functionality by adding a button open the snippets tab on the right side of liferay ide, and expand the drag the snippet labeled liferay aui taglib import v6.1 from the snippet area to the line beneath the existing taglib import in url. about the liferay version number in the snippet title the import was changed for version 6.1, and it is valid for liferay versions going forward. following code gets added to url this declares that we want to use liferay's alloyui tags next, remove the default message in the jsp open the liferay aui taglib snippet category and drag the snippet labeled button-row onto the bottom of the page. a dialog box pops up asking for the type guestbook-buttons for this value, hit enter, and figure 5 inserting snippets is easy using the dialog, or you can do it in the code manually you're almost ready to add the button inside the button row, but as hinted above, we should talk about system generated urls, because you need a url to map to since portlets are designed to be placed on pages by the end user, and end users can place multiple portlets on a page, and you as the developer have no idea what other portlets will share a page with yours, guess what? urls for various functions in your application like you may be used to. say you've written a calendar application that a user has placed on the same the calendar allows the user to add and delete the blog allows the user to add and delete blog entries. the functionality for deleting, both application developers elected to append the del parameter to the url, and give it a primary key value so the application can go look up the calendar event or the blog entry and delete it since both applications read this parameter, when a user uses the delete function in either one of them, both applications attempt to delete either a calendar event or a blog entry that matches the given id. applications are clashing because they use the same url parameter. generated urls are designed to prevent this from happening. make space inside the tag; you'll place the url tag there from the portlet taglib snippet category, drag the renderurl tag to the space you just made inside the tag. asking you to enter values for various tag attributes the only attribute you need at the moment is the var attribute. attribute, enter the value addentryurl. you're creating a variable to hold the make space inside the tag so that you can add another drag the param tag into the tag. asking you to enter values for two tag attributes by hitting finish instead of next when you created this portlet, you indicated you accepted the default portlet framework, which is liferay's mvc to navigate to another page in your portlet application, you use the parameter mvcpath to indicate a link to that page. renderurl that links to another jsp in your application, and you can now use a button your users can click or any other html construct that accepts a link creating a button is as easy as creating the url was. snippet for the button to the proper location in your page, just like you did inside the tag but outside the tag, drag and drop the button snippet from the liferay aui taglib category. dialog box pops up asking you to enter values for various tag attributes for the onclick attribute, enter the text. this code supplies the string value of the url object you created with the see how we used the var attribute in that tag so we would have a variable for the url? this is so you could refer to it here for the value attribute, enter add entry as the text. at this point, you should have code that looks like this save your work using the button in the toolbar or by hitting ctrl-s. good time to check your work to see if everything you've done so far is working as the image below describes, drag your project from the package explorer and drop it on your server runtime figure 6 deploying projects is a drag and drop process once your application deploys, go to a liferay page and click the add button choose applications and from the sample category, drag your guestbook application onto the page and drop it there. pretty sparse at this point, but here's what you have so far figure 7 your button doesn't go anywhere--yet don't click the button remember that you haven't created the page the all you'll get is an error if you do. psychology says that you've clicked it already. next, you'll create the page that url points to so the app doesn't break when you click that button in the same folder your url is in, create the url navigate to docroothtmlguestbook and right-click on the folder. name the file url and click finish the file is opened in a new editor tab. url and paste them into this file. libraries again because you'll use the portlet tags to create urls and the alloy you'll create two urls one to submit the form and one to go back to the previous there will be a difference between the two, however, which as you did before, drag the renderurl snippet from the portlet taglib snippet category onto your jsp. for the var attribute, supply viewurl as you did before, drag the param snippet from the portlet taglib snippet category inside the portletrenderurl tag. mvcpath and the value attribute url next, you need to create a new url for submitting the form. as has been stated already, portlets are designed to run in a portion of a page because of this, they have two phases of operation. the first phase is the one you've already used it's called the render phase. all this means is that the portlet draws itself, using the jsps you write for the other phase is called the action phase. this phase runs once, when a user the portlet performs whatever action the user triggered, such as performing a search or adding a record to a database, and then based on what happened in the action, it goes back to the render phase and re-renders itself according to its new state after the action to save a guestbook entry, you'll have to trigger a portlet action. from the portlet taglib snippet category, drag the actionurl snippet to in the dialog box, supply addentry for the name attribute and addentryurl you now have the two urls you need for your form your guestbook form is pretty simple. all you need are two fields one for the name of the person submitting the entry and one for the entry itself from the liferay aui taglib snippet category, drag the form snippet to for the action attribute, supply, which is the action for the name attribute, give your form the name fm. the tag inserts a unique runtime value this ensures that the form name in this portlet does not clash with a form name in another portlet that may be on the page provide some space between your tags so you can add fields to drag the fieldset snippet inside your tags. attribute, type name, as this is the name field on the form drag another input snippet below the last one, inside your for the name attribute, type message, as this field holds the message below the closing tag, drag the button-row snippet and inside the tags, drag a button snippet. beneath the submit button you just created, drag another button snippet. for the type attribute, enter cancel. for the onclick attribute, enter. this supplies the render url you created that goes back to the save your jsp; it should look like this when you save the jsp, liferay ide re-deploys your application, and if you refresh the page and click the add entry button, your form appears. click the cancel button, it works! don't click the save button yet, though you haven't created the action that saves a guestbook entry, so it'll implementing the action is your next task when users submit the form, your application needs to store the form data so it can be displayed in the guestbook. to keep this first application simple, you'll implement this using a part of the portlet api called portlet preferences. normally, of course, you'd use a database, and liferay makes it very easy to work with databases using its service builder framework. can create the first iteration of your guestbook application using portlet to make your portlet do anything other than re-render itself, you must implement an action defines some processing, usually based on user input, that the portlet must do before it renders itself. portlet, the action you need to implement saves a guestbook entry that a user typed into the form, so it can be retrieved and displayed later since you're using liferay's mvc portlet framework, you have an easy way to implement actions in the portlet class, which acts as the controller. form you just created, you make an action url, and you called it addentry. create a portlet action, you create a method in the portlet class with the same name, and mvcportlet calls that method when a user triggers its matching url liferay ide generated this class when you create a method with the following signature hover your mouse over actionrequest and add the import. you've now created a portlet action. it doesn't do anything, but at least you won't get an error now if you submit your form. next, you should make the action because of the limitations of the portlet preferences api, you need to store each guestbook entry as a string in a string array. in your form, you need to have a delimiter so you can determine where the user name ends and the guestbook entry begins. the caret symbol makes a good delimiter because users are highly unlikely to use that symbol in a guestbook note clearly, portlet preferences and string delimiters are not the best way to implement this. implementation for saving data, follow the writing a data-driven application the following method implements adding a guestbook entry to a portlet preference first, the preferences are retrieved, and then the guestbook-entries preference is retrieved and converted to an arraylist so that you can add an entry reliably without going outside the bounds of the array. fields from your form are retrieved. note that liferay's paramutil class makes finally, the fields are combined into a string delimited by a caret, and the new entry is added to the arraylist, which is then converted back to an array so it can be stored as a preference. the trycatch blocks are required by the this is not the normal way to use portlet preferences, but it provides a quick and easy way for you to store guestbook entries in this first version of your you'd also want to do proper logging in case of an error, rather these are things that can be corrected later the next and final feature to implement is a way to view guestbook entries to view guestbook entries, you have to do the reverse of what you did to store them retrieve them from portlet preferences, loop through them, and present the best way to do this with the mvc portlet is to use the you already have the view your jsp files and your controller your portlet class now you need your model create a new package in your app called url. you can do this by right-clicking on the source folder and selecting new package, and then supplying the package name to the dialog box that this is a simple javabean that contains a right-click on your new package and select new give your class the name entry and click finish you now have a java class for your guestbook entries, and your next task is to give it the fields you need to store entries create two private string variables name and message right-click on a blank area of the editor and select source next, provide two constructors one that initializes the class with no values for the two fields, and one that takes the two fields as parameters and sets your completed class should look like this now that you have your model, you have an easy way of encapsulating guestbook entries so that they can be processed by the controller layer and displayed by your next step is to enhance the controller your portlet class so that guestbook entries are processed and ready to display when users see the as stated before, portlet applications at their most basic have two phases to make the guestbook show the saved guestbook entries when users view the application, you need to customize your portlet's render functionality, which it's currently inheriting from its parent class, open url and place the following method below your this method retrieves the array of guestbook entries from portlet preferences, converts it to a list of entry objects, and places that it then calls the parent class's render beneath the render method, place the following method that does the conversion of the array to a list of your model objects as you can see, this method splits the entries in the string array into two parts based on the caret character now that you have your controller preparing your data for display, your next step is to implement the view, so users can see guestbook entries liferay's development framework makes it easy to loop through data and display you'll use a component called the search container open the snippets tab on the right side of liferay ide and expand the drag the snippet labeled liferay ui taglib import from the snippet area to the line beneath the existing taglib imports in url. this declares that you want to use liferay's ui tags this makes your list of entry objects available to the page from the liferay ui search container snippet category, drag the model search container snippet and drop it above the in the dialog that pops up, click the browse button and then type entry liferay ide shows every instance of an entry class on choose the one you created in the your model class is parsed automatically, and now you can choose the property columns you wish to display to the user. the generated variable is aentry. if you want something more grammatically correct, change it to entry, and then click finish the tag snippet assumes that you're using liferay's persistence framework, because you're not using that, you'll have to fix one of modify the tag so that it uses your your url should look like this save your work, deploy your application, and try adding some at this point, the next learning path on writing a data-driven application may here are more tutorials that you may find interesting developing plugins with the plugins sdk";;
if you're just getting started with liferay faces development, you've come to this learning path starts with creating a jsf portlet and drives down the path of useful jsf features, exploring how each feature is implemented in a liferay portlet. you'll begin by creating your own jsf portlet from scratch, deploying it, and developing it into a guestbook portlet before beginning, make sure you have a liferay development environment you can learn how to install liferay ide or liferay developer studio in the beginning liferay development though you can use the command line or any java ide that's available, liferay provides these development tools, which make it much easier to write code on liferay's platform. you'll use it throughout the development process for the jsf guestbook portlet besides developing a jsf application from scratch, you'll learn about the liferay faces initiative and liferay faces sub-projects like liferay faces alloy, liferay faces bridge, and liferay faces portal. how easy and useful liferay faces makes deploying plugins to liferay portal.;;
getting started with a jsf application for liferay is very easy. path guides you step-by-step through creating and developing a jsf application. in particular, you'll develop a guestbook application which users can use to add when you're finished, the final guestbook application will figure 1 the jsf guestbook can store and display entries for many different guestbooks you may be wondering how and why jsf is so easy to deploy to liferay. liferay supports jsf applications with the use of which is an umbrella project that provides support for the jsf standard jsf portlets use liferay faces bridge, which supports deploying jsf web applications as portlets on any jsr 286 portlet 2.0 compliant portlet container, like liferay portal 5.2, 6.0, 6.1, and 6.2. the bridge later on, but you won't have to worry about it when creating your jsf application, since it's configured behind the scenes ready to begin creating a jsf application for liferay portal?;;
before you begin developing a jsf application, you'll need to install a liferay although it's possible to use anything from a text editor and command line to any java ide available, liferay provides two nearly identical development tools that provide a much easier developer experience and aids in writing code on liferay's platform liferay ide is liferay's free development environment that is based on eclipse, in fact, liferay ide is a plugin for eclipse that brings many liferay-specific features to the table. need installation instructions, visit the developing applications with liferay ide furthermore, liferay developer studio is available for liferay enterprise edition subscribers, or those interested in liferay's premier development for installation instruction for liferay developer studio, visit developing applications with liferay developer studio note to follow the jsf learning path, you must have a liferay portal 6.2 instance and java 7 jdk installed now that your development environment is installed, you can begin creating a;;
since you're configured with liferay idedeveloper studio, you can jump right in applications in liferay portal are called created a jsf project in your workspace, you'll receive a message stating that there are no suitable liferay plugin projects available for a liferay select yes to open a new liferay plugin project wizard to create the jsf plugin project, first. the new plugin project wizard appears figure 1 liferay idedeveloper studio's new plugin project wizard makes it very easy to create a portlet project fill in the project name and display name as guestbook-jsf-portlet and leave the use default location checkbox checked. location is set to your current plugins sdk. liferay-plugins-sdk option for your build type, and the appropriate plugins sdk and liferay runtime. you also have the option of choosing the maven build type, which is also popular with jsf portlets. how to build plugins using maven if you'd like to use maven to build your guestbook portlet and continue following along in this learning path, visit the developing liferay faces portlets with maven tutorial to update yourself on the key differences between using the plugins select portlet for the plugin type make sure the include sample code checkbox is checked and the launch new portlet wizard after project is created checkbox is not checked if since you'll be using the jsf portlet framework, select the jsf 2.x radio the next screen in the wizard offers available jsf ui component suites. can read each ui component suite's summary and learn what each can do for for the guestbook portlet, you'll use the liferay faces alloy ui component suite, so select that radio option and click finish figure 2 the list of component suites includes the jsf standard suite, icefaces, liferay faces alloy, primefaces, and richfaces your project can now be found in the package explorer on the left side of your you've just created a blank jsf liferay project. your next step is to create the portlet that will you'll do this in the new liferay jsf portlet wizard that is launched after the project is created specify the portlet class as url.genericfacesportlet if enter guestbook-jsf for the portlet name. the following fields are edited uncheck the create view files checkbox. you'll create your own view files you just created a jsf portlet! you may have noticed that you specified the class when setting up your jsf portlet. this class handles invocations to your jsf portlet and makes the portlet relying on the liferay faces bridge easier to develop by acting as a turnkey implementation. so where is the bridge in our new guestbook portlet in your package explorer, navigate to the ivy library and you'll discover there are a list of jars that are related to jsf, including the bridge jars figure 3 ivy downloads the required jars for your jsf portlet, depending on the jsf ui component suite you selected when using a plugins sdk to build a liferay portlet, ivy is used to download dependencies needed for your intended project. when creating a jsf portlet, the bridge jars are automatically downloaded into the portlet project, along with several other this is done behind the scenes so you never have to worry about it, but nonetheless, they are there. other important jars that are part of the the current jsf portlet is very bare bones and needs some further development so just for kicks, deploy the jsf portlet to your liferay portal instance to see what it looks like to deploy this portlet, simply drag the project from the package explorer onto figure 4 drag and drop your project onto the liferay server to deploy it note notice in your console that there are many debug messages. default, your portlet has been configured to print everything in your console in if you'd like to not run your portlet in debug mode, navigate to your portlet's url file and remove the following throughout this learning path, debug mode will be kept on you can now view the bare bones jsf guestbook by clicking the add button plus sign and choosing applications. then from the sample category, drag the jsf the portlet display a simple message, which comes by default when creating a liferay portlet through idedeveloper studio figure 5 the jsf guestbook only displays a default message--for now note liferay faces has a specific versioning scheme it follows to keep releases concise and separate from other releases. also makes it easier to differentiate between a liferay faces version's compatibility with other platforms. understanding the liferay faces version scheme you've successfully created a simple jsf guestbook. you'll transform this simple application into a data-driven jsf application.;;
a common way to store data in an application is to use a database. learning path, you'll learn how to turn the guestbook into a database-driven before you begin developing the guestbook's buttons and actions, you'll generate the persistence framework using service builder. create a persistence layer and service layer that are responsible for retrieving;;
"if you've read the mvc learning path, it goes specifically through creating a persistence framework for the mvc version of the guestbook portlet; but could you follow the same steps for a jsf portlet? the functionality of the persistence framework for a jsf portlet works exactly the same as an mvc portlet, meaning you can create the persistence layer the exact same way you would with an mvc portlet using service builder for your jsf portlet, you can complete the using service builder to generate a persistence framework learning path to successfully generate your persistence framework. finished generating your persistence layer, return back to this point and continue on to the next section to learn how to integrate the persistence";;
welcome to liferay's tutorials and learning paths! powerful, robust apps using liferay's tools, frameworks, and apis. sections here are learning paths. learning paths walk you through the development of a specific example application from start to finish, beginning with setting up your development environment and ending with a fully functional they're called learning paths because they're designed to be followed from beginning to end and cover multiple topics along the way. learning paths are thus ideal for getting started with liferay development. currently, the following learning paths are available the sections that follow the learning paths are tutorials. the multiple topics a learning path requires to produce a specific example application, tutorials go more in depth on individual topics, and don't yield a although tutorials also contain example code, this code is general and is designed to give you the information you need on only the you can then apply this to your own custom liferay this makes tutorials better suited to those with some experience the tutorials cover the following three main areas first, consider the tools liferay provides to make your job easier since many developers coming to liferay already have a set of tools they use, these tutorials assume you're using one of three common environments 1 an ant-based command-line environment that integrates with a wide variety of tools, 2 the easy-to-use liferay ide that minimizes your learning curve while giving you powerful development features, and 3 maven, a widely adopted project the liferay developer network provides learning paths and tutorials that teach you how to use these three environments if you don't like eclipse which liferay ide is based on and prefer to use netbeans, intellij idea, or something else, you certainly can. be written in any way java code is written here are some links to instructions on liferay development tools developing with the plugins sdk as a developer wanting to run your own applications on top of liferay portal, you probably want to know what's the best and quickest way to do it? supports two main, standards-based technologies for incorporating your applications into liferay portlets and opensocial gadgets. be written using any of the java web frameworks that support portlet development, including liferay's mvc portlet framework and javaservertm as you write apps, you'll want to leverage powerful frameworks that work seamlessly with liferay and help you complete your app faster. several frameworks that give you all the tools you need to perform various common tasks that you don't want to write yourself, such as handling permissions and letting users enter comments, categories, and tags in addition to liferay's frameworks, you'll want to check out the powerful tag libraries and snazzy ui components that start learning to develop apps for liferay what if you want to skin liferay or customize it? customizations is easy in liferay here are some good tutorials to start with now that you know what the articles here offer, it's time to discover new things as you develop sites in liferay.;;
the web services for remote portlets wsrp specification defines a web service interface for accessing and interacting with presentation-oriented web services what are presentation-oriented web services? web services that send user interfaces over the wire, rather than raw data like json objects or soap data envelopes. if an application is written as a portlet, this is an easy way to expose that application to end users on a completely different system, rather than sending just the data and having to craft an application to present that data. wsrp's presentation-oriented web services allow portals to display remote portlets inside their pages, as if locally deployed, without requiring any additional programming by developers here are the two main components for wsrp producer a web service that exposes one or more portlets and is described using a web services description language wsdl document consumer a web service client that receives the data from the producer and presents it to the user in a portlet window warning the wsrp portlet is not recommended for using on the internet because encryption is not supported between the producer and consumer below, you'll see how the components interact with each other. further ado, let's explore wsrp in liferay! liferay provides a deployable wsrp portlet that supports the 1.0 and 2.0 the portlet is available from liferay marketplace as a ce or ee once you've downloaded and installed the wsrp app, you have instant access to the portlet by navigating to the control panel and, under apps, selecting liferay portal can be used as a wsrp producer or consumer. hosts portlets that are consumed by other portal servers liferay or non-liferay acting as wsrp consumers. the image below illustrates wsrp producers and consumers and how they interact figure 2.18 portlets can interact with other portlets located on a different portal server using wsrp as we mentioned in the previous chapter, there are two main components of the wsrp process producers and consumers. let's go through the basic process of how producers and consumers work together to bring the end user a remote portlet. first, the consumer portal server establishes a connection with its producer this connection is made possible by giving the consumer the producer portlet's url. the consumer then uses the url to discover the producer's portlet and establish a connection. is made, the consumer acquires the producer's information and creates a consumer the proxy portlet acts as an intermediary, relaying requests to and from the end user and the producer portlet for example, you can compare the proxy portlet to a tv satellite box. want to change the channel on your tv, you end user send the channel number you desire to the tv's satellite box consumer's proxy portlet via your tv's when the satellite box receives the request to change the channel, it relays the request to a tv satellite producer's portlet which then sends the channel information back to the satellite box. then, the satellite box displays the new channel to you on your tv. in this simple example, you're not directly requesting the tv satellite to change the channel, but rather, you're communicating with the satellite box, which acts as an intermediary between you this example directly relates to using wsrp with liferay. although the end users are sending requests to the consumer portlet, they're not receiving feedback from the consumer portlet itself, but rather its producer now that you know a little bit about the wsrp process, let's begin configuring for this demonstration, we'll assume you have two portal tip if you're following along with this example and don't have an additional portal server, you can download another instance of liferay portal and have it running at the same time as your current liferay instance to simulate an additional portal server. cases have wsrp producers and consumers linked on differing portal servers. run two portal instances locally at the same time, you'll need to change one of your portal's server configurations. navigate to one of your portal's tomcat-version url and change the port designations to different values e.g., change 8080 to 18080 . new port number for your browser launcher url by adding to create a producer, go to the producers tab and click add producer. your producer a name and choose the appropriate version of wsrp to use. displays a list of available portlets your producer can use. purposes, select the hello world portlet and click the save button. generates a wsdl document to define your producer. figure 2.19 you can view the wsdl document for your producer by clicking the provided url now that we've created a producer, let's create a consumer on your second portal on your consumer portal server, navigate to the consumers tab and select the give it a name and add the producer's wsdl url in the there are also additional fields forward cookies allows the wsrp consumer to forward specific cookies from the user's browser session to the wsrp producer forward headers allows the wsrp consumer to forward specific http headers from the user's browser session to the wsrp producer markup character sets markup character encodings supported for the consumer are shown in a comma delimited list. utf-8 is assumed and will be added automatically as a supported encoding leave these additional fields blank for our demonstration. define the portlets that the end-user can use from this consumer. to actions manage portlets for your consumer. that you've configured for your producer portal server. hello world remote portlet and give the new portlet an arbitrary name. users can consume or use the remote portlet just like any local portlet in the next, you'll learn how to create custom remote portlets with the demand for dynamic portlets by end users, sometimes a finite, pre-selected list of remote portlets isn't enough. allows you to make custom developed portlets remotely accessible for wsrp to enable your custom portlet for wsrp, you'll need to add the after editing your portlet's url file, your custom portlet will appear in the list of portlets available when creating a wsrp producer. now you can share all your portlets to end users using wsrp! next, we'll learn how to remotely access liferay services.;;
"liferay includes a utility called the service builder which is used to generate all of the low level code for accessing resources from the portal this utility is further explained in the liferay developer guide and in liferay in action, but it is mentioned here because of its feature which generates interfaces not only for java code, but also for web services and javascript. this means that the method calls for storing and retrieving portal objects are all the same, and are generated in the figure 2.20 liferay soa's first layer of security is its properties files because the actual method calls for retrieving data are the same regardless of how one gets access to those methods i.e., locally or through web services, liferay provides a consistent interface for accessing portal data that few other the actual interfaces for the various services are covered in the liferay developer guide and used, administrators need to enable users to access these services remotely in the default url file, there is a section called main this section defines the security settings for all of the remote copy this section and paste it into your custom then you can edit the default values to configure the security settings for the axis servlet, the liferay tunnel servlet, the spring remoting servlet, the json tunnel servlet, and the webdav servlet by default, a user connecting from the same machine liferay is running on can access remote services so long as that user has the permission to use those services in liferay's permissions system. of course, you are not really remote unless you are accessing services from a different machine. layers of security when it comes to accessing its services remotely. explicit rights to both layers, a remote exception will be thrown and access to those services will not be granted the first layer of security that a user needs to get through in order to call a method from the service layer is servlet security. the url file is used to enable or disable access to in this section of the properties file, there are properties for each of liferay's remote services you can set each service individually with the security settings that you for example, you may have a batch job which runs on another machine in this job looks in a particular shared folder on your network and uploads documents to your site's documents and media portlet on a regular basis, to enable this batch job to get through the first layer of security, you would modify the url file and put the ip address of the machine on which the batch job is running in the list for that for example, if the batch job uses the axis web services to upload the documents, you would enter the ip address of the machine on which the batch job is running to the url property. if the machine on which the batch job is running has the ip address 192.168.100.100, this configuration will allow that machine to connect to liferay's web services and pass in user credentials to be used to upload the figure 2.21 liferay soa's second layer of security is its permissions system the second layer of security is liferay's security model that it uses for every the user account that accesses the services remotely must have the proper permissions to operate on the objects it attempts to access. otherwise, a remote exception will be thrown. portal administrators need to use liferay's permissions system to grant access to these resources to the administrative user account that attempts to operate on them remotely. example, say that a documents and media folder called documents has been set a role has been created called document uploaders which has the rights to add documents to this folder. your batch job will be accessing liferay's web services in order to upload documents into this folder. for this to work, you have to call the web service using a user account to which the document uploaders role has been assigned or that has individual rights to add documents to the folder. otherwise, you will be prevented from using to call the web service using credentials, you would use the following url the user id is the user's id from liferay's database. logging in as the user and navigating to the my account portlet in the control the user id appears on the details page of the my account portlet in the for example, to get organization data using a user that has the id of 2 with a password of test, you would use the following url it is important to note here how password policies covered in this guide's can be used in combination with this feature. policies on your users requiring passwords to take a certain form, requiring users to change their passwords on a periodic basis, etc., any administrative user account which accesses liferay's web services in a batch job will have its to prevent this from happening, you can add a new password policy which does not enforce the password expiration and add your administrative user id to it. your batch job can run as many times as you need it to and the administrative user account's password will never expire in summary, accessing liferay remotely requires the successful passing to see which liferay service methods are registered and available for use via json web services, open your browser to the following address the page lists the portal's registered and exposed service methods. method's details by clicking the method name. you can view the full signature of each method, all its arguments, the exceptions that can be thrown, and its using a simple form from within your browser, you can even invoke the service method for testing purposes to list registered services on a plugin e.g. a custom portlet, don't forget to use its context path in your url this lists the json web service api for the plugin after configuring the security settings properly, your first step in obtaining access to liferay's remote soap web services is to access the wsdl. on a browser on the same machine liferay is running on, you can do this by if, for example, you are running on tomcat on port 8080, you would specify this if you are accessing a web service that was created as part of a portlet plugin, the url is similar, but uses the context of your application rather than the you can get a list of your service builder-generated wsdl documents by using the url pattern below if you are on a different machine from the liferay server, you will need to pass in your user credentials on the url to access the wsdl in any case, once you successfully browse to this url, you will see the list of you can access the wsdl for each service by clicking on the wsdl link next to the name of the service. there are many services; one for each of the services available from the liferay api once you click on one of the wsdl links, the web service definition language this document can be used to generate client code in you can either save the document to your local machine and then generate the client code that way, or use your tool to trigger liferay to generate the document dynamically by using one of the urls above. further information about developing applications that take advantage of liferay's remote services, please see the liferay developer guide or";;
liferay portal is an easy environment to maintain. administrators have all the options they need to view and diagnose a running liferay portal server through its tunable logs. liferay is easy to do with liferay's patching tool. management of available patches, and makes it easy to install and uninstall upgrading liferay is also a snap, because liferay does most of the work with easy migration tools and automated database upgrade scripts, you'll have your new version of liferay portal up and running in no time. also easy and secure for liferay administrators to remotely access both built-in liferay web services and custom services created using service builder.;;
"which version of liferay should you install? that's an easy question to answer if this is a new installation, we recommend you install the latest version if you want to understand how liferay releases work, read on. otherwise, you can skip this section for now and read it later liferay's release process follows a prescribed structure that is consistent from each release has a specific number sequence attached to it, signifying the type of release it is major, minor or maintenance release. each release also has a term attached to it to indicate its intended level of ee subscribers have access to additional maintenance releases, along with specific fix packs and hot fixes that make applying updates to production let's start with an explanation of liferay's version structure. are organized in a straightforward numerical system consisting of a three digit these numbers represent the type of the release a change in the first or second digit of the version e.g., 6.x to 7.x or 6.1 to 6.2 is a major or minor release. this means that there are changes in functionality or new functionality based on high demand. and bug fixes from prior releases. there are also architectural changes, changes to apis as part of the deprecation process, or changes to internal schema for frameworks such as service builder, because new features have been added. customizations may be affected when installing. upgrade tools and documentation a change in the third digit of the version scheme e.g, 6.2.1 to 6.2.2 is a this means that each maintenance release provides an improved level of security and reliability. customizations are generally safe, but we recommend doing a review. these rules are relaxed when a minor or major release is still in beta quality now let's delve into the evolution of versions each release of liferay has a surname that specifies its expected quality. is needed because pre-releases of liferay look very much like maintenance releases when viewed solely through their version numbers. general replaces the third digit in the version, but is visible through the logs here is a description of each surname and what it means milestone and beta 6.2 m1, 6.2 b1, 6.2 b2,... more of these types within each minor or major release. meant for testing and to provide liferay feedback through the beta testing there will likely be major changes in milestone releases, but beta releases are considered feature complete and should have release candidates 6.2 rc1, 6.2 rc2 there can be zero, one, or more of these right after the beta releases. these releases appear near the end of the release process and are candidates for release. minimal to no bugs, but because they are very new, some minor bugs may have a general availability release is a re-label of the last release candidate, based on internal testing and feedback from beta these releases are stable and are made available via liferay's downloads page for ce and on the customer portal for ee armed with this information, here's our advice for how to manage your liferay when starting a new project, always use the latest stable version available; that is, the latest available ga. at the time of writing, the most recent version is liferay ce 6.2 ga1 6.2.0 or liferay ee 6.1 ga2 6.2.00 always update to the latest maintenance release available for the functional version major or minor that you are using. for example, if you started your project with liferay 6.2.0 ga1, it is recommended that you switch to ga2 ifwhen it becomes available to take advantage of bug fixes and improvements. you have a subscription, you can benefit from the fixes faster by requesting fix packs and hot fixes from the support team you are always welcome to use any preview, beta or release candidate. fact, that's why they existso as many people as possible start using it and please note, we do not recommend using pre-releases milestones, betas, or release candidates in production. use these releases even during development if you have tight deadlines, since you may hit some unexpected bugs plugins that work in any ga or fix pack version will work in any later that is, a plugin developed for liferay 6.2 ga1 will also work in liferay 6.2 ga2 or a ga2 fix pack for more details on updating liferay portal, see the liferay portal is a very flexible application that runs well on several it's simple to install and follows a systematic versioning system that makes it easy to keep current with the latest updates. the strength of the liferay community helps detect potential issues early that are then reported through the forums and are later fixed in a series of";;
"this section contains detailed instructions for installing liferay portal using this allows system administrators to deploy liferay it is recommended that you have a good understanding of how to deploy java ee applications in your application there are five generic steps to installing liferay on an existing application obtain the liferay.war file and the dependencies archive shut your application server down extract the dependencies to a location on your server's global classpath. this allows both liferay and plugins to access these dependencies the instructions below are specific for each application server that liferay liferay supports a wide combination of application servers and because of this, this section assumes mysql as the database, that the database has already been created, and that you're using the setup wizard. you're not using the setup wizard, see the sections above for information on how we also assume your application server is already installed and running if you still need to install your application server, please follow your vendor's instructions first since liferay uses the utf-8 character encoding, make sure that your application server has the java url parameter set before you proceed. that different application servers provide different means for setting this for example, in tomcat this parameter goes in the url or for other application servers, this parameter might go in a different script or might have to be set through an administration console the following instructions assume an installation on a local machine. installing to a remote server, substitute localhost with the host name or ip tip note that liferay requires jdk 6 or do not attempt to install liferay 6.2 on an application server that runs under java 5 or lower; it will not work. application server that ships with a jdk and that jdk is version 5 or lower, you'll need to upgrade your application server to run current versions of without further ado, let's get to the application servers. if you don't have an application server preference, and you want support all the way down to the application server from liferay, then mule after we cover mule tcat, we'll look at all the supported application servers in alphabetical order.";;
"for this section, we will refer to your tcat server's installation location as if you don't already have an existing tcat server, we recommend you download a liferaytcat bundle from if you have an existing tcat server on which you'd like to deploy liferay manually, please follow the steps below your first step is to download the latest liferay.war file and liferay the liferay.war file should be called liferay-portal-6.2.x-date.war and the dependencies file should be called next, let's get started by addressing liferay's library dependencies to run liferay portal on your tcat server, you first need to make some jar files available on tcat's global classpath. these include the liferay dependency jars, a jdbc driver for your database, and some other dependencies that liferay portal create the folder tcathomelibext extract the liferay dependencies file and copy the.jars to tcathomelibext next, you need a few.jar files that are included as part of the liferay tcat bundle, but are not included with tcat. them yourself, so let's get started. url support for java transactions. you can get this.jar, which manages transactions, from url support for the java mail api. url support for the java persistence api. url this is an implementation of the java activation url the java messaging service. url provides utf-7 and modified utf-7 charsets for java. although you can get each.jar listed above separately, it may be more convenient to get them by downloading the liferay source code and copying once you have downloaded the liferay source, unzip the source into a temporary folder. make sure the jdbc driver for your database is accessible by tomcat. the jdbc driver for your version of the database server. extract the jar file and copy it to tcathomelibext now that you have the necessary libraries in place, we'll move on to configuring if you're installing liferay portal onto an existing tcat server, you should be familiar with the tcat administration console. the following instructions assume you have a tcat server with the administration console and a separate, managed tcat server instance where you'll deploy liferay. to tcat server installation and management, see mulesoft's tcat documentation. you have to do a few things to configure your managed tcat server instance create a context for your web application modify the list of classesjars to be loaded figure 1.2 you can log in to the tcat administration console to manage your tcat servers next, you'll configure your managed tcat instance to set the catalinaopts environment variable, you need to add a server in the tcat administration console, navigate to the administration name the profile appropriately liferay 6.2, perhaps, provide a description if you wish, select the workspace where you'll keep your profile profiles is a logical choice, and click the add name it catalinaopts and give it the following value this sets the character encoding to utf-8, sets the time zone to greenwich mean time and allocates memory to the java virtual machine apply the profile to the tcat server where you're deploying liferay. so, go to the servers tab, select the desired server, and select your profile from the set profile dropdown menu create a file locally called url click your server's name to edit its configuration. navigate to the directory tcathomeconfcatalinalocalhost and upload in the content above you will also find commented instructions and tags for configuring a jaas realm, disabling persistent sessions and disabling sessions in general still in your server's files tab, open tcathome url, click the edit url this allows catalina to access the dependency jars you extracted to to ensure consistent use of utf-8 uri encoding, edit tcathome url and add the attribute uriencodingutf-8 where you see redirectport8443, in the definition of your connectors http figure 1.3 you can edit your tcat configuration files in the administration console now it's time to configure your database if you want tcat to manage your data source, use the following procedure. you want to use liferay's built-in data source, you can skip this section make sure your database server is installed and working. a different machine, make sure it's accessible from your liferay machine using the tcat administration console, add your data source as a resource in the context of your web application specified in note the above resource definition assumes your database name is lportal and your mysql username and password are both root. these values with your own database name and credentials your tcat managed data source is now configured. if you want to manage your mail session within tomcat, use the following if you want to use the built-in liferay mail session, you can skip create a mail session bound to mailmailsession. console, edit tcat home url and configure a be sure to replace the mail session values with your own your mail session is configured. next, you need to connect liferay to the mail session and database connections you just created in this section you'll specify appropriate properties for liferay to use in connecting to your database and mail session if you are using tcat to manage your data source, add the following line to the url file in your liferay home. otherwise, if you are using liferay portal to manage your data source, follow the instructions in the deploy liferay section for using the setup if you want to use liferay portal to manage your mail session, you can configure the mail session in liferay portal. your portal as described in the deploy liferay section, go to control panel server administration mail and enter the settings for if you are using tcat to manage your mail session, add the following to your url file to reference that mail session before you deploy liferay portal, let's look at configuring portal access control lists pacl with liferay on tomcat to enable pacl, you need to enable the security manager and add some required permissions to the server policy configuration file. the catalinaopts variable and editing the url file in the administration tab of the tcat administration console, click server profiles and click the profile applied to your liferay tcat server. value field of the catalinaopts variable created earlier, and add the the double equals sign tells the app server to use this policy file on top of edit url and add the required permissions now you have pacl enabled and configured for your portal. it's time to deploy liferay as an exploded web archive in your the first step is to make sure your tcat server is running; then follow these steps to deploy and start liferay if you are manually installing liferay on a clean tcat server, delete the contents of the tcathomewebappsroot directory. in the tcat administration console, click the deployments tab and select select the server where you're deploying liferay and browse to the liferay-portal-6.2.x-date.war file make sure you select advanced options while uploading liferay, and under the name field, type to put the extracted liferay into figure 1.4 upload your liferay portal war file using the deployments tab of the tcat administration console once you've entered all the deployment details, you can select deploy. once you see a successful message in the tcat administration console, you're ready to launch liferay portal on tcat! now you can navigate to liferay and follow the setup wizard. on successfully installing and deploying liferay on mule tcat!";;
liferay home is three folders above your glassfish domain folder for example, if your domain location is if you don't already have an existing glassfish server, we recommend that you download a liferayglassfish bundle from if you have an existing glassfish server or would like to install liferay on glassfish manually, please follow the steps below before you begin, make sure you have downloaded the latest liferay.war file and liferay portal dependencies from the liferay.war file should be called liferay-portal-6.2.x-.war and the dependencies file should be called these instructions assume that you are running the latest supported version of glassfish currently 4.0, have already configured a domain and server, and that you have access to the glassfish administrative console let's start out by installing the jar files you will need liferay depends on jar files found in the liferay dependencies archive. should also have installed your database driver navigate to the folder that corresponds to the domain in which you'll be inside this folder is a sub-folder named lib e.g. unzip the liferay dependencies archive so that its.jar files are extracted make sure the jdbc driver for your database is accessible to glassfish as obtain the jdbc driver for your version of the database server. case of mysql, use mysql-connector-java-version url. download the latest mysql jdbc driver from extract the jar file and copy it to lib terrific, you have your jar files just where you need them. there are a couple of modifications you need to make in your domain to use before starting glassfish, modify your domain's configuration to do the merging in the following jvm options into the current lists of jvm options within any element in the file there may be multiple lists of jvm options in your url file. example, by default, glassfish's element's element and another inside of the element's element. options, make sure that any existing options with values such as url, or -xxmaxpermsize are replaced with the new values listed edit your url and append the following delete, rename, or move the url file to another location to allow your liferay portal default page to be displayed if you want to use glassfish to manage your domain's data source, follow the instructions found in this section. if you want to use liferay portal to manage your data source, you can skip this section start your domain's application server if it is not already running go to the glassfish console url under common tasks, navigate to resources jdbc jdbc figure 1.5 in the glassfish administration console, navigate to jdbc connection pools on the first screen step 1 of 2, enter the name liferaypool for your connection pool, select the url.connectionpooldatasource resource type, and select your database driver vendor e.g. mysql . figure 1.6 it's easy to configure a new glassfish jdbc connection pool. just enter a pool name, select a resource type, and specify a database driver vendor click next to advance to the next step in creating your jdbc connection from the top of this screen step 2 of 2, scroll down to the additional replace or add the following properties url the url of your connection pool note, if you are using the above example, you should specify the name of your database in place of lportal. likewise, if your database is not on the same host as glassfish, specify your the database server's host name in lastly, specify your database type in place of jdbcmysql and use the correct port 3306 is for mysql user the name of your database user you should now see your liferaypool connection pool listed under test your connection by selecting your liferaypool connection pool and if you get a message stating ping succeeded, you've succeeded in setting up a connection pool of your data source! now, you'll setup a jdbc resource to refer to the liferaypool connection navigate to resources jdbc jdbc resources to show the current jdbc resources listed by their jndi names set the jndi name to jdbcliferaypool and select liferaypool as the pool you've now configured your domain's data source on glassfish! if you want to use glassfish to manage your mail session, follow glassfish's documentation on configuring a javamail session with a jndi name of if you want to use liferay portal to manage your mail session, you can skip this step let's tie up some loose ends with regards to liferay being able to access your shutdown your domain's application server if it is currently running if you are using glassfish to manage your data source, create a url file in the liferay home folder mentioned at the beginning of this glassfish installation section and add the following to your url file in your liferay home to refer to your otherwise, if you are using liferay portal to manage your data source, follow the instructions in the deploy liferay section for using the setup if want to use liferay portal to manage your mail session, you can configure the mail session within liferay portal. your portal as described in the deploy liferay section, go to control panel server administration mail and enter the settings for otherwise, if you are using glassfish to manage your mail session, add the following to your url file to reference that mail liferay will now be able to communicate with your database and mail session to enable pacl on glassfish, you need to make some security configurations. first, enable the security manager by editing url and make sure it contains the next, add the required permissions to the server policy configuration file now let's go ahead and deploy liferay click applications in the tree on the left under packaged file to be uploaded to the server, click choose file and browse to the location of the liferay portal.war file. figure 1.8 glassfish provides an administrative console which you can use to deploy liferay once you have deployed liferay via glassfish's administrative console, restart your installation of liferay portal on glassfish is complete!;;
in this section, you'll learn how to install liferay on oracle weblogic 12c. since you're using oracle weblogic, you may wonder if liferay supports xa liferay doesn't require xa transactions, but it supports xa. let's get acquainted with how liferay fits in with your current weblogic domain liferay by default defines liferay home as one folder above the domain in which you'll be installing liferay. for example, if your domain location is oraclemiddlewareoraclehomeuserprojectsdomainsbasedomain, then your liferay home is oraclemiddlewareoraclehomeuserprojectsdomains for this section, the variable wlhome refers to the location of your before you begin, make sure to download the latest liferay.war file and liferay portal dependencies from the liferay.war file is called liferay-portal-version.war and the dependencies file is called liferay-portal-dependencies-version.zip these instructions assume you've already configured a domain and server and that you have access to the weblogic console if you still have the mainwebapp module installed in your weblogic server installation, remove it before proceeding with the instructions in this section let's get started by installing the.jar files liferay needs liferay needs the driver.jar file applicable for the database you plan to use liferay also needs the.jar files contained in the liferay all of these.jar files must go into your domain's navigate to your domain's lib folder. extract the dependency.jar files from the liferay dependencies archive to your domain's lib folder if weblogic does not already have access to the jdbc driver for your database, copy the driver to your domain's lib folder as well the.jar files on which your liferay portal will depend are in let's proceed with configuring weblogic you need to make the following adjustments in your configuration to support you can set weblogic server's memory arguments in your setdomainenv.cmdsh environment script file found in your domain's bin folder. set the wls memory arguments for 64 bit and 32 bit architectures to at least for all other jvms, set the 64 bit and 32 bit wls memory arguments to -xms512m -xmx512m respectively set the permanent generation space for 64 bit and 32 bit architectures lastly, make sure to specify utf-8 for java's file encoding, by including java to specify all of these settings on windows, for example, you'd edit your url file and find the call to the url script. this call, you'd update your memory arguments and permanent generation space settings to be like the following code later in the url file's clustering support section, you'd set the utf-8 file encoding by appending url to the front of the here's what that setting could look like next, you need to specify local environment settings to support liferay's memory requirements, its use of the apache lucene search engine library, and its use of aspect oriented programming aop with from within the domain, open the script file that starts the server that will to deploy liferay to a managed server recommended you'd edit the startmanagedweblogic.cmdsh script file. you're on windows, you'd add directives similar to those listed below, after the make sure to set your mwhome value to your weblogic server's location. linux, you'd make similar changes replacing javaoptions with now that your weblogic environment is configured for liferay, you should consider how you want to manage the database and mail session for liferay. recommend that you use liferay to manage your database and mail session. want to use liferay to manage them, you can skip the next sections and go to the section that follows titled security configuration. you'd rather configure your database andor mail session within weblogic, you can start your weblogic server and follow the instructions in the next if you want weblogic to manage your database for liferay, use the following if you want to use liferay's built-in data source recommended, you select services data sources. give your data source a name, such as liferay data source. choose the type of database and click next you should be on the connection properties enter the database name, the host name, the port, the database user weblogic uses this information to construct the appropriate jdbc url to connect to your database. weblogic prompts you to confirm the information you've specified for your depending on the database you're using, you may need to specify additional if you need to access previous wizard pages to modify information, click back to revisit those pages when you're done specifying your configuration, click next click test configuration to make sure weblogic can connect to your weblogic shows the listing of data sources. notice that your new data source has no value in the target column. click on your data source to edit it click the targets tab and check off the server instances to which you wish to deploy your data source. to configure additional portal properties for the weblogic data source, you must shutdown the servers that you're targeting for the liferay create a url file in your liferay home folder add the following property setting to your url file your data source is set up in weblogic server. you'll need to configure a mail we recommend that you use liferay to manage your portal's mail if you want to use liferay to manage your portal's mail session recommended, skip the next section. if for some reason you want to use weblogic to manage your mail session, you can follow the instructions in the if you want weblogic to manage your mail session, use the following procedure. if you want to use liferay's built-in mail session recommended, you can skip select mail sessions and create a new mail session which points to your give it the name liferay mail and give it the jndi name of mailmailsession and click next choose your server and then click finish to configure additional portal properties for the weblogic mail session, you must shutdown the servers that you're targeting for the liferay create a url file in your liferay home folder, if you liferay portal will reference your weblogic mail session via this portal before you deploy liferay, regardless of whether you're using liferay or weblogic to manage your database andor mail session, you should enable and this will enable your portal to use liferay's plugin security manager with the liferay apps that you download and install from when you are ready to start using apps from marketplace, you'll want to protect your portal and your weblogic server from security threats. enable java security on your weblogic server and specify a security policy to grant liferay portal access to your server first, you'll grant liferay access to your server. permissionsyou can fine-tune your policy's permissions later. file named url in your wlhomeserverlib folder and add the following contents to enable security on your weblogic server and direct the server to your policy file, open the setdomainenv.cmdsh file in your domain's folder. the url java option and set the property url to the location of your url file. can specify both settings on the same line like this the double equals sign tells the app server to use this policy file on top of for extensive information on java se security architecture see its specification also, see section understanding plugin security management in the developer's guide to learn how to configure liferay plugin access to next you'll learn how to configure your weblogic application server for jsf if you'd like to deploy jsf applications on your weblogic application server, you'll need to complete a few extra steps in your configuration process. do not plan on using jsf applications in your application server, you can skip this section assumes you're using jsf 2.1 portlets complete the first section to ensure jsf applications deploy successfully to to avoid a viewexpiredexception with ajax, disable the liferay portal etagfilter by adding the following property in the url for more information on this exception, refer to you'll need to adjust your memory settings for your environment variables. for your memory settings to be permanently set, they need to be hard-coded in just above the definition of your home domain, note that if you have many portlet war modules, you may need to increase for example, the following lines reserves double the amount of if you're running the jsr 329 portlet bridge tck, you'll need to include the url dependency in the global classpath in the lib folder in order for jsf 2.1 portlets to deploy correctly in weblogic, the url descriptor must be configured to fine-tune how class for a working example, please refer to the descriptor from a demo jsf portlet due to a deficiency in the xml parser that ships with weblogic, it is necessary to include a custom apache xerces in order to include it in the proper position in the weblogic classpath, the xerces jars are included in the mojarra shared therefore, it is necessary to add xerces as a dependency in the if using icefaces, primefaces, or richfaces, all jars related to these projects must exist in web-inflib next, you'll need to upgrade mojarra for your weblogic application server however, the version of mojarra that comes with weblogic 12c is version 2.1.20. therefore, it is necessary to upgrade mojarra in weblogic by creating a new shared library war with the updated make sure your mwhome environment variable is defined completed in step 2 open a command prompt and navigate to the liferay-facessupport directory if you're on weblogic 12.1.3, then run the following command to upgrade to if you're on a version of weblogic other than 12.1.3, you'll need to specify the path to mojarra's pom file as the value of the maven property for example, on weblogic 12.1.2 you would run the since the mojarra api and implementation jars are present in the global classpath, url and url must not be included in you've successfully upgraded your mojarra version. configuring cdi for your jsf portlets running on weblogic 12c, you'll need to for more information on configuring cdi, visit the configuring jsf portlets to use cdi now it's the moment you've been waiting for liferay deployment! although you can deploy liferay on a weblogic admin server, we recommend deploying liferay to a managed server. as a best practice, you should dedicate the admin server to managing other servers that run your apps. managed server, you'll be able to startupshutdown liferay more quickly and you'll more easily be able to extend liferay into a cluster configuration regardlesss of which servers you target to host liferay in your weblogic server domain, here are steps for deploying liferay start your weblogic server, if it's not already started go to deployments and select the liferay.war file from the file system, or click the upload your files link to upload it and then click next select install this deployment as an application and click next target the server e.g., a managed server on which to deploy liferay if the default name is appropriate for your installation, keep it. otherwise, give it a name of your choosing and click next after the deployment finishes, click save. liferay precompiles all the jsps, and liferay launches if you're using liferay to manage your database, you can use that liferay portal shows the first time that you go to the portal if you're using liferay to manage your mail session recommended, you can configure the mail session in the control panel. server administration mail and enter the settings for your mail you're now running liferay on oracle weblogic 12c.;;
in this chapter, we examined how to configure liferay's portal settings. looked at the different authentication options provided by liferay. configure liferay so that users can authenticate via ldap, cas, facebook, ntlm, openid, opensso, or siteminder. we also examined some general configuration options for the portal users, such as reserved credentials and default user next, we learned how to configure mail host names, email notifications, content sharing, identification information, and portal display settings. to add custom fields to various portal entities such as users, pages, documents, wiki articles, message board posts, and more we also saw how to view and configure overall server settings. view the memory currently being used by the server, as well as how to initiate garbage collection, a thread dump, search engine re-indexing and the clearing of we learned how to debug parts of the portal by changing log levels and by viewing the various properties defined in the portal. how to properly notify users that the portal is about to shut down and how to set up external services like openoffice integration lastly, we looked at how to create multiple portal instances on a single installation of liferay and we showed how to view currently installed plugins. we hope this information helps you become an effective liferay portal;;
in this chapter, we examined several liferay utility applications the bookmarks portlet, the shopping portlet, the software catalog, the reports and jasperreports applications, the knowledge base, the akismet application, the weather portlet, and the oauth application the bookmarks portlet allows users and administrators to collect and share useful link to pages either within or outside of the portal. portlet allows you to use paypal to set up your portal for e-commerce activity. the software catalog allows you to define a set of software items to make available to visitors to your portal. remember that the software catalog has been replaced by liferay marketplace. if you want to use it, you'll have to manually install it as a plugin. the reports application is an ee-only application that provides a reports admin portlet in the control panel for creating reports and scheduling report generation. implementation, such as the jasperreports application also ee-only, you can upload report definitions in the reports admin portlet, generate reports, and export reports to a wide variety of formats the knowledge base application is an ee-only application that allows you to create articles and organize them into full books or guides that be published on the akismet application offers a web-based spam detection service for your portal's message boards, blogs, wikis, and comments. portlet provides users with a summary of weather-related information for multiple locations and provides a links to open weather map for more detailed information for each lastly, the ee-only oauth application manages third-party applications' access to your portal's resources and vice versa. a tour of the liferay marketplace and learn how to manage liferay plugins.;;
akismet is a web-based spam detection service. the akismet app, available from liferay marketplace, integrates liferay with akismet to provide spam detection for liferay's message boards, blogs, wikis, and comments. akismet app from liferay marketplace, two portlets are added to the control panel the akismet portlet is added to the configuration section and the spam moderation portlet is added to the content section of site administration in order to enable liferay to use akismet, you need to visit url, create an account, and generate an api once you've generated an api key, navigate to the configuration section of the control panel and click on akismet. enter your api key into the provided field and check the enabled for message boards and enabled for discussion the term discussions is another way to refer to comment threads in optionally, you can customize the reportable time and the check the reportable time indicates the time in days after a post is created or updated that it can be marked as spam or not spam. threshold indicates the number of posts after which akismet will no longer after you've finished configuring akismet, click save to see akismet in action, add some message board posts or comment on some see if you can get akismet to mark one as spam. akismet doesn't mark a post as spam, you can always manually do as an once one or more posts have been marked as spam, navigate to the content section of the site administration section of the control panel, then here, you can find all the message board posts, discussions comments, and wiki pages that have been marked as spam. select all the posts that you agree are spam and delete them. select any posts that you don't agree are spam and mark them as not spam. you're not sure about a post, click the actions button and select view in context to view the post in its original setting.;;
"in this chapter, we learned how to manage users, organizations, user groups, and site memberships and teams aren't the only way for portal administrators to group and manage users organizations can be used to arrange users into hierarchical structures and user groups are a flexible way to collect groups of users that transcend organizational you can create roles to define permissions and scope them for the entire portal or for a particular site or organization. assigned to roles; in this case, each member of the user group is assigned to we also looked at how to configure password policies for users and how to view audit trails of what your users are doing in the portal. continue our coverage of liferay's control panel next, where we'll examine configurable portal and server settings.";;
if you have an ad hoc group of users who perform the same set of tasks in a site, you can organize them into site teams. these teams permissions for various site-specific functions. preferred method for collecting permissions within a single site. functions to assign a site team include these for instance, if your site has message boards, you might want to enable a subset of the site's members to moderate the categories and threads, and perhaps to ban to do this, you could create a site team named message board moderators, define the team's permissions on the message boards portlet, and assign the desired site members to the team the permissions assigned to a site team only apply to that site. a team's permissions don't impact other sites, site administrators can concentrate on defining and applying permissions to their sites' teams to create and apply permissions for a group of users to use across multiple sites or organizations in your portal, consider aggregating the users into a to create a team within a site, first navigate to the site administration page of your site and select users site teams. configuring other site membership groupings, such as users, organizations, and user groups can be done in the site memberships portlet, which is also chapter for more information on how these site memberships work. figure 3.26 creating teams within your site can foster teamwork and collaboration, as team permissions enable team members to access the same resources and perform the same types of tasks after you've clicked the add team button and entered a name and a description, your new team shows in the list. to add members, click on actions to manage a team's permissions, click on actions permissions for that setting permissions for the team assigns all of the team's members those only administrators with the ability to editmanage the team have the ability to manage team permissions if you created team whose task is to moderate the message boards, for example, you'd want to give the team all the permissions they'd need. permissions, find the team in the role column, and select the figure 3.27 the troll-busters site team has unlimited permissions on the message boards portlet it's easy to give groups of site users appropriate permissions to next, let's look at how to configure liferay for mobile;;
suppose you're running a portal with lots of users. tens of thousands of users or more!. wouldn't it be nice to have an easy way to periodically communicate important information to them? even nicer to have easy ways to periodically send information to specific groups for example, maybe you'd like to send a reminder about a new policy to all of the site administrators on your portal. reminder to all the members of a certain site to submit an answer to this week's liferay provides two portlets that meet this need the alerts portlet and the announcements portlet figure 9.31 the alerts portlet provides administrators with an easy way to communicate important information to appropriate groups of users the alerts and announcements portlets let you broadcast important information to each alert or announcement can be created in a specific scope so that you can manage which announcements are sent to which furthermore, each portal user can configure how they'd like to receive announcements click on user name my account from the dockbar and then on announcements in the miscellaneous category. customizing the delivery options for alerts and announcements. different configuration for each type of alert or announcement general, news, each kind of announcement that's broadcast to a user is viewable from the alerts or announcements portlet, of course. but alerts and announcements can also be sent via email or sms short message service, i.e., text you can also create roles in liferay to assign to users that should have access to announcing general announcements. for instance, if you'd like an employee in your site to have strict control over what is announced, you can assign them to to create a simple announcement role, you'll need to navigate to the control panel roles add regular specify the name of your role as announcements, click save, and then select the define permissions tab. for this particular role, you'll need to you'll need to click save after selecting each permission. simple announcements role that can add an entry to the announcements portlet and add general announcements to your site! of course, you can add additional permissions to give the announcements role more access, if you prefer figure 9.32 the annoucements portlet displays a list of annoucements to regular users. it also provides administrators with an interface for managing and adding entries let's look at how to create announcements in the announcements portlet. view the announcements portlet as an administrator, you'll see two tabs entries non-administrators only see the entries tab which displays a to add a new announcement, click on manage entries and the distribution scope determines the group of users to which your announcement is sent. general distribution scope are sent to everyone. set a particular site or role, only members of that site or role receive the once you've selected a distribution scope, you'll see a list of all the announcements that have already been created in that scope. actions button next to an announcement to edit or delete it. in addition to the distribution scope, you can provide the following information title the title of the announcement. when the announcement is displayed in the portlet, the full title always appears in bold. title serves as a link to the site specified in the url field if entered, it must be a valid url, starting with for example, an announcement about a news story could include a link content the body of the announcement. you can use the familiar ck editor to write the body of your announcement. use the source button to switch between the editor view and the html view type can be general, news, or test. each user can specify a different delivery mechanism for each type of announcement. specify that she'd like to receive general announcements via email and text, news announcement via email only, and no special delivery mechanism for test each user can customize their delivery options by navigating to user name my account from the dockbar and then clicking on announcements in the miscellaneous category priority can be either normal or important display date this determines when the announcement will be sent to users and will appear in the announcements portlet. this sets the display date to be equal to the unflag this box if you'd like to enter a custom display date. example, administrators can create announcements that won't be displayed until a this date can be days, weeks, months, or years in the once the display immediately box is unflagged, clicking on the display date field opens the date-picker widget expiration date this determines when the announcement expires. announcement expires, it's no longer displayed by the announcements portlet to clicking on the expiration date field opens the date-picker widget the alerts portlet works the same way as the announcements portlet. different portlet because it's designed to be be used only for important messages or message that may require users to take some action. portlet only displays alerts and the announcements portlet only displays alerts. the alerts portlet displays alerts with a bold red box around each alert message to draw attention to the displayed entries. place the alerts and announcement portlets on different pages if they'd like to separate important alerts from more mundane announcements next, let's see what you can do with liferay's chat feature.;;
in this chapter, you learned how to use liferay's audience targeting app. app allows you to define custom user segments, target specific content to different user segments, and create campaigns for different user segments. liferay's audience targeting app allows you generate reports so that you can measure the effectiveness of your campaigns. liferay's audience targeting app also includes a simulator so that you can preview how your site would appear to users belonging to different user segments. you can create user segments by applying various rules that reference session attributes, profile attributes, behavior, and possibly other information, such as information from social it's also easy for developers to create additional rules and rule;;
in this chapter, we explored the configuration options available for liferay we showed how to customize your applications, exportimport portlet data, take advantage of different scopes, and communicate between we also examined the different uses of social applications like facebook and netvibes for your liferay applications. configuration options, we also explored the recycle bin. special file directory allowing users to browse, retrieve, or permanently delete in all, liferay gives you an abundance of options to leverage the full capability of your applications.;;
are there times when you find yourself limited by liferay's page layout options? maybe your feng shui pronounced fung shway senses are picking up on some or perhaps you find yourself adding the same portlets over and over again onto the same types of pages? creating your own custom layout templates. design layouts that flow nicely, embed commonly used portlets, and apply css, velocity, and html to make your pages visually pop you can create layout templates in a plugins sdk project or a liferay maven you can create either type of project from liferay developer studio, liferay ide, or from the command line. this tutorial focuses on creating layout templates in a plugins sdk project, from liferay ide and from the command line to learn how to create liferay maven projects, see the tutorial creating liferay maven plugins from ide creating liferay maven plugins from the command line creating layout templates in liferay ide is easy. follow these steps to create a layout template project in the ide fill in the project name and display name fields choose ant for the build type and select the appropriate plugins sdk and select layout template as your plugin type figure 1 creating a new layout template project is easy with liferay ide you can also create a layout template from the command line using ant from your command line terminal, navigate to your plugins sdk's layouttpl to create a layout template project you must execute the create here's the format to follow in executing the script on linux and mac os x, you'd enter a command similar to the one in this example on windowsx, you'd enter a command similar to the one in this example liferay ide's new project wizard and the create scripts generate layout template projects in your plugin sdk's layouttpl folder. automatically appends -layouttpl to your project name look at the directory structure of a layout template project below a layout template project can contain multiple layout templates. structure is the same, but there is a.png,.tpl, and url file for each layout template in the docroot folder. the layout templates for packaging and deployment check out what each template file does figure 2 this is an example of a default layout template thumbnail in addition to the three template-specific files, a layout template project has now that you're well-versed on the anatomy of a layout template project, go out creating liferay maven plugins from ide;;
liferay includes built-in support for google analytics, allowing administrators to make use of google's tool set for analyzing site traffic data. up for google analytics, a snippet of code is provided which needs to be added to your web pages to allow google's system to register the page hit. tedious process to add this code to every page on a site, especially if it's a large site and there is a lot of user-generated content this problem can be solved in liferay by putting google's code into a custom theme written specifically for the web site on which the portal is running. doing this, however, requires a theme developer to make specific changes to the theme and it prevents users from using the many themes that are freely available because of this, support for google analytics has been built into liferay, and can be turned on through a simple user interface. administrators to make use of google analytics on a site by site basis and turn you can sign up for google analytics at the google to enable google analytics support, navigate to site administration in the control panel, expand the configuration area in menu at the left side of the screen, then click on site settings. click on analytics and you'll see a very simple form, pictured below figure 3.32 setting up google analytics for your site is very easy sign up for google analytics, receive an id, and then enter it into the google analytics id field enter your google analytics id which should have been provided to you when you signed up for the service in the field and click save. site you selected will now have the google analytics code in them and will be to enable a different analytics service, navigate to configuration in the control panel, and then go to portal settings miscellaneous you can enter the name of any additional service you want to add in the analytics field provided. once you have entered the name, go to the site settings advanced analytics page for the site where you wish to add analytics. copy the javascript tracking code provided by your analytics platform into corresponding field for your service. pages on the selected site contain the tracking script and will send analytics data to your analytics platform this is a fairly simple procedure, and it gives you the ability to take advantage of some great tools to help you visualize who's coming to your site;;
liferay lets you use custom sql queries to retrieve data from the database. however, it's sometimes more convenient to build queries dynamically at runtime than it is to invoke predefined sql queries. liferay allows you to build queries dynamically using its dynamicquery api, which wraps hibernate's criteria api. using liferay's dynamicquery api allows you to build queries without writing a the dynamicquery api helps you think in terms of objects and member variables instead of in terms of tables and columns. constructed via hibernate's criteria api can be significantly easier to understand and maintain than the equivalent custom sql or hql queries. you technically don't need to know sql to construct queries via hibernate's criteria api, you still need to take care to construct efficient queries. information on hibernate's criteria api, please see in this tutorial, you'll learn how to create custom finders for liferay applications using service builder and liferay's dynamic query api to use liferay's dynamic query api, you need to create a finder implementation you can define model entities in url and run service builder to generate model, persistence, and service layers for your running service builder and understanding the generated code learning path for more information on using service builder. assumes that you're creating a liferay application that consists of a service once you've used service builder to generate model, persistence, and service layers for your application, you can call custom finders using liferay's dynamic query api by following these steps create a custom -finderimpl class and define a findby- finder method in run service builder to generate the required interfaces and implement your finder method using liferay's dynamic query api add a method to your -localserviceimpl class that invokes your finder run service builder to add the required method to the service once you've taken these steps, you can access your custom finder as a service note you can create multiple or overloaded findby- finder methods in next, let's examine these steps in more detail to define any custom query, either by specifying custom sql or by defining a dynamic query, you need a finder class. the generated package path url package of your service recall that you specify the package path then define a findby- finder method in the class you created. add any required arguments to your finder method's method signature for example, consider a fictitious guestbook application. there are two entities guestbooks and entries. guestbook so the entry entity has a guestbookid field as a foreign key. suppose you need to create a custom finder to search for guestbook entries by the entry name and the guestbook name. in this case, you'd add a custom finder method to guestbookfinderimpl and name it something like the full method signature would appear as once you've created a finder method with the appropriate method signature in your finder class, run service builder to generate the appropriate interface in the package path url package in the service folders of for example, after adding findbyentrynameguestbooknamestring entryname, string guestbookname to guestbookfinderimpl and running service builder, the once the finder interface has been generated, make sure that the finder class for example, the class declaration should look like your next step is to actually define your query in your custom finder method your first step in implementing your custom finder method in your -finderimpl class is to open a new hibernate session. since your -finderimpl class extends basepersistenceimpl, and basepersistenceimpl contains a method, you can simply invoke the opensession method of your -finderimpl's parent class to open a new the basic structure of your finder method should look like for example, in the case of the guestbook application, you could write the following finder method to retrieve a list of guestbook entries that have a specific name and that also belong to a guestbook of a specific name notice that in liferay, you don't create criteria objects directly from the most features of hibernate's criteria api, including restrictions, projections, and orders, can be used on liferay's dynamic query objects. hibernate's criteria api roughly correspond to the where clause of an sql query they offer a variety of ways to limit the results returned by the query. you can use restrictions, for example, to cause a query to return only results where a certain field has a particular value, or a value in a certain range, or projections in hibernate's criteria api let you modify the kind of results for example, if you don't want your query to return a list of entity objects the default, you can set a projection on a query so that only a list of the values of a certain entity field, or fields, is returned. you can also use projections on a query to return the maximum or minimum value of an entity field, or the sum of all the values of a field, or the average, etc. for more information on restrictions and projections, please refer to orders, another feature of hibernate's criteria api, let you control the order of the elements in the list returned by a query. properties to which an order should be applied and you can choose for the properties to appear in ascending or descending order in the list like hibernate criteria, liferay's dynamic queries are chainable. that you can add criteria to, set projections on, and add orders to liferay's dynamic query objects just by appending the appropriate method calls to the for example, the following snippet demonstrates chaining the addition of a restriction criterion and a projection to a dynamic query object when you need to add restrictions to a dynamic query in liferay, don't call hibernate's restrictions class directly. instead, use the methods of liferay's you'll find the same methods in liferay's restrictionsfactoryutil service class that you're used to from hibernate's restrictions class in, to specify that a guestbook must have a certain name, you use similarly, to set projections, you create properties via liferay's service instead of through hibernate's property class. notice that in the custom findbyguestbooknameentryname finder method, there are two distinct dynamic queries. the first query retrieves a list of guestbook ids corresponding to guestbook names that match the guestbookname parameter the second query retrieves a list of guestbook entries with entry names that match the entryname parameter and have guestbookid foreign keys belonging to the list returned by the first query returns a query that retrieves a list of all guestbook entities. adding the.add url name, guestbookname restriction limits the results to only those guestbooks whose guestbook names match the guestbookname projection changes the result set from a list of guestbook entries to a list of this is useful since guestbook ids are much less expensive to retrieve than full guestbook entities and the guestbook ids are all that the next is an order which applies to the list of entries returned by the when this order is applied to a query, the list of results returned by the query are arranged in descending order of the query entity's modifieddate attribute. thus the most recently modified entities guestbook entries, in our example appear first and the least recently modified entities appear last of list of all guestbook entry entities. the.add url name, entryname restriction limits the results to only those guestbook entries whose names match the entryname is a liferay utility class with the method fornamestring propertyname, which returns the specified property. this property can be passed to another liferay this is exactly what happens in the following line of our here, the code makes sure that the guestbook ids foreign keys of the entry entities in the entityquery must belong to the list of guestbook ids returned declaring that an entity property in one query must belong to the result list of another query is a way to use liferay's dynamic query api to create complex queries, similar to sql joins lastly, you apply the order defined earlier to the entries returned by the this orders the list of guestbook entities by the modifieddate attribute, from note service builder not only generates a public list dynamicquerydynamicquery dynamicquery method in -localservicebaseimpl but it also generates public list dynamicquerydynamicquery dynamicquery, int start, int end and public list dynamicquerydynamicquery dynamicquery, int start, int end, orderbycomparator orderbycomparator methods. 1 and either modify your custom finder method or create overloaded versions of your custom finder method to take advantage of these extra methods and their the int start and int end parameters are useful when paginating a result list. start is the lower bound of the range of model entity instances the orderbycomparator orderbycomparator is the comparator by which to order the results to use the overloaded dynamicquery methods of your -localservicebaseimpl class in the optionally overloaded custom finders of your -finderimpl class, just choose the appropriate methods for running the dynamic queries you've now created a custom finder method using liferay's dynamic query your last step is to add a service method that calls your finder so far, you've created a -finderimpl class, defined a custom findby- finder method in that class, and implemented the custom finder method using dynamic now how do you call your custom finder method from the service layer when you ran service builder after defining your custom finder method, the -finder interface was generated e.g., guestbookfinder . however, should not call the -finder interface only a local or remote service implementation i.e., -localserviceimpl or -serviceimpl in your service module should invoke the -finder class. this encourages a proper separation of concerns the portlet classes in your application's web module invoke the business logic of the services published from your application's service module. the services, in turn, access the data model using the persistence layer's note in previous versions of liferay portal, your finder methods were accessible via -finderutil utility classes. finder methods are now injected into your app's local services, removing the need to call finder utilities so you'll add a method in the -localserviceimpl class that invokes the finder method implementation via the -finder class. application's service layer so that the portlet classes and jsps in your web for example, for the guestbook application, you'd add the following method to the entrylocalserviceimpl class after you've added your findby- method to your -localserviceimpl class, run service builder to generate the interface and make the finder method available now you can indirectly call the finder method from your portlet class or from a congratulations on following the three step process of developing a dynamic query in a custom finder and exposing it as a service for your portlet! suppose you have over a million users on your portal, and you want to perform some kind of mass update to a large portion of them. to use a dynamic query to retrieve the list of users in question. into memory, you could loop through the list and update each user. with over a million users, the memory cost of such an operation would be too in general, if you have very large numbers of service builder entities, it can be too expensive in terms of memory and speed to run a dynamic query to retrieve a list of such entities in order to do some processing on them liferay provides actionable dynamic queries to solve this kind of situation. an actionable dynamic query does not return a list of service builder entities instead, it uses a pagination strategy to load only small numbers of service builder entities into memory at a time and performs some processing i.e., performs an action on each entity. instead of trying to use a dynamic query to load a million users into memory and then perform some processing on each of them, a much better strategy is to use an actionable dynamic query to process them. this way, only small numbers of users are loaded into memory at a time, but you still process all the users when you run service builder, it includes actionable dynamic query support in the generated api and service modules. for example, consider the api module of the blade service builder example project the foolocalservice interface in the api module contains these methods the foolocalservicebaseimpl class in the service module implements each of the implementation of url uses dynamicqueryfactoryutil to obtain new regular dynamic query instance for this is the pattern shown earlier you can use url to obtain a new actionable dynamic query instance for the foo entity. instance, you can use chaining to build up the query using any of the techniques described above for regular dynamic queries, such as restrictions or but the point of using an actionable dynamic query is to specify an action to perform on each entity that results from the query. once the query has been defined and an action has been specified, use the url to perform the action on each entity here's an example from a test for liferay dxp's bookmarks application you can see the full context here consider the foolocalservice from the blade service builder api project for most of your actionable dynamic query use cases, the actionable query returned by url will suffice. this actionable dynamic query is an instance of the concrete class url, there are two additional methods related to actionable dynamic queries instances of concrete classes either indexableactionabledynamicquery or exportactionabledynamicquery that extend defaultactionabledynamicquery. indexableactionabledynamicquery contains methods designed to facilitate processing that involves search indexing and exportactionabledynamicquery contains methods designed to facilitate processing that involves export to see examples of configuring indexer and export actionable dynamic queries, to see an example invocation of an indexable actionable dynamic query, see the reindexentries method of the bookmarks application's indexer;;
since blogs are a mainstay on the web, bloggers and blog administrators expect feature-rich environments for publishing blogs. editor and a pleasurable authoring experience. blog admins demand an intuitive environment that facilitates configuring blog instances and managing blog liferay dxp's blogs meets these demands its editor delivers features you'd expect in an elegant in-context manner. has a complete set of wysiwyg controls that appear where and when you need them. you can stay in this easy-to-use mode or switch to source mode to edit your in source mode, you can work with light text on a dark background or dark text on a light background. to cap things off, you can open the dual screen html editor to see your code rendered in real time. a satisfying experience creating awesome blog posts lastly, blogs empowers you to show off your blogs using powerful display you can leverage liferay dxp's built-in display templates or create your own, to present blogs the way you like them. and you can now add a beautiful cover image to each of your blog entries, like album covers for your posts. ityou might not be able to judge a book by its cover, but you're more likely to draw readers to your blog entry by decorating it with an enticing cover by now you're probably chomping at the bit to start blogging, right? each site comes with a built-in blog instance, so let's explore adding an entry in site administration, the blogs app provides the best entries screen appears, listing the site's blog entries click the add icon to create a new blog figure 1 this screenshot highlights the blog entry editor's controls for formatting text, justifying images, and editing tables the screen presents fields to set a cover image, title, and subtitle, and an you may be asking yourself, where are the content editor's controls? the editor gives you a seamless writing experience, displaying controls when you need them and hiding them from view when you don't this keeps your canvas uncluttered, so you can focus on writing. you create content, context-specific controls appear go ahead and enter text in the content area. appear in figure 1, notice the controls above the highlighted word hiking . these controls let you style the text or convert it to a link or a tweet to share your blog post on twitter. you can also use keyboard shortcuts ctrlb for bold, ctrli for italics, and ctrlu for underline. other users by entering the character followed by the user's name whenever you park your cursor in the content area, the add icon appears. if you click on it, it shows controls for inserting an image, table, or to insert an image, click the icon that depicts the mountain silhouette. image file selector screen appears. it lets you choose an existing image or you can also drag-and-drop image files into the content area. if you like an image, but want to modify it a bit, use the image editor. select an existing image from the documents and media repository and click the pencil icon in the bottom right corner of the preview window, to open the image editor. edits you make are automatically applied to a copy of the image figure 2 you can use the image editor to customize your blog's photos after you add an image to the blog entry, clicking the image brings up controls for justifying it to the right or left side of the article. the image justification controls above the moon image you can also insert a table with as many rows and columns as you like. click inside the table, table editing controls appear see the table in figure 1. you designate the first row andor column as table headers. enable you to add rows, columns, and cells now you're familiar with the editor's regular mode. the content's html code, you can. to switch the editor to source view, select for regular mode appears, giving you the option to switch back to regular view. to satisfy your eyes, source view's moon icon and sun icon let you switch between a dark theme and a light theme you can even work in a dual pane view that shows your html code on the left and to open this view, click the enlarge icon preview panes horizontally or vertically. you can also hide the preview pane, so the html editor takes up the entire window space. use the html editor, it can really help you stay in the zone as you create figure 3 the enlarged source editor helps you minimize screen clutter and render changes in real time every 25 seconds, the entry you're editing is automatically saved as a draft, so a browser crash or network interruption won't cause you to lose your entry. can exit the enlarged editor by clicking done which saves your content or clicking cancel to abandon any changes since the last auto-save. normal-sized source view, you can click the roller icon to switch back to the wysiwyg you've learned all the ins and outs of the content editor. how to specify your blog entry's other characteristics the edit screen's first input field drag drop to upload lets you add a cover image optional for your entry. this might be an image that represents your entry's purpose and is designed to attract readers. shows a blog entry's cover image, by default, as part of the blog entry's you can drag and drop onto this field any image you like. alternative to dragging and dropping an image, you can click the select file button to use the image selector to choose an existing image attached to the blog, an image file from documents and media, or an image outside the you can browse to an image file and upload it. an image from documents and media, you have the option to use the image editor to customize and edit the image for your cover. from documents and media, you can access the image editor by clicking the pencil any edits you make are automatically applied to a copy of the image, which you can then use as your cover photo after you've uploaded the image, it displays in the image pane. content, click on the image and drag it into place with your mouse. on the checkmark icon to save the image placement. and if you want to select a different image, you can click the change icon clicking the trash can icon removes the image from the blog entry below the content area are several panels for configuring your blog entry the categorization panel's options allow you to associate tags andor doing this improves search results for blog entries, and you get more navigation options for your users. for example, you can add the tags navigation application to another column on your blogs page, which lets users below this is the related assets if there's some other content in the liferay dxp instance that's related to your entry, you can choose it here. write a blog entry talking about a discussion that happened on the forums. link those two assets together, select the forum thread under related assets the configuration panel is next. since liferay dxp fix pack 13 and liferay portal ce ga4, you can specify a friendly url for the blog entry. selection of automatic generates the url for you based on the blog entry's the generated url appears in the text box shown below the alternatively, you can select the custom option once published, you can view the blog entry by navigating what if you decide to change the blog entry's url later on? the original link will redirect to the new friendly url you can also specify an abstract for the blog entry within the configuration choose a 400 character text-only abstract or a custom abstract containing a thumbnail image and a manually written description. you can set a particular display date for the entry lastly for your blog entry's configuration, you can allow pingbacks. are xml-rpc requests that are automatically sent when you link to another site. if you link to another site in your blog entry, liferay dxp sends a pingback to the other site to notify that site that you linked to it. someone links to your blog entry, liferay can receive a pingback from that person's site and record the link it lets you restrict viewing the blog entry to the owner only or site members default, or open viewing to site guests. clicking on the more options link, brings up a permissions table to grant permissions to or revoke permissions from site guests and site members, with the blog entry permissions enable a role to perform the following actions update edit and modify the blog entry permissions view and modify the blog entry's permissions delete move the blog entry to the recycle bin update discussion edit another user's comment on the blog entry delete discussion delete any comments on the blog entry add discussion comment on the blog entry once you've finished your blog entry, click publish. with the site's other blog entries figure 4 blogs in site administration is the perfect place to create and manage blog entries. it has several options for modifying, displaying, filtering, and finding entries congratulations on creating your blog entry! before displaying it on your site's pages, you may want to learn how to manage blog entries the blogs application in site adminstration helps bloggers and blog search finds entries that match the the order by selector enables you to organize entries by title or display date, in ascending or descending order. displayed using icons, by default. shows large cover images, descriptive style displays single cell rows that show the author's image and entry information, and list style displays the entries using several columns for each entry. working with existing blog entries has you can manage entries individually or in a batch. icon to edit the entry, configure its permissions, or move it to the recycle bin. you can select the all checkbox to select all entries or select an entry's individual check box, and click the trash icon to move them into the recycle under the images tab you can view individual images and delete them the options icon at the top of blogs lets you configure permissions and notifications, or importexport the here are the blog instance configuration options email from defines the from field in the email messages that users entry added email defines a subject and body for the emails sent when a new blog entry has been added entry updated email defines a subject and body for the emails sent when a new blog entry has been updated rss lets you enable rss subscription and choose how blogs are displayed to maximum items to display choose the total number of rss feeds entries to you can choose up to one hundred to be displayed display style choose between full content, abstract, and title. options work just like the ones above for blog entries format choose which format you want to deliver your blogs atom 1.0, rss you've learned how to create blog entries and manage them. for example, who is allowed to view the different blog instances and who is allowed to add blog entries if you have a personal blog, the default permissions should work well for you. if you have a shared blog, you may want to adjust its permissions. settings make it so only the owner of the site where the application was added this, of course, is great if the blogs app has been added to a user's personal pages, but doesn't work so well for a shared multi-author blog. but don't worry it's easy to grant blogging permissions to users bloggers and add them to the role. next, in blogs, click options a list of both instance and site roles is displayed, and currently only the owner is checked for the add entry permission. other role or team that should be able to add blog entries and then click once you've done this, users in the roles or teams that you selected are able to post to the shared blog. you can also grant roles and teams the ability from within the control panel, you can configure all the permissions for blogs. permissions for the blogs and blogs aggregator applications are covered next you've now created a blog entry and learned how to manage blog entries and next, you'll learn how to use the blogs and blogs aggregator applications to display blog entries the way you want them you can add the blogs application a page from the add menu. since blogs supports scopes, you can use it to create a multi-author blog to build a site like url or to create multiple personal blogs to build a site like blogs app to a site page creates a shared blog for members of the site. the app to a user's personal site dashboard creates a blog just for that user. blogs works the same way in both cases. and of course, you can scope a blog to a page to produce a blog instance for just that page add the blogs application to one of your site's pages. site's recently published blog entries. notice that each entry's cover image shows prominently in the listing. the figure below shows a blog entry abstract figure 5 here's a blog entry in abstract format you can see that in the summary view, you don't see the trackbackpingback link, and you only see the number of comments that have been added. entry's title, you'll see the whole article, all the comments in a threaded view, and the trackbackpingback link which others can use to link back to your the full view of the blog entry also contains links to share blog entries on social networks, such as twitter, facebook, and google. an easy way to share blog entries with friends, potentially driving further figure 6 users can view your blog entry in all its glory. they can rate it, comment on it, and share it with other people by default, the blogs application displays the abstract and image of the latest there are several display options that let you configure the listing to to configure the application, click the options icon in the app's title bar and select configuration. to choose the right settings, you should think about the best way to display your entries as well as how you want users to interact with bloggers maximum items to display choose the total number of blog entries to display you can select up to 75 to display at once display template choose between abstract, full content, title, or setting this to abstract shows the entry's cover image and first four users can click on the entry's title to see its full you can click manage display templates for liferay to select an existing blogs application display template adt or to create your own. learn how to customize your own display templates with application display visit the using application display templates section of this guide enable flags flag content as inappropriate and send an email to the enable related assets select related content from other applications to pull into their blog entry for readers to view enable ratings lets readers rate your blog entries from one to five stars enable comment ratings lets readers rate the comments which are posted to enable social bookmarks lets users tweet, facebook like, or 1 google you can edit which social bookmarks are available in the social bookmarks section of the configuration menu display style select a menu, simple, vertical, or horizontal display style for display position choose a top or bottom position for your blog posts social bookmarks choose social bookmarks to enable for blog posts, which includes twitter, facebook, and google here are descriptions for the other blogs configuration tabs permissions shows liferay dxp's permissions dialog for the blogs communication lists public render parameters the application publishes to other applications on the page. other applications can read these and take for each shared parameter, you can specify whether to allow communication using the parameter and select which incoming parameter can sharing lets you embed the application instance as a widget on on any website, facebook, or netvibes, or as an opensocial gadget scope lets you specify the blog instance the application displays the current site's blog default, global blog, or page blog. already have a blog instance, you can select scope option page name create new to create a page-scoped blog instance for the blogs application liferay dxp's blogs application excels at aggregating information from the blogs aggregator application lets you bubble up blog entries from multiple users and highlight them on your site. you can set up a whole web site devoted just to blogging if you wish. aggregator lets you publish entries from multiple bloggers on one page, giving further visibility to blog entries. you can add it to a page from the collaboration category in the add if you click configuration from the options icon in the app's title bar, the blogs aggregator's configuration page appears. selection method select users or scope here. aggregator aggregates the entries of every blogger on your system. to refine the aggregation, you can select an organization by which to filter the if you select scope, the blogs aggregator contains only entries of users this limits the entries to members of the site where the blogs aggregator resides organization select which organization's blogs you want to aggregate display style select from several different styles for displaying blog entries body and image, body, abstract, abstract without title, quote, quote without title, and title maximum items to display select the maximum number of entries the app enable rss subscription creates an rss feed out of the aggregated entries. this lets users subscribe to an aggregate feed of all your bloggers. checkbox, you can configure how you want the rss feed displayed maximum items to display select maximum number of rss items to display display style select from several different styles for displaying rss feeds abstract, full content, and title format select which web feed language to use for your feed, which includes atom 1.0, rss 1.0, or rss 2.0 show tags for each entry, displays all the tags associated with the blogs at the top of the configuration screen, there's an option called it lets you store your current setup configuration or apply an existing archived setup. this is especially helpful when you have multiple configurations you like to use in blogs aggregator instances here are descriptions for the other blogs aggregator's configuration screens current site's blog default, global blog, or the page's. create new to create a page-scoped blog instance and set the blogs app to when you've finished setting the options, click save. you'll notice the blogs aggregator looks very much like the blogs application, except that it shows entries from multiple blogs figure 7 the blogs aggregator lets you display blog entries authored by multiple authors from different sites last up is showing your liferay dxp instance's recent bloggers a great way to applaud bloggers is to display their names using the recent it lists the names of users who've most recently posted blog it shows their name, profile picture, and number of posts. way to show off who's who on your site. you can add the recent bloggers app to a page from the collaboration category in the add recent blogger's configuration page appears. from here, you can set its options recent bloggers aggregates all the users on your system. the aggregation, you can select an organization by which to filter the users. you select scope, the app will show only users who are in the current scope. this limits the users shown to the site where the resides resides organization select which organization's users you want to show display style select from several different styles for displaying users maximum items to display select the maximum number of users the app when you're finished setting the options, click save. figure 8 you can show off your site or organization's most recent bloggers from the recent bloggers app add the recent bloggers app to a page on your site to draw attention to the users who are contributing helpful blogs on your site throughout this section, you've learned how to create blog posts in a powerful no-nonsense editor, manage blog instances and blog entries, and display blogs the way you like them using the the blogs and blogs aggregator applications. now you can enjoy the benefits of participating in the world of blogging blogs are terrific for sharing information on a topic, posting important announcements, and expressing yourself. and if comments are enabled, users can have short exchanges about your blog entry. the best place to discuss things or ask questions, however, is in a forum. next, you'll learn how to create forums;;
"ext plugins are powerful tools for extending liferay. complexity of your liferay instance, you should only use an ext plugin if you're sure you can't accomplish your goal using a different method. for customizing display of apps that support them, or check out customizing liferay portal with hooks for the available alternatives using hook plugins. suffice, keep reading to discover the use cases for ext plugins and how to set first it's important to consider why you should avoid ext plugins when as someone once said, with great power comes great responsibility okay, many people have said that many times. before deciding to use an ext plugin, weigh ext plugins let you use internal apis and even let you overwrite when upgrading to a new version of liferay even if it's a maintenance version or a service pack, you have to review all changes and manually modify your ext plugin to merge your changes with liferay's. additionally, ext plugins aren't hot deployable. lastly, with ext plugins, additional steps are required to deploy or redeploy to production systems now that you know the limitations of ext plugins, let's look at why you'd want with these use cases in mind, you'll learn how to use ext for these things it's time to create an ext plugin sure you can't accomplish your goal in a different way. plugins in liferay ide or in your terminal environment. in the plugins sdk's ext directory you can also create an ext plugin in a liferay maven project this tutorial covers how to create an ext plugin in a plugins sdk project using this is shown from both liferay ide and the terminal. create liferay maven projects, see the tutorial creating liferay maven plugins from ide or the tutorial creating liferay maven plugins from the command line first, follow along with creating an ext plugin using liferay ide! follow the steps below, replacing the project name with your own, and you'll enter your project's name and its display name. note that the display name field is automatically filled in with the capitalized version of the project name leave the use default location checkbox checked. the default location is set to your liferay plugins sdk's location. like to change where your plugin project is saved, uncheck the box and select the ant liferay-plugins-sdk option for your build type your configured sdk and liferay runtime should already be selected. haven't yet pointed liferay ide to a plugins sdk, click configure sdks to open the installed plugin sdks management wizard. new server runtime environment wizard if you need to set up your runtime server; just click the new liferay runtime button next to the liferay select ext for your plugin type figure 1 you can create an ext plugin project with liferay ide the plugins sdk automatically appends -ext to the plugin project name when it a completely new plugin or add a new plugin to an existing plugin project to create a new ext plugin from the terminal, navigate to the ext directory in your liferay plugins sdk and enter the command below that is appropriate for the two arguments after the create command are the project name and display name, respectively. the examples below use the project name example and the display name example. make sure to specify values you want to use for your ext plugin's project name and display name a build successful message from ant tells you there's a new folder e.g., folder example-ext for a project named example inside your plugins sdk's the plugins sdk automatically appends -ext to the project name there are a few things to note about an ext plugin's directory structure. is a listing of an ext folder structure. the screenshot that follows this listing shows the structure of the ext plugin in liferay ide here are detailed explanations of the docrootweb-inf subdirectories ext-implsrc contains the url configuration file, custom implementation classes, and classes that override core classes from ext-libglobal contains libraries to be copied to the application server's global classloader upon deployment of the ext plugin ext-libportal contains libraries to be copied inside liferay's main these libraries are usually necessary because they're invoked from classes you add in ext-implsrc ext-servicesrc contains classes that should be available to other plugins. in advanced scenarios, this folder can be used to hold classes that overwrite service builder puts services' interfaces ext-webdocroot contains the web application's configuration files, including url, which allows you to customize liferay's core are recommended for customizing a struts action. ext-util-bridges, ext-util-java and ext-util-taglib these folders are needed only in scenarios where you need to customize classes of these liferay libraries url, url and url, if you're not customizing any of these libraries, you can ignore by default, several files are also added to the plugin. url the ant build file for the ext plugin project contains plugin-specific properties, including the plugin's display name, version, author, and license type. however, you should use a hook plugin to override properties whenever it's possible. an example where an ext plugin is necessary to override a property is when specifying a custom class as a you can use a url file with each of your ext plugins, but don't override the same property from multiple url filesthe loading order isn't assured and you can cause unintended system behavior as a result tip after creating an ext plugin, remove from docrootweb-infext-webdocrootweb-inf the files you don't need to customize. liferay keeps track of the files deployed by each ext plugin and won't let you deploy multiple ext plugins that override the same file. you're not customizing, you'll avoid collisions with ext plugins deployed you've now created an ext plugin and are familiar with its directory structure and its most significant files. let's use your ext plugin to customize an ext plugin changes liferay itself when the plugin is deployed; it's not a separate component that can you can easily remove at any time. the ext plugin development process is different from that of other plugin types. it's important to remember that once an ext plugin is deployed, some of its files are copied inside the liferay installation; the only way to remove the changes is by redeploying an unmodified liferay application the plugins sdk lets you deploy and redeploy ext plugins during your redeployment involves cleaning i.e., removing your application server and unzipping your specified liferay bundle to start from that way any changes made to the ext plugin during development are properly applied, and files removed from your plugin by previous changes aren't left behind in the liferay application. because of this added complexity, you should use another plugin type to accomplish your goals whenever before digging in to the details, here's an overview of the ext plugin development processes described below it's time to learn each step of the development process before deploying an ext plugin, you must edit the build.username.properties file in the root folder of your plugins sdk. substitute username with your user id on your computer. once you've opened your build properties file, add the following propertiesmake sure the individual paths reflect the right locations on your your url property must specify the path to your liferay the work directory that you specify for the url property is where you've unzipped your liferay bundle runtime. url property must point to your application server's directory look in your liferay bundle at the path to the application server to determine the value to use for your url for example, if your work directory is cwork, specify it as your cdownloadsliferay-portal-tomcat-6.2.0-ce-ga1-timestamp.zip, set the url property to that file's path. the application server within the liferay bundle.zip file is note some liferay bundles come installed with a sample website. for showcasing certain features of liferay, but if you removed it, you likely don't want it reinstalled each time you unzip the bundle. reinstalling the sample website, unzip the bundle, delete the next you'll modify the ext plugin you created and deploy it your environment is set up and you're ready to start customizing. exercise, you'll customize the sections of a user profile. done using a hook and the url property, but for demonstration purposes, you'll learn how to customize it by overriding portal properties using to customize the url portal property, open the in the customization above, the url property no longer specifies user profile page sections for user groups, personal sites, and only the sections named in the value list for the customized url portal property will be shown in the portal's user profile after you've made customizations in the ext plugin, you can deploy the plugin you can deploy your plugin from liferay ide or the terminal deploying in liferay ide drag your ext plugin project from your package explorer onto your server to deploy your plugin. restarts the server, for the server to detect and publish your ext plugin open a terminal window in your ext plugin project directory and enter one of the direct-deploy target deploys all plugin changes directly to the appropriate directories in the liferay application. creates a.war file with your changes and then deploys it to your server. either way, your server must be restarted after the deployment. direct-deploy is preferred for deploying ext plugins during development if your application server supports it. doesn't work in weblogic server or websphere application server a build successful message indicates your plugin is now being deployed. your console window running liferay shows a message like the following one if any changes applied through the ext plugin affect the deployment process itself, you must redeploy all other plugins. affect the deployment process, it's a best practice to redeploy all your other plugins following initial deployment of the ext plugin the ant deploy target builds a.war file with your changes and copies them to the auto-deploy directory inside the liferay installation. server starts, it detects the.war file, inspects it, and copies its contents to the appropriate destinations inside the deployed and running restart the server so that it detects and publishes your ext plugin once your server restarts, try liferay portal to see the customizations you introduced with your ext plugin tip if you deployed the ext plugin using liferay ide, but you don't see your customizations in the portal, your ext plugin may not have successfully to confirm whether the ext plugin deploys successfully, try deploying from the terminal; the ant deployment targets report success or failure if you customized the url property, for example, log in as an administrator and go to control panel users and organizations. existing user and verify that the right navigation menu only shows the sections that you specified for the url property figure 2 if you customized the url property, liferay portal's user information only shows the sections you specified that was a simple application of an ext plugin. complex customization that illustrates the proper way to redeploy an ext plugin, which is different from initial deployment let's customize the details section of the user profile. its jsp, you'll use a more powerful method for adding new sections or even you can refer to custom sections from the url and implement them just by creating a jsp. the property url again and the property url to set the following properties you removed the original details section and added a custom one called basic. when liferay reads the property, it looks for the implementation of each section based on the following conventions the section is implemented in a jsp in the following directory the name of the jsp is the same as the name of the section with the.jsp if the section name has a dash, - , replace it with an for example, if the section is called my-info, the jsp should be named url to comply with jsp naming standards the section name that's shown to the user comes from the language bundles. when using a keyvalue that is not included with liferay, add it to both your ext plugin's url file and the language-specific properties file for each language variant you're providing a translation for. these files go in the ext-implsrc directory of your ext plugin for this example, you'll create a file in the ext plugin with the following path you can write the contents of the file from scratch or just copy the url file from liferay's source code you can remove some of the fields e.g., birthday or gender, leaving the screen name, email address, first name, and last name fields to simplify user creation and user update. the tags associated with and surrounding the field you don't need to add a new key to url, because an entry for the key named basic is already included in liferay's language bundle let's redeploy the ext plugin to review the changes so far, ext plugin development has been similar to the development of other you've now reached the point of divergence. first deployed, some of its files are copied into the liferay installation. after changing an ext plugin, you'll either redeploy or clean redeploy, depending on the modifications you made to your plugin following the initial let's talk about each redeployment method and when to use each one clean redeployment if you removed parts of your plugin, if there are changes to your plugin that can affect plugin deployment, or if you want to start with a clean liferay environment, undeploy your plugin and clean your application server before redeploying your ext plugins. application server, the existing liferay installation is removed and the bundle specified in your plugins sdk environment e.g., the value of url in build.username.properties is unzipped in its the exact steps you take differ based on whether you're developing in remove the plugin from the server. while selecting the ext plugin in the servers view, select the plugin's remove option remember to shut down the application server this is required on windows because the server process locks the installed liferay bundle's files while selecting the ext plugin project in the package explorer view, select the plugin's liferay clean app server... option figure 3 how to clean app server drag the ext plugin and drop it onto the liferay server while selecting the liferay server in the servers view, click the for each ext plugin you're deploying, enter the following commands into your redeployment if you only added to your plugin or made modifications that don't affect the plugin deployment process, you can redeploy using these steps using liferay ide right-click your plugin located underneath your using the terminal redeploy in the terminal using the same procedure as open a terminal window in your ext plugin project's directory and execute either ant deploy or ant direct-deploy after your plugin is published to liferay portal, check for the customizations if you implemented and deployed the example customizations for the user information page, you can see the customizations by viewing an existing user's information in the control panel implementing and deploying this example customization demonstrates the ext next you'll learn how to package an ext plugin for once you're finished developing an ext plugin, you can package it in a.war file for distribution and production deployment using liferay ide with your ext plugin project selected in the package explorer view, select the project's liferay sdk using the terminal from your ext plugin's directory execute the.war file is written to your liferay-pluginsdist directory you really have the hang of building and packaging your ext plugins! you'll learn about jboss 7 requirements for packaging up an ext plugin that if this doesn't apply to you, feel free to skip over if you're deploying to jboss 7 and you're developing an ext plugin that defines a new tag library, you need to take jboss's classloading behavior into account. before packaging this kind of ext plugin, create a url file in the ext plugin's web-inf folder and add the following contents to it also, in your ext plugin's url file, you must add url to your plugin's list of portal dependency.jar files. here's what the property setting looks like with just once you've made these updates, you can package your plugin and deploy it using the process described previously in this tutorial now that you've learned the basics of ext plugin development and covered this requirement for jboss customizations, you should look at some advanced with ext plugins, you can change anything in liferay. additional customization techniques made possible by ext plugins. with each new version of liferay, there can be changes to the implementation if you change liferay's source code directly, you'll have to merge your changes into the newer liferay version. to minimize such conflicts, the best approach is not to change anything. rather, you can extend the class you want to change and override the required methods. configuration files to reference your subclass as a replacement for the original below, you'll learn about these topics first, you'll learn to use advanced configuration files liferay uses several internal configuration files for its own architecture; in addition, there are configuration files for the libraries and frameworks liferay depends on, like struts and spring. configuration could be accomplished using fewer files with more properties in each, but maintenance and use is made easier by splitting up the configuration properties into several files. customization needs, it may be useful to override the configuration specified in liferay provides a clean way to do this from an ext plugin without modifying the original files all the configuration files in liferay are listed below by their path in an ext here are descriptions of what each file is for and the path to the original file in liferay portal next you can learn how to configure a lucene analyzer liferay uses lucene to facilitate search and indexing within the portal. versions of liferay, you could configure lucene analyzers from a while convenient, it was problematic to have only a single analyzer for all portal-indexed fields. for example, it was difficult to provide correct behaviors for handling both keyword and text fields since liferay 6.1, you no longer configure lucene from a url instead, lucene analyzers are defined in spring configuration files. default analyzer configuration is defined in liferay 6.1 introduced per-field analyzers, allowing lucene's query parser to identify the correct analyzer to there are two common scenarios where it's useful to configure lucene analyzers when creating custom language analyzers to override a liferay language analyzer, and when creating a custom indexer to index new fields. number of language analyzers in url out of the box and uses regular expression matching to map localized fields to specific analyzers. your language is not included among the defaults, or you're not satisfied with one of the default language analyzers, you can override it with a custom if you've created a custom indexer to index new fields, you can use the default analyzer for your new fields, select a specific one such as one of the keywordanalyzers , or define a custom analyzer to customize the lucene analyzer configuration, you must create an ext plugin. the analyzer classes reference the lucene apis directly, so it's not possible to configure lucene analyzers from a hook plugin. and declare the beans you'll override with a custom configuration here are a few of the pre-configured analyzers from the you can define custom analyzers for any fields, including custom fields you can learn how to change the api of a core service next sometimes you might need to change the api of a method provided by one of liferay's services e.g., userlocalservice . this is an advanced customization changing a core service api under normal circumstances requires modifying liferay's source code directly and making manual changes to a slew of files. but that's not the liferay way there's a better way to do it the best way to extend an existing service is by creating a custom service that's complementary e.g., a myuserlocalservice that includes all the new your code can invoke this service instead of the default service, and the implementation of your service can invoke the original service as needed this technique doesn't require an ext plugin since it can be done from portlet in fact, using service builder for an ext plugin is deprecated, but it's supported for migration from the old extension environment sometimes it's desirable to change the implementation of the original service to call your custom one; that's when you'll need an ext plugin. definition for userlocalserviceutil in url and point it to your myuserlocalserviceimpl instead of userlocalserviceimpl . myuserlocalserviceutil and userlocalserviceutil will use the same spring you can also replace core classes in portal-impl. if you're sure you need to change a core portal-impl class, and you're certain it can't be replaced using a configuration file, here's the best way to do it while avoiding conflicts when merging with a new portal version rename the original class e.g., deployutil mydeployutil create a new subclass with the old name e.g., deployutil extends mydeployutil override any methods you need to change use a logger with an appropriate class name for both classes e.g., this strategy helps you determine what you'll need to merge when a new tip this is an advanced technique; it may have a large impact on the seek alternatives, and if you're sure this is your only option, think of it as a short term solution. on contributing an improvement to liferay that's it for advanced customization techniques. often, you can't use ant to deploy web applications in production or additionally, some application servers such as websphere or weblogic have their own deployment tools and don't work with liferay's auto-deployment process. here are two methods to consider for deploying and redeploying ext plugins in production you can use this method in any application server that supports auto-deployment; the only artifact that needs to be transferred to the production system is your ext plugin's.war file, produced using the ant war this.war file is usually small and easy to transport. if this is your first time deploying your ext plugin to this server, skip otherwise, start by executing the same steps you first used to deploy liferay on your app server. if you're using a bundle, unzip it again. if you installed liferay manually on an existing application server, you must redeploy the liferay.war file and copy both the libraries required globally by liferay and your ext plugin, to the appropriate directory within the application server copy the ext plugin.war into the auto-deploy directory. liferay distribution, the deploy folder is in liferay's root folder of once the ext plugin is detected and deployed by liferay, restart your some application servers don't support auto-deploy; websphere and weblogic are with an aggregated.war file, all ext plugins are merged before a single.war file then contains liferay plus the changes from all your ext plugins. before you deploy the aggregated liferay.war file, copy the dependency.jar files for liferay and all ext plugins to the global application server class loader in the production server. location varies from server to server; refer to deployment to get the details for your application to create the aggregated.war file, deploy the ext plugin first to the liferay bundle you are using in your development environment. restart the server so that the plugin is fully deployed and shut it down again. now the aggregated file is ready create a.war file by zipping the liferay web application folder from within copy into your application server's global classpath all of the libraries on which your ext plugins depends now, perform these actions on your server redeploy liferay using the aggregated.war file stop the server and copy the new version of the global libraries to the appropriate directory in the application server next we'll show you how to migrate your extension environment from older versions of liferay into ext plugins because ext plugins are an evolution of the extension environment provided in liferay 5.2 and earlier, you might need to migrate your extension environment into ext plugins when upgrading liferay. if you need to do this, we have good news; migrating is automated and relatively easy tip when migrating an extension environment, first consider whether any of the extension environment's features can be moved into other types of plugins. portlets and hooks are designed to meet specific needs and they're easier to additionally, they're easier to maintain since they often require fewer changes when upgrading to a new version of liferay to successfully migrate, execute an ant target within the ext directory of the plugins sdk, pointing to the old extension environment and naming the new remember the three parameters you saw before after executing the target, you should see the logs of several copy operations that take files from the extension environment and copy them into the equivalent directory within the ext plugin see the section creating an ext plugin for an explanation of the main directories within the plugin with the migration process finished, you can upgrade your code to the new version of liferay by completing a few additional tasks. liferay portal is open source software licensed under the lgpl 2.1 license if you reuse any code snippet and redistribute it, whether publicly or to a specific customer, make sure your modifications are compliant with the license. one common way is to make the source code of your modifications available to the community under the same license. make sure you read the license text yourself to find the option that best fits your needs if your goal in making changes is fixing a bug or improving liferay, it could be of interest to a broader audience. consider contributing it back to the project. that benefits all users of the product including you, since you won't have to maintain the changes with each newly released version of liferay. liferay of bugs or improvements in url, to learn all the ways that you can contribute to the liferay portal project in summary, ext plugins are a powerful way to extend liferay. limits to what you can customize with them, so use them carefully. an ext plugin, see if you can implement all or part of the desired functionality through application display templatesdocs6-2tutorials-knowledgebasetapplication-display-templates web plugins offer you a lot of extension capabilities themselves, without introducing the complexity that's inherent with ext plugins. an ext plugin, make your customization as small as possible and follow the instructions in this tutorial carefully to avoid issues customizing liferay portal with hooks developing with the plugins sdk developing plugins with liferay ide creating liferay maven plugins from liferay ide creating liferay maven plugins from the command line";;
the portal defines some settings that allow the theme to determine certain as of this writing, predefined settings are only available for portlet borders, bullet styles, and the site name, but more settings may be you can modify these settings from your theme's time to get on with learning how to customize predefining settings using themes. the first thing to cover is settings for portlet borders by default, the theme turns on portlet borders. setting portlet-setup-show-borders-default to false, in your theme's for example, the following setting makes border display configurable for the site administrator and disables the default behavior of showing the borders now that you've learned how to configure portlet borders, you can learn how to configure bullet styles used in your sites, next several of liferay's core portlets use bullets, and you may have custom portlets in your portal that use bullets too. any portlet can be configured to use any bullet styles inherited by your theme or implemented in your theme. if your theme uses liferay's classic theme as its base parent see you can leverage the classic theme's arrows bullet style the sample code below demonstrates the arrow bullet style class applied from the classic theme's url file to liferay's navigation portlet you can make the above bullet style, for example, along with any bullet styles of your theme available for site administrators to use in their site's just follow the naming convention as demonstrated below, substituting bullet style name, with your bullet style's name then, make the bullet-style setting configurable in your theme's from this setting, you can set a default bullet style and list optional bullet styles you want to make available to site your site administrators can now choose this example bullet style to apply to they select it from the site's look and feel using css and maybe some unobtrusive javascript, you can create a navigation menu that looks just the way you want. next, take a look at how to configure the site name settings let site administrators decide whether to display a if you're using a logo that mentions your company or site on each site page, for example, you may find the default site name display distracting figure 1 by default, themes display the site's title on each page if you're using liferay's unstyled theme as your base theme, you have the following settings available for configuring site name display here is how you might specify them in your url file with these settings configurable, site administrators can control site name display from the each site's look and feel screen for individual portlets, you can modify the portlet's url now that you know how to use the predefined settings available to you in liferay making themes configurable with settings;;
you can provide various flavors of your theme by creating color schemes for color schemes let you keep the styles and overall design for your theme, while at the same time giving a new look for your users to enjoy. color schemes with a css class name, which of course also lets you choose different background images, different border colors, and more figure 1 liferay's classic theme offers three color schemes. you too can offer eye-pleasing color schemes for your themes the example below shows defines a day color scheme and a night color scheme. here's the code as specified in the plugin's url file in your theme's diffscss folder, you can create a colorschemes folder and place a.css file in it for each color scheme your theme supports. don't specify a.css file for a color scheme, the theme's default color scheme in addition to the day and night color schemes, you'll notice that the default color scheme is defined as well. this allows you to return to the default look and feel for your theme. note that color schemes are sorted alphabetically by name rather than id. in the example above, day would be selected by default when you choose the deep blue theme, if the the element overrides the alphabetical sorting and sets the color scheme that is selected by default, when the theme is to make the color schemes of the.css files available, import them into your the example's url and url files could be specified in the url file using these statements the color scheme css class is placed on the page's element, so you can use it to identify your styling. it's conventional to prefix all your css for example, the developer would prefix all the styles with the word day in a color scheme css file named url note that the default color scheme does not require this, as it uses your after specifying your css files, you can create separate thumbnail images for your color schemes element tells liferay where to look for a theme's thumbnail images you only have to place this element in one color scheme for it to affect all of them. for the example above you could use the folders diffsimagescolorschemesnight. in each of your color scheme's folders, images follow the specifications defined in the now you can go color scheme crazy with your themes!;;
"lets use the style of egar allen poe's poem the raven to help us explain liferay to recap, since our narrative is a bit different than poe's original, so far we have you and your cat, lenore ii, sitting by a so you're sitting in your armchair next to the fire, as the maven tutorials shadows dance on the tapestry-covered wall, and lenore ii your cat yes, you're passing this cold winter's night in grand style in front of your computer, of course. sitting on a cold hard metal chair inside an off-white cubicle with empty walls you're still in front of your computer, of course. paint two very different pictures, but both describe what you're doing sitting changing the scenery of your portal sets the mood for your this tutorial shows you how to develop your own theme plugin i.e., your scenery using maven so your portal has a lasting impression on anyone theme plugin creation with maven is similar to portlet plugin creation with if you don't already have a parent maven project, please refer to the that tutorial explains how to create a parent maven project and its to create your liferay theme plugin project, just follow the creating liferay maven plugins from liferay ide creating liferay maven plugins from the command line tutorial, making sure to select theme instead of portlet as the plugin type archetype command line tool to generate your theme project, you can filter on group id liferay, or even the group idartifact id combination liferaytheme, to more easily find the liferay portlet archetypes since it's helpful to familiarize yourself with the liferay theme plugin project's anatomy, that topic is covered next a theme project created from the the srcmainwebapp folder holds your theme's customizations. used the same way that the docrootdiffs folder is used in themes developed if you're using the plugins sdk, any of your theme's files that differ from the corresponding files of your theme's base theme go in the docrootdiffs folder. if you're using maven, any of your theme go in the srcmainwebapp folder. for example, if you've modified url in your theme, your url file should go in the here's a table describing the directory structure differences between themes created using maven and themes created using the plugins sdk as with any maven project's pom, you use the theme project's pom to define the project's artifacts and specify its dependencies the theme plugin project pom has two additional properties artifact as the parent using the syntax groupidartifactidversion, or use the core themes by specifying unstyled, styled, classic, or url sets the template theme language the default settings for the two theme properties look like this to deploy your theme plugin, follow the instructions in the deploying liferay plugins with maven note when you execute the package goal, a war file is created; it's just like the maven war type project. simultaneously, the parent theme is downloaded and copied, and your theme's customizations are overlaid last. a thumbnail image of the theme is created and placed in the target directory. targettheme url in your theme project you now know how to create a theme plugin using maven. its file structure and pom, and you know how to deploy the theme.";;
"a portal properties hook lets you override a subset of that define event actions, model listeners, validators, generators, and content note to customize a property that's not found in the url file, you must use an ext plugin url property lets you define multiple action classes to invoke deploying multiple hooks that set such a portal property appends the values to the property's current value. hooks that add login event actions append their action classes to the portal instance's url to determine whether a property accepts multiple values. description might explicitly mention it or show value lists assigned to a default or example property setting for example, the url property is either true or modify single value properties from one hook only; otherwise there's no telling which value will be assigned here's how to override a portal property using a hook in the plugin's web-infsrc folder, create a url file and override properties with the values you want in the plugin's url file, add the following portal-properties element as a child of the hook element. you've modified the portal property. server administration page's properties screen in the control panel shows your new property setting creating plugins using the plugins sdk";;
would you like to modify the search summaries, indexes, and queries available in developing an indexer post processor hook lets you do just the indexer hook implements a post processing system on top of the existing indexer, letting you modify your portal's search, index, and query in this tutorial, you'll run through a simple example to learn what you can accomplish with an indexer hook. for this example, you'll add job title into the user indexer, so you can search for users by job title if you don't yet have a hook project, create one following the steps in the creating a hook project in the plugins sdk in your hook project, open url and insert the following lines before the closing tag you specify the indexer's model entity in the indexer-class-name element and specify your custom indexer post processor class in the in your hook project's docrootweb-infsrc folder, create your custom indexer post processor class and its package. notice the sampleindexerpostprocessor class extends liferay's the sampleindexerpostprocessor class' postprocessdocument method adds the job title field, enabling users to you've just extended an indexer! you now need to reindex the portal. go to the control panel and click click on the execute button for the action figure 1 click execute to reindex the search indexes navigate to control panel users and organizations all assign the user a job title e.g., blogger and test the indexer hook by searching for the user by the job title you figure 2 by extending the indexer post processor for a model entity, you can search for instances of that model based on the fields you add to the indexer post processor. in this example, you extended the user entity's search index to include job title so you could search for users by job title e.g., blogger now you know the basics of extending the indexer post processor using a customizing liferay portal with hooks developging plugins with liferay ide;;