Tuesday, 29 October 2013

Liferay 6.2 for u


If the user belongs to at least one site and has some administration priviledges then two additional menus appear:
  1. My Sites: Shows the sites that the user belongs to, with direct links to the public and private pages (if they exist).

     
  2. Admin: Contains a link to the Control Panel if the user has access to it and direct links to the site administration sections (Pages, Content, Users and Configuration) that the user has access to. The direct links to each section was one of the last additions based on early user feedback and it has two benefits: It requires fewer clicks to perform any administration operation and it shows the type of things the user will be able to manage for this site even before clicking them.

That's it for now. I'd love to hear your feedback on these changes.
Also, feel free to let me know what other features or improvements of the dockbar or Liferay 6.2 in general that you would like us to cover in upcoming blog entries.

Tuesday, 22 October 2013

LIFERAY PORTAL 6.2 IMPROVES MOBILITY AND WEM


LIFERAY PORTAL 6.2 IMPROVES MOBILITY AND WEM


For the first time in a few years, CMS Report isn't present at Liferay's North American Symposium currently taking place in San Francisco. However, we still have plenty of our friends there helping to feed us with any CMS related news coming out of this conference. Probably the biggest news presented yesterday was Liferay, Inc. revealing Liferay Portal 6.2 to the crowd. 
Liferay offers a more refined, mobile-ready version of the company’s flagship product. The new version should also help enterprises execute their engagement strategy across channels and audiences by making it easy to create mobile-responsive websites that connect with users across every stage of the relationship lifecycle. 
“Today’s enterprises need to interact with their customers, partners, and employees through compelling, seamless experiences across several channels,” said Bryan Cheung, CEO of Liferay. “Liferay Portal 6.2 is a modern, intuitive platform designed to help enterprises understand and reach their customers across mobile, web, and live contexts.”
A key focus of the new release is supporting mobile websites and apps. Websites and content created with Liferay Portal 6.2 automatically display correctly on mobile devices, and site administrators can define rules to handle specific devices and families differently. Liferay also provides mobile device previews right from the interface so users can quickly see how pages look on smaller screens. Finally, a new Mobile App Software Developer Kit (SDK), currently in the works for 6.2, will help developers build custom native apps that incorporate Liferay Portal functionality such as collaboration applications or integrated back end systems.

Major highlights in the new Liferay Portal 6.2 include:

Entirely Updated Modern User Interface – Twitter® Bootstrap-based theming for a slick, vibrant look and feel with instant access to the Bootstrap theme library; new Control Panel theme with streamlined site administration.
Liferay Portal 6.2 Control Panel 
New Mobile Engagement Features – Mobile readiness out of the box with responsive layouts, one-click mobile previews, mobile device rules, and a Mobile App SDK.
Improved Web Experience Management – Site Hierarchies for managing content and users across multiple sites; Application Display Templates, which allow developers to quickly customize the look and feel of applications; improved multi-language support for content, URLs, and applications.

Portal Resiliency, Modularity and Security – Increased platform stability through portlet sandboxing for isolation of individual portlet components from the portal; greater modularity in Liferay Portal architecture with ability to manage multiple versions of libraries, share libraries across multiple plugins, and upgrade and rollback portlets from version to version.
Liferay  Portal 6.2 App Manager
The new version will be available as part of the Liferay Portal Enterprise Subscriptions. Liferay Portal 6.2 will be available to the public later this year.

Wednesday, 16 October 2013

The Portlet Lifecycle

The Portlet Lifecycle

