Class ImageUtil
com.liferay.portal.service.persistence.impl.ImagePersistenceImpl
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 void
cacheResult
(Image image) Caches the image in the entity cache if it is enabled.static void
cacheResult
(List<Image> images) Caches the images in the entity cache if it is enabled.static void
static void
clearCache
(Image image) static int
countAll()
Returns the number of images.static int
countByLtSize
(int size) Returns the number of images where size < ?.static long
countWithDynamicQuery
(DynamicQuery dynamicQuery) static Image
create
(long imageId) Creates a new image with the primary key.static Image
fetchByLtSize_First
(int size, OrderByComparator<Image> orderByComparator) Returns the first image in the ordered set where size < ?.static Image
fetchByLtSize_Last
(int size, OrderByComparator<Image> orderByComparator) Returns the last image in the ordered set where size < ?.static Image
fetchByPrimaryKey
(long imageId) Returns the image with the primary key or returnsnull
if it could not be found.static Map<Serializable,
Image> fetchByPrimaryKeys
(Set<Serializable> primaryKeys) findAll()
Returns all the images.findAll
(int start, int end) Returns a range of all the images.findAll
(int start, int end, OrderByComparator<Image> orderByComparator) Returns an ordered range of all the images.findAll
(int start, int end, OrderByComparator<Image> orderByComparator, boolean useFinderCache) Returns an ordered range of all the images.findByLtSize
(int size) Returns all the images where size < ?.findByLtSize
(int size, int start, int end) Returns a range of all the images where size < ?.findByLtSize
(int size, int start, int end, OrderByComparator<Image> orderByComparator) Returns an ordered range of all the images where size < ?.findByLtSize
(int size, int start, int end, OrderByComparator<Image> orderByComparator, boolean useFinderCache) Returns an ordered range of all the images where size < ?.static Image
findByLtSize_First
(int size, OrderByComparator<Image> orderByComparator) Returns the first image in the ordered set where size < ?.static Image
findByLtSize_Last
(int size, OrderByComparator<Image> orderByComparator) Returns the last image in the ordered set where size < ?.static Image[]
findByLtSize_PrevAndNext
(long imageId, int size, OrderByComparator<Image> orderByComparator) Returns the images before and after the current image in the ordered set where size < ?.static Image
findByPrimaryKey
(long imageId) Returns the image with the primary key or throws aNoSuchImageException
if it could not be found.findWithDynamicQuery
(DynamicQuery dynamicQuery) findWithDynamicQuery
(DynamicQuery dynamicQuery, int start, int end) findWithDynamicQuery
(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<Image> orderByComparator) static ImagePersistence
static Image
remove
(long imageId) Removes the image with the primary key from the database.static void
Removes all the images from the database.static void
removeByLtSize
(int size) Removes all the images where size < ? from the database.static void
setPersistence
(ImagePersistence persistence) static Image
static Image
update
(Image image, ServiceContext serviceContext) static Image
updateImpl
(Image image)
-
Constructor Details
-
ImageUtil
public ImageUtil()
-
-
Method Details
-
clearCache
public static void clearCache()- See Also:
-
clearCache
-
countWithDynamicQuery
-
fetchByPrimaryKeys
- See Also:
-
findWithDynamicQuery
-
findWithDynamicQuery
-
findWithDynamicQuery
public static List<Image> findWithDynamicQuery(DynamicQuery dynamicQuery, int start, int end, OrderByComparator<Image> orderByComparator) -
update
-
update
-
findByLtSize
Returns all the images where size < ?.- Parameters:
size
- the size- Returns:
- the matching images
-
findByLtSize
Returns a range of all the images where size < ?.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil#ALL_POS
will return the full result set. IforderByComparator
is specified, then the query will include the given ORDER BY logic. IforderByComparator
is absent, then the query will include the default ORDER BY logic fromImageModelImpl
.- Parameters:
size
- the sizestart
- the lower bound of the range of imagesend
- the upper bound of the range of images (not inclusive)- Returns:
- the range of matching images
-
findByLtSize
public static List<Image> findByLtSize(int size, int start, int end, OrderByComparator<Image> orderByComparator) Returns an ordered range of all the images where size < ?.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil#ALL_POS
will return the full result set. IforderByComparator
is specified, then the query will include the given ORDER BY logic. IforderByComparator
is absent, then the query will include the default ORDER BY logic fromImageModelImpl
.- Parameters:
size
- the sizestart
- the lower bound of the range of imagesend
- the upper bound of the range of images (not inclusive)orderByComparator
- the comparator to order the results by (optionallynull
)- Returns:
- the ordered range of matching images
-
findByLtSize
public static List<Image> findByLtSize(int size, int start, int end, OrderByComparator<Image> orderByComparator, boolean useFinderCache) Returns an ordered range of all the images where size < ?.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil#ALL_POS
will return the full result set. IforderByComparator
is specified, then the query will include the given ORDER BY logic. IforderByComparator
is absent, then the query will include the default ORDER BY logic fromImageModelImpl
.- Parameters:
size
- the sizestart
- the lower bound of the range of imagesend
- the upper bound of the range of images (not inclusive)orderByComparator
- the comparator to order the results by (optionallynull
)useFinderCache
- whether to use the finder cache- Returns:
- the ordered range of matching images
-
findByLtSize_First
public static Image findByLtSize_First(int size, OrderByComparator<Image> orderByComparator) throws NoSuchImageException Returns the first image in the ordered set where size < ?.- Parameters:
size
- the sizeorderByComparator
- the comparator to order the set by (optionallynull
)- Returns:
- the first matching image
- Throws:
NoSuchImageException
- if a matching image could not be foundNoSuchImageException
-
fetchByLtSize_First
Returns the first image in the ordered set where size < ?.- Parameters:
size
- the sizeorderByComparator
- the comparator to order the set by (optionallynull
)- Returns:
- the first matching image, or
null
if a matching image could not be found
-
findByLtSize_Last
public static Image findByLtSize_Last(int size, OrderByComparator<Image> orderByComparator) throws NoSuchImageException Returns the last image in the ordered set where size < ?.- Parameters:
size
- the sizeorderByComparator
- the comparator to order the set by (optionallynull
)- Returns:
- the last matching image
- Throws:
NoSuchImageException
- if a matching image could not be foundNoSuchImageException
-
fetchByLtSize_Last
Returns the last image in the ordered set where size < ?.- Parameters:
size
- the sizeorderByComparator
- the comparator to order the set by (optionallynull
)- Returns:
- the last matching image, or
null
if a matching image could not be found
-
findByLtSize_PrevAndNext
public static Image[] findByLtSize_PrevAndNext(long imageId, int size, OrderByComparator<Image> orderByComparator) throws NoSuchImageException Returns the images before and after the current image in the ordered set where size < ?.- Parameters:
imageId
- the primary key of the current imagesize
- the sizeorderByComparator
- the comparator to order the set by (optionallynull
)- Returns:
- the previous, current, and next image
- Throws:
NoSuchImageException
- if a image with the primary key could not be foundNoSuchImageException
-
removeByLtSize
public static void removeByLtSize(int size) Removes all the images where size < ? from the database.- Parameters:
size
- the size
-
countByLtSize
public static int countByLtSize(int size) Returns the number of images where size < ?.- Parameters:
size
- the size- Returns:
- the number of matching images
-
cacheResult
Caches the image in the entity cache if it is enabled.- Parameters:
image
- the image
-
cacheResult
Caches the images in the entity cache if it is enabled.- Parameters:
images
- the images
-
create
Creates a new image with the primary key. Does not add the image to the database.- Parameters:
imageId
- the primary key for the new image- Returns:
- the new image
-
remove
Removes the image with the primary key from the database. Also notifies the appropriate model listeners.- Parameters:
imageId
- the primary key of the image- Returns:
- the image that was removed
- Throws:
NoSuchImageException
- if a image with the primary key could not be foundNoSuchImageException
-
updateImpl
-
findByPrimaryKey
Returns the image with the primary key or throws aNoSuchImageException
if it could not be found.- Parameters:
imageId
- the primary key of the image- Returns:
- the image
- Throws:
NoSuchImageException
- if a image with the primary key could not be foundNoSuchImageException
-
fetchByPrimaryKey
Returns the image with the primary key or returnsnull
if it could not be found.- Parameters:
imageId
- the primary key of the image- Returns:
- the image, or
null
if a image with the primary key could not be found
-
findAll
Returns all the images.- Returns:
- the images
-
findAll
Returns a range of all the images.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil#ALL_POS
will return the full result set. IforderByComparator
is specified, then the query will include the given ORDER BY logic. IforderByComparator
is absent, then the query will include the default ORDER BY logic fromImageModelImpl
.- Parameters:
start
- the lower bound of the range of imagesend
- the upper bound of the range of images (not inclusive)- Returns:
- the range of images
-
findAll
Returns an ordered range of all the images.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil#ALL_POS
will return the full result set. IforderByComparator
is specified, then the query will include the given ORDER BY logic. IforderByComparator
is absent, then the query will include the default ORDER BY logic fromImageModelImpl
.- Parameters:
start
- the lower bound of the range of imagesend
- the upper bound of the range of images (not inclusive)orderByComparator
- the comparator to order the results by (optionallynull
)- Returns:
- the ordered range of images
-
findAll
public static List<Image> findAll(int start, int end, OrderByComparator<Image> orderByComparator, boolean useFinderCache) Returns an ordered range of all the images.Useful when paginating results. Returns a maximum of
end - start
instances.start
andend
are not primary keys, they are indexes in the result set. Thus,0
refers to the first result in the set. Setting bothstart
andend
toQueryUtil#ALL_POS
will return the full result set. IforderByComparator
is specified, then the query will include the given ORDER BY logic. IforderByComparator
is absent, then the query will include the default ORDER BY logic fromImageModelImpl
.- Parameters:
start
- the lower bound of the range of imagesend
- the upper bound of the range of images (not inclusive)orderByComparator
- the comparator to order the results by (optionallynull
)useFinderCache
- whether to use the finder cache- Returns:
- the ordered range of images
-
removeAll
public static void removeAll()Removes all the images from the database. -
countAll
public static int countAll()Returns the number of images.- Returns:
- the number of images
-
getPersistence
-
setPersistence
-