Showing posts with label Liferay. Show all posts
Showing posts with label Liferay. Show all posts

Monday, September 2, 2013

Creating Finders method and Custom Queries







Creating Finders method and Custom Queries

Process For Finders method
 if you have some Finder methods do the entries like this
After running the service builder build on service.xml
(Copy and paste from XXXLocalServiceUtil ---->  XXXLocalServiceImpl  ) (change accordingly)
Then again  run service builder build .


Copy the finder function from XXXLocalServiceUtil

 public static java.util.List findByN_S(
        java.lang.String name, int status)
        throws com.liferay.portal.kernel.exception.SystemException {
        return getService().findByN_S(name, status);
    }

To XXXLocalServiceImpl after changing in following way

public java.util.List findByN_S(
            java.lang.String name, int status)
            throws com.liferay.portal.kernel.exception.SystemException {
            return ModOrganizationUtil.findByN_S(name, status);
    }

Process For Custom Queries method
Similerly if you have some custom queries for those function do the entries like this
(Copy and paste from XXXFinderImpl  ----->  XXXLocalServiceImpl) (change accordingly)
 Then again  run service builder build .

   public int searchOrg1stLevelCount(String name, String partnerKey, int status,
            java.util.LinkedHashMap searchParams, boolean isAndOperator)
            throws com.liferay.portal.kernel.exception.SystemException {
        return ModOrganizationFinderUtil.searchOrg1stLevelCount(name, partnerKey, status, searchParams, isAndOperator);
    }

Monday, July 29, 2013

Maven commands needed for a Portlet with service layer



Liferay Service Portlet
---------------------------
When we create a Liferay portlet with service layer is in following structure .

--Root
    --Portlet
    --Service

//This will create the service layers
From Portlet > mvn liferay:build-service

//This will create the jar for the services
From Service > mvn clean package

//This will put the services jar into the folder that will be used for creating war
From Service >mvn install -Dliferay.auto.deploy.dir=(portlet path) -Dfile=.\target\name of the jar file .jar
 
//This will create the war
From Root : mvn clean package

then Copy and  Deploy the war from /target folder