Essentially any client request made to the portal will result in one or more portlets
being invoked. The portlet lifecycle is defined in the Portlet interface of the Portlet
API and provides the following interface.
init(PortletConfig config)
processAction(ActionRequest req, ActionResponse res)
render(RenderRequest req, RenderResponse res)
destroy()
Initialization and Shutdown
The portlet container is responsible for initializing all of the portlets. The
initialization may take place once the portlet container starts up or the first time a request
is made to a portlet. If an error occurs during the portlet initialization, the portlet is not
placed into service. Generally, the initialization method is used to start up any resources
that are useful for the duration of the portlet’s functioning. As an example, the creation of
a connection to a database or a web service is often best done in the init method. The
PortletConfig object provides portlet configuration information that has been
defined in the descriptor.
Similarly the portlet container may invoke the destroy method when it decides
the portlet should be removed from service. This normally happens when the portal is
being shutdown.
Request Handling
Generally in the portal lifecycle, the portlet container will initialize all of the
portlets when the portal is started and invoke the destroy method on all portlets when
the container is shutdown. However while the portal is running every client request made
to the portal will often result in one or more portlets creating a markup fragment to be
included in the final portal page.
A request can be broken into two phases, action handling or rendering markup.
An action request is an optional state that can be made to change the state of the
underlying portlet application. For instance an example login portlet would allow users
to provide their name and password and will display a submission form to send the
supplied information to the portal, resulting in an action request. The portlet container
will handle any action request first before any content is generated as shown in the UML
sequence diagram. Once the action request has completed, the portlet container generates
markup by invoking the render method of every portlet on the page in no particular
order excepting those portlets that have defined their content to be cached. The portal is
responsible for aggregating all portlet fragments and displaying a full portal page back to
the user’s browser. A client request does not have to result in a processAction invocation.
However, every client request to the portal must go through the render phase (unless the
portlet’s content is cached).
Both processAction and render methods supply a request and response object.
The ActionRequest and RenderRequest objects inherit from PortletRequest, a decorator1
for a HttpServletRequest object defined in the Servlet specification. The portlet request
provides much of the same functionality as a HttpServletRequest object that traditional
J2EE web application developers are familiar with as well as methods for querying the
1 A Decorator[GoF], also known as a Wrapper is a design pattern that provides additional
functionality to an object by sub-classing to provide additional methods and exposing
many of the same methods of the underlying (wrappee) object. The Java stream and file
I/O classes are good examples of decorators.
current window state or portlet mode. The primary difference between the ActionRequest
and the RenderRequest is that an ActionRequest may not write to the output stream, since
it is responsible only for performing business logic.
Any event triggered within portlet such as submitting a form or clicking a link
will result in either an action request or a render request being made. The Portet API
provides methods for the construction of URLs in the portal to cause either event to
occur.


Monday, 14 October 2013

User Registration Portlet customization

User Registration Portlet customization


The registration or create account portlet in Liferay portal can be customized to add/remove some of its field without any coding.

This blog explain some of these customization properties which developers can add them in portal-ext to change the behavior of user registration portlet.

users.screen.name.always.autogenerate - If you do not want your users to provide screen name, you can use this property hide screen name text field. The default value is false. If it is changed to true, the screen name field will not appear on the registration page and screen name will be auto generated by the portal.

login.create.account.allow.custom.password - The default registration portlet in Liferay doesn't provide option of password selection to user. If this property is set to true, the registration screen will show password fields to user and user can provide password of his/her choice.

field.enable.com.liferay.portal.model.Contact.male - If your site is not interested in knowing the gender of the user, you can remove gender selection from the page by setting false value of this property.

field.enable.com.liferay.portal.model.Contact.birthday - Last configuration is for birth date field. You can remove bith date selection by setting false value to this property.

Following screen shot shows customized registration portlet using above properties.


captcha.check.portal.create_account - This propery can be used to tell whether or not to use captcha checks for the account creation.

There are few other properties related to user registration which requires more attaention.
users.email.address.required - Set this to false if you want to be able to create users without an email address. An email address will be automatically assigned to a user based on the property "users.email.address.auto.suffix". If user is entering his email id, the system will not generate a new one. Usually, setting this property to false will make sense when you don't want user to use email address for login.

Sunday, 13 October 2013

GENERICPORTLET IN LIFERAY

GENERICPORTLET

 GenericPortlet is abstract class and it extends Object class and implements Portlet,PortletConfig interfaces.
