Thursday, January 12, 2012

Changes in Social Equity in Liferay 6.1

There have been some pretty interesting and important changes regarding Social Equity for Liferay 6.1. While some of the changes are conceptual and others are additional features, there is one thing that is very important: there has been a change of API.

The new equity system is now part of the social activity framework. This is not just a naming concept. As part of the change, several functionalities were moved to different services and the original Social Equity services were removed. The whole framework got its own XML descriptor (formerly activities were configured in resource actions descriptors) that can be used to define activities and everything else related to them. This new descriptor can be used to extend already configured activities and can be used in plugins as well.

The Goal of the New System

While the main goal of being able to measure participation and contribution in a communty hasn't changed, there are some differences how these values are created and maintained. The new social equity system is now part of a broader scoped social activity framework that is designed to log certain activities as well as provide numerical instruments to monitor actvities or simply to provide the means for statistical analysis. 

Activity Counters

This system provides the basis for an extendable metrics system for assets and users.

Statistical Periods

One of the biggest conceptual changes is the introduction of the counter period. Values no longer degrade, rather there is a configurable time interval where points are aggregated resulting in a "current" value for each of these periods. A total value is also maintained. This method suits the human thinking more than the former method of degrading values. We are more used to thinking in periods. We are used to having "employee of the month" or values projected to a certain year - such as balance sheets. 

Equity Counters

The old social equity scores are mostly still there. Fundamentally these values are just counters. Of course there are always those more equals among equals, so equity counters have some special treatment. In addition to the limit system that has been implemented for normal counters these counters have some other checks that for example guard against an asset owner building up its own asset's popularity and a result his or her own contribution score by doing certain actions on his or her asset. 

API changes

One of the most importart API changes is that the triggering of an equity action was moved to the social activity service. In fact, adding a social activity now triggers the new social equity service automatically, so you can simply call one of the addActviity() methods in SocualActivityLocalService and if things are configured and social equity is enabled for the group, everything will be fine. If the activity is configured to be logged, the social activity service will log it the same way it's been doing so far, so that it can appear in the activities portlet. Additionally it will call new SocialActivityCounterLocalService to trigger counter processing. 

To get the value of a counter (including participation and contribution values as they are handled as counters) you can use the fetchLatestActivityCounter() method of the SocialActivityCounterLocalService. There are additional helper methods to retrieve a list of counters by other criteria, but probably this is the most important method of the service.

Liferay 6.1 GA1 in the cloud, step by step

Do you want your new Liferay 6.1 GA1, with all these new functionalities: english and spanish , in the cloud?

Follow this simple steps to achieve it, even if you want to use the new Setup Wizard:

  1. Go to Jelastic ( www.jelastic.com ), create an account depending of your location
  2. Create an enviroment: Tomcat + MySQL
  3. Upload portal libraries ( portal-client and dependencies ) to SERVER/lib.
  4. Upload WAR file from sourceforge ( here ) (Jelastic make it easy that uploading, because directly links to that WAR file)
  5. Create portal-ext.properties at SERVER, with this values:
    • resource.repositories.root=${user.home}/
      ENVIROMENT_NAME
      
    • include-and-override=${liferay.home}/portal-setup-wizard.properties
    • liferay.home=${user.home}/
      ENVIROMENT_NAME
      
    • jdbc.default.jndi.name=
      jdbc/LiferayPool
      
  6. Modify SERVER/context.xml file with this values (note that the "mysql-" is very important at db url):
    • <Resource name="
      jdbc/LiferayPool
      " auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="
      USER
      " password="
      PASSWORD
      " driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://
      mysql-ENVIROMENT_NAME
      .jelastic.com/
      DATABASE_NAME
      ?useEncoding=true&amp;characterEncoding=UTF-8" />
      
  7. Clean catalina.out log to be sure that your installation is successfull.
  8. Restart server.
  9. Check in catalina.out that Liferay starts reading your portal-ext
  10. Browse to you portal: ENVIROMENT_NAME.jelastic.com
  11. Setup Wizard is the first thing you'll see, but as JNDI is configured, we cannot modify database settings. We should go to SERVER/context.xml for database changes.
  12. Set up for portal (name, language, admin credentials), and...
  13. Here it is! Your portal up and running!

Then, you can tune your portal with portal-ext reminding not to modify properties set in this blog.

Importants (and new things):

As you can see, we are taking care of telling setup wizard where to read the new props file (the include-an-override property), and we are also configuring database with JNDI, but of course you can do it with JDBC, just with the usual way:

  • jdbc.default.driverClassName=com.mysql.jdbc.Driver
  • jdbc.default.url=jdbc:mysql://mysql-ENVIROMENT_NAME/database_name?

    useUnicode=true&characterEncoding=UTF-8&useFastDateParsing=false

  • jdbc.default.username=user
  • jdbc.default.password=password

