Search in sources :

Example 1 with AttachmentCriteria

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);
        }
    }
}
Also used : AttachmentCriteria(org.jaffa.components.attachment.apis.data.AttachmentCriteria) AttachmentGraph(org.jaffa.components.attachment.apis.data.AttachmentGraph)

Example 2 with AttachmentCriteria

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;
}
Also used : AttachmentCriteria(org.jaffa.components.attachment.apis.data.AttachmentCriteria) AttachmentGraph(org.jaffa.components.attachment.apis.data.AttachmentGraph) AttachmentUpdateResponse(org.jaffa.components.attachment.apis.data.AttachmentUpdateResponse)

Aggregations

AttachmentCriteria (org.jaffa.components.attachment.apis.data.AttachmentCriteria)2 AttachmentGraph (org.jaffa.components.attachment.apis.data.AttachmentGraph)2 AttachmentUpdateResponse (org.jaffa.components.attachment.apis.data.AttachmentUpdateResponse)1