Liferay 6.0.5

com.liferay.portal.service.persistence
Class PortletUtil

java.lang.Object
  extended by com.liferay.portal.service.persistence.PortletUtil

public class PortletUtil
extends Object

The persistence utility for the portlet service. This utility wraps PortletPersistenceImpl and provides direct access to the database for CRUD operations. This utility should only be used by the service layer, as it must operate within a transaction. Never access this utility in a JSP, controller, model, or other front-end class.

Never modify this class directly. Modify service.xml and rerun ServiceBuilder to regenerate this class.

Caching information and settings can be found in portal.properties

See Also:
PortletPersistence, PortletPersistenceImpl
ServiceBuilder generated this class. Modifications in this class will be overwritten the next time is generated.

Constructor Summary
PortletUtil()
           
 
Method Summary
static void cacheResult(List<Portlet> portlets)
          Caches the portlets in the entity cache if it is enabled.
static void cacheResult(Portlet portlet)
          Caches the portlet in the entity cache if it is enabled.
static void clearCache()
           
static void clearCache(Portlet portlet)
           
static int countAll()
          Counts all the portlets.
static int countByC_P(long companyId, String portletId)
          Counts all the portlets where companyId = ? and portletId = ?.
static int countByCompanyId(long companyId)
          Counts all the portlets where companyId = ?.
 long countWithDynamicQuery(DynamicQuery dynamicQuery)
           
static Portlet create(long id)
          Creates a new portlet with the primary key.
static Portlet fetchByC_P(long companyId, String portletId)
          Finds the portlet where companyId = ? and portletId = ? or returns null if it could not be found.
static Portlet fetchByC_P(long companyId, String portletId, boolean retrieveFromCache)
          Finds the portlet where companyId = ? and portletId = ? or returns null if it could not be found, optionally using the finder cache.
static Portlet fetchByPrimaryKey(long id)
          Finds the portlet with the primary key or returns null if it could not be found.
static List<Portlet> findAll()
          Finds all the portlets.
static List<Portlet> findAll(int start, int end)
          Finds a range of all the portlets.
static List<Portlet> findAll(int start, int end, OrderByComparator orderByComparator)
          Finds an ordered range of all the portlets.
static Portlet findByC_P(long companyId, String portletId)
          Finds the portlet where companyId = ? and portletId = ? or throws a NoSuchPortletException if it could not be found.
static Portlet findByCompanyId_First(long companyId, OrderByComparator orderByComparator)
          Finds the first portlet in the ordered set where companyId = ?.
static Portlet findByCompanyId_Last(long companyId, OrderByComparator orderByComparator)
          Finds the last portlet in the ordered set where companyId = ?.
static Portlet[] findByCompanyId_PrevAndNext(long id, long companyId, OrderByComparator orderByComparator)
          Finds the portlets before and after the current portlet in the ordered set where companyId = ?.
static List<Portlet> findByCompanyId(long companyId)
          Finds all the portlets where companyId = ?.
static List<Portlet> findByCompanyId(long companyId, int start, int end)
          Finds a range of all the portlets where companyId = ?.
static List<Portlet> findByCompanyId(long companyId, int start, int end, OrderByComparator orderByComparator)
          Finds an ordered range of all the portlets where companyId = ?.
static Portlet findByPrimaryKey(long id)
          Finds the portlet with the primary key or throws a NoSuchPortletException if it could not be found.
static List<Portlet> findWithDynamicQuery(DynamicQuery dynamicQuery)
           
static List<Portlet> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end)
           
static List<Portlet> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator orderByComparator)
           
static PortletPersistence getPersistence()
           
static Portlet remove(long id)
          Removes the portlet with the primary key from the database.
static Portlet remove(Portlet portlet)
           
static void removeAll()
          Removes all the portlets from the database.
static void removeByC_P(long companyId, String portletId)
          Removes the portlet where companyId = ? and portletId = ? from the database.
static void removeByCompanyId(long companyId)
          Removes all the portlets where companyId = ? from the database.
 void setPersistence(PortletPersistence persistence)
           
static Portlet update(Portlet portlet, boolean merge)
           
static Portlet update(Portlet portlet, boolean merge, ServiceContext serviceContext)
           
static Portlet updateImpl(Portlet portlet, boolean merge)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortletUtil

public PortletUtil()
Method Detail

clearCache

public static void clearCache()
See Also:
BasePersistence.clearCache()

clearCache

public static void clearCache(Portlet portlet)
See Also:
BasePersistence.clearCache(com.liferay.portal.model.BaseModel)

countWithDynamicQuery

public long countWithDynamicQuery(DynamicQuery dynamicQuery)
                           throws SystemException