Hope it helps!

Himanshu

Monday, January 9, 2012

Liferay 6.1 CE released - A first brief review!

Liferay 6.1 CE released - A first brief review!

Its a new year for a new chance to get better in all that things we failed or where we couldn´t gettin better in the past time.
This belongs not only to us but also to our near business partners as well. As that said Liferay does worked out my new-year-call in a pretty short time with Liferay 6.1 CE which has been released recently.
Are you still on Liferay 6.X or lower? Lets migrate your solutions for your customers on sunday to Liferay 6.1 because there are many fancy things around there… i smell something good here and i guess this has something todo with Liferay.

Notice: the next week i will create a review about the CMIS-Interface of Liferay 6.1. I will test it against Alfresco! Stay tuned!

At a glance - all is gettin good - at least at the very end. Until then we see how we can make better our current situation.

In Advance: Many “small” killer changes!

First Start Part 1: The user has to configure inital portal propertiesFirstly, if you start Liferay at the very first time you have to talk with Liferay about your taste regarding initial portal-settings which will be stored in a separated file called wizard.properties. Some initial properties like portals-name can be passed on it here.
More actions available through the dockbars. For instance the action \ If you have reached the main page you see at a glance that the UI has been slightly enhanced and looks more clearly since 6.0. If you going through the dockbar-actions on the top you might imagine some new actions right there.
Enhanced Social Equity: The Settings are more feasable as in Liferay 6.0. For those who dont know: this functionality enables more spice & taste to your social life. Each user can get points for several actions wich points out their contribution-value. Especilly the control-panel (the action has been moved to the “Go To” actions) has been completely refined. Many “small eyes changes”(which were surely big in their development) have been done. For instance, the Social Equity feature says more clearly what settings we can change here and which consequenes collaboration-actions can have on user-listings (Top Users Dashlet, Ranking etc.).
A new nice feature is the ability to get a first imaginatine on how REST-Services can be called. Therfore Liferay introduces a developer-page where you can see and test REST-Services directly in the browser.
Web Service Dictionary enables you to see directly in the browser which REST-Calls exists, how you can use these service for your own AND ...... performing test through a WEB-GUI. Do you want any more? ;-)




Do Document-Management, hurry up!

As im a longterm ECM-Specialist my personal passion belongs to document-mangement. I just loving to increase productivity, lower overhead on customersite. Now you are able to perform better document-management practices with Liferay. You are now able to create custom datatypes with custom metadata. Your metadata can have text, date, number, associations as attributes with multilanguage support - its just the Liferay-Way! Managing own datatypes, properties and metadata-sets (like Alfresco-Aspects). See in the next photo the result of that new document type in real ...


Look at the first picture. Ive created my own datatype called “Offer” with my own attributes. On applying this documenttype on a new document you can see in the image how it feels like: ... my own document type ... without an coding.
As you can see - a webpreview will be created as well. Do you want any more for Liferay 6.1?

Sunday, January 8, 2012

Liferay 6.1 CE released

Liferay Logical Architecture

Liferay Architecture

Enterprise Layer

The enterprise layer forms the top layer of services and components that are grouped into taxonomies which support and realize enterprise functions such as Portal Management, Content Management, Workflow Management, Document Management, User Management, Security Management.  The Enterpise Layer is also comprised of inter related service components and features such as Personalization, Collaboration, Social Networking, Delivery Channels, Virtualization and Tunneling Servlets. These form the basic backbone or core enterprise features of Liferay.

Service Layer

Liferay follows a Model Driven Architecture approach.  In the traditional sense it requires a Platform Independent Model (PIM) from which we derive and Platform Specific Model (PSM) and subsequently generate implementation logic.  In Liferay however, we begin with a Domain Specific Model(DSM) since the root model is only specific to Liferay domain and it defines all the nouns of the system with their interactions and is translated to a Platform Specific Model(PSM) which constitutes the EJB’s, Spring Framework, Hibernate Layer, Web Services and then generates the implementation classes by extending the appropriate services.  This is made possible due to the implementation of Service Builder which is the most integral tool provided by Liferay and enforces the same standards throughout.  The services builder is the Model Driven Transformation (MDT) Tool in this context.

 

Extensions Framework

