Liferay 7.0-ce-b4

com.liferay.portal.service.persistence
Class PortletUtil

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

@ProviderType
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.

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 it 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()
          Returns the number of portlets.
static int countByC_P(long companyId, String portletId)
          Returns the number of portlets where companyId = ? and portletId = ?.
static int countByCompanyId(long companyId)
          Returns the number of portlets where companyId = ?.
static 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)
          Returns 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)
          Returns the portlet where companyId = ? and portletId = ? or returns null if it could not be found, optionally using the finder cache.
static Portlet fetchByCompanyId_First(long companyId, OrderByComparator<Portlet> orderByComparator)
          Returns the first portlet in the ordered set where companyId = ?.
static Portlet fetchByCompanyId_Last(long companyId, OrderByComparator<Portlet> orderByComparator)
          Returns the last portlet in the ordered set where companyId = ?.
static Portlet fetchByPrimaryKey(long id)
          Returns the portlet with the primary key or returns null if it could not be found.
static Map<Serializable,Portlet> fetchByPrimaryKeys(Set<Serializable> primaryKeys)
           
static List<Portlet> findAll()
          Returns all the portlets.
static List<Portlet> findAll(int start, int end)
          Returns a range of all the portlets.
static List<Portlet> findAll(int start, int end, OrderByComparator<Portlet> orderByComparator)
          Returns an ordered range of all the portlets.
static List<Portlet> findAll(int start, int end, OrderByComparator<Portlet> orderByComparator, boolean retrieveFromCache)
          Returns an ordered range of all the portlets.
static Portlet findByC_P(long companyId, String portletId)
          Returns the portlet where companyId = ? and portletId = ? or throws a NoSuchPortletException if it could not be found.
static Portlet findByCompanyId_First(long companyId, OrderByComparator<Portlet> orderByComparator)
          Returns the first portlet in the ordered set where companyId = ?.
static Portlet findByCompanyId_Last(long companyId, OrderByComparator<Portlet> orderByComparator)
          Returns the last portlet in the ordered set where companyId = ?.
static Portlet[] findByCompanyId_PrevAndNext(long id, long companyId, OrderByComparator<Portlet> orderByComparator)
          Returns the portlets before and after the current portlet in the ordered set where companyId = ?.
static List<Portlet> findByCompanyId(long companyId)
          Returns all the portlets where companyId = ?.
static List<Portlet> findByCompanyId(long companyId, int start, int end)
          Returns a range of all the portlets where companyId = ?.
static List<Portlet> findByCompanyId(long companyId, int start, int end, OrderByComparator<Portlet> orderByComparator)
          Returns an ordered range of all the portlets where companyId = ?.
static List<Portlet> findByCompanyId(long companyId, int start, int end, OrderByComparator<Portlet> orderByComparator, boolean retrieveFromCache)
          Returns an ordered range of all the portlets where companyId = ?.
static Portlet findByPrimaryKey(long id)
          Returns 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<Portlet> orderByComparator)
           
static Set<String> getBadColumnNames()
           
static PortletPersistence getPersistence()
           
static Portlet remove(long id)
          Removes the portlet with the primary key from the database.
static void removeAll()
          Removes all the portlets from the database.
static Portlet 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.
static Portlet update(Portlet portlet)
           
static Portlet update(Portlet portlet, ServiceContext serviceContext)
           
static Portlet updateImpl(Portlet portlet)
           
 
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 static long countWithDynamicQuery(DynamicQuery dynamicQuery)
See Also:
BasePersistence.countWithDynamicQuery(DynamicQuery)

findWithDynamicQuery

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

findWithDynamicQuery

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

findWithDynamicQuery

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

update

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

update

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

findByCompanyId

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

Parameters:
companyId - the company ID
Returns:
the matching portlets

findByCompanyId

public static List<Portlet> findByCompanyId(long companyId,
                                            int start,
                                            int end)
Returns 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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from PortletModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
companyId - the company ID
start - the lower bound of the range of portlets
end - the upper bound of the range of portlets (not inclusive)
Returns:
the range of matching portlets

findByCompanyId

public static List<Portlet> findByCompanyId(long companyId,
                                            int start,
                                            int end,
                                            OrderByComparator<Portlet> orderByComparator)
