Class CompanyUtil
com.liferay.portal.service.persistence.impl.CompanyPersistenceImpl 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
- Author:
- Brian Wing Shun Chan
- See Also:
- {$generated.description}
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidcacheResult(Company company) Caches the company in the entity cache if it is enabled.static voidcacheResult(List<Company> companies) Caches the companies in the entity cache if it is enabled.static voidstatic voidclearCache(Company company) static intcountAll()Returns the number of companies.static intcountByLogoId(long logoId) Returns the number of companies where logoId = ?.static intReturns the number of companies where mx = ?.static intcountByWebId(String webId) Returns the number of companies where webId = ?.static longcountWithDynamicQuery(DynamicQuery dynamicQuery) static Companycreate(long companyId) Creates a new company with the primary key.static CompanyfetchByLogoId(long logoId) Returns the company where logoId = ? or returnsnullif it could not be found.static CompanyfetchByLogoId(long logoId, boolean useFinderCache) Returns the company where logoId = ? or returnsnullif it could not be found, optionally using the finder cache.static CompanyReturns the company where mx = ? or returnsnullif it could not be found.static CompanyReturns the company where mx = ? or returnsnullif it could not be found, optionally using the finder cache.static CompanyfetchByPrimaryKey(long companyId) Returns the company with the primary key or returnsnullif it could not be found.static Map<Serializable,Company> fetchByPrimaryKeys(Set<Serializable> primaryKeys) static CompanyfetchByWebId(String webId) Returns the company where webId = ? or returnsnullif it could not be found.static CompanyfetchByWebId(String webId, boolean useFinderCache) Returns the company where webId = ? or returnsnullif it could not be found, optionally using the finder cache.findAll()Returns all the companies.findAll(int start, int end) Returns a range of all the companies.findAll(int start, int end, OrderByComparator<Company> orderByComparator) Returns an ordered range of all the companies.findAll(int start, int end, OrderByComparator<Company> orderByComparator, boolean useFinderCache) Returns an ordered range of all the companies.static CompanyfindByLogoId(long logoId) Returns the company where logoId = ? or throws aNoSuchCompanyExceptionif it could not be found.static CompanyReturns the company where mx = ? or throws aNoSuchCompanyExceptionif it could not be found.static CompanyfindByPrimaryKey(long companyId) Returns the company with the primary key or throws aNoSuchCompanyExceptionif it could not be found.static CompanyfindByWebId(String webId) Returns the company where webId = ? or throws aNoSuchCompanyExceptionif it could not be found.findWithDynamicQuery(DynamicQuery dynamicQuery) findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end) findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<Company> orderByComparator) static CompanyPersistencestatic Companyremove(long companyId) Removes the company with the primary key from the database.static voidRemoves all the companies from the database.static CompanyremoveByLogoId(long logoId) Removes the company where logoId = ? from the database.static CompanyremoveByMx(String mx) Removes the company where mx = ? from the database.static CompanyremoveByWebId(String webId) Removes the company where webId = ? from the database.static voidsetPersistence(CompanyPersistence persistence) static Companystatic Companyupdate(Company company, ServiceContext serviceContext) static CompanyupdateImpl(Company company)
-
Constructor Details
-
CompanyUtil
public CompanyUtil()
-
-
Method Details
-
clearCache
public static void clearCache()- See Also:
-
clearCache
-
countWithDynamicQuery
-
fetchByPrimaryKeys
- See Also:
-
findWithDynamicQuery
-
findWithDynamicQuery
-
findWithDynamicQuery
public static List<Company> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<Company> orderByComparator) -
update
-
update
-
findByWebId
Returns the company where webId = ? or throws aNoSuchCompanyExceptionif it could not be found.- Parameters:
webId- the web ID- Returns:
- the matching company
- Throws:
NoSuchCompanyException- if a matching company could not be foundNoSuchCompanyException
-
fetchByWebId
Returns the company where webId = ? or returnsnullif it could not be found. Uses the finder cache.- Parameters:
webId- the web ID- Returns:
- the matching company, or
nullif a matching company could not be found
-
fetchByWebId
Returns the company where webId = ? or returnsnullif it could not be found, optionally using the finder cache.- Parameters:
webId- the web IDuseFinderCache- whether to use the finder cache- Returns:
- the matching company, or
nullif a matching company could not be found
-
removeByWebId
Removes the company where webId = ? from the database.- Parameters:
webId- the web ID- Returns:
- the company that was removed
- Throws:
NoSuchCompanyException
-
countByWebId
Returns the number of companies where webId = ?.- Parameters:
webId- the web ID- Returns:
- the number of matching companies
-
findByMx
Returns the company where mx = ? or throws aNoSuchCompanyExceptionif it could not be found.- Parameters:
mx- the mx- Returns:
- the matching company
- Throws:
NoSuchCompanyException- if a matching company could not be foundNoSuchCompanyException
-
fetchByMx
Returns the company where mx = ? or returnsnullif it could not be found. Uses the finder cache.- Parameters:
mx- the mx- Returns:
- the matching company, or
nullif a matching company could not be found
-
fetchByMx
Returns the company where mx = ? or returnsnullif it could not be found, optionally using the finder cache.- Parameters:
mx- the mxuseFinderCache- whether to use the finder cache- Returns:
- the matching company, or
nullif a matching company could not be found
-
removeByMx
Removes the company where mx = ? from the database.- Parameters:
mx- the mx- Returns:
- the company that was removed
- Throws:
NoSuchCompanyException
-
countByMx
Returns the number of companies where mx = ?.- Parameters:
mx- the mx- Returns:
- the number of matching companies
-
findByLogoId
Returns the company where logoId = ? or throws aNoSuchCompanyExceptionif it could not be found.- Parameters:
logoId- the logo ID- Returns:
- the matching company
- Throws:
NoSuchCompanyException- if a matching company could not be foundNoSuchCompanyException
-
fetchByLogoId
Returns the company where logoId = ? or returnsnullif it could not be found. Uses the finder cache.- Parameters:
logoId- the logo ID- Returns:
- the matching company, or
nullif a matching company could not be found
-
fetchByLogoId
Returns the company where logoId = ? or returnsnullif it could not be found, optionally using the finder cache.- Parameters:
logoId- the logo IDuseFinderCache- whether to use the finder cache- Returns:
- the matching company, or
nullif a matching company could not be found
-
removeByLogoId
Removes the company where logoId = ? from the database.- Parameters:
logoId- the logo ID- Returns:
- the company that was removed
- Throws:
NoSuchCompanyException
-
countByLogoId
public static int countByLogoId(long logoId) Returns the number of companies where logoId = ?.- Parameters:
logoId- the logo ID- Returns:
- the number of matching companies
-
cacheResult
Caches the company in the entity cache if it is enabled.- Parameters:
company- the company
-
cacheResult
Caches the companies in the entity cache if it is enabled.- Parameters:
companies- the companies
-
create
Creates a new company with the primary key. Does not add the company to the database.- Parameters:
companyId- the primary key for the new company- Returns:
- the new company
-
remove
Removes the company with the primary key from the database. Also notifies the appropriate model listeners.- Parameters:
companyId- the primary key of the company- Returns:
- the company that was removed
- Throws:
NoSuchCompanyException- if a company with the primary key could not be foundNoSuchCompanyException
-
updateImpl
-
findByPrimaryKey
Returns the company with the primary key or throws aNoSuchCompanyExceptionif it could not be found.- Parameters:
companyId- the primary key of the company- Returns:
- the company
- Throws:
NoSuchCompanyException- if a company with the primary key could not be foundNoSuchCompanyException
-
fetchByPrimaryKey
Returns the company with the primary key or returnsnullif it could not be found.- Parameters:
companyId- the primary key of the company- Returns:
- the company, or
nullif a company with the primary key could not be found
-
findAll
Returns all the companies.- Returns:
- the companies
-
findAll
Returns a range of all the companies.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromCompanyModelImpl.- Parameters:
start- the lower bound of the range of companiesend- the upper bound of the range of companies (not inclusive)- Returns:
- the range of companies
-
findAll
public static List<Company> findAll(int start, int end, OrderByComparator<Company> orderByComparator) Returns an ordered range of all the companies.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromCompanyModelImpl.- Parameters:
start- the lower bound of the range of companiesend- the upper bound of the range of companies (not inclusive)orderByComparator- the comparator to order the results by (optionallynull)- Returns:
- the ordered range of companies
-
findAll
public static List<Company> findAll(int start, int end, OrderByComparator<Company> orderByComparator, boolean useFinderCache) Returns an ordered range of all the companies.Useful when paginating results. Returns a maximum of
end - startinstances.startandendare not primary keys, they are indexes in the result set. Thus,0refers to the first result in the set. Setting bothstartandendtoQueryUtil#ALL_POSwill return the full result set. IforderByComparatoris specified, then the query will include the given ORDER BY logic. IforderByComparatoris absent, then the query will include the default ORDER BY logic fromCompanyModelImpl.- Parameters:
start- the lower bound of the range of companiesend- the upper bound of the range of companies (not inclusive)orderByComparator- the comparator to order the results by (optionallynull)useFinderCache- whether to use the finder cache- Returns:
- the ordered range of companies
-
removeAll
public static void removeAll()Removes all the companies from the database. -
countAll
public static int countAll()Returns the number of companies.- Returns:
- the number of companies
-
getPersistence
-
setPersistence
-