The GenericPortlet class provides a default implementation for the Portlet interface.It provides an abstract class to be subclassed to create portlets. A subclass of GenericPortlet should override at least one method, usually one of the following:

    processAction, to handle action requests
    doView, to handle render requests when in VIEW mode
    doEdit, to handle render requests when in EDIT mode
    doHelp, to handle render request when in HELP mode
    init and destroy, to manage resources that are held for the life of the servlet

Normally there is no need to override the render or the doDispatch methods. Render handles render requests setting the title of the portlet in the response and invoking doDispatch. doDispatch dispatches the request to one of the doView, doEdit or doHelp method depending on the portlet mode indicated in the request.
Portlets typically run on multithreaded servers, so please note that a portlet must handle concurrent requests and be careful to synchronize access to shared resources. Shared resources include in-memory data such as instance or class variables and external objects such as files, database connections, and network connections.

Methods in GenericPortlet:

doDispatch(RenderRequest request, RenderResponse response)
doHelp(RenderRequest request, RenderResponse response)
doView(RenderRequest request, RenderResponse response)
getInitParameter(java.lang.String name)
getResourceBundle(java.util.Locale locale)
init()
render(RenderRequest request, RenderResponse response)
init:
public void init(PortletConfig config)  throws PortletException
Called by the portlet container to indicate to a portlet that the portlet is being placed into service.
The default implementation just stores the PortletConfig object.
The portlet container calls the init method exactly once after instantiating the portlet. The init method must complete successfully before the portlet can receive any requests.
The portlet container cannot place the portlet into service if the init method does one of the following:
1.         it throws a PortletException
2.         it does not return within a time period defined by the Web server
public void init() throws PortletException
A convenience method which can be overridden so that there's no need to callsuper.init(config).
Instead of overriding init(PortletConfig), simply override this method and it will be called by GenericPortlet.init(PortletConfig config). The PortletConfig object can still be retrieved via getPortletConfig().
processAction:
public void processAction(ActionRequest request,ActionResponse response)
throws PortletException,java.io.IOException
Called by the portlet container to allow the portlet to process an action request. This method is called if the client request was originated by a URL created (by the portlet) with the RenderResponse.createActionURL() method.
The default implementation throws an exception.
Specified by:
processAction in interface Portlet
render:
public void render(RenderRequest request,RenderResponse response)
throws PortletException,java.io.IOException
The default implementation of this method sets the title using the getTitle method and invokes the doDispatch method.
Specified by:
render in interface Portlet
getTitle:
protected java.lang.String getTitle(RenderRequest request)

Used by the render method to get the title. The default implementation gets the title from the ResourceBundle of the PortletConfig of the portlet. The title is retrieved using the 'javax.portlet.title' resource name.Portlets can overwrite this method to provide dynamic titles (e.g. based on locale, client, and session information). Examples are:
  • language-dependant titles for multi-lingual portals
  • shorter titles for WAP phones
  • the number of messages in a mailbox portlet
Returns:
the portlet title for this window
doDispatch:
protected void doDispatch(RenderRequest request,RenderResponse response)
throws PortletException,java.io.IOException
The default implementation of this method routes the render request to a set of helper methods depending on the current portlet mode the portlet is currently in. These methods are:
·      doView for handling view requests
·      doEdit for handling edit requests
·      doHelp for handling help requests
If the window state of this portlet is minimized, this method does not invoke any of the portlet mode rendering methods. For handling custom portlet modes the portlet should override this method.
doView:
protected void doView(RenderRequest request,RenderResponse response)throws PortletException,java.io.IOException

Helper method to serve up the mandatory view mode. The default implementation throws an exception.
doEdit:
protected void doEdit(RenderRequest request, RenderResponse response)
throws PortletException,java.io.IOException

Helper method to serve up the edit mode. The default implementation throws an exception.
doHelp:
protected void doHelp(RenderRequest request,RenderResponse response)throwsPortletException,java.io.IOException

