public class AttachmentUtil
extends java.lang.Object
com.liferay.mail.reader.service.persistence.impl.AttachmentPersistenceImpl
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
AttachmentPersistence
Constructor and Description |
---|
AttachmentUtil() |
Modifier and Type | Method and Description |
---|---|
static void |
cacheResult(Attachment attachment)
Caches the attachment in the entity cache if it is enabled.
|
static void |
cacheResult(java.util.List<Attachment> attachments)
Caches the attachments in the entity cache if it is enabled.
|
static void |
clearCache() |
static void |
clearCache(Attachment attachment) |
static int |
countAll()
Returns the number of attachments.
|
static int |
countByMessageId(long messageId)
Returns the number of attachments where messageId = ?.
|
static long |
countWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) |
static Attachment |
create(long attachmentId)
Creates a new attachment with the primary key.
|
static Attachment |
fetchByMessageId_First(long messageId,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
Returns the first attachment in the ordered set where messageId = ?.
|
static Attachment |
fetchByMessageId_Last(long messageId,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
Returns the last attachment in the ordered set where messageId = ?.
|
static Attachment |
fetchByPrimaryKey(long attachmentId)
Returns the attachment with the primary key or returns
null if it could not be found. |
static java.util.Map<java.io.Serializable,Attachment> |
fetchByPrimaryKeys(java.util.Set<java.io.Serializable> primaryKeys) |
static java.util.List<Attachment> |
findAll()
Returns all the attachments.
|
static java.util.List<Attachment> |
findAll(int start,
int end)
Returns a range of all the attachments.
|
static java.util.List<Attachment> |
findAll(int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
Returns an ordered range of all the attachments.
|
static java.util.List<Attachment> |
findAll(int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator,
boolean useFinderCache)
Returns an ordered range of all the attachments.
|
static Attachment |
findByMessageId_First(long messageId,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
Returns the first attachment in the ordered set where messageId = ?.
|
static Attachment |
findByMessageId_Last(long messageId,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
Returns the last attachment in the ordered set where messageId = ?.
|
static Attachment[] |
findByMessageId_PrevAndNext(long attachmentId,
long messageId,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
Returns the attachments before and after the current attachment in the ordered set where messageId = ?.
|
static java.util.List<Attachment> |
findByMessageId(long messageId)
Returns all the attachments where messageId = ?.
|
static java.util.List<Attachment> |
findByMessageId(long messageId,
int start,
int end)
Returns a range of all the attachments where messageId = ?.
|
static java.util.List<Attachment> |
findByMessageId(long messageId,
int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
Returns an ordered range of all the attachments where messageId = ?.
|
static java.util.List<Attachment> |
findByMessageId(long messageId,
int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator,
boolean useFinderCache)
Returns an ordered range of all the attachments where messageId = ?.
|
static Attachment |
findByPrimaryKey(long attachmentId)
Returns the attachment with the primary key or throws a
NoSuchAttachmentException if it could not be found. |
static java.util.List<Attachment> |
findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery) |
static java.util.List<Attachment> |
findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
int start,
int end) |
static java.util.List<Attachment> |
findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery,
int start,
int end,
com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator) |
static java.util.Set<java.lang.String> |
getBadColumnNames() |
static AttachmentPersistence |
getPersistence() |
static Attachment |
remove(long attachmentId)
Removes the attachment with the primary key from the database.
|
static void |
removeAll()
Removes all the attachments from the database.
|
static void |
removeByMessageId(long messageId)
Removes all the attachments where messageId = ? from the database.
|
static Attachment |
update(Attachment attachment) |
static Attachment |
update(Attachment attachment,
com.liferay.portal.kernel.service.ServiceContext serviceContext) |
static Attachment |
updateImpl(Attachment attachment) |
public static void clearCache()
BasePersistence.clearCache()
public static void clearCache(Attachment attachment)
BasePersistence.clearCache(com.liferay.portal.kernel.model.BaseModel)
public static long countWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
BasePersistence.countWithDynamicQuery(DynamicQuery)
public static java.util.Map<java.io.Serializable,Attachment> fetchByPrimaryKeys(java.util.Set<java.io.Serializable> primaryKeys)
BasePersistence.fetchByPrimaryKeys(Set)
public static java.util.List<Attachment> findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery)
BasePersistence.findWithDynamicQuery(DynamicQuery)
public static java.util.List<Attachment> findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end)
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int)
public static java.util.List<Attachment> findWithDynamicQuery(com.liferay.portal.kernel.dao.orm.DynamicQuery dynamicQuery, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
BasePersistence.findWithDynamicQuery(DynamicQuery, int, int, OrderByComparator)
public static Attachment update(Attachment attachment)
BasePersistence.update(com.liferay.portal.kernel.model.BaseModel)
public static Attachment update(Attachment attachment, com.liferay.portal.kernel.service.ServiceContext serviceContext)
BasePersistence.update(com.liferay.portal.kernel.model.BaseModel, ServiceContext)
public static java.util.List<Attachment> findByMessageId(long messageId)
messageId
- the message IDpublic static java.util.List<Attachment> findByMessageId(long messageId, int start, int end)
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, then the query will include the default ORDER BY logic from AttachmentModelImpl
.
messageId
- the message IDstart
- the lower bound of the range of attachmentsend
- the upper bound of the range of attachments (not inclusive)public static java.util.List<Attachment> findByMessageId(long messageId, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
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, then the query will include the default ORDER BY logic from AttachmentModelImpl
.
messageId
- the message IDstart
- the lower bound of the range of attachmentsend
- the upper bound of the range of attachments (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static java.util.List<Attachment> findByMessageId(long messageId, int start, int end, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator, boolean useFinderCache)
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, then the query will include the default ORDER BY logic from AttachmentModelImpl
.
messageId
- the message IDstart
- the lower bound of the range of attachmentsend
- the upper bound of the range of attachments (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)useFinderCache
- whether to use the finder cachepublic static Attachment findByMessageId_First(long messageId, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator) throws NoSuchAttachmentException
messageId
- the message IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchAttachmentException
- if a matching attachment could not be foundpublic static Attachment fetchByMessageId_First(long messageId, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
messageId
- the message IDorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching attachment could not be foundpublic static Attachment findByMessageId_Last(long messageId, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator) throws NoSuchAttachmentException
messageId
- the message IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchAttachmentException
- if a matching attachment could not be foundpublic static Attachment fetchByMessageId_Last(long messageId, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
messageId
- the message IDorderByComparator
- the comparator to order the set by (optionally null
)null
if a matching attachment could not be foundpublic static Attachment[] findByMessageId_PrevAndNext(long attachmentId, long messageId, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator) throws NoSuchAttachmentException
attachmentId
- the primary key of the current attachmentmessageId
- the message IDorderByComparator
- the comparator to order the set by (optionally null
)NoSuchAttachmentException
- if a attachment with the primary key could not be foundpublic static void removeByMessageId(long messageId)
messageId
- the message IDpublic static int countByMessageId(long messageId)
messageId
- the message IDpublic static void cacheResult(Attachment attachment)
attachment
- the attachmentpublic static void cacheResult(java.util.List<Attachment> attachments)
attachments
- the attachmentspublic static Attachment create(long attachmentId)
attachmentId
- the primary key for the new attachmentpublic static Attachment remove(long attachmentId) throws NoSuchAttachmentException
attachmentId
- the primary key of the attachmentNoSuchAttachmentException
- if a attachment with the primary key could not be foundpublic static Attachment updateImpl(Attachment attachment)
public static Attachment findByPrimaryKey(long attachmentId) throws NoSuchAttachmentException
NoSuchAttachmentException
if it could not be found.attachmentId
- the primary key of the attachmentNoSuchAttachmentException
- if a attachment with the primary key could not be foundpublic static Attachment fetchByPrimaryKey(long attachmentId)
null
if it could not be found.attachmentId
- the primary key of the attachmentnull
if a attachment with the primary key could not be foundpublic static java.util.List<Attachment> findAll()
public static java.util.List<Attachment> findAll(int start, int end)
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, then the query will include the default ORDER BY logic from AttachmentModelImpl
.
start
- the lower bound of the range of attachmentsend
- the upper bound of the range of attachments (not inclusive)public static java.util.List<Attachment> findAll(int start, int end, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator)
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, then the query will include the default ORDER BY logic from AttachmentModelImpl
.
start
- the lower bound of the range of attachmentsend
- the upper bound of the range of attachments (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)public static java.util.List<Attachment> findAll(int start, int end, com.liferay.portal.kernel.util.OrderByComparator<Attachment> orderByComparator, boolean useFinderCache)
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, then the query will include the default ORDER BY logic from AttachmentModelImpl
.
start
- the lower bound of the range of attachmentsend
- the upper bound of the range of attachments (not inclusive)orderByComparator
- the comparator to order the results by (optionally null
)useFinderCache
- whether to use the finder cachepublic static void removeAll()
public static int countAll()
public static java.util.Set<java.lang.String> getBadColumnNames()
public static AttachmentPersistence getPersistence()