Liferay Provides extensions framework by use of an Extension Environment and Plugins Framework.  The extension environment has the same directory structure of the Liferay and was implemented by overriding the existing source files by placing them in the same path.  The design also incorporated multiple –ext.properties file to change default settings of the portal by overriding desired properties in the –ext.properties file.  The best approach is the hot deployable plugin framework which provided a number of wizards to construct portlets, themes, layouts and hooks or interceptors, and now provides an ext-plugin which provides a similar offset by only replicating those flies that require modification without the entire portal content.  The Plugins approach provides both an IDE and command line interface.  The IDE takes a wizard approach to create portlets, themes, layouts and hooks.  The hooks are basically interceptors can be categorized into model hooks, JSP hooks, properties hook, event hooks.  Model hooks deal with interception of entity actions in services, JSP hooks are provided to dynamically modify Liferay JSP pages, the event hook is used to intercept portal events, property hook is used to update the Liferay properties.  The ext-hook plugin is a new feature than provides changes to the Liferay structure and can be hot deployed at runtime.

Logical Architecture of Liferay

Liferay supports Windows, Mac and Linux OS.  JRE is installed on the supported OS to host the JVM.  An application server is required to contain the Liferay instance.  The officially supported servers include, but not limited to Apache Tomcat, Glassfish, Geronimo, Jetty, JOnAS, JBoss, and Resin.  Most of these servers are available as bundled versions for download and are deployed in the JVM container.  The server provides connectivity and interoperability using an Enterprise Service Bus (ESB), and there are multiple services offered by the servers which are leveraged by Liferay.  Some of the services, which are primarily used by Liferay on the Application server, include the following: JNDI, JDBC, JTS, JMS, JAAS, JDO, JWS, JSP/Servlets, JavaMail.  Applications can be deployed on the server like SOLR Search engine, or DROOLS Rule Engine, or Tunneling Servlets which can further provide extension or integration of external applications with Liferay.  Liferay uses a number of technologies at its core to offer the various services.  These technologies include EJB, Hibernate, Spring and JBPM.  Liferay implements Lucene Search Engine by default and can be configured to extend the SOLR Search Engine which is built on Lucene to extend capabilities to provide clustering, faceted search, filtering with additional enhancements and scalability.   A Portlet Bridge is provided to deploy JSR 168/286 portlets and supports RIA applications.  Liferay contains Language adaptors such as for Python, Ruby and PHP which allows easy integration.
The Administration Kernel provides the base framework for integration and support of all modules, with tooling support, wizards, service providers, listeners and runtime configuration parameters to tweak the application server in runtime mode.  The services builder provides the basic framework to construct and deploy the services using a Model Driven Development (MDD) approach.  The portlet plug-in leverages on the portlet bridge to provide dynamically generated portlets to the end users and enhanced RIA integration.  The hooks plug-in provide convenient access to intercept and alter the services and functionality of the Liferay instance in a standardized approach.By leveraging on all the services and features extended by Liferay, a robust Enterprise Services layer resides on atop of this providing extended solutions ranging from Portal Management, Web Content Management, Enterprise Content Management, Document Management, User Management, Workflow Management, Security Management.  These in turn provide features such as Personalization, Collaboration, Virtualization, Social Networking and integrates Dynamic Delivery Channels, and Tunneling Services.
 Liferay Logical Architecture Diagram


Friday, January 6, 2012

Add search in theme in LIFERAY

Steps to add search in theme:

1. Open file [LIFRAY_SDK]/themes/{theme-name}/docroot/_diffs/templates/portal_normal.vm

2. Add $theme.search() at your desired location.

3. Build and deploy the theme.

4. A search text box will appear where the code was placed
Steps to customize the search:

In case you need to customize the search functionality to search only specific content types, follow the steps below.

1. Open file [LIFERAY_HOME]/tomcat-6.0.26/webapps/ROOT/WEB-INF/classes/portal-ext.properties

2. Add following lines:

com.liferay.portlet.blogs.util.BlogsOpenSearchImpl=true

com.liferay.portlet.bookmarks.util.BookmarksOpenSearchImpl=true

com.liferay.portlet.calendar.util.CalendarOpenSearchImpl=true

com.liferay.portlet.directory.util.DirectoryOpenSearchImpl=true

com.liferay.portlet.documentlibrary.util.DLOpenSearchImpl=true

com.liferay.portlet.imagegallery.util.IGOpenSearchImpl=true

com.liferay.portlet.journal.util.JournalOpenSearchImpl=true

com.liferay.portlet.messageboards.util.MBOpenSearchImpl=true

com.liferay.portlet.wiki.util.WikiOpenSearchImpl=true

3. Change values to “false” for those you do not want to include in search result.

For example, to search only “Web Content”, leave “com.liferay.portlet.journal.util.JournalOpenSearchImpl” to “true” and make other values to false.