Throws:
SystemException
See Also:
BasePersistence.countWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

public static List<Portlet> findWithDynamicQuery(DynamicQuery dynamicQuery)
                                          throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

public static List<Portlet> findWithDynamicQuery(DynamicQuery dynamicQuery,
                                                 int start,
                                                 int end)
                                          throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int)

findWithDynamicQuery

public static List<Portlet> findWithDynamicQuery(DynamicQuery dynamicQuery,
                                                 int start,
                                                 int end,
                                                 OrderByComparator orderByComparator)
                                          throws SystemException
Throws:
SystemException
See Also:
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)

remove

public static Portlet remove(Portlet portlet)
                      throws SystemException
Throws:
SystemException
See Also:
BasePersistence.remove(com.liferay.portal.model.BaseModel)

update

public static Portlet update(Portlet portlet,
                             boolean merge)
                      throws SystemException
Throws:
SystemException
See Also:
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean)

update

public static Portlet update(Portlet portlet,
                             boolean merge,
                             ServiceContext serviceContext)
                      throws SystemException
Throws:
SystemException
See Also:
BasePersistence.update(com.liferay.portal.model.BaseModel, boolean, ServiceContext)

cacheResult

public static void cacheResult(Portlet portlet)
Caches the portlet in the entity cache if it is enabled.

Parameters:
portlet - the portlet to cache

cacheResult

public static void cacheResult(List<Portlet> portlets)
Caches the portlets in the entity cache if it is enabled.

Parameters:
portlets - the portlets to cache

create

public static Portlet create(long id)
Creates a new portlet with the primary key. Does not add the portlet to the database.

Parameters:
id - the primary key for the new portlet
Returns:
the new portlet

remove

public static Portlet remove(long id)
                      throws NoSuchPortletException,
                             SystemException
Removes the portlet with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
id - the primary key of the portlet to remove
Returns:
the portlet that was removed
Throws:
NoSuchPortletException - if a portlet with the primary key could not be found
SystemException - if a system exception occurred

updateImpl

public static Portlet updateImpl(Portlet portlet,
                                 boolean merge)
                          throws SystemException
Throws:
SystemException

findByPrimaryKey

public static Portlet findByPrimaryKey(long id)
                                throws NoSuchPortletException,
                                       SystemException
Finds the portlet with the primary key or throws a NoSuchPortletException if it could not be found.

Parameters:
id - the primary key of the portlet to find
Returns:
the portlet
Throws:
NoSuchPortletException - if a portlet with the primary key could not be found
SystemException - if a system exception occurred

fetchByPrimaryKey

public static Portlet fetchByPrimaryKey(long id)
                                 throws SystemException
Finds the portlet with the primary key or returns null if it could not be found.

Parameters:
id - the primary key of the portlet to find
Returns:
the portlet, or null if a portlet with the primary key could not be found
Throws:
SystemException - if a system exception occurred

findByCompanyId

public static List<Portlet> findByCompanyId(long companyId)
                                     throws SystemException
Finds all the portlets where companyId = ?.

Parameters:
companyId - the company id to search with
Returns:
the matching portlets
Throws:
SystemException - if a system exception occurred

findByCompanyId

public static List<Portlet> findByCompanyId(long companyId,
                                            int start,
                                            int end)
                                     throws SystemException
Finds a range of all the portlets where companyId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the company id to search with
start - the lower bound of the range of portlets to return
end - the upper bound of the range of portlets to return (not inclusive)
Returns:
the range of matching portlets
Throws:
SystemException - if a system exception occurred

findByCompanyId

public static List<Portlet> findByCompanyId(long companyId,
                                            int start,
                                            int end,
                                            OrderByComparator orderByComparator)
                                     throws SystemException
Finds an ordered range of all the portlets where companyId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the company id to search with
start - the lower bound of the range of portlets to return
end - the upper bound of the range of portlets to return (not inclusive)
orderByComparator - the comparator to order the results by
Returns:
the ordered range of matching portlets
Throws:
SystemException - if a system exception occurred

findByCompanyId_First

public static Portlet findByCompanyId_First(long companyId,
                                            OrderByComparator orderByComparator)
                                     throws NoSuchPortletException,
                                            SystemException
Finds the first portlet in the ordered set where companyId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the company id to search with
orderByComparator - the comparator to order the set by
Returns:
the first matching portlet
Throws:
NoSuchPortletException - if a matching portlet could not be found
SystemException - if a system exception occurred

findByCompanyId_Last

public static Portlet findByCompanyId_Last(long companyId,
                                           OrderByComparator orderByComparator)
                                    throws NoSuchPortletException,
                                           SystemException
