Class AttachmentDao
java.lang.Object
- All Implemented Interfaces:
de.xima.cmn.dao.interfaces.IAbstractDao<Attachment, Long, IEntityContext>, IAttachmentDao, IGenericDao<Attachment>
-
Field Summary
Fields inherited from class de.xima.cmn.dao.AbstractDao
entityClass, LOG -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintclearOriginalAttachmentReferences(IEntityContext ec, Attachment... attachments) Finds and resets 'original attachment' references to the provided attachments.createByUser(IEntityContext ec, String username, Attachment attachment) createByUser(IEntityContext ec, String username, Attachment attachment, List<ProtocolEntryProcessing> protocolEntries) voiddeleteByUser(IEntityContext ec, String username, boolean force, Attachment... attachments) voiddeleteByUser(IEntityContext ec, String username, Attachment... attachments) voiddeleteByUuid(IEntityContext ec, String uuid, Vorgang formRecord) Deletes the attachment of the given form record with the given UUIDgetAllBy(IEntityContext ec, Vorgang vorgang, EAttachmentSource source, String uuid) getByName(IEntityContext ec, Vorgang vorgang, String name) getByRecordAndUser(IEntityContext ec, UUID formRecordUuid, IUser user, int page, int pageSize) Finds the attachments of the form record given by its UUID if the given user can access the form record and the attachments itself.getByUUID(IEntityContext ec, String uuid) getByUUID(IEntityContext ec, String uuid, Vorgang v) getByUUID(IEntityContext ec, UUID uuid) Returns the attachment with the given UUIDprotected IFCDaoActionHook<Attachment> getUploadElementAttachments(IEntityContext ec, Vorgang formRecord) Returns all attachments of the given form record that are associated with an upload element.longgetUsedFileSize(IEntityContext ec, Mandant mandant) updateByUser(IEntityContext ec, String username, String oldFileName, Attachment attachment) updateByUser(IEntityContext ec, String username, String oldFileName, Attachment attachment, List<ProtocolEntryProcessing> protocolEntries) Methods inherited from class GenericDao
getEntityRefs, getPostActionHook, readMethods inherited from class de.xima.cmn.dao.AbstractDao
all, bulkDelete, bulkUpdate, cb, checkLockingVersion, cq, create, create, delete, delete, deleteAll, executePagedDaoAction, getAttributes, getAttributes, getSingleAttributes, getSingleAttributes, getTransactionHandler, notifyListener, notifyListener, read, registerListener, registerListener, registerListener, resultTotalCount, setTransactionHandler, singleElement, unregisterListener, unregisterListener, unregisterListener, update, updateMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.xima.cmn.dao.interfaces.IAbstractDao
all, bulkDelete, bulkUpdate, checkLockingVersion, create, create, delete, delete, deleteAll, executePagedDaoAction, getAttributes, getAttributes, getSingleAttributes, getSingleAttributes, getTransactionHandler, read, registerListener, registerListener, registerListener, resultTotalCount, setTransactionHandler, singleElement, unregisterListener, unregisterListener, unregisterListener, update, updateMethods inherited from interface IGenericDao
count, createOrUpdate, findAll, findSingle, getEntityRefs, read
-
Constructor Details
-
AttachmentDao
public AttachmentDao()
-
-
Method Details
-
getAllBy
public List<Attachment> getAllBy(IEntityContext ec, Vorgang vorgang, EAttachmentSource source, String uuid) - Specified by:
getAllByin interfaceIAttachmentDao
-
getUploadElementAttachments
Description copied from interface:IAttachmentDaoReturns all attachments of the given form record that are associated with an upload element.- Specified by:
getUploadElementAttachmentsin interfaceIAttachmentDao- Parameters:
ec- Entity context for database operations.formRecord- Form record to get the attachments for.- Returns:
- List of attachments associated with an upload element ordered by the name of the upload element.
-
getByUUID
- Specified by:
getByUUIDin interfaceIAttachmentDao
-
deleteByUuid
Description copied from interface:IAttachmentDaoDeletes the attachment of the given form record with the given UUID- Specified by:
deleteByUuidin interfaceIAttachmentDao- Parameters:
ec- Entity context for database operations.uuid- UUID of the attachment to deleteformRecord- Form record to delete the attachment from.
-
getByName
- Specified by:
getByNamein interfaceIAttachmentDao
-
getByUUID
- Specified by:
getByUUIDin interfaceIAttachmentDao
-
getByUUID
Description copied from interface:IAttachmentDaoReturns the attachment with the given UUID- Specified by:
getByUUIDin interfaceIAttachmentDao- Parameters:
ec-IEntityContextto useuuid-UUIDUUID of the attachment- Returns:
Attachmentfor the given UUID
-
getByRecordAndUser
public PagedResult<Attachment> getByRecordAndUser(IEntityContext ec, UUID formRecordUuid, IUser user, int page, int pageSize) Description copied from interface:IAttachmentDaoFinds the attachments of the form record given by its UUID if the given user can access the form record and the attachments itself.- Specified by:
getByRecordAndUserin interfaceIAttachmentDao- Parameters:
ec- entity context for accessing the database.formRecordUuid- the UUID of the form recorduser- to get the attachments for. The user is assumed to be the end user.page- to get. If a page less than or equal tozerois given, paging is disabled and all entities are returned in one page.pageSize- size of the page to get. If a page size less thanzerois given, paging is disabled and all entities are returned in one page.- Returns:
- a list of form record attachment of the form record the user has access to ordered by their upload date
(desc).
nullif the form record given by the UUID could not be found.
-
deleteByUser
- Specified by:
deleteByUserin interfaceIAttachmentDao
-
deleteByUser
public void deleteByUser(IEntityContext ec, String username, boolean force, Attachment... attachments) - Specified by:
deleteByUserin interfaceIAttachmentDao
-
clearOriginalAttachmentReferences
Description copied from interface:IAttachmentDaoFinds and resets 'original attachment' references to the provided attachments.- Specified by:
clearOriginalAttachmentReferencesin interfaceIAttachmentDao- Parameters:
ec- entity context for accessing the database.attachments- attachments which might be referenced from other attachments as their 'original attachment'- Returns:
- number of cleared references
-
updateByUser
public Attachment updateByUser(IEntityContext ec, String username, String oldFileName, Attachment attachment) - Specified by:
updateByUserin interfaceIAttachmentDao
-
updateByUser
public Attachment updateByUser(IEntityContext ec, String username, String oldFileName, Attachment attachment, List<ProtocolEntryProcessing> protocolEntries) - Specified by:
updateByUserin interfaceIAttachmentDao- Parameters:
ec- the entity context to useusername- the name of the involved useroldFileName- the name of the file to be replaced (just for the protocol)attachment- the attachment to updateprotocolEntries- (modifiable) list of protocol entries- note: general protocol entry properties as 'benutzer' will be set here in the DAO
- note: a concluding 'attachment updated' protocol entry for this update will also be added here
- Returns:
- the updated attachment
- See Also:
-
createByUser
- Specified by:
createByUserin interfaceIAttachmentDao
-
createByUser
public Attachment createByUser(IEntityContext ec, String username, Attachment attachment, List<ProtocolEntryProcessing> protocolEntries) - Specified by:
createByUserin interfaceIAttachmentDao- Parameters:
ec- the entity context to useusername- the name of the involved userattachment- the attachment to persistprotocolEntries- (modifiable) list of protocol entries- note: general protocol entry properties as 'benutzer' will be set here in the DAO
- note: a concluding 'attachment created' protocol entry for this update will also be added here
- Returns:
- the persisted attachment
- See Also:
-
getUsedFileSize
- Specified by:
getUsedFileSizein interfaceIAttachmentDao
-
getPreActionHook
- Overrides:
getPreActionHookin classGenericDao<Attachment>
-