Enjoy the customized search in Liferay :)

Thursday, January 5, 2012

orderable search container in liferay by example

Liferay provide us with many good taglib out of them search container is one of them.It is widely used taglib. For simple understanding of search container please check Wiki here is the link Wiki Search Container. One thing that article is missing how to implement ordering using. For that we will follow few step and will do a simple example.
Step 1: Read the wiki article Search Container.
Step 2:Now write the below code in your jsp.

<%
PortalPreferences portalPrefs = PortletPreferencesFactoryUtil.getPortalPreferences(request);
String orderByCol = ParamUtil.getString(request, "orderByCol");

String orderByType = ParamUtil.getString(request, "orderByType");

if (Validator.isNotNull(orderByCol) && Validator.isNotNull(orderByType)) {
portalPrefs.setValue("KK_3", "kk-order-by-col", orderByCol);
portalPrefs.setValue("KK_3", "kk-order-by-type", orderByType);

} else {

orderByCol = portalPrefs.getValue("KK_3", "kk-order-by-col", "name");
orderByType = portalPrefs.getValue("KK_3", "kk-order-by-type", "asc");

}

OrderByComparator orderByComparator = AddressBookUtil.getAddressBookOrderByComparator(orderByCol, orderByType);
%>


Now I will explain what is happening we are getting the column on which we have to do ordering in orderByCol and order asc or desc in orderByType.
In line portalPrefs.setValue("KK_3", "kk-order-by-col", orderByCol);
here "KK_3" is namespace , "kk-order-by-col" is key and orderByCol is value.
In last line OrderByComparator orderByComparator = AddressBookUtil.getAddressBookOrderByComparator(orderByCol, orderByType);
For this you need to write a comparator , I have written it in com.ext.portlet.addressBook.util.AddressBookUtil and write this code


public class AddressBookUtil {

/**
*
* @param orderByCol
* @param orderByType
* @return
*/

public static OrderByComparator getAddressBookOrderByComparator(
String orderByCol, String orderByType) {

boolean orderByAsc = false;

if (orderByType.equals("asc")) {
orderByAsc = true;
}

OrderByComparator orderByComparator = null;

if (orderByCol.equals("name")) {
orderByComparator = new AddressBookNameComparator(orderByAsc);
} else if (orderByCol.equals("status")) {
orderByComparator = new AddressBookStatusComparator(orderByAsc);
}

return orderByComparator;
}

}

Now in same package write AddressBookNameComparator and AddressBookStatusComparator if you want you can write any where else and do the required imports. Below is the code for AddressBookNameComparator

public class AddressBookNameComparator extends OrderByComparator {

public static String ORDER_BY_ASC = "name ASC";

public static String ORDER_BY_DESC = "name DESC";

public AddressBookNameComparator() {
this(false);
}

public AddressBookNameComparator(boolean asc) {
_asc = asc;
}

public int compare(Object obj1, Object obj2) {
AddressBook project1 = (AddressBook) obj1;
AddressBook project2 = (AddressBook) obj2;

int value = project1.getName().toLowerCase().compareTo(
project2.getName().toLowerCase());

if (_asc) {
return value;
} else {
return -value;
}
}

public String getOrderBy() {
if (_asc) {
return ORDER_BY_ASC;
} else {
return ORDER_BY_DESC;
}
}

private boolean _asc;

}

Do the required imports .Same way you can do for other columns.
Step 3: Use the SearchContainer taglib.

<liferay-ui:search-container
emptyResultsMessage="No Result Found"
orderByCol="<%= orderByCol %>"
orderByType="<%= orderByType %>"
>
<liferay-ui:search-container-results results="<%= AddressBookLocalServiceUtil.getAddressBookList(searchContainer.getStart(), searchContainer.getEnd(),orderByComparator)%>">
total="<%= AddressBookLocalServiceUtil.getAddressBookCount() %>"
/>
<liferay-ui:search-container-row classname="com.ext.portlet.addressBook.model.AddressBook" escapedmodel="<%= true %>">
keyProperty="bookId"
modelVar="addressBook"
>


<liferay-ui:search-container-column-text name="name" orderable="<%= true %>" orderableproperty="name">
>

<%= addressBook.getName() %>

</liferay-ui:search-container-column-text>

<liferay-ui:search-container-column-text name="status" orderable="<%= true %>" orderableproperty="status" property="status">
/>

</liferay-ui:search-container-column-text>


<liferay-ui:search-iterator />
</liferay-ui:search-container-row></liferay-ui:search-container-results>
That is all about orderable search container.If you have read the wiki article then you will easily understand this.