text;
stringlengths
5
32.6k
liferay dxp 7.0 continues to use you can focus on your application's business logic instead of its persistence it still generates model classes, local and remote services, and this tutorial demonstrates upgrading a liferay plugins sdk 6.2 portlet called guestbook portlet project guestbook-portlet . writing a data-driven application section of the liferay portal 6.2 learning path writing a liferay mvc application figure 1 the guestbook portlet to model guestbooks and guestbook entries to get the most from this tutorial, you can download and refer to the the guestbook portlet has the following characteristics upgrading most service builder portlets involves these steps to update the code and resolve compilation issues quickly. remaining compilation errors manually the guestbook portlet has the following compilation error the url file specifies a tag library attribute total that doesn't exist remove the total attribute assignment to make the tag like this that's the guestbook portlet's only compilation error you need to fix manually since the guestbook portlet's dependencies haven't changed, there aren't any if you need to adapt a portlet's dependencies, refer to tutorial resolving a plugin's dependencies as you did in liferay portal 6.2 the guestbook portlet's url file specifies exception class names in in liferay portal 6.2, service builder generates exception classes to the path them to package-pathexception for example, the guestbook portlet's package path is its exception class for exception element update references to your portlet's exception classes deploy the portlet as you normally would. the server prints messages indicating deploying the guestbook portlet produces these messages the portlet is now available on liferay dxp congratulations on upgrading and deploying a portlet that uses service builder migrating plugins sdk projects to workspace and gradle migrating data upgrade processes;;
using external artifacts in your project requires configuring their to do this, look up the artifact's attributes and plug them into dependency entries for your build system either your build system downloads the dependency artifacts your project needs to compile successfully before specifying an artifact as a dependency, you must first find its artifacts have these attributes this tutorial shows you how to make sure your projects have the right each liferay artifact is a jar file whose meta-infmanifest.mf file contains the manifest also specifies the artifact's for example, these two osgi headers specify the artifact id and important artifacts in liferay dxp fix packs override liferay dxp subfolders of a fix pack zip file's binaries folder if an installed fix pack provides an artifact you depend on, specify the version of that fix pack artifact in your dependency this table lists the group id, artifact id, version, and origin for each core next, you'll learn how to find artifacts for liferay dxp apps and independent independent modules and modules that make up liferay dxp's apps aren't part of the you must still, however, find their artifact attributes if you want to declare dependencies on them. the resources below provide the artifact details for liferay dxp's apps and independent modules important url is the group id for all liferay dxp's apps and the app manager is the best source for information on deployed modules. knows what's deployed on your liferay dxp server. you can use it to find whatever follow these steps to get a deployed module's information in liferay dxp, navigate to control panel apps app search for the module by its display name, symbolic name, or related you can also browse for the module in its app. or searching, the app manager shows the module's artifact id and version figure 1 you can inspect deployed module artifact ids and version numbers figure 2 the app manager aggregates liferay and independent modules if you don't know a deployed module's group, use the open a gogo shell session by entering the following into a command prompt this results in a g! the felix gogo shell command prompt search for the module by its display name e.g., liferay bookmarks api or in the results, note the module's number. for example, these results show the liferay bookmarks api to list the module's manifest headers, pass the module number to the in the results, note the bundle-vendor value you'll match it with an artifact group in a later step disconnect from the gogo shell session search for the module by its artifact id determine the group id by matching the bundle-vendor value from step 3 with a group listed that provides the artifact next, you'll learn how to use liferay dxp's reference documentation to find a liferay dxp app module's attributes liferay dxp's app javadoc lists each app module's artifact id, version number, and this is the best place to look up liferay dxp app modules that aren't yet deployed to your liferay dxp instance note to find artifact information on a core liferay dxp artifact, refer to follow these steps to find a liferay dxp app module's attributes in the javadoc navigate to javadoc for an app module class. if you don't have a link to the class's javadoc, find it by browsing on the overview page, search for the package name you copied in step 2 the heading above the package name shows the module's artifact id, version remember, the group id for all app modules is figure 3 liferay dxp app javadoc overviews list each app module's display name, followed by its group id, artifact id, and version number in a colon-separated string. note module version numbers aren't currently included in any tag library next, you'll learn how to look up artifacts on mvnrepository and maven central most artifacts, regardless of type or origin, are on these sites can help you find artifacts based on class packages. include an artifact's id in the start of an artifact's package names. example, if you depend on the class url.component, search for the package name url on one of the maven sites note make sure to follow the instructions listed earlier to determine the version of liferay artifacts you need now that you have your artifact's attribute values, you're ready to configure a specifying dependencies to build systems is straightforward. build file, specifying a dependency entry that includes the group id, artifact note to configure third-party libraries in a module, see the tutorial adding third party libraries to a module note that different build systems use different artifact attribute names, as the following examples demonstrate configuring a dependency on liferay's journal api module for gradle, maven, and ivy here's the dependency configured in a url file here's the dependency configured in an url file liferay dxp exports many third-party packages. if you're developing a war, deploy it to check if the packages you're using are in the osgi runtime container already. specify their corresponding artifacts as being provided. don't deploy a provided package's jar again or embed the jar in your project. exporting the same package from different jars leads to split package issues, whose side affects differ from case to case. third-party library not an osgi module, refer to if you're developing a war that requires a different version of a third-party liferay dxp or another module exports, if the package provider is an osgi module, publish its exported packages by otherwise, follow the instructions for adding a third-party library not an osgi module now you know how to find artifacts and configure them as dependencies. that's a skill you can depend on! third party packages portal exports;;
in this tutorial, you'll learn how to search for portal services and portlet you can find liferay's services by searching for them in the javadocs first, you'll learn how to find a portal service using liferay's javadocs searching for liferay portal services is easy and intuitive. options, portal-impl and portal-kernel, are the most popular options when searching for liferay's javadocs. in summary, the portal-kernel directory provides interfaces and utils, and the portal-impl directory provides service implementations that implement those interfaces. are miscellaneous util and test classes that are used in liferay dxp liferay's javadocs are easy to browse and well-organized. organization services, for example in your browser, open up the javadocs you're offered several options, which were discussed earlier. under portal kernel, click on the link for the url package, since the services for the organization entity belong to the portal scope find and click on the localservice class in this case, organizationlocalservice in the class summary table or the classes what if you want to find module services searching for liferay module services is also easy. hosted on liferay's nexus repository, and can be viewed by downloading and extracting the module's url file. module's java api is organized by reading the here's an example of how to find services for a bookmarks entry then select the appropriate version select the url version url link, which extract the jar file, once downloaded open the extracted contents and select the url file select the url package from the main view, and then select the bookmarksentrylocalservice class in the class summary you've successfully located the bookmark entry's services another easy way to search for services in module projects is by importing them for liferay developer studio, you can right-click in the package explorer and module, select the build type, and click finish. module services from liferay developer studio now you're ready to invoke liferay services every liferay service provides a local interface to clients running in the same many local services e.g., localservice classes are called by remote services e.g., service classes. the complexity of the local service implementations and include permission the core liferay services that are provided as part of liferay portal were generated by the same service builder tool that you can use in your you can invoke a remote liferay service by calling the appropriate localservice or service class. the following code found in the journal-content-web module demonstrates how to retrieve the portal instance's group by calling liferay's grouplocalservice by liferay convention, the grouplocalservice instance variable is created and set for usage in the class it's called from the unbind- annotation retrieves a reference to a service of type grouplocalservice, and ignores how this service has been published and besides the services service builder made available for your application, you can also access any service published within the osgi registry. following services are available some types of portlets don't have access to the osgi registry using declarative services e.g., spring mvc and jsf. you can call osgi services in these portlets by using service trackers you'll learn more about referencing osgi services next all the services created within your service builder application are wired using this uses aop proxies to give your services the ability to deal with transactions, indexing, and security in many cases, however, you'll need to reference an external service i.e., something that is not defined within your spring application context. has included the ability to reference osgi services from your spring beans using you'll step through a simple example next suppose you're building an application with a simple entity defined in your the application needs to send an sms every time a new entity is created, and the smsservice is provided by a module installed in the how would you get a reference from the -localserviceimpl spring bean to an you can do this by using the annotation using this annotation lets you retrieve a reference to an osgi service from a this provides some nice benefits. not available, the whole spring context is not created until the service is likewise, if the smsservice suddenly disappears, the whole spring application context is destroyed. this makes our spring apps much more robust fortunately, service builder generates this kind of code every time you have a reference to an entity which is not defined in your url file. example, imagine that your entity has a reference provided in your url the generated code for this entity would look like the following you know how to find liferay's core and module services, and can invoke you also learned about referencing osgi services;;
connecting to an application server's jndi data sources from liferay dxp's osgi environment is almost the same as connecting to them from the java ee in an osgi environment, the only difference is that you must use liferay dxp's class loader to load the application server's jndi classes. following code demonstrates this the example code sets liferay dxp's classloader on the thread to access the jndi after working with the data source, the code reinstates the thread's here are the class imports for the code above your applications can use similar code to access a data source. substitute jdbctestdb with your data source name note an osgi bundle's attempt to connect to a jndi data source without using liferay dxp's classloader results in a url.classnotfoundexception. for example, here's an exception from attempting to use apache tomcat's jndi api without using liferay dxp's classloader an easier way to work with databases is to connect to them using service builder connecting service builder to external data sources;;
servlet-based portlets have little overhead and are easy to upgrade. tutorial shows you how to upgrade them and refers to code from before and after upgrading a sample servlet-based portlet called sample json project the portlet shows a click me link. the link, the liferay logo appears figure 1 the sample json portlet displays text stating click me that you can click to initiate an action to get the most from this tutorial, you can download and refer to the here are the sample portlet's characteristics follow these steps to upgrade a servlet-based portlet adapt the code to liferay dxp 7.0's api makes adapting a portlet's code straightforward, and it automates much of the the sample portlet relied on liferay portal to provide several dependency jar here's the portal-dependency-jars property from the portlet's instructions for using packages that liferay dxp exports are found liferay dxp 7.0's core system exports the package this portlet needs from each of the upgraded sample portlet continues to specify these jars in the they're made available to the portlet at but to avoid packages from compile time conflicting with the core system's exported packages, the liferay plugins sdk 7.0 excludes the jars from next, deploy your portlet as you always have the server prints messages that indicate the following portlet status note on deploying the sample upgraded portlet, the wab warns that the portal-dependency-jars property is deprecated for running on liferay dxp 7.0, it's fine to specify the portal-dependency-jars for using packages that exports. using a dependency management tool this helps prepare it for future liferay dxp versions and the portlet is installed to liferay dxp's osgi runtime and is available to users figure 2 clicking on the sample portlet's click me link shows the liferay logo you've upgraded and deployed your servlet-based portlet to migrating plugins sdk projects to workspace and gradle migrating data upgrade processes;;
liferay jsf portlets are easy to upgrade and require few changes. project, which encapsulates liferay dxp's java api and javascript code. of this, upgrading jsf portlets to liferay dxp 7.0 requires only updating there are two ways to find a jsf portlet's dependencies for liferay dxp 7.0 in this tutorial, you'll see how easy it is to upgrade a liferay portal 6.2 jsf portlet jsf 2.2 to liferay dxp 7.0 by upgrading the sample jsf applicant this portlet provides a job application users can submit figure 1 the jsf applicant portlet provides a job application for users to submit for reference, you can download the follow these steps to upgrade your liferay jsf portlet open your liferay jsf portlet's build file e.g., url, url to where the dependencies are configured and generate a dependency list by choosing the environment to which you want figure 2 the liferay faces site gives you options to generate dependencies for many environments compare the generated dependencies with your portlet's dependencies and make for the sample jsf applicant portlet, only one the liferay faces bridge ext dependency must be updated to version 5.0.0 the updated dependency should look like this your liferay jsf portlet is upgraded and deployable to liferay dxp 7.0! you deploy a liferay jsf portlet to liferay dxp 7.0 the same way you deploy to when the plugin war file lands in the liferayhomedeploy folder, liferay dxp's plugin compatibility layer converts the war to a web application bundle wab and installs the portlet as a wab to liferay dxp's osgi on deploying an upgraded portlet, the server prints messages that indicate the deploying a liferay jsf portlet produces messages like these after the portlet deployment is complete, it's available on liferay dxp you've learned how to upgrade and deploy a liferay jsf portlet. dependencies and deployed the portlet as you always have.;;
when developing an application, it's important to think about the different configuration options that your application should support. to think about how users should be able to access your application's liferay dxp supports a flexible mechanism for configuring making your applications configurable in this tutorial, you'll learn to implement a configuration action. the configuration action is invoked when a user clicks on the gear icon and gear icon of an application that has not been customized and then select configuration, you'll find two standard tabs permissions and sharing. tabs provide standard options for configuring who can access your application and how you can make your application more widely available. instructions in this tutorial, you'll learn how to create a setup tab that allows custom configuration fields to be manipulated. configuration action, follow these steps note to quickly see a working configuration action, deploy the and add the blade message portlet to a page. change the configuration options and save them to see them in action tutorial, if you want to make your application configurable, you should create a java interface to represent the configuration. decorate your interface with the.ocd annotation and specify a unique id using the annotation's id a common pattern is to use the fully qualified class name of the interface for the id since fully qualified class names are unique. methods to represent configuration fields and decorate the methods with the.ad annotation. the return type of the method specifies the type of the to specify a field's default value, use the annotation's deflt to specify that a field is optional, set requiredfalse. information about the meta.ocd and meta.ad annotations, please see the add the following line to your project's url file this line lets bnd use your configuration interface to generate an xml this lets liferay dxp auto-generate a ui for your configuration in the system settings area of the control panel. sometimes preferable for users to be able to access your configuration directly from the portlet without having to go to the control panel. you'll learn how to facilitate this this sample configuration contains a single string field called favoritecolor tutorial, if you want a reference to the configuration in your application class, you need to declare the configuration as a volatile member variable, decorate your application class with the annotation, specify the appropriate configurationpid in the annotation, add an appropriately annotated activate method that instantiates the configuration variable, and add a public getter method for each configuration field. simple example that makes the sample configuration discussed earlier available in this example, overriding the doview method is not strictly necessary. however, it's useful since adding the configuration to the request object before calling url makes the configuration able to be read from the request to implement a configuration action, you should create a class that extends liferay dxp's defaultconfigurationaction class. then you need to add a reference to your configuration the same way that you added such a reference to your declare the configuration as a volatile member variable, decorate your configuration action class with the annotation, specify the appropriate configurationpid in the annotation, add an appropriately annotated activate method that instantiates the configuration variable, and add a public getter method for each configuration field next, you should specify configurationpolicy configurationpolicy.optional in that the component is created regardless of whether or not the configuration was you also need to specify the portlet to which your configuration action to do so, make the following specification in your class's your component should be registered as a configuration action class so you should specify service url in your class's next, you should override the processaction method so that it reads a url parameter from the action request, sets the value as a portlet preference, and invokes the processaction method of the settingsconfigurationaction ancestor finally, you should override the include method so that it sets the configuration as an attribute of the http servlet request and then invokes the include method of the basejspsettingsconfigurationaction class. now that your configuration action class has been created, you're ready to create a user interface for selecting configuration options and submitting the when creating a jsp-based user interface, it's convenient to create an url page for your application. the url page should contain all of the imports, tag library declarations, and other page components are required by each of your other pages should import url so that you liferay dxp follows this convention this jsp not only declares some tag libraries and imports some classes. make certain variables available on the page. the scriptlet at the end of the file uses one of these variables, renderrequest, to get the configuration which was stored in the renderrequest by your portlet's doview method. finally, the value of a specific field favoritecolor is read from the the default view of your application is provided by your application's your url should import your url so that the same tag libraries, imports, and variables are available on the page. this jsp simply checks whether or not the favoritecolor variable is empty. it's empty, a message is displayed that tells the user that they need to select a favorite color in the portlet's configuration. is not empty, the name of the selected color is displayed in the selected color. key must be specified in your application's url file. default location for this file is in the content package the configuration user interface of your application is provided by your this interface is displayed on the setup tab when a user clicks on your application's gear icon and then selects as previously discussed, your url should import tags to construct two urls in the variables configurationactionurl and configurationrenderurl. form that allows the user to select a favorite color. form, the configurationactionurl is invoked and the application's processaction method is invoked with the favoritecolor included as a if the request fails, the user is redirected to the configuration page it's a best practice to supply a url parameter named cmd constants.cmd equals cmd whose value indicates the purpose of the request. the value of the cmd parameter is update constants.cmd equals update many core applications read the value of the cmd parameter and perform some processing depending on its value if you're developing an application using the example code from this tutorial, deploy the application to liferay dxp, add it to a page, and click on the options select a favorite color and click save. selection was saved as a portlet configuration setting, look for the application to display a message like this now you know how to create application configurations and how to create a mechanism to allow users to edit the configuration.;;
this tutorial describes how to take an existing portlet developed for liferay portal 6.2 or prior, which uses portlet preferences to allow administrators to configure the portlet, and convert it to use the new configuration api for more information on the configuration api and the recommended ways to develop configurable applications for liferay dxp 7.0, please see the making your applications configurable before you start, it's important to understand the benefits of making this that will allow you to decide whether to go ahead with the change or not, since previous configuration mechanisms of liferay portal 6.2 and prior still work ability to modify the default portlet preferences through the new system previously the default configuration of a portlet could only be set by modifying the url file, which was not easy to extend in the future liferay will support modifying the default values for any portlet using this api for each company or site. won't need to make any change to benefit from this you can now use the portletpreferences api to allow users to have their own personal preferences for the portlet, which was the original intention of this have full programmatic control of the scope of the configuration portlet instance or group, instead of leaving it to the url file it becomes easier to read the configuration of the portlet from any class or the configuration is also presented as a typed object which reduces the possibility of error reading a property name or type one final thing to note is that using the new configuration api preserves all existing configurations of the portlet, since it uses the same persistence storage the portletpreferences table. that means that you can deploy a new version of the portlet to a running system and the existing portlets that may have been added to its pages and configured will not need to be reconfigured if your existing liferay portal 6.2 or prior application uses portlet preferences and you have decided to convert it to use the new configuration api, follow these steps identify the existing preferences of the portlet configuration for example, you could check the url where you will find dom elements with the name preferences--xxx--, where xxx is the name of determine the scope of the portlet configuration. specifying it is through url. preferences-company-wide, preferences-unique-per-layout and preferences-owned-by-group to determine the right scope. related to this, we make the following recommendations for the scope of the for any portlet that can be added to a page it should be portlet instance for any portlet that is accessible through the product menu and is used to administer the site it should be group create a java interface that will represent the configuration, with one by liferay's convention, the suggested names for these interfaces are portlet nameportletinstanceconfiguration for the portlet scoped ones or portlet namegroupserviceconfiguration for the group scoped ones. you can choose different conventions this interface will use two annotations .ocd and to declare that it represents a configuration and to specify the desired scope. the id specified in the.ocd annotation must be the fully qualified class name of the interface in the code above replace category with a category name of your choice. of the box liferay uses wem, forms, collaboration and foundation. portlet fits in any of those go ahead and use them. name it will be added, but you will need to provide a translation as well if you want to specify the name of the configuration as it will appear in system settings and optionally translate it to several languages add the attributes name and localization to specify the location of a resource bundle file to the.ocd annotation create one class that implements the configuration bean declaration interface to let the configuration framework know about the configuration change the configuration jsp to retrieve the configuration using the if the scope is portlet instance the configuration can be retrieved from portletdisplay once the configuration object is obtained, the individual preferences can now be changed from this... to this finally it is usually necessary to read the configuration from java classes in cases where the portletdisplay is not available, or when the scope is group or company, the portletprovider class offers methods the best way to access the portletprovider depends on who is making the invocation within an osgi component a reference to the configurationprovider can be within a service created with service builder the code is very similar for all other cases it is preferred to get the configuration injected or as a last resort it is possible to use configurationproviderutil to obtain the configuration, although this method might have issues in highly dynamic environments;;
here are the ways to configure logging for module classes and class hierarchies here's an example log4j xml configuration use category elements to specify each class or class hierarchy to log messages set the name attribute to that class name or root package. category sets logging for the class hierarchy starting at package url. messages at or above the debug log level are printed for classes in url and classes in packages starting with url set each category's priority element to the log the log messages are printed to liferay log files in liferayhomelogs you can see examples of module logging in several for example, the action-command-portlet, samples among others leverage module logging note if the log level configuration isn't appearing e.g., you set the log level to error but you're still getting warn messages, make sure the log configuration file name prefix matches the module's symbolic name. bnd installed, output from command bnd print path-to-bundle includes the are instructions for installing bnd for the command line note a log4j configuration's appenders control log file location, naming, and rotation. to override advanced log4j options such as liferay dxp's log appenders, use an ext plugin that's it for module log configuration. you're all set to print the information;;
when you're developing a liferay dxp application, it's often necessary to use various liferay dxp apis or tools. for example, you might want to create a service builder application or use liferay dxp's message bus or asset framework. you determine which versions of liferay dxp artifacts modules, apps, etc. your application's modules need to specify as dependencies? configure liferay dxp dependencies, please refer to the following tutorial;;
liferay faces is an umbrella project that provides support for the javaservertm faces jsf standard within liferay portal. in this section of reference documentation, you'll learn more about each of you'll also learn about the liferay faces version scheme.;;
now that your development environment build configuration is settled, you can start upgrading your projects. the two most common upgrade problems are visit these upgrade problem tutorials for tips on how to fix them this tutorial is heavily focused on the liferay upgrade planner. upgrading your code manually, continue to the listed tutorials above to fix your you'll begin auto-correcting upgrade problems first initiate this step to auto-correct straightforward updates like if you choose to preview the auto-correct upgrade problems first, you can view them in the project explorer under the liferay upgrade problems dropdown. you click one of the upgrade problems listed with the preview, you're offered documentation in the liferay upgrade plan info window on the proposed change once you've performed this step, the result list is removed initiating this step finds the upgrade problems that were not eligible for the problems are listed under the liferay upgrade problems if you click one of the upgrade problems listed with the preview, you're offered documentation in the liferay upgrade plan info window on the these upgrade problems are available in the for the version upgrade you're performing the next step is resolving the reported upgrade problems now that the upgrade problems have been located, you must resolve them. select each upgrade problem, the documentation for how to adapt your code is displayed in the liferay upgrade plan info window for each upgrade problem node, you're also given the version the upgrade problem applies to e.g., when upgrading to liferay dxp 7.2 from liferay portal 6.2, you could have upgrade problems from the 7.0, 7.1, or 7.2 upgrade. through the reported problems, mark them as resolvedskipped using the context you can right-click on the problem in the project explorer and choose from leave this step marked as incomplete until you have resolved all upgrade after resolving all the reported upgrade problems, you must remove all previously found markers because, in most cases, the line number and other accompanying marker information are out of date and must be removed before initiate this step to remove all the problem markers you've fixed all the upgrade problems that could be automatically detected by the upgrade planner. next, you'll take a deeper look at resolving;;
to determine why javascript and css updates to your module aren't having an effect in your browser, perform these checks if you're developing a portlet module, check that your portlet class has the correct properties specified in its annotation for example, consider this sample portlet class as described in the first item above, the portlet's css file is specified by values of this property are relative to the module's of url, the actual path to the css file in the module is portlet's javascript file is specified by the property values for this property work the same as the values for the css property also note that the property url specifies the css class wrapper example-portlet. subclasses of example-portlet in your portlet's actual css file. example, in url you'd do this to change the background to green in other words, to avoid css class and id name conflicts, all the css properties you specify must be subclasses of the class specified via the url example-portlet, in this example check that caching isn't preventing js and css updates to your module from using developer mode with themes;;
optional dependency is one your module can use if it's available, but can still important try to avoid optional dependencies. module may be trying to provide distinct types of functionality. situation, it's best to split it into multiple modules that provide smaller, if you decide that your module requires an optional dependency, follow these declare the package that your module optionally requires as an optional dependency in your module's url file note that you can use either an optional or dynamic import. create a component to use the optional package create a second component to act as a controller of the first component. second component checks the classloader for the optional class on the it handles both cases appropriately. means you must catch any classnotfoundexception. if the classloader check in the controller component is successful, the client this check is automatically performed whenever there are any wiring changes to the module containing these components declarative services components are always restarted when there are wiring changes as above, if you install the module when the optional dependency is missing from classnotfoundexception and logs a warning or info message or takes whatever other action you implement to handle this case. dependency, refreshing your module triggers the osgi bundle lifecycle events that trigger your controller's activate method and the check for the optional since the dependency exists, your client component uses it note that you can refresh a bundle from liferay dxp's gogo shell with this for more information about optional dependencies, see;;
liferay dxp 7.0 uses the log4j logging framework, but a different one may it's a best practice to use simple logging facade for java slf4j to log messages in your modules and slf4j is already integrated into liferay dxp, so you can here's how to use slf4j to log messages in a class throughout your class, log messages where noteworthy things happen use logger methods appropriate for each message log verbosity should correlate with the log level set for the class or package. make sure you provide additional information at log levels expected to be more verbose, such as info and debug you're all set to add logging to your modules and traditional plugins.;;
liferay dxp's data can be retrieved using its apis. understand how data is used amid all of liferay dxp's constructs. level, all the data is represented by an object model. the database and automatically mapped from sql to the model by you can listen for events on these models and take action when they are stored to a context a site, a page, or global. when storing data in your application, you should therefore take advantage of scope so your application integrates well with the system and users can add your application in whatever scope they read on to learn how to do both of these things.;;
you can invoke the remote services of any installed liferay application the same way that you invoke your local services. invoking remote services locally. one reason to invoke a remote service instead of the corresponding local service might be to take advantage of the remote service's permission checks. consider the following common scenario in the above scenario, it's a best practice to invoke the remote service instead doing so ensures that you don't need to duplicate this is the practice followed by the services in of course, the main reason for creating remote services is to invoke them service builder can expose your project's remote web services both via by default, running service builder with remote-service set to true for your entities generates a json web services you can access your project's json-based restful services many default liferay services are available as web services. web services via soap and json web services. if you're running liferay locally on port 8080, visit the following url to browse liferay's default soap web to browse liferay's default json web services, visit this url by default, the context path is set to which means that core liferay by default, the page shows the json web services in the portal context. context in the context name selector menu. context name shows you the json web services in liferay's web content app this app's entities all begin with journal . you can also access a context's for example, the url for the web content important to invoke liferay services remotely, your liferay instance must be configured to allow remote web service access. understanding liferay's service security model each entity's available service methods are listed in the left column of the to view details about a service method, click it. full package path to the service's impl class is displayed along with the method's parameters, return type, and possible exceptions. for example, in the portal context click the announcementsentry entity's get-entry method. method's details page, where you can also invoke the service figure 1 the json web services page for an entity's remote service method also lets you invoke that service the only parameter required to invoke the get-entry method is an entryid. invoke this web service, you could enter an announcement entry's id in the entryid field and then click invoke. liferay returns feedback from each invocation that indicates, for example, whether the service invocation succeeded invoking remote services in this manner is a great way to test your service builder can also make your project's web services available via soap after you've built your -service project's wsdd web service deployment descriptor and deployed your project's modules, its services are available on your liferay server. you can view your liferay instance's and app's soap services in a browser as described in the tutorial when viewing your soap services in a browser, liferay lists the services available for all your entities and provides links to their wsdl documents. example, clicking on the wsdl link for the user service takes you to the this wsdl document lists the entity's soap web services. wsdl is available, any soap web service client can access it. soap web service client implementations, see the tutorial liferay web services are designed to be invoked by client applications. liferay's web services apis can be accessed by many different kinds of clients, including non-portlet and even non-java clients. develop client applications that can access liferay's json web services, please for information on how to develop client applications that access liferay's soap web services, please see the to learn how to create remote web services for your own application, for more information on liferay services, see the liferay portal ce javadocs at;;
in this tutorial, you'll learn about the differences between local and remote services, and when you should invoke local services rather than their remote once service builder has generated your module project's services, you can call them from anywhere in your application. when invoking a local service, you should call one of the service methods of a localservice class. never call the service methods of an impl class directly. your project are generated automatically when using service builder. set the local-service attribute to true for an entity in the url service builder generates methods that call existing services, but you can create new methods in the localserviceimpl class that can be generated into new exposed methods in your module's services localservice, many of liferay's module applications use their generated remote services for important calls in their controller layer, for example, because they offer conveniences like configured permissions checking. permission check and then invoke the corresponding local service. are many services you'd like to expose only to your local project, and do not want other applications to have access to in the bookmarks application, for example, the interface provides the openentry method, which opens a bookmark for viewing. there are many services that you don't want to expose to other applications in in the example mentioned above, bookmarks are configured to only open locally, meaning that other apps do not have access to open and view a bookmark this should only be done by the bookmarks application. certain cases, you'll need to invoke local services instead of remote services. for more information on invoking remote services, see the to see how you could call a local service from a portlet action class, you'll notice that this class has a private instance variable called the dlapplocalservice instance variable of type dlapplocalservice gets an instance of dlapplocalservice at runtime via the instance variable is set like this this tutorial demonstrated how you can call the local services generated by service builder in your project. to learn how to call liferay services, see the finding and invoking liferay services;;
service builder creates finder methods that retrieve entities by their attributes their column values. when you add a column as a parameter for the finder in your url file and run service builder, it generates the finder method in your persistence layer and adds methods to your service layer if your queries are simple enough, consider using if you want to do something more complicated like joins, you can write your own custom sql queries. you'll learn how in this tutorial say you have a guestbook application with two tables, one for guestbooks and one the entry entity's foreign key to its guestbook is the that is, the entry entity table, gbentry, tracks an entry's guestbook by its long integer id in the table's guestbookid column. want to find a guestbook entry based on its name, message, and guestbook name, you must access the name of the entry's guestbook. join the entry and guestbook tables to include the guestbook name. builder lets you do this by specifying the sql as liferay custom sql and invoking it in your service via a custom finder method liferay custom sql is a service builder-supported method for performing custom, complex queries against the database by invoking custom sql from a finder method service builder helps you generate the interfaces it's easy to do by following these steps access your finder method from your service next, using the guestbook application as an example, you'll learn how to after you've tested your sql, you must specify it in a particular file for customsqlutil class from module retrieves sql from a file called url in your service module's custom-sql folder and create the url file in that custom-sql the url file must adhere to the following format create a custom-sql element for every sql query you want in your application, and give each query a unique id. the recommended convention to use for the id value is the fully-qualified class name of the finder followed by a dot . character and the name of the finder method. more detail on the finder class and finder methods is provided in step 2 for example, in the guestbook application, you could use the following id value custom sql must be wrapped in character data cdata for the sql element. importantly, do not terminate the sql with a semi-colon. the url file of the guestbook application specifies an sql query that joins the gbentry and gbguestbook tables now that you've specified some custom sql, the next step is to implement a the method name for the finder should match the id you just specified for the sql element next, implement the finder method in your persistence layer to invoke your service builder generates the interface for the finder in your api module but you must create the implementation the first step is to create a finderimpl class in the service persistence for the guestbook application, you could create a entryfinderimpl class should extend basepersistenceimpl to generate the finder interface based on the finderimpl class. your finderimpl class to make it a component annotated with that implements the finder interface you just generated now you can create a finder method in your entryfinderimpl class. finder method and static field to the finderimpl class. how you could write the entryfinderimpl class the custom finder method opens a new hibernate session and uses liferay's url clazz, string id method to get the custom sql to use for the database query. findbyentrynameentrymessageguestbookname static field contains the custom the findbyeventnameeventdescriptonlocationname string is based on the fully-qualified class name of the finder interface eventfinder and the name of the finder method your custom sql is in place and your finder method is implemented. next, you'll call the finder method from your service so far, you've created a finderimpl class, generated the finder interface, and created a custom finder method that gets your custom sql. to add a service method that calls your finder 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 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 a jsp for example, to call the finder method in the guestbook congratulations on developing a custom sql query and custom finder for your;;
"if you've already used service builder to define your model entities and have implemented business logic for creating and modifying those entities, you might have some ideas for helping users to submit valid model entity data. example, suppose you're working on a calendar app where users can select a date how can you specify that only future dates are liferay service builder's model hints provide a single place in your application where you can specify entity data model hints are specified in a single file called if your project is comprised of an api module, a service module, and a web module, as is common for liferay dxp 7.0 applications, url should go in the service module. example, in liferay's bookmarks application, the url file goes in the bookmarks-servicesrcmainresourcesmeta-inf folder. hints are referred to as such because they suggest how entities should be model hints let you to configure how the alloyui tag library, aui, shows model fields. as liferay displays form fields in your application, it first checks the model hints you specified and customizes the form's input fields based on these hints. model hints can also be used to specify the size of the database columns used to store the entities and to note service builder generates a number of xml configuration files in your service module's srcmainresourcesmeta-inf folder. most of these files to manage spring and hibernate configurations. the spring or hibernate configuration files; your changes will be overwritten the next time service builder runs. however, you can safely edit the the bookmarks app's model hints file the root-level element is model-hints. all the model entities are represented by model sub-elements of the model-hints element. have a name attribute specifying the fully-qualified model class name. model has field elements representing its model entity's columns. field element must have a name and a type. types correspond to the names and types specified for each entity's columns in the service module's url file. service builder generates all these elements for you, based on url to add hints to a field, add a hint tag inside its field tag. you can add a display-width hint to specify the pixel width used to display the default pixel width is 350. pixels, you could nest a hint element named display-width and give it a to see the effect of a hint on a field, you must run service builder again and note that changing display-width doesn't limit the number of characters a user can enter into the name field; it only controls the field's width in the alloyui input form to configure the maximum size of a model field's database column i.e., the maximum number of characters that can be saved for the field, use the the default max-length value is 75 characters. want the name field to persist up to 100 characters, add a max-length hint remember to run service builder and redeploy your project after updating the so far, you've seen a few different hints. the following table describes the portlet model hints available for use model hint values and descriptions this file contains many hint examples, so you can reference it when customizing you can use the default-hints element to define a list of hints to apply to for example, adding the following element inside a model element applies a display-width of 300 to each field you can define hint-collection elements inside the model-hints root-level element to define a list of hints to apply together. for example, liferay's url defines the following you can apply a hint collection to a model field by referencing the hint like the one above in your model-hints element, you can apply it to your model's date field by using a hint-collection element that references the as always, remember to run service builder and redeploy your project after for example, suppose you want to use a couple of model hints in your project. start by providing users with an editor for filling in their comment fields. apply the same hint to multiple entities, define it as a hint collection. reference the hint collection in each entity model-hints root element in your url file. to reference a hint collection for a specific field, add the hint-collection element inside the field's field element after defining hint collections and adding hint collection references, rebuild your services using service builder, redeploy your project, and check that the hints defined in your hint collection have taken effect you've learned the art of persuasion through liferay's model hints. now you can not only influence how your model's input fields are displayed, but you can also can set its database table column sizes. insert individual hints directly into your fields, apply a set of default hints to all of a model's fields, or define collections of hints to apply at either of you've picked up the hints on how liferay model hints specify";;
"liferay dxp provides many features that help users accomplish their tasks. sometimes, however, you may find it necessary to customize a built-in feature. it's easy to find an area you want to customize, but it may seem like a daunting task to figure out how to customize it. easy customization, meaning there are many extension points you can use to add there's a process you can follow that makes finding an extension point a breeze in this tutorial, you'll learn how to find an extension point. through a simple example that locates an extension point for importing ldap this will require the use of liferay dxp's you must first think of words that describe the application behavior you want to with the right keywords, you can easily track down the desired module consider the example for importing ldap users. keywords for finding the component are import, user, and ldap the easiest way to discover the module responsible for a particular feature in liferay dxp is to use the application manager. the application manager lists app suites and their included modulescomponents in an easy-to-use interface. you'll use your keywords to target the applicable open the app manager by navigating to control panel apps the top level lists app suites, independent apps, and navigate the app suites, apps, and modules, or use search to find components that might provide your desired extension point. keywords in element names and descriptions. the liferay foundation app suite; select it figure 1 the liferay foundation app suite contains the ldap authentication application select the ldap application from the app listing the ldap application only has one module, but typically, applications have more than one module to inspect. select the liferay portal security ldap figure 2 the app manager lists the module, package name, version, and status search through the components, applying your keywords as a guide. component name you think best fits the functionality you want to customize; you'll inspect it later using the gogo shell figure 3 the component name can be found using the app manager note when using the gogo shell later, understand that it can take several tries to find the component for which you're looking; naming conventions should allow you to find your desired extension point in a next, you'll begin using the gogo shell to inspect the component for extension once you have the component that relates to the functionality you want to extend, you can use the gogo shell's service component runtime scr commands to you can execute scr commands using this tutorial assumes you're using the gogo shell via telnet for the ldap example component you copied previously, the command would look the output includes a lot of information. for this exercise, you're interested in the services the component references. example, here's the reference for the service that imports ldap users the ldapuserimporter is the extension point needed to customize the process of if none of the references satisfy what you're looking for, search other components from the app manager if you plan on overriding the referenced service, you'll need to understand the reference's policy and policy option. if the policy is static and the policy option is reluctant, binding a new higher ranking service in place of a bound service requires reactivating the component or changing the target. information on the other policies and policy options, visit the particular, sections 112.3.5 and 112.3.6. override a component's service reference, visit the following important not all extension points in liferay dxp are available as referenced referenced services are common extension points when using declarative services ds, but there are extension points not exposed this way. if your project does not use the ds component framework, you'd need to look for the api that describes its service consumption from the osgi registry. brief list of other potential extension points in liferay dxp you successfully formulated keywords that described the functionality you wanted to customize, used those keywords in the app manager to target the applicable module component, and used the gogo shell to inspect the component for extension points.";;
creating a folder structure a good folder structure facilitates evolving and maintaining code, especially in collaboration. use pre-defined folder structures familiar to developers writing code and configuration files a manifest, java classes, and modules stubbed out with them let developers focus on common build tools that manage dependencies include deployment interacting with the runtime environment to install, there are several good build tools for developing modules on liferay dxp. liferay's opinionated build environment based on gradle and bndtools that simplifies module development and automates much of it note liferay supports developers using their build tool of choice. addition to providing liferay workspace for those who don't already have a preferred build environment, liferay provides good support for maven and gradle. the following tutorials and samples demonstrate developing in these note themes and layout templates are not built as modules. create them, see the themes and layout templates tutorials here are the steps for starting module development on completing this tutorial you'll have created a module and deployed it to a creating and configuring a liferay workspace workspace is straightforward using a tool called blade cli blade. blade is a command line tool that creates workspaces and performs common tasks follow the steps in this tutorial to install blade the blade executable is now in the system path you can create a workspace in the current directory by executing this command its directory structure looks like the one shown in figure 1 liferay workspace aggregates projects so they can leverage the gradle build environment workspace can be configured to use a liferay dxp installation bundle anywhere on url sets the default bundle location to a folder for convenience it's suggested to if you install it to a different location, uncomment the url property and set it to that location note user interfaces in liferay developer studio lets developers create and import to create a project, follow the tutorial creating a liferay workspace project with liferay developer studio the workspace is ready for creating modules blade provides module templates and module samples. files for different types of modules. the samples can be generated in a workspace and demonstrate many module types. developers can use templates and the blade command blade create -l lists the module templates figure 2 blade's create command generates a module based on a template. executing create -l lists the template names creating a module with liferay developer studio here's the command syntax for creating a module module templates and their options are described here's an example of creating a liferay mvc portlet module module projects are created in the modules folder by default here's the module project anatomy the figure below shows an mvc portlet module project figure 3 liferay modules use the standard maven directory structure sample modules are another helpful development resource an alternative to creating a module from a template is to generate a sample developers can examine or modify sample modules as desired this command lists the sample names the figure below shows the listing figure 4 the blade samples command lists the names of sample modules developers can create, examine, and modify to meet their needs here's the blade samples command syntax it creates the sample project in a subfolder of the current folder building a module and deploying it to liferay dxp is easy liferay workspace provides gradle tasks for building and deploying modules. blade's blade gw command solves a common need in gradle projects invoking the gradle wrapper from any project directory. you can use blade gw just as you would invoke gradlew, without having to specify the wrapper path in a module folder, execute this command to list the gradle tasks available workspace uses bndtools to generate the module's osgi manifest.mf file and to compile the module and generate the module jar, the generated jar is in the module project's buildlibs folder and ready for start your liferay dxp server, if you haven't already started it tip to open a new terminal window and the workspace's liferay dxp server bundled with tomcat or jbosswildfly, execute this command blade can deploy modules to any local liferay dxp server. liferay dxp's osgi framework using felix gogo shell and deploys modules directly to the osgi container using felix file install commands. to deploy the module, execute this command also blade lets developers deploy all modules in the current folder tree. deploy all modules in a workspace's modules folder, for example, execute blade deploy in the modules folder if you're using liferay developer studio, you can deploy modules by dragging them from the package explorer onto the liferay dxp server. developer studio provides access to note when deploying a module to liferay dxp using blade cli, the module is directly installed into liferay dxp's osgi container. is stored differently in liferay dxp than if it were copied into the deploying modules with blade cli once you've deployed a portlet module, it's available in the liferay dxp ui under the application category and name you specified via the portlet component's figure 6 here's a bare-bones portlet based on one of liferay's module templates blade lets developers set a watch on changes to a module project's output if they're modified, blade redeploys the module automatically. watch on a module at deployment, execute this command in the module project here's output from deploying and watching a module named url output from the blade deploy -w command indicates that the module is installed and started, reports the module's osgi bundle id, and stands ready to redeploy the module if its output files change congratulations on a great start to developing your module!;;
liferay is very flexible when it comes to supporting different development instead of being pigeonholed into using a specific tool, liferay works with whatever tools you like to use. this set of tutorials describes some of the more popular tools that are used to develop for liferay. looking for the best development tool for liferay, or even a seasoned veteran looking for a tool you may like more than your current setup, this section will;;
to leverage the benefits of modularization in liferay dxp 7.0, many classes from former liferay portal 6 jar file url have been moved into application and framework api modules. the table below provides details about these classes and the modules they've moved to. and each module's symbolic name artifact id are listed, to facilitate this information was generated based on comparing classes in liferay-portal-src-6.2-ee-sp20 to classes in liferay-dxp-digital-enterprise-src-7.0-ga1;;
the url module exports many third party java packages that can cause problems if used improperly. example, uses the compile scope for a dependency that liferay's osgi runtime already provides, the dependency jar is included in the war's web-inflib and deployed in the resulting wab, and two versions of dependency classes wind up on this can cause weird errors that are hard to debug to find a list of the packages exported by url, go to you don't have access to the source code, the same list in a less user-friendly format is in the url file in installed and available in liferay's osgi runtime. one of them, specify the corresponding dependency as being provided provided here's how to specify a provided dependency now you can safely leverage third party packages liferay dxp provides! resolving a plugin's dependencies;;
the osgi framework lets you build applications composed of multiple modules. modules must resolve their java package dependencies for the framework to assemble the modules into a working system. library would be an osgi bundle module, but many libraries aren't. you resolve the packages your osgi module needs from non-osgi third party here is the main workflow for resolving third party java library packages step 1 - find an osgi module of the library projects, such as eclipse orbit convert hundreds of traditional java libraries to osgi modules. are available at these locations deploying the module to liferay's osgi framework lets you share it on the if you find a module for the library you need, then add a compileonly gradle or provided maven dependency for it in your module. when you deploy your module, the osgi framework wires the dependency module to your module. if there's no osgi module based on the java library, go to step 2 tip refrain from embedding library jars that provide the same packages that liferay dxp or existing modules provide already note if you're developing a war that requires a different version of a liferay dxp or another module exports, if the package provider is an osgi module, publish its exported packages by otherwise, rename the third-party library not an osgi jar that the wab generator excludes and embed the jar in your project step 2 - resolve the java packages privately in your module you can copy required library packages into your osgi module or embed them wholesale, if you the rest of the tutorial shows you how to do this note liferay's gradle plugin url automates several third party library configuration steps. gradle module projects created in to leverage the url plugin outside of liferay workspace, add code like the listing below to your gradle project if you use gradle without the url plugin, you'll have to embed the third party libraries wholesale the recommended package resolution workflow is next when you depend on a library jar, much of the time you only need parts of it. explicitly specifying only the java packages you need makes your bundle more this also insulates modules that depend on your module from unneeded here's a configuration workflow that minimizes dependencies and java package add the library as a compile-only dependency e.g., compileonly in copy only the library packages you need by specifying them in a conditional package instruction conditional-package in your url file. conditional-package url adds packages your module uses such as url, url, url to your module's class conditional-package url. adds packages your module uses such as url and all its sub-packages e.g., url, url, etc. to your module's class path if a class your module needs or class its dependencies need isn't found, go back to main workflow step 1 - find an osgi module version of the library to resolve it important resolving packages by using compile-only dependencies and conditional package instructions assures you use only the packages you need and avoids unnecessary transitive dependencies. steps up to this point, as much as possible, to resolve required packages if a library package you depend on requires non-class files e.g., dlls, descriptors from the library, then you might need to embed the library wholesale in your module. this adds the entire library to your module's classpath next you'll learn how to embed libraries in your module you can use gradle, maven, or ivy to embed libraries in your module. examples for adding apache shiro using all three open your module's url file and add the library as a dependency in the compileinclude configuration the url plugin's compileinclude configuration is transitive. the compileinclude configuration embeds the artifact and all its dependencies in a lib folder in the module's jar. also, it adds the artifact jars to the note the compileinclude configuration does not download transitive if your module requires such artifacts, add them as you would another third party library note if the library you've added as a dependency in your url file has transitive dependencies, you can reference them in an -includeresource instruction by name without having to add them explicitly to see how it's used in the maven section next open your module's build file and add the library as a dependency in the open your module's url file and add the library to an this instruction adds the shiro-core-version.jar file as an included resource in the module's meta-inflib folder. url is your module's embedded library. expression 0-9 helps the build tool match the library version to make available on the module's classpath. the embedded jar to the module's classpath via the bundle-classpath lastly, if after embedding a library you get unresolved imports when trying to deploy to liferay, you may need to blacklist some imports the character represents all packages that the module refers to explicitly. bnd detects the referenced packages resolving all of your module's package dependencies, especially those from traditional java libraries, is a quite an accomplishment creating modules with blade cli;;
there are two places in the control panel where you can manage and configure apps the app manager, and the components listing. manage apps in liferay's osgi framework. you can use the app manager to install, activate, deactivate, and delete apps in your liferay instance. apps at the app suite, app, and osgi module levels unlike the app manager, the components listing lets you view and manage apps regardless of liferay's osgi framework. the components listing also differs by letting you view apps by type portlet, theme, and layout template, and set app although the components listing lets you activate and deactivate apps, you can't use it to install or delete apps first, you'll learn how to use the app manager access the app manager by selecting control panel apps app the app manager lists your liferay instance's app suites and apps in the bar above the first table lets you display the contents of you can also sort the tables by title. or down arrows to perform an ascending or descending sort, respectively. search for an app suite, app, or module, use the search bar at the top-right. this is often the quickest way to find exactly what you're looking for figure 1 the app manager lets you manage the app suites and apps installed in your liferay instance each item listed in the tables contains a description if available, version, the status refers to the item's osgi status clicking the actions button to each item's right brings up a menu that lets you activate, deactivate, or delete the to view an item's contents, click its name in the table. suite, a new table lists the suite's apps. if you click an app, a new table if you click a module, a new table lists the module's the component level is as far down as you can go in osgi without after that, it's turtles all the way down. level in the app manager, you can use the link trail above the table to go back for information on using the app manager to install an app, see the article next, you'll learn how to use the components listing access the components listing by selecting control panel the components listing first shows a table containing a list of portlets installed in your liferay instance. type of component to viewportlets, themes, or layout templatesby clicking the matching tab on top of the table. to configure a component, select its name in the table, or select edit from its actions button . doing either opens the same configuration screen figure 2 the components listing lets you manage the portlets, themes, and layout templates installed in your liferay instance the configuration screen lets you view a component's module id and plugin id, activate or deactivate the component, and change the component's add to page the component's module id and plugin id appear at the top of the you can activate or deactivate a component by checking or unchecking the to change a component's add to page permission for a role, select the role's change button in the permissions table. takes you to control panel users roles, where you can change the component's permissions for the selected role figure 3 you can also activate or deactivate a component, and change its permissions now you know how to manage the apps installed in your liferay;;
"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, visit 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 developer studio or a in this tutorial, you'll refer to the event listing example project that's referenced throughout the liferay service builder tutorials now let's learn how to run service builder from the package explorer, open the url file from your -service by default, the file opens up in the service builder make sure you are in overview mode. 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. for information 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 select liferay build-service after running service builder, your generated files are available. information about the generated files appears below open a terminal window and navigate to your module project's root folder, which should be located in your liferay workspace's modules directory. about creating your module project in a creating modules with blade cli to create your own predefined service builder project liferay workspace offers a gradle or maven build environment; this tutorial liferay is tool agnostic, however, and you can use other for gradle projects, enter the following command in your module project's root note liferay workspaces provide the gradle wrapper script for usage, if you don't have gradle installed globally in your classpath. workspace's root folder, so you can call it from your module project's root folder, if necessary e.g.,....gradlew buildservice if your module project uses maven, you can build services running the following command from the module project's root folder important the mvn service-builderbuild command only works if you're using the url plugin version 1.0.145. maven projects using an earlier version of the service builder plugin should using service builder in a maven project tutorial for more information on using maven to run service builder 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 now you'll examine the files service builder generated for your entity. that the files listed under local service and remote service below are only generated for an entity that has both local-service and remote-service service builder generates services for these entities in two locations in your project. these locations use the package path that you for liferay's bookmarks application, for example, these two locations are the following ones the bookmarks-api module contains the api for the bookmarks project. classes and interfaces in the -api module are packaged in a.jar file called url in the module's buildlibs folder. file is generated whenever you compile and deploy your module. this jar to liferay, the necessary interfaces to define the service api are the bookmarks-service module contains the implementation of the interfaces defined in the bookmarks-api module. these interfaces provide osgi services for the portal instance to which your application is deployed. generates classes and interfaces belonging to the persistence layer, service bookmarks-apisrcmainjavacomliferaybookmarks and now you'll look at the classes and interfaces generated for the entities you each entity has similar classes generated for it, depending on what you specfied for them in the url. you won't have to customize more than three classes for each entity. localserviceimpl, serviceimpl, and impl 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 note util classes are generated for backwards compatibility purposes your module applications should avoid calling the util classes 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 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 you've generated your application's initial model, persistence, and service layers and you understand the generated code running service builder and understanding the generated code";;
"an application without reliable business logic or persistence isn't much of an unfortunately, writing your own persistence code often takes fortunately, liferay provides the liferay service builder you might now be thinking, what?! not to fear; you can still write your own persistence code if you and if you choose to use service builder, you can edit and customize the regardless of how you produce your persistence code, you can then use it to implement your app's business logic this section of tutorials shows you how to use service builder to generate your persistence framework and implement your business logic.";;
"modern web apps exchange large amounts of data with clients. specification lets this exchange occur over a full-duplex connection that remains open, therefore enabling real-time communication. efficient than techniques like long polling, which open two connections to emulate a full-duplex connection. for more information on websockets since websockets are ubiquitous throughout the web and in all modern browsers, you need a way to register new websocket endpoints in liferay dxp. websocket whiteboard lets you define new websocket endpoints as regular osgi this tutorial shows you how to do this. there may be instances where you want to use a liferay osgi module in a non-liferay osgi container, and need to define a websocket endpoint. you must register a url.servletcontext service with the property you must also configure the url's serviceloader. can do this by creating your own module as a url fragment. here's an example of a manifest for such a module next, you'll learn how to define a new websocket server endpoint in a liferay defining a new websocket server endpoint in liferay dxp is straightforward. if you're running liferay portal 7.0.2 ga3 or liferay digital enterprise 7.0 fix pack 7 or earlier, add the following property to your otherwise, you can skip this and move on to the deploy the liferay websocket whiteboard module url to your liferay dxp instance. download this module from jcenter or maven central by clicking the respective in your module's build file, add a dependency to the liferay websocket in your module, define a websocket server endpoint as you normally would. note, however, that liferay dxp doesn't currently support the annotation-driven approach; only the interface-driven approach is supported. url with the following properties for example, the following steps show you how to define a websocket endpoint in for the purposes of this example, the portlet also contains a client that communicates with the endpoint. this example portlet, echo portlet, uses websocket functionality to echo a simple message the client sends to the server figure 1 the example echo portlet sends and receives a simple message via a websocket endpoint although the following steps show only code snippets, you can to see the complete example code use these steps to define a websocket endpoint add the websocket dependency to your module's build file. the dependency in a url file note that the annotation contains the required property url, which defines also note that service url in the annotation registers this class as an endpoint service in otherwise, there's nothing special about the echowebsocketendpoint class's code; it resembles that of any other in this example, the echo portlet's url again, there's nothing special about this code; it resembles that of other websocket clients now you know how to create websocket endpoints in liferay dxp";;
you can access liferay's web services via simple object access protocol soap the packaging protocol is soap, and the transport protocol is http note an authentication token must accompany each liferay web service for details, see the tutorial on as an example, consider some example soap web service clients for liferay's company, user, and usergroup services that perform these tasks list each user group the user with the screenname test belongs to add a new user group named mygroup add your liferay instance's administrative user to the new user group. demonstration purposes, you'll use an administrative user whose email you'll use these soap related classes can you see the naming convention for soap related classes? either -servicesoapservicelocator, -servicesoap, or -soap as suffixes. the -servicesoap class is the interface to the services specified in the web services definition language wsdl file for each the -soap classes are the serializable implementations of the models so how do you determine the urls for these services? you can see a list of the services deployed on your liferay instance by opening your browser to the following url note that this url only lists services in the portal context. find services in other contexts in your liferay instance, see the soap sections regardless of the context you're viewing soap services in, each web service is listed with its name, operations, and a link to its wsdl file. here's the list of secure web services listed for usergroup note that some of these methods are overloaded liferay uses service builder to automatically generate json and soap web service if you haven't used service builder before, see its the wsdl file is written in xml and provides a model for describing and here's a wsdl excerpt of the addusergroup operation to use the service, you pass in the wsdl url along with your login credentials to the soap service locator for your service. now you'll learn how to invoke liferay's soap web services. you'll do this by setting up a java web services client in eclipse. eclipse's web service client wizard to either create a new web service client project or add a client to an existing project. client to your project for each service that you want to consume in your client for this example, you'll build a web service client to invoke liferay's company, user, and usergroup services to create a new web service client project in eclipse, click file new other..., then expand the web services category. for each client you create, you're prompted to enter the service definition wsdl for the desired service. since your example web service client needs liferay's company, user, and usergroup services, enter the following when you specify a wsdl, eclipse automatically adds the auxiliary files and libraries required to consume that web service. service client project using one of the above wsdls, you need to create additional clients in the project using the remaining wsdls. additional client in an existing project, right-click on the project and select the following code locates and invokes operations to create a new user group named myusergroup and add a user with the screen name test to it. url file in your web service client project and add this if you create this class in a package other than the one that's specified in this code, replace the package with your package. from eclipse, make sure that your liferay server is running, right-click the url class, and select run as java application. console to check that your service calls succeeded running this client should produce output like this the output tells you the user had no groups, but was added to the user group you might be thinking, but an error was thrown! error is thrown url.remoteexception , but you can sit here as cool as an ice cream sandwich all the same. the exception is thrown because the usergroup check is invoked before the usergroup is created. next line of the output says added user group named..., you're okay. web service invocations worked! here are a few things to note about this example the operations getcompanybyvirtualhost, getuseridbyscreenname, usergroupservicesoap in the wsdl files. parameter order, request type, response type, and return type are conveniently specified in the wsdl for each liferay web service. next, you'll learn how to implement a web service client in php you can write your client in any language that supports web services invocation. the following example code invokes the same operations as before, but uses php and a php soap client instead of java remember, you can implement a web service client in any language that supports;;
liferay's service builder can generate local and remote services for your the section of tutorials on service builder gives a general introduction to service builder, as well as instructions on generating your app's local services. but what if you want to use service builder to generate your app's remote services? and how should you invoke remote services generated by service builder? this section shows you how to use service builder to create json and soap web services, and how to invoke those services. liferay's own developers use service builder to generate json and soap web services, knowing how to invoke these services is especially important. section includes the following tutorials use service builder to generate your app's json and soap web services learn the basics of invoking json and soap web services in liferay learn how liferay secures web services, and how to invoke them with proper learn some of the details behind how service builder generates json web services, and how you can tailor this process to your needs learn how to invoke liferay's json web services api via url. information on passing url parameters, troubleshooting, and more learn how to use liferay's json web services invoker to optimize your json web see examples of how to invoke liferay's json web services via javascript, url, learn which properties you can use to control how json web services behave in learn how soap web services work in liferay.;;
liferay dxp includes a centralized and extensible authentication layer called the this layer is mainly used for authenticating remote invocations of liferay dxp's api the main responsibilities of the authentication verification layer are to if no available authverifier is able to verify request credentials, an authorization context supporting non-authenticated access is created for a this allows each liferay dxp api to expose only a single api endpoint. in contrast, legacy prior to 6.2 versions of liferay dxp exposed two api endpoints for each api the apiendpoint uri was for non-authenticated access and the uri apisecureendpoint was for authenticated access liferay dxp offers built-in authverifier implementations for the most common these include situations where remote clients use http basic or http digest authentication, send credentials in request parameters, send authenticated jsessionid s, or use shared secrets to establish trust. authverifier implementations can be deployed as modules containing implementations of the authverifier interface that are registered as services note the authentication verification layer's focus is on verifying authentication, not on providing credentials. the authentication verification layer is not responsible for issuing tokens, credentials, or displaying sign in instead, the layer verifies existing credentials and authenticated sessions and is therefore a complement to authentication endpoints. ensure backwards compatibility, the default portal implementations support requests providing username and password credentials. verification layer stands on the border between authentication and this layer and surrounding processes are provided by the authverifierfilter class that implements the url.filter interface the layer uses the chain of responsibility design pattern to support both built-in and third party authverifier implementations. can provide configurations where it specifies mapped urls and other properties each incoming request is matched against all registered authverifier s to select the final list of authverifier s that is used to process the request. it's the responsibility of each authverifier to verify the incoming request when a request is processed by all matching authverifier s, liferay dxp creates an authorization context for the resolved user this encompasses setting the remoteuser to return the resolved user id setting liferay dxp threadlocal s to the resolved user the resolved user can be the user returned by one of the authverifier instances or a guest user if no instance was able to verify the provided for more detailed technical information, please see the authverifiers not yet;;
"this reference guide provides a list of the default ckeditor plugins bundled with liferay dxp's alloyeditor. each plugin below links to its url file note the following ckeditor plugins are not available for inline mode in alloyeditor at this time; however, you can still use them in the classic to use the classic ckeditor instead of alloyeditor, there are a few properties you can use, depending on the portlet. that you need to your url file";;
liferay's mvc portlet framework is used extensively in liferay's portlets and is is a lightweight extension of url.genericportlet. saves you from writing a lot of boilerplate code. to liferay dxp 7.0 without a hitch upgrading a liferay mvc portlet involves these steps adapt the code to liferay dxp 7.0's api identifies code affected by the new api, explains the api changes and how to adapt to them, and in many cases, provides options for adapting the code after upgrading your portlet, deploy it the same way you always do the server prints messages that indicate the following portlet status you've upgraded and deployed your liferay mvc portlet on your liferay dxp 7.0 have fun showing off your upgraded portlet! migrating plugins sdk projects to workspace and gradle migrating data upgrade processes;;
it's common to create portlets that extend url.genericportlet. upgrading a genericportlet is straightforward and takes only adapt the portlet to liferay dxp 7.0's api using the upgrade planner this tutorial demonstrates upgrading a liferay plugins sdk 6.2 sample portlet called sample dao project sample-dao-portlet figure 1 the sample-dao-portlet lets users manage food items the sample portlet lets users view, add, edit, and delete food items from a for reference, you can download the the sample portlet has the following characteristics the portlet uses a traditional plugins sdk portlet project folder structure figure 2 the sample-dao-portlet project uses a typical plugins sdk portlet folder structure upgrading most genericportlet portlets involves these steps since the sample portlet's dependencies haven't changed, upgrading it involves only adapting the code to liferay dxp 7.0's api. facilitates updating the code and resolving compilation issues quickly resolving a plugin's dependencies if you need to adapt to dependency changes you deploy a genericportlet to liferay dxp 7.0 in the same way you deploy to when the plugin war file lands in the liferayhomedeploy folder, liferay dxp's plugin compatibility layer converts the war to a web application bundle wab and installs the portlet as a wab to liferay dxp's osgi on deploying an upgraded portlet, the server prints messages that indicate the deploying the sample portlet produces messages like these the portlet is now available on liferay dxp you've learned how to upgrade and deploy a portlet that extends you adapt the code, resolve dependencies, and deploy the migrating plugins sdk projects to workspace and gradle migrating data upgrade processes;;
"layout templates for liferay dxp 7.0 differ slightly from layout templates for the layout template's rows and columns are affected by bootstrap's this tutorial demonstrates the following upgrading a layout template involves updating its liferay version and updating the class syntax for its rows and columns follow these steps to upgrade your layout template open your url file and update the liferay-versions property to 7.0.0 open your layout template's.tpl file and replace row-fluid with row, previously, column size was denoted using a class value of format the new bootstrap grid system uses the format the device-size value must be xs, sm, md, or lg. cases, an md device size works well. you can read more about the bootstrap grid system on their site at url.3css the number value must be an integer from 1 to 12. divisible by twelve; so the combined width of a row's columns must equal 12 inside the.tpl file, replace each span-number class value with col-device-size-number, where device-size is xs, sm, md, or lg and number is an integeter from 1 to 12 here's an example column that uses the md device size and a column that is a third 412 of the row's total width as an example, here's liferay portal 6 layout template url url url your layout template is ready to use in liferay dxp 7.0! planning plugin upgrades and optimizations benefits of liferay dxp 7.0 for liferay portal 6 developers";;
mvc commands are used to break up the controller layer of a liferay mvc sometimes you'll want to override an mvc command, whether it's in a liferay application or another liferay mvc application whose source code you don't own. since mvc commands are components registered in the osgi runtime, you can simply publish your own component, and give it a higher service ranking. command will then be invoked instead of the original one the logical way of breaking up the controller layer is to do it by portlet the three mvc command classes you can override are find more information about implementing each of these mvc command classes in the tutorials on liferay mvc portlets. here we're going to focus on overriding the logic contained in existing mvc note while it's possible to copy the logic from an existing mvc command into your override class, then customize it to your liking, it's strongly recommended to decouple the original logic from your override logic. override logic separate form the original logic will keep the code clean, maintainable, and easy to understand to do this, use the method to fetch a reference to the original mvc if there are no additional customizations on the same command, this reference will be the original mvc command set the url target to the mvc command class name. approach, your extension will continue to work with new versions of the original portlet, because no coupling exists between the original portlet logic and your the command implementation class can change. make sure to keep your reference updated to the name of the current implementation class note in liferay dxp 7.0 ga1, there's a bug that occurs when modules with override mvc commands are removed from the osgi runtime. an mvc command with a lower service ranking the original mvc command in most cases to replace the removed one, the reference to the command is removed this bug is documented and fixed start by learning to override mvcrendercommand. the process will be similar for you can override mvcrendercommand for any portlet that uses liferay's mvc framework and publishes an mvcrendercommand component for example, liferay's blogs application has a class called this mvc render command can be invoked from any of the portlets specified by the url parameter, by calling a render url that names the what if you want to override the command, but not for all of the portlets listed in your override component, just list the url of the portlets where you want the override to take for example, if you want to override the blogseditentry mvc render command just for the blogs admin portlet the blogs application accessed in the site administration section of liferay, your component could look like this note the last property listed, url. osgi runtime which service to use, in cases where there are multiple components registering the same service, with the same properties. you specify here, the more weight your component carries. override component will be used instead of the original one, since the default value after that, it's up to you to do whatever you'd like. the existing render method or redirect to an entirely new jsp don't copy the existing logic from the mvc render command into your override this unnecessary duplication of code that makes if you want to do something new like set a request attribute and then execute the logic in the original mvc render command, obtain a reference to the original command and call its render method like this sometimes, you might need to redirect the request to an entirely new jsp that you'll place in your command override module if you want to render an entirely new jsp, the process is different the render method of mvcrendercommand returns the path to a jsp as a string. the jsp must live in the original module, so you cannot simply specify a path to you need to make the method skip dispatching to the original jsp altogether, by using the mvcpathvalueskipdispatch constant from the then you need to initiate your own dispatching process, directing the request to here's how that might look in practice in this approach, there's no reference to the original mvc render command because the original logic isn't reused. instead, there's a reference to the servlet context of your module, which is needed to use the request a servlet context is automatically created for portlets. for other modules by including the following line in your url file once we have the servlet context we just need to dispatch to the specific jsp in you can override mvc action commands using a similar process to the one presented again, you'll register a new osgi component with the same properties, but with a higher service ranking. for mvc action command overrides, extend the and the only method you'll need to override is doprocessaction, which must as with mvc render commands, you can add your logic to the original behavior of the action method by getting a reference to the original service, and calling it here's an example of an mvcactioncommand override that checks whether the delete action is invoked on a blog entry, and prints a message to the log, before continuing with the original processing it's straightforward to override mvc action commands while keeping your code decoupled from the original action methods. you can also override mvc resource there are fewer uses for overriding mvc resource commands, but it can also be the process is similar to the one described for mvcrendercommand and there's a couple things to keep in mind the service to specify in your component is url as with overriding mvcrendercommand, there's no base implementation class you'll implement the interface yourself keep your code decoupled from the original code by adding your logic to the original mvcresourcecommand's logic by getting a reference to the original and returning a call to its serveresource method the following example overrides the behavior of url.captchamvcresourcecommand, from the login-web module of the login portlet. it simply prints a line in the console then executes the original logic returning the captcha image for the account creation screen and that, as they say, is that. even if you don't own the source code of an application, you can override its mvc commands just by knowing the component;;
since liferay portal 6.1, developers could customize the portal and portlet struts actions using a hook and strutsactionwrappers. url file for a hook that overrode the login portlet's login the url contains the struts mapping and the new class that overrides the default login action the wrapper could extend either basestrutsaction or basestrutsportletaction, depending on whether the struts action was a portal or portlet action starting in liferay dxp 7.0, this mechanism no longer applies for most of the portal portlets because they are no longer using struts actions, but this tutorial demonstrates how to convert your existing strutsactionwrappers to converting strutsactionwrappers to mvccommands is easier than you may think as a review, legacy strutsactionwrappers needed to implement all the methods, such as processaction, render, and serveresource, even if only one method each of these methods can now be customized independently, using different classes, making the logic simpler and easier to maintain. depending on the method you customized in your strutsactionwrapper, you need to use the matching mvccommand shown below look at the examplestrutsportletaction class for a strutsactionwrapper example. depending on the actions overridden, the user must use different mvccommands. in this example, the action and render were overridden, so in order to migrate to the new pattern, you would need to create two classes mvcactioncommand and mvcrendercommand next you'll need to determine the associated mapping that is used by the for most cases, the mvccommand mapping is the same mapping defined in the using the beginning login example once again, the struts-action-path mapping, loginlogin, remains the same for the mvccommand mapping in liferay dxp 7.0, but some of the mappings may have changed. it's best to check liferay's source code to determine the correct mapping depending on the url it is a different parameter actionurl s are contained in the attribute name of the tag library or with the parameter actionrequest.actionname. resourceurl s are contained as the attribute id. once you have this information, you can override the mvccommand by following the instructions found in these sections of the overriding mvc commands tutorial now you know how to convert your strutsactionwrapper s to mvccommand s!;;
if you have servlet filter hooks ready to be upgraded, this tutorial's for you. adapt your code to liferay dxp 7.0's api using the liferay upgrade planner. you ran the planner's fix upgrade problems step, many of the existing issues were autocorrected or flagged. for any remaining errors, consult the resolving a plugin's dependencies liferay dxp's plugin compatibility layer converts the plugin war to a web application bundle wab and installs it to liferay's osgi runtime your servlet filter is running on liferay dxp 7.0! upgrading the liferay maven build;;
you might be tired of hearing about it by now, but it's worth repeating it's composed of many applications, which are divided into even smaller chunks of functionality. the applications, and sometimes even code chunks, are configurable at several scopes, as discussed in the introductory article for this section if you need to make configuration changes to an application that take effect in a system-wide fashion, where do you do it? readers who have been around a while will be raising their hands hoping to be called on, sure that the correct answer is why, system-wide application configuration takes place in a properties file, on their mobile device for their attentiveness. answer, so they need to sit back down and listen like the rest of the class. there's a brand new way to make configuration changes at the system scope in liferay dxp 7.0, and you don't need to go messing around in a properties file to these settings can now be made in the control panel, in configuration figure 1 system settings are accessed through the control panel in system settings, the configuration options are categorized into logical groupings based on their functionality, and there's a search box to make finding the app you want to configure easier figure 2 system settings are organized by component changing an app's default configuration options in system settings isn't once you find what you're looking for, simply click the name of the component you want to configure, or click the actions button changes you'd like, then click save. your configuration changes are saved and important content generated using templates e.g., freemarker templates and application display templates is cached. cached content might not reflect configuration changes until the cache is invalidated cleared. provides cache clearing options figure 3 after saving changes to a configuration, the actions reset default values and export are available for it if you make some regrettable configuration decisions and can't recall exactly what you did, start over by clicking the actions button , then clicking reset default while browsing the categories of system settings, you'll notice that each entry this scope is different than the overall application configuration scope discussed in the introduction to this section. this is the system settings application after all, so all of the configuration done here affects the system scope. the scope field here refers to the scope at which this default, system-wide configuration can be overridden. values that you'll see under scope system any configuration made at the system scope here becomes the final value for the application in a system-wide fashion. system and cannot be overridden anywhere else figure 4 some system settings entries have a system scope default configuration for application making configuration changes at this level affects the application in a system-wide fashion as well. these become the system-wide defaults for the application, they can be overridden from each application instance figure 5 some system settings entries have a default configuration for application scope default configuration for all sites configuration at this scope can be figure 6 some system settings entries have a default configuration for all sites scope default settings for all instances configuration at this scope can be overridden in each liferay dxp instance usually via instance settings figure 7 some system settings entries have a default configuration for all instances scope if an application is configurable from instance settings and system settings, use system settings to configure it whenever possible. settings and later want to revert to using the system settings default configurations, look for the reset values button from the instance settings figure 8 some instance settings entries have a reset values button so you can safely revert your configuration changes, falling back to the system settings defaults the reset values button removes configuration values from the liferay dxp database so you can rely on the defaults specified in system settings. reset values button for an instance settings entry, once you use instance settings to configure the application, you can't later decide to use system only changes to instance settings will be recognized what if you change many default configurations in system settings, and then need to make the same changes in another liferay dxp installation? don't need to remember and duplicate every choice you made. application lets you export a single entry's configurations e.g., the dynamic data lists entry's configurations, or all the settings you made in the system then you can deploy them in the target liferay dxp to export a single entry's configurations, click the actions button file then downloads that contains any configuration changes you saved note if you're running liferay de 7.0 fix pack 7 or earlier, or liferay ce portal 7.0 ga3 or earlier, system settings exports a.cfg file instead of a.config file. the file format was changed to fix a bug with multi-value settings, which the.cfg format didn't handle properly. any liferay dxp system newer than those listed in this note although.config files are now the default file type exported by system settings, you're free to continue using.cfg filesthey're still supported by the configuration framework underlying system settings to export all the configuration changes you've made in system settings, click the system settings options button the.config files for all the entries you edited then download in a to make these configurations active in the destination liferay dxp system, simply unzip and place the.config files in the liferayhomeosgiconfigs folder now you know what system settings is and how to use it. is to explore the entries to see what configuration options you can make. aren't sure what something does, check the documentation for the feature you're interested in, as specific configurations are covered there.;;
jsps in osgi modules are customized using module fragments. attaches to the host module to alter the jsps. fragment is part of the host module. osgi alliance's core specification document this tutorial shows you how to upgrade your app jsp hooks to liferay dxp 7.0 liferay developer studio's upgrade planner's generates module fragments from app jsp hook plugins. fragments in the same folder as your plugins sdk root if your hook is in a plugins sdk or in the liferayworkspacemodules folder if your hook is in a module fragments follow this name convention pluginname-app-fragment. for example, if the plugin's name is app-jsp-hook and it modifies a jsp in the blogs app, the upgrade planner generates a module fragment named here are the steps for upgrading app jsp hook plugins the module fragment's url file must specify an osgi header fragment-host set to the host module name and version if the host module belongs to one of liferay dxp's app suites, the code upgrade tool generates a url file that specifies an appropriate fragment-host for example, here's a fragment-host that attaches a module fragment to the updating the jsp is straightforward too the upgrade planner creates a module fragment that contains an upgraded the following table shows the old and new jsp paths for example, the upgrade planner generates a customized version of the blogs lets you compare custom jsps with originals figure 1 the upgrade planner lets you compare custom jsps with originals make any additional needed changes in your 7.0 custom jsp. this stops the host module momentarily, attaches the fragment to the host, and then restarts the host module. here's output from deploying a module fragment that attaches to the blogs web resolving a plugin's dependencies upgrading the liferay maven build;;
you can upgrade your portlet language key hooks to liferay dxp 7.0 by following create a new module based on the blade sample resource-bundle here are the module folder structure's main files that target the portlet module's resource bundle, but prioritize yours your portlet language key customizations are deployed in your new module on overriding a module's language keys upgrading core language key hooks resolving a plugin's dependencies upgrading the liferay maven build;;
here are the steps for upgrading a core language key hook to liferay dxp 7.0 create a new module based on the blade sample resource-bundle in here are the main parts of the module folder structure copy all your plugin's language properties files into the module your core language key customizations are deployed to liferay dxp 7.0 upgrading portlet language key hooks resolving a plugin's dependencies upgrading the liferay maven build;
"customization modules include any module extension or override used to for examples of these types of modules, visit the getting a customization module running on liferay dxp 7.0 takes two steps adapt your code to liferay dxp 7.0's api using the liferay upgrade planner. you ran the planner's fix upgrade problems step, many of the existing issues were autocorrected or flagged. for any remaining errors, consult the resolving a plugin's dependencies note a fragment was a common customization module in past versions of fragments are no longer recommended; you should upgrade a fragment to a dynamic include or portlet filter. for more information on recommended ways of customizing jsps in liferay dxp 7.0, see the your customization module is upgraded for liferay dxp 7.0!";;
liferay's api based approaches to overriding jsps are the best way to override jsps in apps and in the core. custom jsp bags to override core jsps. but the approach is not as stable as the if your custom jsp bag's jsp is buggy because of your code or because of a change in liferay, you are most likely to find out at runtime, where functionality breaks and nasty log errors greet you. that you're maintaining existing custom jsp bags, however, this tutorial a custom jsp bag module must satisfy these criteria includes a class that implements the registers the service in the osgi runtime provides the jsp you're extending the module provides transportation for this code into liferay's osgi runtime. when configuring it to build a proper jar, map the path of the jsps in the jar in a url file you could specify if you're using the maven standard directory layout and placing your jsps under srcmainresources, you can ignore the any core jsps you're customizing should be put into this folder, and the rest of their path and their name must match exactly the path and name of the jsp that's nested underneath portal-webdocroothtml. and you used the includeresource directive above, put the overridden jsp in create a class that implements customjspbag. the overall goal is to make sure loads the jsps from your module upon activation when the component is activated, you need to add the url path for all your custom core jsps by directory path to a list in the custom jsp bag you'll need to override the following methods getcustomjspdir return the directory path in your module's jar where the jsps are placed for example, meta-infjsps getcustomjsps return a list of the custom jsp url paths and override its getresources and getresource methods. method is for looking up all of the paths to resources in the container by a it should return a hashset of strings for the matching custom the getresource method returns one specific resource by its name for an example of a full class that provides a working implementation of a register the custom jsp bag implementation from your module in the osgi runtime url this should be a more human readable name, like my custom jsp bag url this will determine the priority of your if you specify 100 here, and one of your coworkers develops a separate custom jsp bag implementation and gives theirs a ranking of 101, if you want to add something to a core jsp, see if it has an empty url and override that instead of the whole jsp. it'll keep things simpler and more stable, since the full jsp might change significantly, breaking your by overriding the url, you're only relying on the original jsp including the url. if you need to add something to url, override url as of 7.0, the content from the following jsp files formerly in htmlcommonthemes are inlined to improve performance they're no longer explicit files in the code base. in your module to add functionality and content remember, this type of customization should be seen as a last resort. risk that your override will break due to the nature of this implementation, and core functionality in liferay can go down with it. override is in another module, refer to the section on api based approaches to overriding jsps in liferay portal 6.2, you could use application adapters to scope your core jsp customizations to a specific site. since the majority of jsps were moved into modules for liferay dxp 7.0, the use case for this has shrunk considerably. need to scope a core jsp customization to a site, prepare an application adapter as you would have for liferay portal 6.2, and deploy it to liferay dxp 7.0. however, note that this approach is deprecated in liferay dxp 7.0 and won't be supported at all in liferay 8.0;;
you can completely override jsps using osgi fragments. but can make things unstable when the host module is upgraded liferay's api based approaches to overriding jsps, on the other hand, provide more stability as they let you customize specific parts of the jsp that are safe to override. also, the api based approaches don't limit your override to a specific host module version. maintaining existing jsp overrides that use osgi fragments, however, this tutorial explains how they work an osgi fragment that overrides a jsp requires these two things specifies a host module's symbolic name and version in the osgi header includes the original jsp with any modifications you need to make for more information about fragment modules, you can refer to section 3.14 of the osgi alliance's core specification document there are two players in this game the fragment and the host. a parasitic module that attaches itself to a host. compare the fragment-host relationship to the relationship between a pilot fish by not doing much work like the pilot fish who benefits from the shark's in return, the host module gets whatever benefits you've conjured up in your fragment's jsps for the shark, it gets free dental to the osgi runtime, your fragment is part of the host module your fragment must declare two things to the osgi runtime regarding the host the bundle symbolic name of the host module this is the module containing the original jsp the exact version of the host module to which the fragment belongs both are declared using the osgi header fragment-host supplying a specific host module version is important. module isn't present, your fragment won't attach itself to a host, and that's a a new version of the host module might have changed its jsps, so if your now-incompatible version of the jsp is applied to the host module, you'll break the functionality of the host. it's better to detach your fragment and leave it lonely in the osgi runtime than it is to break the functionality of there are two possible naming conventions for targeting the host original jsp for example, if the original jsp is in the folder url, then the fragment bundle should contain a jsp with the same path, using the following pattern after that, make your modifications. just make sure you mimic the host module's folder structure when overriding its jar. if you're overriding liferay's login application's url for example, you'd put your own url in if you need to post-process the output, you can update the pattern to include liferay dxp's buffering mechanism. below is an example that overrides the note an osgi fragment can access all of the fragment host's packagesit doesn't need to import them from another bundle. bnd adds external packages the fragment uses even ones in the fragment host to the fragment's the problem is, however, when bnd tries to import a host's internal package a package the host doesn't export. can't activate the fragment because the internal package remains an unresolved requirement a fragment shouldn't import a fragment host's packages if your fragment uses an internal package from the fragment host, continue using it but explicitly exclude the package from your bundle's import-package osgi this import-package header, for example, excludes packages now you can easily modify the jsps of any application in liferay figure 1 liferay's applications are swimming in the osgi runtime, waiting for your fragment modules to clean their teeth, so to speak to see a sample jsp-modifying fragment in action, look at the;;
they are used to listen for persistence events on models and do something in response either before or after the event model listeners were designed to perform lightweight actions in response to a create, remove, or update attempt on an entity's database table or a mapping table for example, usersroles . here are some supported use cases there are also use cases that are not recommended, since they're likely to break unpredictably and give you headaches if there is no existing listener on the model, your model listener is the only however, there can be multiple listeners on a single model, and the order in which the listeners run cannot be controlled you can create a model listener in a module by doing two simple things create a -modellistener class that extends basemodellistener in the body of the class override any methods from the modellistener the available methods are listed and described at the end of this in your model listener class, the parameterized type for example, customentity in the snippet above is used to tell the listener's servicetrackercustomizer which model class the listener should be registered register the service with liferay's osgi runtime. set service url and immediatetrue in the component that's all there is to preparing a model listener. the modellistener interface provides lots of opportunity to listen for model look in liferay's basepersistenceimpl, particularly the remove and update methods, and you'll see how model listeners are accounted for before for the onbefore... case and after for the onafter... case the model persistence event now that you know how to create model listeners, keep in mind that they're useful as standalone projects or inside of your application. needs to do something like add a custom entity every time a user is added in liferay, you can include the model listener inside your application;;
is convenient for making system-scoped configuration changes and setting default but there's another supported configuration approach configuration files. can use configuration files to transfer configurations from pre-production systems to production systems, or between any other liferay dxp systems. developers choose to distribute the default configuration for their applications whatever the reason, configuration files are a straightforward way of configuring liferay dxp option that becomes available once you modify a configuration entry. is the recommended way to create.config files you download a.config file containing the entry's settings in a keyvalue format. entry's total available configuration keys and values, even if only one value you can export a single configuration entry or the entire set of modified configurations in liferay dxp for example, the journal service entry, which backs liferay's web content capabilities, has this file name figure 1 the web content system settings entry has the backend id url.journalserviceconfiguration configuration files use the.config property value format defined by the apache important content generated using templates e.g., freemarker templates and application display templates is cached. cached content might not reflect configuration changes until the cache is invalidated cleared. provides cache clearing options the.cfg file format is common in osgi environments, so liferay dxp supports it, but.config files are preferable. you can specify a property value's type, and the syntax described below is for.config files the general syntax for all keys and values in a.config file is the same for single value configurations without special characters, that's all there is settings with multiple values and certain characters require slight configuration entries can have properties that accept multiple values. example, a configuration property for specifying supported file extensions needs here's how to write a multi-value setting in a.config do not use a space character between values after the comma. character can cause a failure to load the property open the web content entry from system settings and you'll see what looks like figure 2 the web content system settings entry has many charactersblacklist fields in the configuration file, this is really a single key with an array of double quotes and equals signs must be escaped in.config files. escaping is using another character to denote that a character shouldn't be used since double quotes and equals signs are already used in.config files, escaping them tells the framework not to read them the normal way, but to pass them through as part of the value. this setting illustrates a multi-value setting with a regular, unescaped character , and two escaped ones and along with the mandatory escaping of double quotes and equals characters, it's beneficial to escape spaces inside values to avoid problems in the above example, a is used before each space character to ensure it's if you don't escape spaces yourself, the framework adds the backslash for you after deployment once you have a configuration file, deploy it so liferay dxp recognizes it and updates the targeted configuration values to deploy the.config file, place it in your to change the configuration further, you can edit the.config file directly or use system settings the.config file format supports specifying the type of a configuration value by inserting a special type marker character. because liferay dxp already knows the correct type for each configuration property, the type characters are only useful for informational purposes. for example, a configuration with a boolean type has b just before the value to mark it as a boolean type if you see type markers in.config files, you can safely ignore them. example included above functions identically without the type marker in a clustered environment, each node needs the same configuration values for for example, all nodes should use the same blogs configuration to accomplish this, deploy a.config file to one node. uses an internal system that appies the change to all nodes in the cluster configurations supporting multiple independent occurrences of the same configuration entry are called factory configurations factory configuration example liferay dxp supports the publication of jax-ws and jax-rs web services. which is a context path where the web services are deployed and accessed. endpoints can be created via factory configuration by navigating to the cxf enter the desired configuration values and repeat the process, adding as many cxf endpoint configurations as needed. creating cxf endpoint configurations also creates cxf endpoints themselves. this is how factory configuration works if a service is meant to support factory configuration, its system settings figure 3 if a system settings entry has an add button, it's suitable for factory configuration as with single-instance configurations, you can accomplish factory configuration in the system settings interface as described in the example once you determine you must write a factory if your service supports factory configuration, use liferay's convention of calling the first instance of the configuration url the next instance contains a unique subname something other than default . it's smart to use a descriptive name to follow the cxf endpoints example described above, if liferay's developers had shipped an initial cxf endpoint.config file with liferay dxp, it would have perhaps the url configuration specifies a context path for rest web services, and then you create another endpoint with a different context path your second configuration file could be named note some system settings entries like the cxf endpoints entry don't ship with a configuration file, so anything you create is the first occurrence. however, if you configure one and export it to obtain the.config file, it's instead it's given a guaranteed unique identifier this is to guarantee that the file has a unique name. the configuration file for deployment in a separate liferay dxp system, you can rename the exported file to use a more descriptive subname. file and deploy it to the same system it was exported from, the new subname marks it as an entirely new configuration. additional configuration instance in this case, not just a renamed one warning for configuration entries supporting factory configuration, omitting the sub-name from a.config file's name breaks the system settings application's functionality but only for the configuration entry targeted by lps-76352 for more information. once an improperly named configuration file is deployed, you can't add any entries for the configuration in question from its system settings entry. file to configure a cxf endpoint, not only does this not add a cxf endpoint, it also prevents you from adding any cxf endpoints via system settings deploying an erroneous lacking a sub-name.config file doesn't break just rename the file using the proper convention described above or remove it entirely and start over in many cases, configuration files can be used to force a factory configuration scenario, but not all configurations are designed to be it's best to stick to the intended use cases. as described above to determine if factory configuration is a good idea. stick to the single occurrence mode of configuration specifying only one configuration file for the service.;;
liferay is so configurable it can be hard to keep track of where all the fortunately, the control panel is most often the place to look, and there's a tidy configruation section there that houses a lot of the higher level for example, system and instance scoped this section considers the configuration options dealing that might sound self explanatory, and it is, for the most part. means that configuration at this level affects the entire system, which means all the virtual instances of liferay in the system. virtual instance is, read the section on there are several configuration sections that take effect at the system scope get started by learning about system settings.;;
"liferay dxp provides a robust script engine that can be used to execute scripts in a liferay dxp's script engine was originally developed to allow developers to write portlets in languages other than java such as php, groovy, since then, the script engine has been extended to do much for example, when liferay dxp's workflow framework was introduced, the script engine was leveraged to support the execution of scripts from within a workflow liferay dxp now provides a script console in the server administration area the script console provides an easy way for system administrators to execute scripts to perform repetitive user maintenance operations, bulk invocations of liferay's api, or even system level operations the tutorials in this section explain how to use liferay's script engine and they cover the following topics invoking liferay's api from a script running scripts from the script console using the script engine with workflow leveraging custom java tools in the script engine invoking liferay's api is probably the most common task for which you'll want to if you have any familiarity with liferay's api, this will be very to access liferay's scripting console, navigate to the control panel, click on server administration under the system heading, then click on important liferay's script engine supports the following languages beanshell, javascript, groovy, python, and ruby. liferay, these languages were all available by default. 7, only groovy is available by default. the other languages are still supported; you just have to install the appropriate modules. all of these modules are freely available on";;
most global instance settings can be configured from the instance settings section instance settings is divided into configuration, identification, social, figure 1 the configuration options in instance settings are divided into four categories the configuration section is much larger than the others, so it's presented last the identification section has several links for addresses, phone numbers and other information you can configure in your instance. contact information for the organization that owns the instance. query for this information in their applications the social section lets you configure ratings and mentions has ratings enabled, you can choose whether to use a simple like, thumbs, or stars for rating the content. you can also choose whether to allow users to mention other users, and if so, whether all users have the capability or whether you want to further refine the mentions configuration figure 2 you can configure the mentions capability throughout a liferay instance this section allows you to set the default instance language and the time zone. you can also set up an instance-wide logo which appears in the top left corners of liferay's default theme is configured to display liferay's logo. themes, you can choose whether or not to display the logo. an image file that fits the space. if you pick something too big, it might since there's a lot under this heading, here's a brief list, with a longer description of each following general lets you configure global settings, such as the company name, domain, the virtual host, a global instance logo, and more authentication allows you to configure user authentication methods and connections to ldap and single sign-on servers users has three tabs labeled fields, reserved credentials and default user the fields tab enables or disables some user fields, such as the reserved credentials tab lets you reserve screen names and email addresses so users cannot register using them. this to prevent users from registering on the instance with user names that contain profanity or that sound official, such as admin or president. default user associations tab lets you configure default membership to roles, user groups, sites for new users and provides a check box which allows you to retroactively apply these to existing users terms of use decide whether to require terms of use, and point to a web content article if you want to create your own mail host names lets you add a list of other mail host names to be associated with your organization. for example, your main domain might be url but you might use url for your email any domain names associated with your organization can go here email notifications allows you to configure liferay to send email notifications for certain events, such as user registrations, password changes, etc. you can customize those messages here content sharing contains options for enabling site administrators to display content in one site from other sites they administer. configure rules for whether subsites should be able to display content from let's discuss these settings in more detail the general link takes you to a screen with three headings main configuration, navigation, and additional information. under the main configuration heading, you can set the name of the company or organization that's responsible for this name also defines the name of your instance's default its default name is url so you will definitely want to change this to reflect the name of your company or organization. mail domain, virtual host and content delivery network address here under the navigation heading, you can set a home page for your instance here as well as default landing and logout pages. for setting these pages, just use the part of the page's address that follows your domain. the default landing page to be use you can also use the variables liferayscreenname and liferayuserid as part of the address. this comes in handy if you want to redirect users to their personal pages upon login. the default login or logout page in a url file with the for more information, see the url documentation entries for the default landing page under the additional information heading, you can specify a legal name, id, company type, sic code, ticker symbol, industry and industry type the authentication section has several tabs general, opensso, ldap, openid, cas, google, ntlm, and facebook. you can use any of these authentication methods to configure how users will authenticate to liferay. quite a few authentication methods, there are different settings for each figure 3 after clicking on instance settings in liferay's control panel, you can configure any of the areas shown in this figure the settings on the general tab of the authentication page affect only liferay functionality and don't have anything to do with the integration options on the the general tab allows you to customize liferay's standard specifically, the general tab allows you to select from several global authentication settings authenticate by email address default, screen name, or user id a numerical id auto-generated in the databasenot recommended if enabled, liferay allows a user to check a box which will cause the site to remember the user's log in by placing a if disabled, users will always have to log in enabledisable account creation by strangers. site, you will probably want to leave this on so visitors can create enabledisable account creation by those using an email address in the domain of the company running the site which you just set on the general this is handy if you are using liferay to host both internal and external web sites. you can make sure all internal ids have to be created by administrators but external users can register for ids will send users a verification email with a link back to the instance to verify the email address they entered is a valid one they can access by default, all settings except for the last are enabled. email address is an important default for the following reasons an email address is, by definition, unique to the user who owns it people can generally remember their email addresses. haven't logged into the instance for a while, it is possible they will forget their screen names, especially if they weren't allowed to use their screen names of choice because they were already taken if a user changes his or her email address, it is more likely the user will forget to update his or her email address in his or her profile, if the email address is not used to authenticate. not updated, all notifications sent by the instance will fail to reach the so it is important to keep the email address at the forefront of a user's mind when he or she logs in to help the user keep it up to date if you need to use a third party authentication service or set up single sign on to learn about the supported services and how to configure them if you click on users from the instance settings screen, you'll find three tabs fields, reserved credentials and default user associations the fields tab allows you to enabledisable these fields on the addedit user in the reserved credentials tab, enter any screen names and email addresses that liferay prevents users from registering with these screen names and email addresses. you might use this feature to prevent users from creating ids that look like administrative ids or that have reserved the default user associations tab has three fields allowing you to list one per line sites, organization sites, roles, and user groups you want new users to become members of automatically. by default, liferay assigns new users to both the users role and the power users role. you can also choose whether to apply these configurations to existing users user groups are handy tools for pre-populating your users' private sites with a certain page set, defined by a site template. if you've done that and want all users you add to immediately be added to the user group and inherit those pages, do you want to disable the requirement for all users to read the terms of use? you can do that, or even specify the group id and article id for a web content article that you'd like to use as your own custom terms of use you can enter other mail host names one per line besides the one you this lets the instance know which mail host names there are five tabs under the email notifications page of instance settings. sender tab allows you to set the instance's administrative name and email address. the email sender entry specifies the virtual instance's administrative name and address for email notifications, declared as the fromname and fromaddress variables respectively in the email templates. this name and email address appear in the from field in all email messages sent by the virtual instance figure 4 you can customize the email template for the email messages sent to users who have just created their accounts the other four tabs are account created notification, email verification notification, password changed notification and password reset notification. these tabs allow you to customize the email messages that are sent to users each time any of those four events occur figure 5 there are some handy variables available for use in email templates a list of tokens, entitled definition of terms, is provided so you can insert certain values such as the portal url or the user id when you are setting up the content sharing section of the instance settings area of the control panel allows you to choose whether or or not site administrators can display content in sites from other sites they administer. for example, suppose that a certain user is a site administrator of two sites engineering and marketing. checkbox in the content sharing section of instance settings determines whether or not the site administrator can display content from the marketing site in the engineering site and vice versa the content sharing section of instance settings also allows you to choose a behavior for whether or not subsites can display content from parent sites and enabled by default this means that subsites can display content from parent sites by default but this can be disabled by a site administrator disabled by default this means that subsites cannot display content from parent sites by default but this can be enabled by a site administrator disabled this means that subsites cannot display content from parent sites and this behavior cannot be changed by a site administrator next, learn to integrate existing users from other environments, such as ldap;;
here's a quick scenario you already have a server hosting a site created with that means you already have a hosted liferay database. need to set up another site that runs on liferay. way to skin this cat, if you want to kill two birds with one stone, just create an additional virtual instance of liferay. you'll get to have two separate sites the birds, with a shared server and database the stone. that the sites have a shared database and server, you can set up a separate virtual instance in two shakes of a lambs tail it's important to note before proceeding that no real animals were harmed in the writing of the above paragraph virtual animals, however... now without the idioms liferay allows you to run more than one virtual instance on the virtual instances section of the control panel appears under the configuration heading. this section lets you manage multiple liferay instances from a single liferay installation. separate from every other instance's data. all instance data, however, is kept each virtual instance has its own domain name. proper instance based on this domain name. instance, configure its domain name in your network first. add an instance, click the add button here figure 1 add and manage virtual instances of liferay in the control panel's configuration virtual instances section you'll be prompted for four fields and a check box web id a general convention is to use the domain name for this. user-generated id for the instance virtual host put the domain name you configured in your network here. users are directed to your liferay server via this domain name, liferay will then be able to send them to the proper virtual instance mail domain enter the domain name for the mail host for this instance. liferay will use this to send email notifications from the instance max users enter the maximum numbers of user accounts you would like your active use this check box to choose whether to create an active or an when you are finished filling out the form, click save. instance using your new domain name. you are brought to what looks like a clean this is your new virtual instance which can be configured read the next section on configuring an instance's settings to learn more about configuring your new instance.;;
once you have a liferay dxp installation, you're going to want to configure it. whether that means adding a virtual instance, setting up the initial instance to suit your needs, or integrating existing users into the installation. that configuration happens at different scopes. there's an important difference between the system scope and the the system scope is the highest level scope you can make all virtual instances of liferay are impacted by configuration done at this scope. the instance scope applies only to one particular virtual instance of liferay. liferay installations with their own virtual host that share a server and each instance can be configured very differently so what kind of configuration do you need to do in your instance? integrating existing users into liferay get started by learning about adding a virtual instance.;;
"liferay portal and its core portlets offer a host of services that you can programmatically invoke from local and remote clients. or the apis of its portlets, like the to see that liferay is chock-full of useful access points. situations in which you want to modify the behavior of these services to do this, you may be tempted to extend a service interface directly. are problems inherent with this approach. fix packs later added to the product may modify the interface e.g., adding a new method to the service. implemented the api directly, your implementation may not account for the as a result, the patch could break your customization don't worryliferay has provided a safe way to customize its services all the functionality provided by liferay is enclosed in a layer of services that are accessed by the controller layer in its portlets; this architecture lets you change how a liferay core portlet behaves without changing the liferay generates dummy wrapper classes for all its service for example, userlocalservicewrapper is created as a wrapper for userlocalservice, a service interface for adding, removing, and retrieving if you extend the wrapper class, you can alter the service's behavior, and your customization can be safeguarded from being broken by any future patches to the interface this tutorial shows you how to modify a portal service using a hook. of this tutorial, you'll have a hook plugin that overrides a liferay service hook plugins are the best tool for leveraging this architecture to customize to modify the functionality of a service from a hook, you create a class that extends the service wrapper class, override the methods you want to modify, and instruct liferay to use your service class to override you can follow these steps to override any liferay service from your own create a class that extends the wrapper class of the service interface you to create the extension class from liferay idedeveloper studio, open your project's url file, which is found in the docrootweb-inf select the url file editor's overview mode tab and select service wrappers from the editor's outline. wrapper in the editor's main area to bring up the service wrapper detail figure 1 liferay ide's hook configuration editor comes with custom service wrapper creation and editing capabilities in the service wrapper detail screen, click the browse icon at the right of the service type text field and select the service class you want to in the service impl text field, you can enter the fully qualified class name of your service wrapper extension class and click the create icon to the right of the text field. this creates the extension class you entered figure 2 creating wrapper extensions is easy. you enter the name of your service implementation class and click the create icon to create it for overriding the service you can alternatively create your wrapper extension class manually in your the initial wrapper extension class that liferay ide creates is virtually a blank canvas on which you can add your custom override methods. class refers to liferay's default implementation for the service. calling the wrapper's methods via the super.methodname... in your custom method implementations, you invoke the underlying default the code below is from an example custom service implementation class named url that overrides the userlocalservice by note that its constructor calls the a new implementation of the service's deleteuser... method has been added for holding custom logic. class' version of the method, which invokes the underlying default implementation, is called at the end of the custom method. parent class method is optional but is a common practice to leverage now that you've created your wrapper extension class, you can add methods to it to override liferay's implementation of the service interface note on deployment, the wrapper class extension is loaded in the hook's class loader, which means the extension can access any other class included in the same war file but cannot access liferay's internal classes you must specify your custom service implementation class in the ide's hook configuration editor, liferay ide automatically specifies the service implementation class in the url file. your wrapper extension class manually, you must also manually specify the service implementation class in a element within the for example, here's what a wrapper extension specification to userlocalservice can look like your hook substitutes the service's default behavior with the behavior of your there are other liferay services that you may need to extend to meet advanced here are just a few services that you may want to customize for a complete list of available services and their methods, check the javadocs or browse url.2javadocs for javadocs on the services of any of liferay portal's core portlets. different version of liferay, visit url, select the liferay portal version, and click on the javadocs link note to modify a portal utility class, you can extend the utility's base implementation in a hook. file to see if there's an option for specifying an extension to the utility. example, to customize the behavior of liferay's class with your custom implementation. property to the fully qualified name of your implementation class you've done well learning how to properly customize liferay services. out there and put your newfound skills to use! developing plugins with the plugins sdk developing liferay hook plugins with maven";;
if you're an avid maven user and have been using it for liferay portal 6.2 project development, you must upgrade your maven build to be compatible with there are two main parts of the maven environment upgrade process that you must address for more information on using maven with liferay dxp 7.0, see the guided and expedited upgrade process for your maven build, try the you'll start off by upgrading your maven environment's liferay maven plugins the biggest change for your project's build plugins is the removal of the liferay now provides several individual maven plugins that accomplish specific tasks. liferay's css builder, service builder, theme builder, etc. with smaller plugins available to accomplish specific tasks in your project, you no longer have to rely on one large plugin that provides many things you may not want for example, suppose your liferay portal 6.2 project was using the liferay-maven-plugin for liferay css builder only. the legacy liferay-maven-plugin plugin dependency from your project's then, add the css builder plugin dependency to your project's url file some common liferay maven plugins are listed below, with their corresponding artifact ids and tutorials explaining how to configure them in liferay portal 6.2, you were also required to specify all your app server for example, your parent pom probably contained settings this is no longer required in liferay dxp 7.0 because liferay's maven tools no longer rely on your liferay dxp installation's specific versions. you've learned about the new maven plugins available to you for next, you'll learn about updating your liferay maven many liferay portal 6.2 artifact dependencies you were using have changed in see the table below for popular liferay maven artifacts that have for more information on resolving dependencies in liferay dxp 7.0, see the resolving a plugin's dependencies of course, you must also update the artifacts you're referencing for your if you're using the central repository to install liferay maven artifacts, you won't need to do anything more than update the artifacts in if, however, you're working behind a proxy or don't have internet access, you must update your company-shared or local repository with the latest with these updates, you can easily upgrade your liferay maven build so you can begin developing traditional plugin projects for liferay dxp 7.0.;;
if you've developed themes in liferay portal 6.1 or liferay portal 6.2, as part of your upgrade you'll want to use them in liferay dxp 7.0. requires several modifications. to help automate this process you'll use the the following tutorials show you how to upgrade your liferay portal 6.1 and liferay portal 6.2 themes to liferay dxp 7.0.;;
"do you want to override liferay's struts actions or add a new struts action to you can do both using struts action hooks first, consider the interfaces used for struts actions the strutsaction interface is used with portal struts actions, like the strutsportletaction interface is used struts actions are classes, and they're specified in a url file. file resides in its web-inf folder. it links actions to jsps or tiles. action performs a task and then returns a forward, an object containing a name the forward defines the page the portal sends the user to after the when a user submits a form that maps to a struts action, the portal loads and executes the action class' method, which returns a forward you can use a struts action hook plugin to overridewrap existing struts actions or to create a new struts action and path; you'll do both in this tutorial. you'll override a struts action to use your own class. struts action path and navigate to it. for the first part of this tutorial, you'll override a portlet's existing struts action using a hook plugin project you can view the current actions in your portal's url for example, here's the default login struts action you can override a portlet's struts action like the one above by following these open the url file from your hook plugin's docrootweb-inf add a struts-action element within the hook element add to the struts-action element, a struts-action-path element with a value that specifies the action path you're overriding and add a struts-action-impl element with a value that specifies your custom action the following struts action from example hook plugin example-hook this action class is invoked for the struts the example hook's struts-action element looks in your hook plugin's docrootweb-infsrc folder, create a struts portlet action class and its package folders here's an example struts portlet action class notice that the class extends the base class basestrutsportletaction. the render method of class above prints to the console the message custom struts action every time a user logs in as a best practice in extending struts actions, consider invoking the base class that's it for overriding struts actions! the next section of this tutorial demonstrates how to add a new struts action now that you know how to override a struts action, you might also be interested if you like, create a folder for the new action's jsp. stores its custom jsp in a folder docrootmeta-infcustomjspshtmlportal add a jsp for your new struts action. for example, the following code from the example-hook2-hook plugin's jsp greets the user create a new struts action class. as an example, here's the code from the example-hook2-hook plugin's struts notice that the examplestrutsaction class's execute method sets the request attribute name to the current user's name, or to world if the this class overrides basestrutsaction's execute method, but not its executestrutsaction, method. it's fine to ignore overriding that method in this example open the url file from the hook plugin's docrootweb-inf if you're using a custom jsp folder, add within the hook element a custom-jsp-dir element that specifies the jsp folder path as its value. within the hook element, just after the custom-jsp-dir element if you added one, add a struts-action element. element, add a struts-action-path element with a value that specifies the action path you're overriding and add a struts-action-impl element with a value that specifies your custom action class the following example struts action from the example-hook2-hook plugin specifies struts action path custompath for invoking the custom struts if you'd like your struts action path to be public, add it to your portal's list of paths that don't require authentication. property assignment from your portal's url into your then add your struts action path to the end of it looks similar to the assignment below, where you'd replace custompath with your custom struts action path restart the portal server and try your new struts path open your custom struts action's jsp in your browser. hook plugin example-hook2-hook can be accessed from a browser at the path figure 1 the example-hook2-hook example hook plugin's new struts action jsp displays hello world! now you know about the interfaces used for struts actions. learned how to override an existing action and create a new action using a you're ready to strut your stuff! customizing liferay portal with hooks";;
applications are delivered through liferay marketplace as lpkg files. a simple compressed file format that contains.jar files to be deployed to if you want to examine an application from marketplace, all you have to do is unzip it to reveal the.jar files it contains after examining them, you may want to customize make your customization, but don't deploy it the way you'd normally deploy an application. instead, liferay dxp provides a way to update application modules without modifying the original.lpkg file they're packaged in, by overriding the.lpkg file. create a folder called override in the liferay dxp instance's name your updated.jar the same as the.jar in the original.lpkg, minus the for example, if you're overriding the url from the liferay ce amazon url, you'd name your.jar url copy this.jar into the override folder you created in step one this works for applications from marketplace, but there's also the static.lpkg that contains core liferay technology and third-party utilities such as the if you find you need to customize or patch any of these.jar files, deploying these customizations is a similar process make your customization and package your.jar file name your updated.jar the same as the original.jar, minus the version place this.jar in the osgistatic folder note that any time you add and remove.jars this way, liferay dxp must be shut down and then restarted to make the changes take effect if you must roll back your customizations, delete the overriding.jar files liferay dxp uses the original.jar on its next startup.;;
a portal properties hook plugin lets you override a subset of generators, and content sanitizers. lists this subset of properties note to customize a property that's not in the url property defines action classes to invoke before login. deploying multiple hooks for properties like this appends the values to the for example, multiple hooks that add login event actions append their action classes to the portal instance's url whether a property accepts multiple values by stating it or showing value lists assigned to a default or example property setting some portal properties accept a single value only. url property is either true or false. value property from one hook onlythere's no telling which value is assigned if 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;;
why might you need to customize liferay services? field to liferay's user object and you want its value to be saved whenever the adduser or updateuser methods of liferay's api are called. want to add some additional logging functionality to some of liferay's apis. whatever your case may be, liferay's service wrappers provide easy-to-use extension points for customizing liferay's services to create a module that overrides one of liferay's services, follow the reference article to create a servicewrapper project type as an example, here's the userlocalserviceoverride class that's generated in the service wrapper template tutorial notice that you must specify the fully qualified class name of the service wrapper class that you want to extend. the service argument was used in full this import statement, in turn, allowed the short form of the service wrapper class name to be used in the class declaration of your component class the bottom line is that when using blade create to create a service wrapper project, you must specify a fully qualified class name as the service this is also true when using blade create to create a service for information about creating service projects, please see the the generated userlocalserviceoverride class does not actually customize any before you can test that your service wrapper module actually works, you need to override at least one service method open your userlocalserviceoverride class and add the following methods each of these methods overrides a liferay service method. merely add a few print statements that are executed before the original service lastly, you must add the following method to the bottom of your service wrapper so it can find the appropriate service it's overriding on deployment now you're ready to build your project. navigate to your project's root folder the jar file representing your portlet module is produced in your project's buildlibs directory to deploy your project, run this command from your project's root directory blade cli detects your locally running liferay instance and deploys the specified module to liferay's module framework. command, you should see a message like this use the gogo shell to confirm that your module was installed run blade sh lb if your module was installed, you'll see an entry like this finally, log into your portal as an administrator. confirm that your customizations of liferay's user service methods have taken effect by checking liferay's log for the print statements you've created and deployed a liferay dxp 7.0 service creating modules with blade cli;;
functionality provided by these module's scripts. but you can't with javascript files. for example, you can create a module named session-js-override-web to override liferay dxp's url file create a srcmainresourcesmeta-infresourcesjs folder in your module, copy the original javascript file into it, and rename it. example, create a copy of the url module and rename it make sure you also rename the module definition apply your modifications and save the file write your module's configuration file url to apply your override. module's srcmainresourcesmeta-infresourcesjs folder. url file below specifies the condition that the should load the custom aui module liferay-session-override instead indicated with the when property of the trigger module you can follow this same pattern to create your finally, you must configure your url file. changes, you must specify the url's location with the the liferay-session-override module from the previous example has the configuration below in its url file now you know how to override liferay dxp's default yuiaui modules! configuring modules for liferay dxp's module loaders;;
your upgrade process not only relies on portlet technology, themes, and customization plugins, but also the frameworks your project leverages. following frameworks and their upgrade processes are discussed in this section continue on to learn more about upgrading these frameworks.;;
"more than in any other liferay release, liferay dxp 7.0 centers on you, the liferay's platform has been rebuilt, making it easier to build on and maintain, and providing more new developer features than any previous liferay here are some key benefits of this release for developers more extensible, easier to maintain optimized for your tooling of choice let's consider how they make development easier for you liferay has always been simple and lean, compared to the proprietary alternatives; this version widens the gap even more liferay dxp 7.0 is simpler than its predecessors, thanks to a streamlined and modular in addition, many liferay specific ways of creating extensions and applications have evolved to follow official or de-facto standards. developers can now more easily reuse their existing knowledge and use what they learn developing for liferay outside of it liferay dxp 7.0 is also leaner. its modularized core allows developers and system administrators to remove parts they don't need or don't want; this facilitates deployment, reduces startup times and memory footprints, and results in more efficiencies and performance improvements if you have been using liferay, you've already experienced some of the benefits of modular development, thanks to plugins. liferay dxp 7.0 takes these benefits to a in addition to building plugins as you have previously, you can take advantage of a complete module development and runtime system based on osgi standards. liferay dxp 7.0 facilitates creating applications of all types by composing and and don't worry, modules are easy to understand. jar file and can be as small as one java class or as large as any application an application for liferay can comprise one single module or the cool thing is that modules can cooperate, allowing you to build applications by combining smaller pieces that are easier to develop, deploy, maintain, and reuse if you have worked on large developments on top of liferay you have probably experienced situations in which you wanted to share a subset of classes from java ee does not provide any standard way to achieve this, but liferay provided certain capabilities to achieve it with a mechanism known as clp that used class loader magic to allow plugins to invoke services in other plugins created with this mechanism, however, is still a bit limited java ee's class loader doesn't allow for much more and doesn't give you the freedom to specify any or all classes from one module to use from within another module liferay dxp 7.0 enables greater reusability, both in code and runtime memory, several for any desired reusable functionality you just create a module remember, it's just a jar file with some metadata with the classes you want other modules need only declare that they use the classes in that module by specifying their packages and liferay dxp 7.0 automatically wires them all invocations are regular java calls! this mechanism eliminates the dreaded jarclasspath hell issue. you have to jockey jar files in classpaths; nor do you have to implement the runtime environment uses separate class spaces per module; it even accommodates using multiple versions of libraries in the same application as long as they can coexist whenever we ask liferay developers what is their favorite characteristic of liferay, great extensibility is one of the top three most popular responses. you can customize almost every detail and add your own functionality on top is liferay dxp 7.0 more extensible? many more extension points have been but not only that, all new extension points and many existing ones which have been upgraded, use a new extension mechanism based on osgi's service model. here are some of the mechanism's benefits simpler an implementation of an extension point is now always a java class that implements an interface and has one annotation . that's it; it couldn't be any easier easier to maintain extension points are now more strictly defined through a java interface that uses semantic versioning rules. your extensions can work without changes, even across several liferay versions, as long as the specific extension api is backwards compatible dynamic extensions can be loaded and removed at any time during your own developments can now also leverage this model and you can create simple extension points by just creating an interface and annotating a setter method with an annotation . implementing extensibility has never been easier liferay dxp 7.0 empowers you to use the tools you like if you don't have strong preferences and are open to our suggestions, we offer it provides an opinionated directory structure and build system based on gradle and bnd. liferay workspace can be used standalone through the command line or with liferay developer studio, which runs on eclipse and if you want to continue using the plugins sdk, we've got you covered. plugins sdk is available to facilitate your transition to liferay dxp 7.0. plugins sdk structure can reside in a liferay workspace alongside new developments that use the new build environment; you can switch between traditional projects and new projects at your own pace finally, we have also developed a lightweight tool called blade cli, which facilitates starting new projects from templates it's especially useful for gradle which doesn't have maven's concept of archetypes. commands to startstop the server and deploy and administer modules creating configurable code is a breeze with liferay dxp 7.0. liferay's new configuration api allow administrators to change the configuration on the fly, through an auto-generated user interface called system settings now you understand how liferay dxp 7.0 enriches your experience as a developer and makes developing apps and customizations fun next, we'll take a look at osgi and modularity to discuss key concepts and demonstrate how easy and gratifying it is to build modules.";;
you can take full advantage of maven in liferay developer studio with its built-in maven in this tutorial, you'll learn about the following topics first you'll install the necessary maven plugins for liferay developer studio in order to support maven projects in developer studio properly, you first need a mechanism to recognize maven projects as liferay developer studio projects. recognized in eclipse as faceted web projects that include the appropriate therefore, all developer studio projects are also eclipse web projects faceted projects with the web facet installed. 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 liferay developer studio relies on the following eclipse plugins to all you have to do is install them so you can begin developing maven projects when first installing liferay developer studio, the installation startup screen lets you select whether you'd like to install the maven plugins automatically. worry if you missed this during setup. you'll learn how to install the required maven plugins for developer studio manually below navigate to help install new software. check the liferay ide maven support option. maven plugins you need to begin developing maven projects for liferay dxp figure 1 you can install all the necessary maven plugins for developer studio by installing the liferay ide maven support option if the liferay ide maven support option does not appear, then it's already to verify that it's installed, uncheck the hide items that are already installed checkbox and look for liferay ide maven support in the also, if you'd like to view everything that is bundled with the liferay ide maven support option, uncheck the group click next, review the install details, accept the term and license your developer studio is ready to develop maven projects for liferay dxp! you'll learn about creating maven projects in developer studio next you can create a maven project based on liferay's provided maven archetypes give your project a name, select the maven-module build type, and choose the project template archetype you'd like to use figure 2 the new liferay module project wizard lets you generate a maven module project optional click next and name your component class name and package. can also specify your component class's properties in the properties menu you've created a liferay module project using maven! if you created your maven project outside of developer studio with another tool, you can still manage that project in developer studio, but you must first import it. to import a pre-existing maven project into liferay developer studio, follow the steps figure 3 developer studio offers the maven folder in the import wizard click browse... and select the root folder for your maven project. you've selected it, the url for that project should be visible in the figure 4 use the import maven projects wizard to import your pre-existing project now your maven project is available from the package explorer. about liferay developer studio's pom graphical editor you're provided a nifty pom graphic editor when opening your maven project's this gives you several different ways to leverage the power of maven in your project 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 developer studio provides five interactive modes to help you edit and organize your pom by taking advantage of these interactive modes, liferay developer studio makes modifying and organizing your pom and its dependencies a snap!;;
liferay developer studio provides an all-in-one, integrated development environment based on eclipse that supports development for liferay dxp. developer studio includes liferay ide plugins and additional enterprise-only features like developer studio is also designed to work with build tools such as gradle and maven, and service builder files, workflow definitions, layout templates, and more. find wizards for creating every kind of liferay project there is, snippet for tag libraries, and auto-deploy of changes to plugins in this section of tutorials, you'll learn how to install liferay developer studio and developmanage liferay modules using liferay workspace and other technologies.;;
once you've upgraded your plugin to liferay dxp 7.0, you can optimize it to take advantage of all liferay dxp 7.0 if you haven't yet familiarized yourself with what's changed from liferay portal 6, make sure to do so as they'll help you understand and appreciate the optional improvements for plugins and plugin development the optimization tutorials here are some common optimizations to consider several optimization tutorials are here and more are coming soon.;;
it's important to have a consistent user experience across your apps. liferay dxp's built-in apps achieve this through liferay's lexicon experience language and its web lexicon provides a consistent, user-friendly ui for liferay dxp apps, and is included in all themes that are based on the styled base theme, making all the components documented on the this means you can use lexicon markup and components in your liferay dxp apps. these tutorials explain how to apply lexicon's design patterns to achieve the same look and feel as liferay dxp's built-in apps the tutorials in this section cover the following topics;;
"an application with properly modularized plugins offers several benefits. can release individually its plugins without releasing the entire application. external clients can consume services from particular plugins, without having to depend on an entire application. and by splitting up large amounts of code into concise modules, teams can more easily focus on particular areas of the these are just a few reasons to modularize application plugins in this tutorial, you'll learn how to convert your traditional application into before getting started, it's important to reiterate that the module structure shown in this tutorial is just one of many ways for structuring your it's also important to remember that applications come in all different shapes and sizes. there may be special actions that some this tutorial provides the general process for converting to modules using liferay's module structure the instructions covered in this tutorial apply to both the commercial and open the first thing you'll do is create your application's web client module the first thing you'll do is create your application's parent directory and the directory structure for your application's web client module. holds your application's portlet classes and is responsible for its ui. you start creating a skeleton structure for your application's modules, you should determine which modules will comprise this version of your if your application provides service and api classes which is the case for all liferay service builder applications, you should create separate modules for your service implementation and service api classes. assumes the maven project model, although any build tools or directory setup is note it's recommended that you use the build plugin versions that support the following gradle or maven build plugin versions should be used in their respective build frameworks it is home for your application's independent modules and configuration files. application's name is tasks, then your parent folder could be tasks if your application uses liferay service builder, use the following command to generate the parent folder and service implementation and service if the parent folder already exists, it must be empty. this command names the parent folder after the applicationname the -service and -api module folders are described later in this create the folder structure for your web client module. automatically by using blade cli. demonstrate creating all different kinds of portlets navigate to your parent directory e.g., tasks and run the following blade cli command to generate a generic web client module structure replace the srcmainjavaapplicationname folder with your root for instance, if your application's root package name is url, your class's directory should be url files located in the srcmainresourcesmeta-infresources you'll insert your traditional application's java code and jsps, so the generated default code is not necessary verify that your current directory structure for your application's -web module matches the structure listed below the instructions in the rest of this sub-section only affect your application's web client module this is used to generate your module's manifest.mf file that is generated when you build your project. module's url file to fit your application. configuring your module's url, visit dictionary-web module's url for a simple example below for a more advanced example, examine the journal-web module's url this is used to specify all your module's the url file that was generated for you is pre-populated with content and default dependencies related to osgi and liferay dxp. dependencies ... block, you need to add the web client module's to learn how to find and specify dependencies on liferay api modules, refer to the reference document when deploying your module into the osgi container, osgi checks if the dependencies are available in the container. available in the container, your module will be unavailable. dependencies are not bundled with your module. copy your traditional application's jsp files into the your application's jsp files should reside in the web client module your next task is to add your portlet classes, non-service classes, and classes into their respective directories and ensure their package names within the class are specified correctly. your client module can hold one class or many classes, depending on how large your application is. good practice to organize your classes into sub-packages of the main package, to more easily manage them. you'll examine the journal-web module for an example of a client module holding many different java classes note many applications have service and api classes. need to live in separate implementation and api modules. about creating these later in this tutorial now that you have the necessary classes in your client module, you need to edit these classes to be compliant with osgi. component framework to work with. using a component framework lets you easily harness the power of osgi. component framework and recommends that liferay developers use it too. tutorial assumes that you're using declarative services. use any other osgi component framework in liferay dxp review your traditional application's xml files and migrate the configuration and metadata information to the portlet class as properties. you can do this by adding the annotation to your portlet class and adding the necessary properties to that annotation. should look similar to the following example convert all references of the portletid e.g., 58instance4gth to the class name of the portlet, replacing all periods with underscores e.g., if your traditional application has resource actions, you'll need to migrate file and add the following property as an example, you can view the directory application's add any language keys that your application uses to the include the language keys that are unique to your application. application will use the default language keys in liferay when it is you've created your application's web client module and navigated through some of the most common tasks necessary to modularize your portlet there are certain parts of your application that may not be covered in this tutorial that you must account for. provides developer tutorials divided into popular areas so you can easily find the correct way to transform your legacy code to use liferay dxp's updated best the table below serves as a quick reference guide. process for many of your application's directories, packages, and files. this is a sample table for a fictitious tasks applications many applications only have a web client module. applications, such as liferay service builder applications, require additional modules to hold their service api and service implementation logic. learn how to create these modules next in this section, you'll learn about converting a liferay portal 6 service builder application to a liferay dxp 7.0 style application. learned how to generate your implementation and api modules. run the service-builder blade cli command outlined in step 2 of the previous the api module holds your application's service builder generated api and the implementation module holds your application's service before you begin editing the api and implementation modules, you'll need to configure your root project e.g., tasks to recognize the multiple modules a multi-module gradle project must have a url file in the root project for building purposes. your service builder project's modules using blade cli, the url file was inserted and pre-configured for the api and service modules. should add your web module into the service builder project's generated parent folder and define it in the url file too. web module via gradle settings later, but for now, go ahead and copy the module into the project generated by the service-builder template. example, an example tasks project's root folder would look like this your root project directory should now be in good shape. to use service builder to generate your application's service api and service copy your traditional application's url file and paste it into the implementation module's root directory e.g., taskstasks-service blade cli generated a url file for your service implementation module. make sure to edit this url file to fit your application. example of a service implementation module's bnd file, examine the export-import-service module's bnd below blade cli also generated your service implementation module's in this file, service builder is already configured to generate code both in this module and in your service api module. run service builder, java classes, interfaces, and related files are generated in your api and service modules. implementation module's url file to view the default as you've learned already, you don't have to accept the generated build blade cli simply generated some standard osgi and for example, service builder is already available for you by default. cli applies the service builder plugin automatically when a project contains with the service builder plugin already available, you don't have to worry about configuring it in your project another important part of your service implementation module's url file is the buildservice... block. how service builder runs for your project. generate your api module successfully, but extra configuration might be open a terminal and navigate to your root project folder. your url file's configuration is used to generate your application's service api and service implementation classes in their you've also generated other custom files related to for more information on configuration options for the service builder plugin, see the now that you've run service builder, continue copying custom classes into the table below highlights popular liferay portal 6 classes and packages and where they should be placed in your this table is intended to aid in the organization of your classes and configuration files; however, remember to follow the organizational methodologies that make the most sense for your application. one size does not fit all with your modules' directory schemes once you've copied all of your custom classes over, run gradlew buildservice again to generate the remaining services now that your services are generated, you'll need to wire up your modules so they can reference each other when deployed to liferay's osgi container. cli has already partially completed this task. for example, it assumes that the service implementation module depends on the service api module you still need to associate the client module with the api and service modules, since they were generated separately. in your project's url file, you must add the web module with the api and service modules so it's included in the gradle build add the api and service modules as dependencies in you client module you've successfully generated your application's services using they now reside in modules, and can be deployed to now it's time to build your modules and deploy them to your liferay dxp instance. to build your project, run gradlew build from your project's root directory once your project successfully builds, check all of your modules' buildlibs there should be a newly generated jar file in each, which is the file you'll need to deploy to liferay dxp. you can deploy each jar by running blade deploy from each module's root directory note if you deploy your modules out of order, you might receive error for instance, if you try deploying your web client module first, you'll receive errors if it relies on the service implementation and service once each module's dependencies are met, they will successfully be for more information on checking each module's once you've successfully deployed your modules, you can list them from the gogo figure 1 once you've connected to your liferay instance in your gogo shell prompt, run lb to list your new converted modules this tutorial explained how to convert your traditional application into the modular format of a liferay dxp 7.0 style applicaton.";;
"the liferay theme generator is an easy-to-use command-line wizard that streamlines the theme creation process. it is independent of the liferay plugins sdk, and generates themes for liferay portal 6.2, liferay dxp 7.0, and up. this tutorial focuses on using the liferay theme generator to create themes. just a few steps, you'll have a working liferay theme note the liferay theme generator the tool is still in development and is not guaranteed to work on all platforms and environments this tutorial demonstrates how to install the liferay theme generator the first step is to install the liferay theme generator the liferay theme generator has several dependencies. install url, if it's not already installed. which is the version liferay portal 7.0 supports to test your url installation, execute the following command the resulting output should look similar to this note to avoid any potential compatibility issues, we recommend installing the long term support lts version of url at the time of this writing, node package manager npm is installed along with url first, create an.npmrc file in your user's home directory. you bypass npm permission-related issues in the.npmrc file, specify a prefix property like this one set the prefix value based on your user's home directory. specify is where global npm packages are to be installed next, set the npmpackages system environment variable to the prefix as a last npm configuration, since npm installs yeoman and gulp executables to npmpackagesbin on unix and to npmpackages on windows, make sure to add the appropriate directory to your system path. globally by executing the following command you've completed installing the liferay theme generator's dependencies install the liferay theme generator. 7.x.x versions of the theme generator 8.x.x versions create themes for 7.0 and 9.x.x versions create themes for 7.2 and up to create themes for 6.2 or 7.0, run the following command to create themes for 7.0 or 7.1 versions of liferay dxp, run if you are on windows, you must do additional setup for generated themes to use to use sass on windows, you must use either sass from node-sass or sass from by default, the generator creates theme projects to use node-sass; but you can reconfigure them to use ruby based sass and compass. indirectly requires visual studio, developers who are not already using visual studio may opt to use ruby based sass and compass instead of node-sass note if your theme was built with an older version of the liferay theme generator and specifies the liferay-theme-deps-7.0 1.0.0 dependency in its url, npm install may fail in liferay dxp due to its dependency to fix this issue, change the dev dependency in your url to liferay-theme-deps-7.0 7.0.0 and rebuild your theme. recommend that you use the latest 7.x.x version of the theme generator and dependencies in your url to ensure full compatibility this section explains both sass installations by default, the generator uses sass from node-sass. node-sass requires node-gyp, which in turn requires python and visual studio. explain how to set up node-gyp, python, and visual studio. is a particularly large dependency, if you aren't already using visual studio you might want to consider using ruby sass instead of node-sass as an alternative to using sass from node-sass, you can use sass from ruby. liferay themes require using compass along with ruby based sass. install and use sass and compass, you must install ruby via the ruby installer note sass version 3.5 has compatibility issues with compass. that you install sass version 3.4.0 as shown in the command below the following commands install the sass and compass gems after creating a theme project in the next section, you'll learn how to configure a project to use ruby based sass and compass now that you've installed the liferay theme generator and theme dependencies, when you installed the liferay theme generator, you also installed three for the purposes of this tutorial, the focus will be on the default liferay note if you run into permissions issues during theme generation, make sure you have readwrite access to all folders on your system from a directory in which you want to create a theme, run the following command note some theme options are deprecated for 7.0 such as velocity theme to view the deprecated options, run the generator with the the liferay theme generator prompts you for the following things enter a theme id, or press enter to accept the default select the version of your liferay instance e.g., 7.0 note that freemarker is used by default; you can only select velocity if you run the generator with the --deprecated flag based on the inputs up to this point, the default generator starts installing additional required software and creating your theme project when prompted, enter your app server's path. provide is added to the url in your theme's root folder. you can change the path in that file if you change app servers finally, enter your liferay instance's url, or press enter to accept the the generator creates a new theme project in your current directory. inherits styles from the liferay-theme-styled note that you can switch to using a different base theme by executing the they're analogous to java apis. and other themes that use liferay-theme-styled or liferay-theme-unstyled as a base theme are analogous to api implementationsthey're not meant to be extending liferay's classic theme is strongly discouraged important by default, your theme is based off of the styled theme and uses lib-sassbourbon, instead of compass. if, however, you are on windows and are using the ruby version of sass, you must configure the theme to support compass. open the url file found in the root folder of your theme, and locate the rubysass property and change it from false to true now that your theme is set to support compass, you must install the ruby sass middleware and save it as a dependency for your theme run the following command to install the ruby sass middleware the --save flag adds ruby sass to the list of dependencies in your theme's run the gulp build task to generate the base files for your theme. build folder of your theme to view the base files bit bare bones, but you have everything you need to develop it the generated theme's structure differs slightly from a theme created in the in a theme generated in the liferay plugins sdk, you put in a theme generated by the liferay theme generator, you put changes in the src folder to develop your theme, copy the build files into your src folder. instance to make a change to the url theme template, you would create a templates folder in your src folder, and copy the url file from the buildtemplates folder into the this gives you the base template to build on. important that you mirror the folder structure in order for the changes to be another noticeable difference in the generator created theme is that all css files have been converted to sass scss files. sassy css scss is the new main syntax which allows you to use the latest css3 styles and leverage sass syntax advantages, such as nesting and variables to deploy your theme to your configured liferay dxp instance, execute this command you can apply your theme by following the instructions found in the note by default theme images are cached by the browser. update images in the theme, it is best practice to use versioning in the image then just update the version each time you update the image, which will remove the potential for any caching issues now that you've created a theme and deployed it, you can use the theme project's to further develop and manage your theme. these offer basic functions, such as build and deploy, as well as more complex interactions, such as auto deploying when a change is made and setting the base theme you're ready to design a terrific theme! importing resources with a theme";;
themelets are small, extendable, and reusable pieces of code. require multiple components, a themelet only requires the files you wish to this creates a more modular approach to theme design, that lends itself well to collaboration, and reduces the need for duplicated code in your theme themelets let developers easily share code snippets across their themes with a themelet can consist of css and javascript. themelets are very flexible, and therefore they have a number of possible uses. you can make a themelet to modify the appearance of liferay dxp 7.0 admin tools, or a themelet that uses a custom javascript component for responsive embedded videos. for example, take a look at the liferay product menu animation themelet. this themelet simply alters the animation for liferay's product menu figure 1 themelets can be used to modify one aspect of the ui, that you can then reuse in your other themes if there is something you find yourself coding over and over again for themes, it's a good candidate for a themelet this tutorial demonstrates how to create a themelet to extend your theme to create a themelet, you need a theme to extend and the liferay theme generator and dependencies installed, as explained in the follow these steps to create a themelet open the command line and navigate to the directory you want to create your run yo liferay-themethemelet and follow the prompts to generate the figure 2 the themelet sub-generator automates the themelet creation process, making it quick and easy the generated themelet contains a url file with configuration information and a srccss folder that contains a url file. like a theme, add your css changes to the srccss folder, and add your javascript changes to the srcjs folder to use your themelet, you must install it globally first. themelet visible to the generator. to install your themelet globally, navigate into its root folder and run npm link. the command using sudo npm link. this creates a globally-installed symbolic link for the themelet in your npm packages folder. themelet is available to install in your themes now that your themelet is developed, you can install it in your theme after you've developed your themelet, follow the steps below to install it into navigate to your theme's root directory and run the following command choose themelet as the theme asset to extend select search globally installed npm modules figure 3 you can extend your theme using globally installed npm modules or published npm modules highlight your themelet, press spacebar to activate it, and press enter to run gulp deploy to build and deploy your theme with the new themelet as you can see, themelets are a handy tool to add to your theme development bag o' tricks importing resources with your themes;;
adapted your traditional plugin to liferay dxp's api, you can continue maintaining it in the plugins sdk. plugins sdk, however, is deprecated as of liferay dxp 7.0. the sdk will become increasingly difficult. liferay workspace replaces the plugins sdk, providing a comprehensive gradle development environment and more. command migrates traditional plugins such as portlets to gradle-based web from there you can build and deploy them to liferay dxp 7.0 command migrates plugins sdk plugins to web application projects in workspace's plugin files are re-organized to follow the standard web in a terminal, navigate to the liferay workspace root folder. plugins sdk project's name to blade's convert command blade extracts the plugin from the plugins sdk and reorganizes it in a standard web application project in workspace's wars folder note you can execute blade convert -l to show a list of projects that can be migrated in your plugins sdk. run blade convert --all to migrate all plugin projects in your plugins sdk to workspace the image below shows the plugin files before and after they're migrated to figure 1 the convert command migrates a plugins sdk project to a workspace web application project. it moves java source files to srcmainjava and all other filesfolders to srcmainwebapp the following table maps traditional plugin source files to the standard web plugins sdk folders to web application folders from your plugin's new location, you can invoke to deploy the.war, copy it from the plugin's buildlibs folder to the welcome to your plugin's new home in workspace! workspace development lifecycle;;
"upgrading to liferay dxp 7.0 involves migrating your installation and code your custom apps to the new version. you'll learn how to upgrade your code in this the first upgrade process step is to adapt your existing plugin's code to the great news is that liferay's upgrade planner makes this it identifies liferay api changes affecting your code, explains the api changes, and offers resolution steps. you might be tempted to optimize your existing plugins right away to benefit from the new things liferay dxp offers, but you shouldn't. upgrade your plugins according to these tutorials. plugins running in liferay as fast as possible, and at the same time you'll have prepared the plugins for the optimizations you can implement later these tutorials assume you're using the to follow along with this section, install the planner and step through the for convenience, this tutorial section also references documentation and outlined steps to aid those opting to upgrade their code manually here are the code upgrade steps upgrade your development environment legacy project environments should be upgraded to the latest version of liferay workspace to ensure you leverage all available features a liferay workspace is a generated environment that is built to hold and manage your liferay projects. createimport a workspace to get if you don't have an existing 7.x liferay workspace, you must create skip to the next step if you have an existing workspace set the liferay dxp version in workspace's configuration you intend to configure your bundle url that the liferay dxp bundle is downloaded configure your target platform version, which provides the specific artifacts associated with a liferay dxp release download the liferay dxp bundle you're upgrading to copy your plugins sdk projects into workspace and convert them to migrate existing plugins to workspace migrate your existing plugins to workspace. plugin to workspace and converting it to the workspace's build optimize your workspace's build environment for the most efficient code update your repository url to liferay's frequently updated cdn update your workspace plugin version to leverage the latest features of remove the project's dependency versions since it's leveraging target fix common upgrade problems dealing with your project's dependencies and auto-correct straightforward upgrade problems these are problems that cannot be auto-corrected; you can update them manually according to the breaking changes mark upgrade problems as resolved after addressing them after fixing your upgrade problems, remove the problem markers resolving a plugin's dependencies upgrade your customization plugins so they're deployable to liferay dxp 7.0 upgrade core language key hooks upgrade portlet language key hooks upgrade portal properties hooks upgrade your themes so they're deployable to liferay dxp 7.0 upgrading your theme from liferay portal 6.1 to 7.0 upgrading your theme from liferay portal 6.2 to 7.0 upgrade your layout templates so they're deployable to liferay dxp 7.0 use liferay dxp's class loader to access the app server's jndi api upgrade service builder service invocation for service builder logic remaining in a war, you must implement a service tracker to call services. for logic divided into osgi modules, you can leverage declarative services adapt your app to account for service builder-specific changes migrate off of velocity templates velocity template usage is deprecated for liferay dxp 7.0. convert your template to freemarker upgrade your portlets so they're deployable to liferay dxp 7.0 upgrade web plugins previously stored in the webs folder of your legacy attempt to leverage an extension point instead of upgrading your ext plugin. if an ext plugin is necessary, you must review all changes between the previous liferay portal instance you were using and liferay dxp 7.0, and then manually modify your ext plugin to merge your changes with liferay dxp's once you've finished the code upgrade steps, your custom apps will be compatible";;
to create a powerful, reliable platform for developing modular applications, liferay sought best-of-breed standards-based frameworks and technologies. it was imperative not only to meet demands for enterprise digital experiences but also to offer developers, both experienced with liferay and new to liferay, a clear and elegant way to create apps here were some of the key goals allow breaking down a large system into smaller pieces of code, whose boundaries and relationships could be clearly defined explicitly differentiate public apis from private apis facilitate extensibility of existing code modernize the development environment, leveraging more state-of-the-art tools to provide a great developer experience it wasn't long before liferay discovered that osgi and its supporting toolstechnologies fit the bill! in this tutorial, you'll learn how liferay dxp 7.0 uses osgi to meet these objectives. and equally important, you'll find out how easy and fun modular development can here are the topics you'll dig into modules as an improvement over traditional plugins development and customization of applications for liferay has been done traditionally in war-style plugins portlet, hook, ext, and web. liferay dxp 7.0, traditional liferay plugins can be replaced with or can be you'll see the similarities and differences of plugins and modules, and you'll learn the benefits of using in liferay dxp 7.0, you can both declare dependencies among modules and combine modules to create applications. provides huge benefits, it's important to devote a large section for it osgi services and dependency injection osgi provides a powerful concept called osgi services also known as osgi's declarative services standard provides a clean way to inject dependencies in a dynamic environment. except the changes happen while the system is running. elegant extensibility model that liferay dxp 7.0 leverages extensively module deployment is managed by liferay dxp 7.0 not the application server. this section demonstrates how to use dynamic deployment for better control after investigating these topics, you'll get hands-on experience creating and let's start with learning how modules are better than traditional plugins in liferay dxp 7.0, you can develop applications using osgi modules or using traditional liferay plugins war-style portlets, hooks, ext, and web liferay's plugin compatibility layer explained later makes it possible to deploy traditional plugins to the osgi runtime framework. from all liferay dxp 7.0 and osgi offer, however, you should use osgi modules better encapsulation - the only classes a module exposes publicly are this lets you define internal public classes transparent to external clients dependencies by package - dependencies are specified by java package, not in traditional plugins, you had to add all of a jar file's classes to the classpath to use any of its classes. import packages containing the classes you need. packages are added to the module's classpath lightweight - a module can be as small as you want it to be. to a traditional plugin, which may require several descriptor files, a module requires only a single descriptor filea standard jar manifest. traditional plugins are typically larger than modules and deployed on app server startup, which can slow down that process considerably. quickly and require minimal overhead cost easy reuse - modules lend themselves well to developing small, highly they can be combined to create applications that are modules can be distributed publicly e.g., on maven and since modules are versioned, you can specify precisely the modules you want to use annotations to describe themselves. to specify its name, display name, resource bundle, public render parameters, instead of specifying that information in descriptor files separate from the code, you specify them in context in the code these are just a few ways modules outshine traditional plugins. that developers experienced with liferay plugins have the best of both worlds. liferay dxp 7.0 supports traditional plugins and modules. developers can find comfort in the simplicity of modules and their similarities here are some fundamental characteristics modules share with plugins developers use them to create applications portlets for liferay they're zipped up packages of classes and resources they're packaged as a standard java jars now that you've compared and contrasted modules with plugins, it's time to tour a module's structure is extremely simple. meta-infmanifest.mf. you add code and resources to the module and organize here's the essential structure of a module jar file the manifest.mf file describes the module to the system. identify the module and its relationship to other modules here are some of the most commonly used headers bundle-name user friendly name of the module bundle-symbolicname globally unique identifier for the module. conventions e.g., url are commonly used bundle-version version of the module export-package packages from this module to make accessible to other import-package packages this module requires that other modules provide other headers can be used to specify more characteristics, such as how the module was built, development tools used, etc for example, here are some headers from the liferay journal web module manifest note to remove unnecessary noise from this example, some headers have been abbreviated .. and some have been removed you can organize and build a module's java code and resources however you like. you're free to use any directory structure conventions, such as those used in maven or by your development team. and you can use any build tool, such as is an environment for managing module projects and theme projects. workspace provides gradle build scripts and a workspace created from the liferay workspace can be used from the command line or from note also that liferay developer studio provides plugins for gradle, maven, and bndtools. tooling details are covered later in this series now that you're familiar with the module structure and manifest, it's time to the most common way to build modules is with a little tool called bnd. it's an engine that, among other things, simplifies generating manifest instead of manually creating a manifest.mf file, developers use bnd bnd can be used on its own or along with other build tools, such liferay workspace uses bnd together with gradle or maven one of bnd's best features is that it automatically transverses a module's code to identify external classes the module uses and adds them to the manifest's bnd also provides several osgi-specific operations that simplify module development bnd generates the manifest based on a file called url in the project root. this file's header list is similar to but shorter than that of the manifest.mf. compare the liferay journal web module's url file content simplified a bit below to its manifest.mf file content that was listed the main difference is that the url file doesn't specify an it's unnecessary because bnd generates it in the manifest.mf file automatically. bnd plugins are available to use with gradle and maven. workspace includes bnd, developers can use bnd from the command line and from now that you're familiar with bnd and the export-package and import-package manifest headers, let's explore how to use them to leverage dependencies using an osgi manifest, a module declares the java packages it consumes and the manifest's import-package and export-package settings expose as you determine whether to use a particular module, you know up-front what it offers and what it depends on. as an improvement over java ee, osgi takes away dependency guesswork this part of the tutorial explains how to develop modular apps using dependencies let's start by learning how dependencies operate in liferay dxp 7.0 since all of liferay dxp 7.0 leverages dependencies, it also demonstrates how to as mentioned previously, all of what was in liferay portal 6 and its apps has been refactored into osgi modules. the portal-service api the main api in liferay portal 6 has been replaced by the portal-kernel module liferay dxp 7.0's kernel api and many small, highly-cohesive modules that provide frameworks, utilities, apps, and more not only do liferay dxp modules depend on third-party modules but they also depend you can likewise leverage dependencies in your projects. you're developing new osgi modules or continuing to develop traditional apps, you need only set dependencies on modules whose packages you need each module's manifest lists the packages the module depends on. environment such as gradle, maven, or antivy, you can set dependencies on each at build time, the dependency framework verifies the entire dependency chain, downloading all newly specified modules. happens at runtime the osgi runtime knows exactly which modules depend on which other modules failing fast if any dependency is unmet. is explicit and enforced automatically upfront versioning is independent for each liferay module and its exported packages. can use a specific package version by depending on the version of the module and you're free to use a mix of liferay modules in the versions you want but remember, with great power comes great responsibility, so unless you really know what you're doing, use the same version of each module you for all its modules, liferay dxp uses semantic versioning. it's a standard that enables api authors to communicate programmatic compatibility of a package or module automatically as it relates to dependent consumers and api implementations. if a package is programmatically i.e., semantically incompatible with a project, bnd used in liferay workspace fails that project's build immediately. developers not using bnd can check package versions manually in each dependency module's manifest semantic versioning also gives module developers flexibility to specify a version range of packages and modules to depend on. versions of a package work for an app, the developer can configure the app to what's more, bnd automatically determines the semantically compatible range of each package a module depends on and records the range to on testing your project, you might find a new version of a dependency package has bugs or behaves differently than you'd like. package version range to include versions up to, but not including, the one you next you want to consider when to modularize existing apps and when to combine liferay dxp 7.0's support of dependencies and semantic versioning facilitates the dependency frameworks enable you to use modules and you can use these modules throughout your organization and liferay dxp 7.0's integration with dependency management frees you to modularize existing apps and develop apps that combine it's a powerful and fun way to develop apps on liferay dxp here are some general steps to consider when modularizing an existing app start by putting the entire app in a single module this is a minimal first step that acquaints you with liferay dxp 7.0's module framework. confidence as you build, deploy, and test your app in an environment of your choice, such as a liferay workspace, gradle, or maven project split the front-end from the back-end modularizing front-end portlets and servlets and back-end implementations e.g., service builder or osgi component is a logical next step. this enables each code area to evolve separately and allows for varying implementations extract non-essential features to modules you may have functionality or api extensions that need not be tied to an app's core codebase. refactored as independent modules that implement apis you provide. might be connectors to third-party systems or support for various data the principles listed above also apply to developing new modular-based apps. you design an app, consider possible implementation variations with respect to its features, front-end, and back-end. encapsulate the variations using apis. then develop the apis and implementations as separate modules. liferay's blogs application exemplifies modularization in the manner we've non-essential features and extensions blogs-editor-configuration - extends the portal-kernel module for blogs-recent-bloggers-web - provides the recent bloggers app blogs-item-selector-api - encapsulates the item-selector implementation blogs-item-selector-web - renders the blogs app's item-selector blogs-layout-prototype - creates a page template showcasing blog entries the blogs app, like many modular apps, separates concerns into modules. way, front-end developers concentrate on front-end code, back-end developers concentrate on that code, and so on. to design, implement, and test the modules independently as you develop app-centered modules, you can consider bundling them with your app e.g., as part of a liferay marketplace app. app is convenient for the consumer. by bundling a module with an app, however, you're committing to the app's release schedule. directly deploy a new version of a module for the appyou must release it as so far, you've learned how dependencies and semantic versioning work. considered guidelines for modularizing existing apps and creating new modular now, to add to the momentum around osgi and modularity, you'll explore osgi services and dependency injection using osgi declarative services in liferay dxp 7.0, the osgi framework registers objects as services. offers functionality and can leverage functionality other services provide. osgi services model supports a collaborative environment for objects declarative services ds provides a service component model on top of osgi ds service components are marked with the annotation and implement or extend a service class. service component can refer to and use each the service component runtime scr registers component services and handles binding them to other components that reference them here's how the magic happens service registration on installing a module that contains a service component, the scr creates a component configuration that associates the component with its specified service type and stores it in a service service reference handling on installing a module whose service component references another service type, the scr searches the registry for a component configuration that matches the service type and on finding a match binds an instance of that service to the referring component it's publish, find, and bind at its best! how does a developer use ds to register and bind services? no, it's much easier than that. annotations and add this annotation to a class definition to make the class a componenta service provider add this annotation to a field to inject it with a service that the annotation makes the class an osgi component. service property to a particular service type in the annotation, allows other components to reference the service component by the specified service type for example, the following class is a service component of type url on deploying this class's module, the scr creates a component configuration that associates the class with the service type someapi specifying a service reference is easy too. to a field marks it to be injected with a service matching the field's type on deploying this class's module, the scr finds a component configuration of the class type someapi and binds the service to this referencing component class at build time, bnd creates a component description file for each module's the file specifies the component's services, dependencies, and activation characteristics. framework reads the component description to create the component and manage its the scr stands ready to pair service components with each other. referencing component, the scr binds an instance of the targeted service to it as an improvement over dependency injection with spring, osgi declarative services supports dynamic dependency injection. publish service components for other classes to use. components and even publish alternative component implementations for a service. this kind of dynamism is a powerful part of liferay dxp 7.0 in osgi, all components, java classes, resources, and descriptors are deployed the manifest.mf file describes the module's physical characteristics, such as the packages it exports and imports. component description files specify its functional characteristics i.e., the services its components offer and consume. also modules and their components have their own lifecycles and administrative apis. shell tools give you fine-grained control over module and component deployment since a module's contents depend on its activation, consider the activation installation copying the module jar into liferay dxp's deploy folder installs the module to the osgi framework, marking the module installed resolution once all the module's requirements are met e.g., all packages it imports are available, the framework publishes the module's exported activation modules are activated eagerly by default. started in the framework and marked active on resolution. module's components are enabled. if a module specifies a lazy activation policy, as shown in the manifest header below, it's activated only after another module requests one of its classes the figure below illustrates the module lifecycle figure 1 this state diagram illustrates the module lifecycle lets developers manage the module lifecycle. they can installuninstall modules developers can update a module and notify dependent modules liferay's tools, including liferay developer studio, liferay workspace, and blade cli offer similar shell commands that use the osgi admin api on activating a module, its components are enabled. component activation requires all its referenced that is, all services it references must be registered. the highest ranked service that matches a reference is bound to the component. when the container finds and binds all the services the component references, it components can use delayed default or immediate activation policies. specify immediate activation, the developer adds the attribute immediatetrue unless immediate activation is specified, the component's activation is delayed. that is, the component's object is created and its classes are loaded once the in this way delayed activation can improve startup times gogo shell's service component runtime commands scrlist bundleid lists the module's bundle's components scrinfo componentidfullclassname describes the component, including its status and the services it provides screnable componentidfullclassname enables the component scrdisable componentidfullclassname disables the component. disabled on the server or current server node in a cluster until service references are static and reluctant by default. service remains bound to the referencing component until the service is every time a higher ranked matching service is registered, the framework unbinds the lower ranked service from the component and binds the new service in its place automatically. here's a annotation that uses a declarative services annotations let you specify component activation and gogo shell commands let you control modules and components. next, you'll create and deploy a module and component to liferay dxp the previous sections explained some of the most important concepts for liferay portal 6 developers to understand about osgi and modularity. put this knowledge to practice by creating and deploying a module the module includes a java class that implements an osgi service using the project uses gradle and bnd, and can be built and deployed from within a liferay workspace here's the module project's anatomy on building the module jar, bnd generates the module manifest automatically getdescription - returns the class's name activate - prints the console message activating myservice. annotation signals the osgi runtime environment to invoke this the annotation defines the class as an osgi service component. following properties specify its details url - designates the component to be a service component for registering under the type myservice. class implements a service of itself. note, service components typically implement services for interface classes immediatetrue - signals the service component runtime to activate the component immediately after the component's dependencies are resolved the bundle-symbolicname is the arbitrary name for the module. version value 1.0.0 is appropriate bnd generates the module's osgi manifest to the file meta-infmanifest.mf in this project, the jar is created in the buildlibs the last file to examine is the gradle build file url since the myservice class uses the annotation, the project depends on the osgi service component annotations module. simple because liferay workspace module projects leverage the workspace's gradle although this module project was created in a liferay workspace, it can easily be modified to use in other build environments. most important, it was created in a liferay workspace place the project files in a folder under the modules folder e.g., to build the module jar and deploy it to liferay dxp, execute the deploy gradle note if blade is installed recommended, gradle can be executed by entering blade gw followed by a task name e.g., blade gw deploy . details on blade commands, see blade cli on deploying the module, the following message is printed to the server console you've successfully built and deployed an osgi module to there is much more to learn about developing apps using osgi. are listed below and many more abound. to make the best of your time, however, avoid osgi service articles that explain techniques that are older and more complicated than declarative services developers new to osgi should check out these resources introduction to liferay development osgi enroute is a site the osgi alliance provides to the osgi community. provide hands-on experience with osgi modules and declarative services osgi alliance's developer section explains osgi's architecture and modularity developers ready to dive deep into osgi should read the osgi specifications. they're well-written and provide comprehensive details on all that osgi offers. the osgi alliance osgi compendium release 6 specifies the following services that liferay dxp 7.0 leverages extensively declarative services specification configuration admin service specification for modifying deployed since configuration admin services are already integrated with declarative services, however, liferay developers need not use the low-level metatype service specification for describing attribute types as metadata.;;
a liferay theme is the overall look and feel for a site. combination of css, javascript, html, and freemarker templates. default themes are nice, you may wish to create your own custom look and feel liferay dxp provides several tools and environments that you can what if you only wish to make a minor change to the overall look and feel? say you just want to change a menu animation. theme for this single modification, you can themelets are modular, customizable, reusable, shareable pieces of code that they enable reusable code for themes. code each time, you can use the same themelet in each theme liferay has its own set of base themes, called that create the default look and feel you see at first start. inherits from the unstyled theme, and simply adds some additional styling on these same base themes are used to create a custom theme. which uses the styled theme as its base. foundation, you can then make your customizations to the theme files. the theme, mirror the folder structure of the files you wish to change place the modified files in the src folder of your theme if using the liferay theme generator, or copy them into the webapp folder of your theme if using liferay developer studio. once your theme is developed it is packaged as a war web application archive file and can be deployed to the server, either manually or using build tools. apply your theme to your pages through the the only limitation is your imagination.;;
"a theme without content is like an empty house. empty house, it may be difficult for prospective buyers to see its full beauty. however, staging the house with some furniture and decorations helps prospective buyers imagine what the house might look like with their belongings. resources importer module is a tool that allows a theme developer to have files and web content automatically imported into liferay dxp when a theme is deployed. usually, the resources are imported into a site template but they can also be liferay administrators can use the site or site template created by the resources importer to showcase the theme. great way for theme developers to provide a sample context that optimizes the in fact, all standalone themes that are uploaded to liferay marketplace must use the resources importer. experience for marketplace users a user can download a theme from marketplace, install it on liferay dxp, go to sites or site templates in the control panel and immediately see their new theme in action. in this tutorial, we explain how to include resources with your theme note the resources importer has undergone some changes that affect the properties, class names, and structures that were referred to in versions prior please read through the steps below to see the updates. previous versions of liferay, you had to deploy the resources importer if you declared it as a dependency in your theme's url in liferay dxp 7.0 and up, this is no longer a requirement. importer is now an osgi module, and is deployed to your instance by default when you create a new theme using the liferay theme generator, check your theme's url file for the developer this is a convenience feature for theme developers. importing resources to a site or site template that already exists, recreates the site template and its resources to the sites that are based on the site without resources-importer-developer-mode-enabledtrue, you have to manually delete the sites or site templates built by the resources importer, each time you want to apply changes from your theme's warning the resources-importer-developer-mode-enabledtrue setting can be dangerous since it involves deleting and re-creating the affected site or it's only intended to be used during development. if you'd like to import your theme's resources directly into a site, instead of into a site template, you can specify the following in your if you're using the resources-importer-target-valuesite-name property, double check the site name that you're specifying. value, you could end up deleting and re-creating the wrong site! warning it's safer to import theme resources into a site template than into setting can be handy for development and testing but should be used cautiously. don't use this setting in a theme that will be deployed to a production liferay instance or a theme that will be submitted to liferay marketplace. theme for deployment to a production liferay instance, use the default setting so that the resources are imported into a site template. or implicitly by commenting out or removing the all of the resources a theme uses with the resources importer go in the imported by your theme should be placed in the following directory structure the following is the xml file for a basic web content article you can view an article's xml by going to its source when you create a new theme using the liferay theme generator, a default url file is created and a default url file is created in the web-inf folder you have two options for specifying resources to be imported with your theme. the recommended approach is to add resource files to the folders outlined above and to specify the contents of the site or site template in a url alternatively, you can use an url file to package the resources you'd like your theme to deploy. url, just export the contents of a site from liferay portal using the then place the url file in your theme's use an archive file to package all of your resources, you won't need a url file or any other files in your lar file is version-specific; it won't work on any version of liferay other than the one from which it was exported. for this reason, using a url file to specify resources is the most flexible approach. for liferay marketplace, you should use the url to specify resources the url in the theme-namesrcweb-infsrcresources-importer folder specifies the site pages, layout templates, web content, assets, and portlet configurations provided with the theme. this file describes the contents and hierarchy of the site for liferay to import as a site or site template note site templates only support the importing of either public page sets if you want to import both public and private page sets, as shown in the example url below, you must import your resources into a site even if you're not familiar with json, the url file is easy to let's examine a sample url file the first thing you should declare in your url file is a default layout template id so the target site or site template can reference the layout you can also specify different layout templates you can find layout templates in your liferay next, you have to declare the layouts, or pages, that your site template should use. note that pages are called layouts you can specify a name, title, and friendly url for a page, and you can set a page to be hidden. to declare that web content should be specifying their portlet ids, which can be found in the app manager of the select the suite that the app is located in, click the app, click the app web link, and open the portlets tab that appears. displayed below the name of the app. you can find a full list of the default portlet ids for liferay in the portlet id quick you can also specify portlet preferences for each portlet the following properties are available in the url colorschemeid specifies a different color scheme by id than the default color scheme to use for the layout columns specifies the column contents for the layout friendlyurl sets the layout's friendly url hidden sets whether the layout is hidden layoutcss sets custom css for the layout to load after the theme layoutprototypelinkenabled sets whether the layout inherits changes made to the page template if the layout has one layoutprototypename specifies the page template by name to use for the if this is defined, the page template's uuid is retrieved using the name, and layoutprototypeuuid is not required layoutprototypeuuid specifies the page template by uuid to use for the if layoutprototypename is defined, this is not required layouttemplateid when defined outside the scope of a portlet, sets the default layout template for the theme's layouts. sets the layout template for the layout layouts specifies child pages for a layout set publicpages namemap passes a name object with multiple name keyvalue pairs. in the example sitemap above, you can use this to pass language keys for layout portletpreferences specifies the portlet's preferences. portletsetupportletdecoratorid specifies the portlet decorator to use for the portlet borderless barebone decorate . portlets specifies the portlets to display in the layout's column. portlets, recursively use columns as shown in the example url above for the comliferaynestedportletswebportletnestedportletsportlet portlet themeid specifies a different theme by id than the default theme bundled with the url to use for the layout the default value is portlet empty page. possible values are copy copy of a page of this site, embedded, fullpageapplication, linktolayout, node page set, panel, portlet, and url link to url typesettings specifies settings using keyvalue pairs for the layout note portlet preferences set in url are saved in the database to to determine the proper keyvalue pair for a portlet preference, there are a couple approaches you can take you can manually set the portlet preference in liferay dxp, and then check the values in this column of the database as a hint for what to configure in your for example, you can configure the asset publisher to display assets that match the specified asset tags, using the following configuration alternatively, you can search each app in your liferay dxp bundle for the keyword this returns some of the app's jsps that have the portlet preferences defined for the portlet you can use a combination of both of these approaches to determine the keyvalue pairs for the portlet preferences note that portlet preferences that require an existing configuration, such as a tag or category, may require you to create the configuration on the global site first, so that the resources importer finds a match when deployed with the theme tip you can specify an application display template adt for a portlet in the url file by setting the displaystyle and displaystylegroupid to learn more about adts, visit the styling apps with application display templates optionally, you can create an url file in your url file defines the pages of the site or site template to be imported, along with the layout templates, portlets, and portlet preferences of these pages, the url file specifies details about the assets to be tags can be applied to any asset. abstract summaries and small images can be applied to web content articles. for example, the following url file specifies two tags for the url image, one tag for the custom url web content article, and an abstract summary and small image for the child web content url article structure now that you've learned about the directory structure for your resources, the url file for referencing your resources, and the url file for describing the assets of your resources, it's time to put resources into you can create resources from scratch andor bring in resources that you've already created in liferay. let's go over how to leverage your html basic web content, json structures, or vm or ftl templates files from note in previous versions of liferay, basic web content could be added without the need of a structure or template. in liferay dxp 7.0 and above, all web content articles require a structure and template web content edit the article, and copy the content from the source view. create a folder for the article under resources-importerjournalarticles, copy the contents into an xml file, named as desired, and place it into the the web content article's xml fills in the data structure edit the structure by clicking the link under structure and template, and copy and paste its contents into a new json file for the structure in the resources-importerjournalstructures folder. structure json sets a wireframe, or blueprint, for an article's data template create a folder for the template under the link under structure and template, and copy and paste its contents into a new ftl file for the template, and place it into the folder for the template. the template defines how the data should be displayed here is an outline of steps you can use in developing your theme and its theme-namesrcweb-infsrcresources-importer folder and its create a url file in your resources-importer folder. file, define the pages of the site or site template to be imported, along with the layout templates, portlets, and portlet preferences of these pages create an url file in your resources-importer folder. file, specify details of your resource assets set the resources-importer-target-value property to the name of the site or site template into which you are importing, or comment it out to use the for example, the following configuration sets the target value to the name of an existing site or site template alternatively, this configuration uses the theme's name as the target value note by default resources are imported into a new site template named if you want your resources to be imported into an existing site or site template, you must specify a value for the comment out the resources-importer-target-class-name property to import into a site template or set it to url.group to as mentioned above the example url, you must import your resources into a site, if you define both public and private page sets in if you don't specify a value for the resources-importer-target-class-name property, your resources will be deploy your theme into your liferay instance view your theme, and its resources, from within liferay. portal as an administrator and check the sites or site templates section of the control panel to make sure that your resources were deployed correctly. from the control panel you can easily view your theme and its resources you can go back to any of the beginning steps in this outline to make it's just that easy to develop a theme with resources intact!";;
theme projects that use the liferay js theme toolkit, such as those created with the liferay theme generator have access to several gulp tasks that you can execute to manage and deploy your theme note gulp is included as a local dependency in generated themes, so you are not required to install it. url followed by the gulp task from a generated theme's here are the gulp tasks you can execute build generates the base theme files, compiles sass into css, and zips all theme files into a war file that you can deploy to a liferay deploy runs the build task and deploys the war file to the note if you're running the felix gogo shell, you can also deploy your theme using the gulp deploygogo command. task will not work for 6.2 themes extend allows you to specify a base theme or themelet to extend. default, themes created with the liferay theme generator are based off of the styled theme you first are prompted if you want to extend a base theme or themelet, then you're prompted for where you would like to search for modules. globally installed npm modules searches globally accessible npm modules selecting npm registry searches for published modules if you have v8.x.x of the liferay js theme toolkit installed, you can also specify a package url to locate a themelet note you can retrieve the url for a package by running after you've selected modules from the options it provides, the modules are added to your url file as dependencies. note the classic theme is an implementation of an existing base theme and is therefore not meant to be extended. kickstart allows you to copy the css, images, js, and templates from another theme into the src directory of your own. the extend task, kickstarting from another theme is a one time inheritance, whereas extending from another theme is a dynamic inheritance that applies your src files on top of the base theme on every build init prompts you for local and remote app server information to use in status displays the name of the base themethemelets your theme extends watch allows you to preview the changes you make to your theme without after invoking the watch task, every time you save any changes to a file in your theme, applicable changes are compiled and they're copied directly to a proxy port e.g. 9080 for you to preview note you must have developer mode enabled to use the watch task. once you're happy with the live preview, deploy your theme to apply the changes;;
a liferay workspace is a generated environment that is built to hold and this workspace is intended to aid in the management of liferay projects by providing various gradle build scripts and this is the official way to create liferay dxp 7.0 modules for those developers that still want to develop war-style plugins using the plugins sdk, this way is also supported using a liferay workspace. tutorial to learn about using liferay workspace with maven liferay workspaces can be used in many different development environments, which makes it flexible and applicable to many different developers. workspace and initialize a new liferay workspace you can also use it with other developer ides. easily integrates with liferay developer studio, providing a seamless development to learn more about liferay developer studio and using workspace with it, see creating a liferay workspace with liferay developer studio your workspace also offers gradle properties that you can modify to help manage there are also some folders that aren't generated by default, but can be manually created and set. customize your workspace's folder structure any way you'd like. info on a workspace's folder structure and how you can configure a workspace, configuring a liferay workspace liferay workspaces offer a full development lifecycle for your modules to make your liferay development easier than ever. the development lifecycle includes creating, building, deploying, testing, and releasing modules. about the development lifecycle of a liferay workspace, see the development lifecycle for a liferay workspace;;
if you have proxy server requirements and want to configure your proxy to work with the liferay upgrade planner, follow the instructions below in dev studio's url url file, add the following go to window preferences general network set the active provider drop-down selector to manual under proxy entries, configure both proxy http and by clicking the field and selecting the edit button figure 1 you can configure your proxy settings in dev studio's network connections menu for each schema http and enter your proxy server's host, port, and do not leave whitespace at the end of your proxy host or port settings once you've configured your proxy entry, click apply and close you've successfully configured the upgrade planner's proxy settings!;;
liferay provides working examples of sample projects that target different integration points in liferay dxp. these working examples can be copypasted into your own independent project so you can take advantage of various liferay each sample is a standalone project and includes its own build liferay's sample projects can be found in the you can find documentation for liferay's sample projects if you'd like to browse the repository locally or copy sample projects into your at first glance, you'll notice that the repository is broken up into three the provided sample projects are organized by their development toolchains to cater to a variety of developers. each folder offers the same set of sample their only difference is that the build files are specific to for example, the gradle folder contains projects using standard oss gradle plugins that can be added to any gradle composite build. same concept also applies to the liferay-workspace and maven projects the gradle folder also uses the liferay gradle plugin e.g., url which encompasses additional functionality for various the liferay gradle plugin is recommended for gradle some samples also come configured with logging to help you fully understand what the sample is accomplishing behind the scenes. logging is implemented for several samples e.g., etc., which lets osgi modules supply their own logging configuration defaults without external configuration. for a list of sample template projects available, visit the sub-section in the liferay blade samples repository. a subset of missing extension point samples can be found in the liferay extension points without template projects section for details on contributing to this repository.;;
ext plugins let you use internal apis and even let you overwrite liferay dxp core this puts your deployment at risk of being incompatible with security, performance, or feature updates released by liferay. version of liferay dxp, you must review all changes and manually modify your ext projects to merge your changes with liferay dxp's during your upgrade to liferay dxp 7.0, it's highly recommended to leverage an extension point to customize liferay dxp instead of using you existing ext plugin, liferay dxp 7.0 provides many extension points that let you customize almost every detail of liferay dxp. if there's a way to customize what you want with an extension point, do it that way instead. more extensible, easier to maintain section for more details on the advantages of using liferay dxp's extension for more information on ext projects, how to decide if you need one, and how to;;
designed to work with liferay dxp. these plugins were stored in the webs folder upgrading a liferay web plugin involves these steps adapt the plugin to liferay dxp 7.0's api using the liferay upgrade planner. when running the planner's fix upgrade problems step, many of the existing for remaining issues, the planner identifies code affected by the new api and ways to adapt it after deploying the upgraded portlet, the server prints messages that indicate you've upgraded and deployed your liferay web plugin on your liferay dxp 7.0;;
velocity templates were deprecated in liferay portal 7.0 and are now removed in favor of freemarker templates in liferay dxp 7.0. freemarker is developed and maintained regularly, while velocity is no longer freemarker is faster and supports more sophisticated macros freemarker supports using taglibs directly rather than requiring a method to you can pass body content to them, parameters, etc although velocity templates still work in liferay dxp 7.0, we highly recommend migrating to freemarker templates. for more information on this topic, see the;;
liferay dxp 7.0 continues to use you can focus on your application's business logic instead of its persistence it still generates model classes, local and remote services, and upgrading most service builder portlets involves these steps adapt the portlet to liferay dxp 7.0's api using the upgrade planner. running the planner's fix upgrade problems step, many of the existing issues for remaining issues, the planner identifies code affected by the new api and ways to adapt it for example, consider an example portlet with the following compilation error the url file specifies a tag library attribute total that doesn't exist remove the total attribute assignment to make the tag like this resolve these error types and others until your code is adapted to the new api to adapt your app's dependencies, refer to the resolving a plugin's dependencies once your dependencies are upgraded, rebuild your services! to rebuild your portlet's services, see the an example change where upgrading legacy service builder code can produce differing results is explained below names in exception elements like this in liferay portal 6.2, service builder generates exception classes to the path them to package-pathexception for example, the example portlet's package path is its exception class for exception element is required in your service builder project, you must update the references to once your service builder portlet is upgraded, deploy it note service builder portlets automatically migrated to liferay workspace using the upgrade planner or blade cli's convert command automatically has its service builder logic converted to api and implementation modules. this is a best practice for liferay dxp 7.0 the portlet is now available on liferay dxp. portlet that uses service builder!;;
when upgrading a portlet leveraging first decide if you're building your service builder logic as a war or note service builder portlets automatically migrated to liferay workspace using the upgrade planner or blade cli's convert command automatically have its service builder logic converted to api and implementation modules. this is a best practice for liferay dxp 7.0 if you prefer keeping your service builder logic as a war, you must implement a service tracker to call services. if you're optimizing your service builder logic to invoke liferay services from;;
in liferay dxp's osgi environment, you must use the portal's class loader to load the application server's jndi classes. an osgi bundle's attempt to connect to a jndi data source without using liferay dxp's class loader results in a for more information on how to do this, see the connecting to jndi data sources;;
this tutorial guides you through the process of upgrading your 6.1 theme to run for a more in depth tutorial that covers upgrading 6.2 themes, please see the you'll use liferay theme generator to get the upgrade process started. theme generator supplies your theme with the necessary tools to deploy and make in this tutorial, you'll use liferay theme generator's import feature to help before you import your theme, you need to make some modifications to your theme to ensure liferay theme generator sets up the correct version and template make sure these settings are present in your theme open your url file and make sure the template language also in url, set the theme version to 6.2 finally, open your url file and update the liferay portal version to 6.2, as well note liferay theme generator's importer only recognizes 6.2 themes. therefore, 6.1 themes must be versioned as 6.2 to be recognized by the the importer only supports importing 6.2 themes generated with the plugins sdk. if your theme was not generated with the plugins sdk, such as those created with maven, you must modify your theme to match the plugins sdk structure before now that your theme is prepped, you can start the import process next follow these steps to import your theme install liferay theme generator and its required dependencies, as explained navigate to the folder where you want your theme imported import your theme by running this command follow the prompts to complete your theme import your theme has been imported into a folder named after your original theme. example, a theme named my-awesome-theme-for-61 would be imported into a folder called my-awesome-theme-for-61-theme next, you can learn how to update your theme for 7.0 now that you've successfully imported your theme, you have the tools necessary these tools are provided by the part of the liferay js theme toolkit the first of these tools you'll use is the upgrade task. backs up your files so you can revert them later if needed modifies and renames some files for compatibility creates a url file under backup, so you can easily see what's been creates a compatibility file for compass mixins, which may have been used important before you run the update task, read the section below titled an important note about core stylesheets for advice on renaming effectively overriding core stylesheets upgrade your theme, by running these commands if the upgrade task didn't update your files like you expected, you can easily revert them back using the upgrade revert task the upgrade task automates some of the steps for you, but some manual changes when the upgrade task finishes, the console may output additional manual changes you may need to make to your theme note because liferay portal 7.0 uses bootstrap 3, the default has been changed to box-sizing border-box. if you were using width or height and padding together on an element, you may need to make changes, or those elements may have unexpected sizes there are likely changes that you still need to make, which these tools and this guide can't realistically cover. therefore, it's recommended that you make changes gradually, rather than all at once. identify any issues your theme may have below for ways on how to update your theme manually follow the instructions in the next section to build and deploy your theme follow these steps to build and deploy your theme to check that everything is running smoothly, run this command if all goes well, you can now deploy your theme by running this command if you're using velocity as your template language, you'll notice this message on your server console when deploying your theme support of velocity is deprecated. update your theme to use freemarker for it's recommended that you migrate to using freemarker for your theme templates. for more details, please see the additional tasks and info can be found in the you've now completed a major step in upgrading your theme this appendix covers the changes you need to make to your theme if you manually update your files, or if you need to make additional changes after using the liferay js theme toolkit's upgrade task your theme contains metadata about its capabilities and requirements. metadata needs to be updated to ensure your theme is available for use in your theme must target the proper liferay dxp version in your case, 7.0.0. you must update the theme version in two places in the file url, add the following property to ensure liferay dxp deploys your theme add the following version information to your url to ensure liferay dxp makes your theme available for use if you're not using the default theme template language, freemarker .ftl, you must add a template-extension tag to your url if you have any required deployment contexts listed in your url file, these will likely need to be removed resources-importer-web portal compatibility hook is for previous versions portal-compat-hook because this tutorial is focused on upgrading a theme rather than importing content and assets, it does not cover the resources you can learn more about the resources importer in the importing resources with a theme tutorial if you've made customizations to core liferay dxp stylesheets, it's recommended that you not use these customizations right away. ui has changed significantly since version 6.1, and any customizations you may have are either not likely to work, or will cause problems in the ui important rename these files to something like url, url, etc. if you don't rename these files, you may get an error when this is because sass is importing ambiguous names like it's recommended that you get your theme working in liferay dxp 7.0 first, and then audit the styles in these core css files to see if they're still necessary and don't cause any issues liferay dxp 7.0 now uses the.scss extension for sass stylesheets under my-imported-themesrccss, rename your url file to if you have any additional css files that need to take advantage of sass and bourbon, you must rename those as well for example, url becomes url, and url if you've imported any renamed stylesheets into another, you'll want to update for example url needs to be updated from beginning with version 7.0, liferay portal now uses for mixins, rather than compass. bourbon is being imported in a core stylesheet, so you shouldn't need to import it yourself also, files with the.scss extension are processed by sass automatically. but you must still import or link to these to use them remove compass from all your sass files, and don't worry about when liferay portal switched from using compass to some mixins changed syntax, became unsupported, or became unnecessary these mixins should be updated or removed if you've used bootstrap 2.3.2 in your theme, a migration guide is available the class.aui is no longer in use. selectors that contain.aui as a parent qualifier must be modified, or those selectors will not match the expected yahoo stopped all new development of yui, because of this announcement, liferay has decided to sunset alloyui and deprecate it as of liferay portal 7 although alloyui is deprecated, it's still available by default, and existing alloyui 3 based code continues to work to further research changes to an alloyui module, you can find a url file under each component's directory moving forward, it's recommended to migrate your alloyuiyui code to either url or the framework of your choice. below, you'll find some libraries used jquery is a fast, small, and feature-rich javascript it makes things like html document traversal and manipulation, event handling, animation, and ajax much simpler. it's also popular among front-end developers, making it ideal for getting started quickly for more in depth coverage, see jquery's documentation lodash is a modern javascript utility library delivering it's used in liferay dxp to fill the void left for more in depth coverage, see lodash's documentation written by liferay to specifically to meet the needs of liferay dxp, is a javascript library for building ui components in a solid, flexible way for more in depth coverage, see url's documentation in prior versions of liferay portal, velocity templates .vm files were the default template language for writing theme markup. in liferay dxp 7.0, freemarker templates .ftl files are the default template language, and velocity templates are deprecated with that in mind, if your themes are written in.vm files, they should still work, but you're missing out on additional theme features. in a future release, support for velocity templates will be removed for a typical theme, migrating to freemarker should be simple. both languages are relatively similar whichever language you decide to use, there are several convenient macros there are many changes since liferay portal 6.1 which break in version 7.0. of these changes are documented in liferay dxp's breaking changes. in url, admin controls are now called using in url, portlet menu icons have been condensed into a single call and are now controlled using the portletconfigurationicon classes see liferay portal's breaking changes for more details in url, access to icons have been changed, to minimize dependency on see liferay portal's breaking changes for more details the only significant change to layout templates has been the addition of if you're using any custom layout templates, you'll want to integrate bootstrap a comparison between layout templates in liferay portal 6.1 and liferay portal 7.0 is shown in the example below importing resources with a theme;;
liferay dxp has more extension points than ever, and connecting existing hook plugins to them takes very few steps. in most cases, after you upgrade your hook using the liferay upgrade planner, it's ready to run on liferay dxp. tutorials show you how to upgrade each type of hook plugin;;
liferay goes to great lengths to maintain backwards compatibility. breaking changes are necessary to improve liferay dxp. breaking changes affect your code upgrade process and must be resolved. liferay provides a list of breaking changes for every major release to ensure you can easily adapt your code during the upgrade process the easiest way to resolve breaking changes is by using the it automatically finds all documented breaking changes and can automatically resolve some of them on its own if you're resolving breaking changes manually, make sure to investigate each breaking change document if you're upgrading code across multiple versions. example, if you're upgrading from liferay portal 6.2 to liferay dxp 7.0, you must resolve all the breaking changes listed in the three documents listed above now that you've resolved your breaking changes, you'll learn how to upgrade;;
layout templates specify how content is arranged on your site pages in liferay dxp. for example, take a look at the 1-2-1 columns layout ce layout shown below figure 1 the 1-2-1 columns layout ce page layout creates a nice flow for your content liferay dxp 7.0 and dxp provide several layout templates out-of-the-box for you to you can change the layout for your page, and view the installed layout templates, by opening the edit menu for your page, under the navigation heading of the product menu and scrolling down to the layouts heading figure 2 liferay provides several layout templates out-of-the-box for you to use if you'd like to create your own custom layout templates, you've come to the this tutorial demonstrates how to create a layout template with the layouts sub-generator create a thumbnail for a layout template in order to create a layout template with the layouts sub-generator, you will need the url build tools installed. tutorial explains how to install these tools and how to create a theme once you have the liferay theme generator installed you can go ahead and get follow these steps to create a layout template open the command line and navigate to the directory you want to create your run yo liferay-themelayout to start the layouts sub-generator figure 3 the layout template sub-generator automates the layout creation process note if you run the layout sub-generator from the root directory of a theme created with the themes generator, it will add the layout template as a part of the theme in the srclayouttpl directory enter a name and id for your layout template, or press enter to accept the choose your liferay version and press enter to continue at this point the layout template design process begins. states, layout templates implement bootstrap's grid system. consists of 12 sections, so columns range in size from 1 to 12. sub-generator is user-friendly, allowing you to add and remove rows and enter the number of columns you would like for row 1 once you've entered a value, the generator asks how wide you want your row and column to be, and presents you with the available widths choose from the available options with your arrow keys and press enter to if you have remaining space, the generator will repeat this step for the once you're done configuring your row, you are presented with a few options add a row adds a row below the last row insert row displays a vi to insert your row. choose where to insert your row, highlighted in blue, then press enter to figure 4 rows can be inserted using the layout vi figure 5 rows are removed using the layout vi once you are done designing your layout you can move onto the next step select finish layout to complete your layout's design figure 6 select the finish layout option to complete your design your layout template files are generated for you in the current directory enter the path to your app server directory, or press enter to accept the enter the url to your server or press enter to accept the default your layout template is generated, but you still need to include it in your note currently the liferay theme generator does not add the layout template configuration to your url. will be added in a future release. for now you must add this manually next add your custom layout template to your url below is an example configuration for when your layout template was generated, a default thumbnail was created. can learn how to create a custom thumbnail in the next section to create your own thumbnail follow the steps below navigate to the docroot directory of the layout template you just created note if you created the layout template in your existing themes generator theme, the thumbnail is located in your theme's replace the url file with your own custom thumbnail png navigate back to the layout's root directory and run gulp deploy to re-build and deploy the template to your app server note if your layout template was added as part of your themes generator theme, the layout template will deploy when the theme is deployed note currently the liferay theme generator does not add the thumbnail specify the thumbnail's location in your url using below is an example configuration for the your layout template is complete! as you can see, the layouts sub-generator makes creating a layout template a piece of cake edit a page on your site and select your new layout template to use it importing resources with your themes;;
liferay's theme builder gives developers who aren't using e.g., gradle or maven a way to compile and build a theme war file. theme builder, you must apply it to your project. structure themes for liferay dxp, see the follow the instructions below to apply the theme builder plugin and build your liferay provides two theme builder plugins depending on your build tool if you want to apply the theme builder plugin to an ant project, examine the url file as an example below you should first supply the path to the theme builder jar. configures the literal path to the jar on your local machine. you could configure ivy to do this for you behind then create an ant target e.g., build-theme that configures the required parameters to build your theme for assistance applying the theme builder plugin for a gradle or maven project, building themes in a maven project execute the appropriate command based on your build tool the war is generated in the following folder, depending on the build tool you you've successfully configured and leveraged the theme builder in you can also use the theme builder to migrate a plugins sdk migrating a theme from the plugins sdk to workspace;;
macros let you assign theme template fragments to a variable. theme templates from becoming cluttered and makes them easier to read. defines several freemarker macros in that you can use in your freemarker theme templates to include theme resources, likewise, velocity macros are available in liferay dxp also exposes its taglibs as freemarker macros. for more information on using the taglib in your freemarker templates. tutorial shows how to use liferay dxp's macros in your freemarker and velocity note that velocity templates are supported, but deprecated as of liferay we recommend that you convert your velocity theme templates to freemarker at your earliest convenience to avoid future this tutorial covers both freemarker and velocity template macros to help with your conversion process the syntax for a macro is straightforward. containing the template fragment. for example, below is the macro directive for note liferay dxp's default freemarker macro calls are namespaced with custom macros, they can be called with the explicit variable name to include the template fragment in your theme templates, call the macro using the macro is replaced with the template fragment when the page is rendered. that's all there is to a basic macro macros can also be passed arguments. for example liferay dxp's language macro you can pass an argument in the macro call like this you can read more about freemarker macros and velocity macros at liferay dxp provides several macros that you can use in your theme templates. there are several default macros defined in the that you can use in your freemarker theme templates. defines the default macros for velocity. the table below lists the available now you know how to use liferay dxp's macros in your theme templates!;;
"jsp templates are the predominant templating framework in liferay dxp. application display templates adts, ddm templates, and more make use of jsps jsps, however, are not the only templating language since many developers prefer other templating frameworks e.g., freemarker and velocity, liferay enables you to use other template formats by offering the context contributors framework because jsps are native to java ee, they have access to all the contextual objects inherent to the platform, like the request and the session. these objects, developers can normally obtain liferay-specific context information by accessing container objects like themedisplay or template formats like freemarker aren't native to java ee, so they don't have if your template needs contextual information such as the current user, the page, or anything else, java ee won't make it available to the template like it does for jsps you must inject it yourself into the liferay, however, gives you a head start by injecting a contextobjects map of common variables e.g., themedisplay, locale, user, etc. by default into freemarker templates e.g., themes. usually referred to as the context of a template. other context object that liferay doesn't provide by default, you must modify or to do that, you create a context contributor context contributors modify a template's context by injecting variables and functionality usable by the template framework. templating languages for themes, adts, and any other templates used in for example, suppose you want your theme to change color based on the you could create a context contributor to inject the user's organization to your theme's context, and then determine the theme's color based context contributors are already used in liferay dxp by default. menu display is determined by a variable injected by a context contributor. you'll learn more about this later first, you'll learn how to create your own context contributor, and then you'll examine one example of how liferay dxp uses context contributors create a generic osgi module using your favorite third party tool, or use create a unique package name in the module's src directory and create a new java class in that package. to follow naming conventions, begin the class name with the entity you want to inject context-specific variables for, followed by templatecontextcontributor e.g., directly above the class's declaration, insert the following annotation the immediate element instructs the module to start immediately once the type property should be set to one of the two interface typeglobal or typetheme. set if you only wish to inject context-specific variables for your theme; otherwise, setting the typeglobal field affects every context execution in liferay dxp, like themes, adts, ddm templates, etc. finally, your service the productmenutemplatecontextcontributor class's annotation interface in your -templatecontextcontributor class. implementing the preparemap, method notice that the prepare method receives the contextobjects map as a this is your template's context that was described earlier. method should be used to edit the context by injecting new or modified variables into the contextobjects map for a quick example of how you can implement the templatecontextcontributor interface to inject variables into a template's context, you'll examine the productmenutemplatecontextcontributor class used by liferay dxp by default. this class injects variables into liferay's freemarker theme and determines whether the product menu is displayed in the current theme the productmenutemplatecontextcontributor class implements the prepare... method, which injects a modified variable bodycssclass and a new variable liferayproductmenustate into the theme context this method prepares the context contributor to inject variables into the theme to be used by the product menu. for this example, the cssclass and productmenustate variables are defined and then placed in the contextobjects by doing this, these variables have been injected into the theme context, making them accessible to the theme. specifically, the cssclass variable provides styling for the product menu and the productmenustate variable determines whether the visible product menu should be open or closed note in previous versions of liferay, if you needed to inject variables into themes, you were forced to create those variables in the url file of this forced theme developers to keep that logic updated in every theme version of every theme they developed. with context contributors, you can inject variables into existing frameworks without forcing theme developers to the prepare method above also determines whether to show the product menu or not with the following if statement the isshowproductmenu... method injects functionality into the theme's context by providing an option to showhide the product menu. also included in the productmenutemplatecontextcontributor class the productmenutemplatecontextcontributor provides an easy way to inject variables into liferay dxp's theme directly related to the product menu. do the same with your custom context contributor. additional variables to any context in liferay, you're free to fully harness the power of your chosen templating language";;
if you want to package ui resources independent of a specific theme and include them on a liferay dxp page, theme contributors are your best option. instead, you'd like to include separate ui resources on a liferay dxp page that are attached to a theme, you should look into contains ui resources to use in liferay dxp. once a theme contributor is deployed to liferay dxp, it's scanned for all valid css and js files, and then its resources are included on the page. you can, therefore, style these ui components as you like, and the styles are applied for the current theme this tutorial demonstrates how to next, you'll learn how to create a theme contributor in liferay versions prior to 7.0, the standard ui for user menus and navigation the dockbar was included in the theme template. 7.0, these standard ui components are packaged as theme contributors for example, the control menu, product menu, and simulation panel are packaged as theme contributor modules in liferay, separating them from the theme. means that these ui components must be handled outside the theme figure 1 the control menu, product menu, and simulation panel are packaged as theme contributor modules if you want to edit or style these standard ui components, you'll need to create your own theme contributor and add your modifications on top. new ui components to liferay dxp by creating a theme contributor to create a theme contributor module, follow these steps create a generic osgi module using your favorite third party tool, or use to create your module, in which case you can skip step 2 to identify your module as a theme contributor, add the liferay-theme-contributor-type and web-contextpath headers to your for example, see the control menu theme contributor the theme contributor type helps liferay dxp better identify your module. example, if you're creating a theme contributor to override an existing theme contributor, you should try to use the same type to maximize compatibility with future developments. the web-contextpath header sets the context from which the theme contributor's resources are hosted because you'll often be overriding css of another theme contributor, you should load your css after theirs. you can do this by setting a weight for in your url file, add the following header the higher the value, the higher the priority. a weight of 100, it will be loaded after one with a weight of 99, allowing create a srcmainresourcesmeta-infresources folder in your module and place your resources css and js in that folder build and deploy your module to see your modifications applied to liferay dxp that's all you need to do to create a theme contributor for your site. with great power comes great responsibility, so use theme contributors wisely. the ui contributions affect every page and aren't affected by theme deployments importing resources with your themes;;
benefits of liferay 7 for liferay 6 developers, applications that comprise osgi modules offer considerable advantages over the main benefit is that modular development practices structure code in ways these practices involve, for example, defining contracts such as apis more clearly, hiding internal classes, and handling related to this, module dependencies are explicitly modules run only when all their dependencies are metthis can eliminate many obscure run time errors splitting large applications into small independent modules lets you focus on smaller release cycles for those modules. individual modules can be updated for instance, you might fix a jsp's security issue in an application's web client module. modulenone of the application's other modules need change the scenarios described below can help you decide whether to convert an you can now make an informed decision on whether to stick with your upgraded traditional application as is or modularize it to leverage liferay dxp 7.0's;;
"the service builder gradle plugin lets you generate a service layer defined in a the plugin has been successfully tested with gradle 4.10.2 to use the plugin, include it in your build script the service builder plugin automatically applies the java since the plugin automatically resolves the liferay service builder library as a dependency, you have to configure a repository that hosts the library and its transitive dependencies. the liferay cdn repository hosts them the plugin adds one task to your project the buildservice task is automatically configured with sensible defaults, plugin is applied, or whether the osgimodule property is true if the war plugin is applied url web-infservice if osgimodule is true url url if the war plugin is applied url url if osgimodule is true bundlesymbolicname.util.serviceprops the bundlesymbolicname of the project is inferred via the osgihelper class if osgimodule is true the file url in the first resources directory of the main source set by default url otherwise the file url in the first resources directory of the main source set by default url if the war plugin is applied url web-infsql otherwise the directory meta-infsql in the first resources directory of the main source set by default srcmainresourcesmeta-infsql of a data-driven liferay osgi application split in myapp-app, myapp-service and myapp-web modules, the url file is usually contained in the root in the url of the same module, it is enough to apply the url plugin as described, and then add the following snippet to enable the use of liferay service builder while apidir is required, the testdir property assignment can be left out, in which case arquillian-based integration test classes are generated tasks of type buildwsddtask extend javaexec, so all its properties and methods, such as args they also have the following properties set by default the properties of type file supports any type that can be resolved by url. moreover, it is possible to use closures and callables as values for the string properties, to defer evaluation until task execution there are additional configurations that can help you use service builder by default, the plugin creates a configuration called servicebuilder and adds a dependency to the latest released version of liferay service builder. possible to override this setting and use a specific version of the tool by manually adding a dependency to the servicebuilder configuration plugins to your project, the service builder dependency is already added to the therefore, if you try to apply a customized version of service builder, it's not recognized; you must override the to do this, you must customize the classpath of the buildservice task. you're supplying the customized service builder plugin through a module named custom-sb-api, you could modify the buildservice task like this if you do this in conjunction with the servicebuilder dependency configuration, the custom service builder version is used.";;
for liferay dxp 7.0 administration applications, the title should be moved to the inner views of the app and the associated back link should be moved to the if you open the blogs admin application in the control panel and add a new blog entry, you'll see this behavior in action figure 1 adding a new blog entry displays the portlet title at the top, along with a back link this tutorial uses the blogs admin application's url follow these steps to configure your app's title and back url use paramutil to retrieve the redirect for the url display the back icon and set the back url to the redirect finally, set the title using the url method, as shown in the example configuration below the example above provides a title for two scenarios you should also update any back links in the view to use the redirect. example the url form's cancel button redirects the user now you know how to configure your app's title and back url! applying lexicon patterns to your forms, navigation, and search;;
while writing your npm portlet, you may need to reference a dependency package for instance, you can retrieve an npm dependency package module's css file and use it in your portlet. provides two methods for retrieving an osgi bundle's dependency npm package to retrieve dependency npm packages and this tutorial references the url below to help demonstrate these methods to obtain an osgi bundle's npm dependency package, pass the package's name in as the getdependencyjspackage method's argument. resolves the react dependency package reactresolvedid's resulting value is email you can use the resolvemodulename method to obtain a module in an npm to do this, pass the module's relative path in as the resolvemodulename method's argument. the example below resolves a module named react-with-addons for the react dependency package the resolvedmodule variable evaluates to email distreact-with-addons. you can also use this to reference static resources inside npm packages like css or image files, as shown in the example below now you know how to obtain an osgi bundle's dependency npm packages descriptors! obtaining an osgi bundle's npm package descriptors the structure of osgi bundles containing npm packages;;
"liferay developer studio provides extended front-end development tools to assist in liferay you now have access to code inferencing and code completion features for alloyui, javascript, css, and jquery this tutorial covers how to use the code assist features for alloyui, javascript, css, and jquery in developer studio. each language is covered in its own section, so you can navigate to the language you're most interested in. continue reading to find out how to use developer studio's code assist features in your developer studio's integration of tern gives you access to code assist in javascript, alloyui, and css. to access these features, you must be working in a javascript, jsp, html, or css file you must have tern features enabled in your project in order to use by default, liferay portlet plugins already have tern features enabled. enabling code assist features in your project tutorial to learn how to enable tern features for non-liferay specific projects note for those developing with the plugins sdk, the taglib descriptions that developer studio makes available to users are dependent upon the plugins sdk version. developer studio uses taglib descriptions from the current sdk's url file, so a more up-to-date plugins sdk means more up-to-date taglib descriptions you'll begin testing the alloyui code assist features next there are several helpful code assist features that can improve your productivity when writing code for alloyui. access the alloyui code assist features in the url of your project open your project's url file and type the following code press ctrlspace with your cursor to the right of aui.. the code inference for the aui global object. framework's own api documentation is also displayed. figure 1 this figure demonstrates code inference in a js file note code assist not only works for methods of an object, but also works for aui-specific tern completions for objects. for instance, you could type au and press ctrlspace to see a list of objects to choose from by default, code inference is triggered by a keystroke combination; however, you can enable auto activation in developer studio's preferences menu. check the enable auto activation box and click apply. the figure below shows how to enable auto activation figure 2 the enable auto activation checkbox is listed below the auto-activation heading now, if you follow the previous example, code inference activates as soon as you press the trigger key, which in this case is the. period key in addition to general code inference for alloyui, you have access to code aui javascript templates are available in eclipse's javascript editor as well as in the htmljsp editor when working with and follow the steps below to use aui code templates type the following code in your url press ctrlspace to bring up the code inference for aui, and you'll see a list of all the available alloyui code templates, along with figure 3 developer studio gives you access to aui code templates in the js and jsp editors select your template and hit enter to paste its contents into your note you can view all the alloyui code templates you have installed by going to developer studio's preferences menu and selecting javascript in addition to code inference in your js files, you can also use code inference in your jsphtml files using tags open one of your project's jsps and add the aui taglib directive if it is not you can also add the import from the snippets menu under taglib imports add an tag inside your jsp and configure it to look like the press ctrlspace with your cursor placed to the right of aui to bring up whether in a javascript file or inside a jsp, you now have access to code assist features that improve your workflow next, you'll examine the javascript code assist features for developer studio in addition to alloyui code assist features, you also have access to code inference and completion using raw javascript. available in your project because the tern module liferay is enabled. plugin provides code completions for the static javascript object apis available to portlets when running in liferay portal. to learn more about enabling tern modules in eclipse, refer to the enabling code assist features in your project the example below shows how you can use code assist features to easily access functions in your portlet project open the url of your portlet and add the following function add the following button to the url of your portlet place your cursor within the quotation marks of the onclick attribute and the code inference dialog pops up with a list of possible javascript functions available for you to use type say and you'll notice the list is narrowed down to your new figure 4 javascript code assist features give easy access to your functions select the saytext function, and you'll notice that it's accompanied by documentation that provides the parameter for the function, as well as the file path where the function is located press enter to use code completion and add the function to your button as you can see, javascript development is a breeze using developer studio's code assist now that you know how to use the alloyui and javascript code assist features, you can learn how to use the css code assist features next developer studio offers code inference and completion tools for css. tools, you'll need to install an additional plugin note the plugin described below is planned to be bundled with liferay developer studio in the near future. initial tests of the plugin revealed performance issues in some cases, which is why it is not yet a part of liferay developer studio. not consistent, so you may have no issues installing the plugin, but we wanted to give full disclosure about it follow the steps below to install the plugin in developer studio go to help install new software... paste the following link into the work with input field click add... and check the box next to wtp html - web resources click next and follow the installation instructions now that your plugin is installed, you'll need to enable the css features in right-click your project and go to properties web check both boxes to enable css features in your you have successfully installed and enabled the new css features in your now that you have the css features enabled, you'll find out how to use them follow the steps below to use the css code assist features to locate a css note that the process below can also be used to locate an id open your url file and add the following class to it inside your url add an tag and configure it to within the quotations of the cssclass attribute, press ctrlspace to bring up the code inference for css. begin typing sample-class to narrow down the classes to the one you're looking for figure 5 css code inference improves your workflow when developing in css notice, along with code inference, you can also view the styling you have for the class, as well as the file in which it is located press enter to use code completion and add the css class to the jsp if you look at the code inference dialog for css classes, you'll also notice that in addition to your own css classes, you also have access to bootstrap css classes found in liferay portal note you can go to the file that the class, id, or function is located in by hovering over top of it in your jsp and holding down the ctrl windows or command mac key, and clicking the hyperlink that appears lastly, you'll learn about the code assist features for jquery you can also use code assist with jquery. to do this, you must enable the tutorial to learn how to enable tern modules in your project the jquery tern plugin gives type information for the jquery framework. example below, you'll test the jquery code assist feature in the file, type the following sample variable press ctrlspace to bring up the code inference for the variable you're declaring, and you'll see a list of everything that is available. jquery documentation is available for each method. below for an example of using code assit in jquery figure 6 using the jquery code assist features gives you the convenience of showing you what's available, and the documentation behind each option furthermore, for jquery callback handlers, the type information for parameters figure 7 jquery code assist also displays type information for parameters you now know how to use developer studio's front-end development code assist features to improve your workflow from liferay 6 to liferay dxp 7.0";;
gradle is a popular open source build automation system. you can take full advantage of gradle in liferay developer studio by utilizing buildship, which is a collection of eclipse plugin-ins that provide support for building software using gradle buildship is bundled with liferay developer studio versions 3.0 and figure 1 navigate to help installation details to view plugins included in liferay developer studio the first thing you'll learn about in this tutorial is creating gradle projects you can create a gradle project by using the gradle project wizard navigate to file new project... and select gradle you can also specify your project location and optionally, you can navigate to the next page and specify your gradle distribution and other advanced options. figure 2 you can specify your gradle distribution and advanced options such as home directories, jvm options, and program arguments you can also import existing gradle projects in liferay developer studio figure 3 you can specify what gradle project to import from the import gradle project wizard click the browse... button to choose a gradle project once you're finished, click next again to review the import configuration. figure 4 you can preview your gradle project's import information next you'll learn about gradle tasks and executions, and learn how to run and display them in liferay developer studio liferay developer studio provides two views to enhance your developing experience using gradle gradle tasks and gradle executions. following the instructions below go to window show view other... navigate to the gradle folder and open gradle tasks and gradle gradle tasks and executions views open automatically once you create or import a the gradle tasks view allows you to display the gradle tasks available for you to use in your gradle project. users can execute a task listed under the gradle project by double-clicking it figure 5 navigate into your preferred gradle project to view its available gradle tasks once you've executed a gradle task, you can open the gradle executions view to figure 6 the gradle executions view helps you visualize the gradle build process keep in mind that if you change the gradle build scripts inside your gradle projects e.g., url or url , you must refresh the project so liferay developer studio can account for the change and display it properly in to refresh a gradle project, right-click on the project and select figure 7 make sure to always refresh your gradle project in liferay developer studio after build script edits if you prefer eclipse refresh your gradle projects automatically, navigate to window preferences gradle and enable the automatic project if you'd like to enable gradle's automatic synchronization for just one gradle project, you can right-click a gradle project and select properties gradle and enable auto sync that way. this feature is available in buildship version 2.2, so make sure you have the you're now equipped with the knowledge to add, import, and build your gradle projects in liferay developer studio!;;