Finds the last portlet in the ordered set where companyId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
companyId - the company id to search with
orderByComparator - the comparator to order the set by
Returns:
the last matching portlet
Throws:
NoSuchPortletException - if a matching portlet could not be found
SystemException - if a system exception occurred

findByCompanyId_PrevAndNext

public static Portlet[] findByCompanyId_PrevAndNext(long id,
                                                    long companyId,
                                                    OrderByComparator orderByComparator)
                                             throws NoSuchPortletException,
                                                    SystemException
Finds the portlets before and after the current portlet in the ordered set where companyId = ?.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
id - the primary key of the current portlet
companyId - the company id to search with
orderByComparator - the comparator to order the set by
Returns:
the previous, current, and next portlet
Throws:
NoSuchPortletException - if a portlet with the primary key could not be found
SystemException - if a system exception occurred

findByC_P

public static Portlet findByC_P(long companyId,
                                String portletId)
                         throws NoSuchPortletException,
                                SystemException
Finds the portlet where companyId = ? and portletId = ? or throws a NoSuchPortletException if it could not be found.

Parameters:
companyId - the company id to search with
portletId - the portlet id to search with
Returns:
the matching portlet
Throws:
NoSuchPortletException - if a matching portlet could not be found
SystemException - if a system exception occurred

fetchByC_P

public static Portlet fetchByC_P(long companyId,
                                 String portletId)
                          throws SystemException
Finds the portlet where companyId = ? and portletId = ? or returns null if it could not be found. Uses the finder cache.

Parameters:
companyId - the company id to search with
portletId - the portlet id to search with
Returns:
the matching portlet, or null if a matching portlet could not be found
Throws:
SystemException - if a system exception occurred

fetchByC_P

public static Portlet fetchByC_P(long companyId,
                                 String portletId,
                                 boolean retrieveFromCache)
                          throws SystemException
Finds the portlet where companyId = ? and portletId = ? or returns null if it could not be found, optionally using the finder cache.

Parameters:
companyId - the company id to search with
portletId - the portlet id to search with
Returns:
the matching portlet, or null if a matching portlet could not be found
Throws:
SystemException - if a system exception occurred

findAll

public static List<Portlet> findAll()
                             throws SystemException
Finds all the portlets.

Returns:
the portlets
Throws:
SystemException - if a system exception occurred

findAll

public static List<Portlet> findAll(int start,
                                    int end)
                             throws SystemException
Finds a range of all the portlets.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
start - the lower bound of the range of portlets to return
end - the upper bound of the range of portlets to return (not inclusive)
Returns:
the range of portlets
Throws:
SystemException - if a system exception occurred

findAll

public static List<Portlet> findAll(int start,
                                    int end,
                                    OrderByComparator orderByComparator)
                             throws SystemException
Finds an ordered range of all the portlets.

Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil.ALL_POS will return the full result set.

Parameters:
start - the lower bound of the range of portlets to return
end - the upper bound of the range of portlets to return (not inclusive)
orderByComparator - the comparator to order the results by
Returns:
the ordered range of portlets
Throws:
SystemException - if a system exception occurred

removeByCompanyId

public static void removeByCompanyId(long companyId)
                              throws SystemException
Removes all the portlets where companyId = ? from the database.

Parameters:
companyId - the company id to search with
Throws:
SystemException - if a system exception occurred

removeByC_P

public static void removeByC_P(long companyId,
                               String portletId)
                        throws NoSuchPortletException,
                               SystemException
Removes the portlet where companyId = ? and portletId = ? from the database.

Parameters:
companyId - the company id to search with
portletId - the portlet id to search with
Throws:
SystemException - if a system exception occurred
NoSuchPortletException

removeAll

public static void removeAll()
                      throws SystemException
Removes all the portlets from the database.

Throws:
SystemException - if a system exception occurred

countByCompanyId

public static int countByCompanyId(long companyId)
                            throws SystemException
Counts all the portlets where companyId = ?.

Parameters:
companyId - the company id to search with
Returns:
the number of matching portlets
Throws:
SystemException - if a system exception occurred

countByC_P

public static int countByC_P(long companyId,
                             String portletId)
                      throws SystemException
Counts all the portlets where companyId = ? and portletId = ?.

Parameters:
companyId - the company id to search with
portletId - the portlet id to search with
Returns:
the number of matching portlets
Throws:
SystemException - if a system exception occurred

countAll

public static int countAll()
                    throws SystemException
Counts all the portlets.

Returns:
the number of portlets
Throws:
SystemException - if a system exception occurred

getPersistence

public static PortletPersistence getPersistence()

setPersistence

public void setPersistence(PortletPersistence persistence)

Liferay 6.0.5