Showing posts with label Finders method. Show all posts
Showing posts with label Finders method. 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);
    }