use of org.jaffa.components.attachment.apis.data.AttachmentCriteria in project jaffa-framework by jaffa-projects.
the class AttachmentService method deleteAttachment.
public static void deleteAttachment(UOW uow, String serializedKey) throws FrameworkException, ApplicationExceptions {
AttachmentService service = new AttachmentService();
AttachmentCriteria attachmentCriteria = new AttachmentCriteria();
attachmentCriteria.setSerializedKey(StringCriteriaField.getStringCriteriaField(CriteriaField.RELATIONAL_EQUALS, serializedKey, null));
AttachmentGraph[] graphs = service.localQuery(attachmentCriteria, uow);
if (graphs != null && graphs.length > 0) {
for (AttachmentGraph graph : graphs) {
graph.setDeleteObject(Boolean.TRUE);
service.localUpdate(null, graph, uow);
}
}
}
use of org.jaffa.components.attachment.apis.data.AttachmentCriteria in project jaffa-framework by jaffa-projects.
the class AttachmentService method cloneAttachment.
public static AttachmentUpdateResponse cloneAttachment(UOW uow, String oldSerializedKey, String newSerializedKey) throws FrameworkException, ApplicationExceptions {
AttachmentService service = new AttachmentService();
AttachmentCriteria attachmentCriteria = new AttachmentCriteria();
attachmentCriteria.setSerializedKey(StringCriteriaField.getStringCriteriaField(CriteriaField.RELATIONAL_EQUALS, oldSerializedKey, null));
AttachmentGraph attachmentGraph = new AttachmentGraph();
attachmentGraph.setSerializedKey(newSerializedKey);
AttachmentUpdateResponse[] attachmentUpdateResponses = service.localCloneOrMassUpdate(attachmentCriteria, attachmentGraph, true, uow);
return attachmentUpdateResponses != null ? attachmentUpdateResponses[0] : null;
}
Aggregations