Helper method to serve up the help mode. The default implementation throws an exception.
getPortletConfig:
public PortletConfig getPortletConfig()
Returns the PortletConfig object of this portlet.
Returns:
the PortletConfig object of this portlet
destroy:
public void destroy()
Called by the portlet container to indicate to a portlet that the portlet is being taken out of service. The default implementation does nothing.
Specified by:
destroy in interface Portlet
getPortletName:
public java.lang.String getPortletName()
Returns the name of this portlet.
Specified by:

getPortletContext:

public PortletContext getPortletContext()
Returns the PortletContext of the portlet application the portlet is in.
Specified by:

getResourceBundle:

public java.util.ResourceBundle getResourceBundle(java.util.Locale locale)
Gets the resource bundle for the given locale based on the resource bundle defined in the deployment descriptor with resource-bundle tag or the inlined resources defined in the deployment descriptor.
Specified by:
getInitParameter:
public java.lang.String getInitParameter(java.lang.String name)
Returns a String containing the value of the named initialization parameter, or null if the parameter does not exist.
Specified by:
getInitParameterNames:
public java.util.Enumeration getInitParameterNames()
Returns the names of the portlet initialization parameters as an Enumeration of String objects, or an empty Enumeration if the portlet has no initialization parameters.
Specified by:

Saturday, 12 October 2013

Earning money through online

Liferay monitoring using Google Analytics

Liferay monitoring using Google Analytics

Liferay includes built-in support for Google Analytics, allowing administrators
to make use of Google’s tool set for analyzing site traffic data. When you sign
up for Google Analytics, a snippet of code is provided which needs to be added
to your web pages to allow Google’s system to register the page hit. It can be a
tedious process to add this code to every page on a site, especially if it’s a large
site and there is a lot of user-generated content.
is problem can be solved in Liferay by puing Google’s code into a custom
theme wrien specifically for the web site on which the portal is running. Doing
this, however, requires a theme developer to make specific changes to the theme
and it prevents users from using the many themes that are freely available for
Liferay “out of the box.”
Because of this, support for Google
Analytics has been built into Liferay,
and can be turned on through a simple
user interface. is allows Liferay
administrators to make use of
Google Analytics on a community by
community basis and turn it on and
off when needed.
To enable Google Analytics support,
go to Site Seings in the control
panel, and then select Analytics
on the right. You’ll see a very simple
form, pictured below.
Put your Google Analytics ID
(which should have been provided to you when you signed up for the service)
in the field and click Save. All the pages in the community you selected will
now have the Google Analytics code in them and will be tracked.
is is a fairly simple procedure, and it gives you the ability to take advantage
of some great tools to help you visualize who’s coming to your site and
from where. Next, we discuss some topics germane to maintaining your Liferay

installation as it’s used. Let’s start with backup.

Portal Instances in Liferay

Portal Instances in Liferay

Portal Instances
Liferay Portal allows you to run more than one portal instance on a single server.
e Portal Instances page of the control panel lets you manage these instances.
Data for each portal instance are kept separate from every other portal instance.
All portal data, however, is kept in the same database.
Each portal instance requires its own domain name. Liferay will direct users
to the proper portal instance based on this domain name. So before you configure
an instance, configure its domain name in your network first. When you’re
ready to add an instance, click the Add buon here.
You’ll be prompted for four fields and a check box:
16.6. PLUGINS INSTALLATION 595
Web ID: A general convention is to use the domain name for this. It’s a
user-generated ID for the instance.
Virtual Host: Put the domain name you configured in your network here.
When users are directed to your Liferay server via this domain name, Liferay
will then be able to send them to the proper portal instance.
Mail Domain: Enter the domain name for the mail host for this instance.
Liferay will use this to send email notifications from the portal.
Max Users: Enter the maximum numbers of user accounts you would like
your portal instance to support.
Active: Use this check box to choose whether to create an active or an inactive
portal instance.
When you are finished filling out the form, click Save. Now navigate to the
portal using your new domain name. You will see you are brought to what looks
like a clean install of Liferay. is is your new portal instance which can now

be configured any way you like.