Returns 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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from PortletModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
companyId - the company ID
start - the lower bound of the range of portlets
end - the upper bound of the range of portlets (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of matching portlets

findByCompanyId

public static List<Portlet> findByCompanyId(long companyId,
                                            int start,
                                            int end,
                                            OrderByComparator<Portlet> orderByComparator,
                                            boolean retrieveFromCache)
Returns 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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from PortletModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
companyId - the company ID
start - the lower bound of the range of portlets
end - the upper bound of the range of portlets (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
retrieveFromCache - whether to retrieve from the finder cache
Returns:
the ordered range of matching portlets

findByCompanyId_First

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

Parameters:
companyId - the company ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the first matching portlet
Throws:
NoSuchPortletException - if a matching portlet could not be found

fetchByCompanyId_First

public static Portlet fetchByCompanyId_First(long companyId,
                                             OrderByComparator<Portlet> orderByComparator)
Returns the first portlet in the ordered set where companyId = ?.

Parameters:
companyId - the company ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the first matching portlet, or null if a matching portlet could not be found

findByCompanyId_Last

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

Parameters:
companyId - the company ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the last matching portlet
Throws:
NoSuchPortletException - if a matching portlet could not be found

fetchByCompanyId_Last

public static Portlet fetchByCompanyId_Last(long companyId,
                                            OrderByComparator<Portlet> orderByComparator)
Returns the last portlet in the ordered set where companyId = ?.

Parameters:
companyId - the company ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the last matching portlet, or null if a matching portlet could not be found

findByCompanyId_PrevAndNext

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

Parameters:
id - the primary key of the current portlet
companyId - the company ID
orderByComparator - the comparator to order the set by (optionally null)
Returns:
the previous, current, and next portlet
Throws:
NoSuchPortletException - if a portlet with the primary key could not be found

removeByCompanyId

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

Parameters:
companyId - the company ID

countByCompanyId

public static int countByCompanyId(long companyId)
Returns the number of portlets where companyId = ?.

Parameters:
companyId - the company ID
Returns:
the number of matching portlets

findByC_P

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

Parameters:
companyId - the company ID
portletId - the portlet ID
Returns:
the matching portlet
Throws:
NoSuchPortletException - if a matching portlet could not be found

fetchByC_P

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

Parameters:
companyId - the company ID
portletId - the portlet ID
Returns:
the matching portlet, or null if a matching portlet could not be found

fetchByC_P

public static Portlet fetchByC_P(long companyId,
                                 String portletId,
                                 boolean retrieveFromCache)
Returns 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
portletId - the portlet ID
retrieveFromCache - whether to retrieve from the finder cache
Returns:
the matching portlet, or null if a matching portlet could not be found

removeByC_P

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

Parameters:
companyId - the company ID
portletId - the portlet ID
Returns:
the portlet that was removed
Throws:
NoSuchPortletException

countByC_P

public static int countByC_P(long companyId,
                             String portletId)
Returns the number of portlets where companyId = ? and portletId = ?.

Parameters:
companyId - the company ID
portletId - the portlet ID
Returns:
the number of matching portlets

cacheResult

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

Parameters:
portlet - the portlet

cacheResult

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

Parameters:
portlets - the portlets

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
Removes the portlet with the primary key from the database. Also notifies the appropriate model listeners.

Parameters:
id - the primary key of the portlet
Returns:
the portlet that was removed
Throws:
NoSuchPortletException - if a portlet with the primary key could not be found

updateImpl

public static Portlet updateImpl(Portlet portlet)

findByPrimaryKey

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

Parameters:
id - the primary key of the portlet
Returns:
the portlet
Throws:
NoSuchPortletException - if a portlet with the primary key could not be found

fetchByPrimaryKey

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

Parameters:
id - the primary key of the portlet
Returns:
the portlet, or null if a portlet with the primary key could not be found

fetchByPrimaryKeys

public static Map<Serializable,Portlet> fetchByPrimaryKeys(Set<Serializable> primaryKeys)

findAll

public static List<Portlet> findAll()
Returns all the portlets.

Returns:
the portlets

findAll

public static List<Portlet> findAll(int start,
                                    int end)
Returns 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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from PortletModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
start - the lower bound of the range of portlets
end - the upper bound of the range of portlets (not inclusive)
Returns:
the range of portlets

findAll

public static List<Portlet> findAll(int start,
                                    int end,
                                    OrderByComparator<Portlet> orderByComparator)
Returns 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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from PortletModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
start - the lower bound of the range of portlets
end - the upper bound of the range of portlets (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
Returns:
the ordered range of portlets

findAll

public static List<Portlet> findAll(int start,
                                    int end,
                                    OrderByComparator<Portlet> orderByComparator,
                                    boolean retrieveFromCache)
Returns 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. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from PortletModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order.

Parameters:
start - the lower bound of the range of portlets
end - the upper bound of the range of portlets (not inclusive)
orderByComparator - the comparator to order the results by (optionally null)
retrieveFromCache - whether to retrieve from the finder cache
Returns:
the ordered range of portlets

removeAll

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


countAll

public static int countAll()
Returns the number of portlets.

Returns:
the number of portlets

getBadColumnNames

public static Set<String> getBadColumnNames()

getPersistence

public static PortletPersistence getPersistence()

Liferay 7.0-ce-b4