Search in sources :

Example 96 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.Document in project box-c by UNC-Libraries.

the class OperationsMessageSender method sendMarkForDeletionOperation.

/**
 * Sends a MarkForDeletion operation message, indicating that an object is being marked for deletion
 * from the repository
 *
 * @param userid id of user who triggered the operation
 * @param marked object marked for deletion
 * @return id of operation message
 */
public String sendMarkForDeletionOperation(String userid, Collection<PID> marked) {
    Element contentEl = createAtomEntry(userid, marked.iterator().next(), CDRActions.MARK_FOR_DELETION);
    Element mark = new Element("markForDeletion", CDR_MESSAGE_NS);
    contentEl.addContent(mark);
    Element subjects = new Element("subjects", CDR_MESSAGE_NS);
    mark.addContent(subjects);
    for (PID sub : marked) {
        subjects.addContent(new Element("pid", CDR_MESSAGE_NS).setText(sub.getRepositoryPath()));
    }
    Document msg = contentEl.getDocument();
    sendMessage(msg);
    LOG.debug("sent mark-for-deletion operation JMS message using JMS template: {}", this.getJmsTemplate());
    return getMessageId(msg);
}
Also used : Element(org.jdom2.Element) PID(edu.unc.lib.boxc.model.api.ids.PID) Document(org.jdom2.Document)

Example 97 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.Document in project box-c by UNC-Libraries.

the class OperationsMessageSender method sendRestoreFromDeletionOperation.

/**
 * Sends a RestoreFromDeletion operation message, indicating that an object is being un-marked for deletion
 *
 * @param userid id of user who triggered the operation
 * @param unmarked object being un-marked for deletion
 * @return id of operation message
 */
public String sendRestoreFromDeletionOperation(String userid, Collection<PID> unmarked) {
    Element contentEl = createAtomEntry(userid, unmarked.iterator().next(), CDRActions.RESTORE_FROM_DELETION);
    Element mark = new Element("restoreFromDeletion", CDR_MESSAGE_NS);
    contentEl.addContent(mark);
    Element subjects = new Element("subjects", CDR_MESSAGE_NS);
    mark.addContent(subjects);
    for (PID sub : unmarked) {
        subjects.addContent(new Element("pid", CDR_MESSAGE_NS).setText(sub.getRepositoryPath()));
    }
    Document msg = contentEl.getDocument();
    sendMessage(msg);
    LOG.debug("sent restore-from-deletion operation JMS message using JMS template: {}", this.getJmsTemplate());
    return getMessageId(msg);
}
Also used : Element(org.jdom2.Element) PID(edu.unc.lib.boxc.model.api.ids.PID) Document(org.jdom2.Document)

Example 98 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.Document in project box-c by UNC-Libraries.

the class OperationsMessageSender method sendReorderOperation.

@Deprecated
public String sendReorderOperation(String userid, String timestamp, PID destination, Collection<PID> reordered) {
    Element contentEl = createAtomEntry(userid, destination, CDRActions.REORDER);
    Element reorder = new Element("reorder", CDR_MESSAGE_NS);
    contentEl.addContent(reorder);
    reorder.addContent(new Element("parent", CDR_MESSAGE_NS).setText(destination.getRepositoryPath()));
    Element reorderedEl = new Element("reordered", CDR_MESSAGE_NS);
    reorder.addContent(reorderedEl);
    if (reordered != null) {
        for (PID re : reordered) {
            reorderedEl.addContent(new Element("pid", CDR_MESSAGE_NS).setText(re.getRepositoryPath()));
        }
    }
    Document msg = contentEl.getDocument();
    sendMessage(msg);
    return getMessageId(msg);
}
Also used : Element(org.jdom2.Element) PID(edu.unc.lib.boxc.model.api.ids.PID) Document(org.jdom2.Document)

Example 99 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.Document in project box-c by UNC-Libraries.

the class OperationsMessageSender method sendEditTypeOperation.

/**
 * Sends Edit Type operation message.
 *
 * @param userid id of user who triggered the operation
 * @param pids objects changed
 * @param newType new type
 * @return id of operation message
 */
public String sendEditTypeOperation(String userid, Collection<PID> pids, ResourceType newType) {
    Element contentEl = createAtomEntry(userid, pids.iterator().next(), CDRActions.EDIT_TYPE);
    Element newTypeEl = new Element("newType", CDR_MESSAGE_NS);
    contentEl.addContent(newTypeEl);
    Element newTypeValueEl = new Element("value", CDR_MESSAGE_NS);
    newTypeEl.addContent(newTypeValueEl);
    newTypeEl.setText(newType.name());
    Element subjects = new Element("subjects", CDR_MESSAGE_NS);
    newTypeEl.addContent(subjects);
    for (PID sub : pids) {
        subjects.addContent(new Element("pid", CDR_MESSAGE_NS).setText(sub.getRepositoryPath()));
    }
    Document msg = contentEl.getDocument();
    sendMessage(msg);
    LOG.debug("sent edit-type operation JMS message using JMS template: {}", this.getJmsTemplate());
    return getMessageId(msg);
}
Also used : Element(org.jdom2.Element) PID(edu.unc.lib.boxc.model.api.ids.PID) Document(org.jdom2.Document)

Example 100 with Document

use of com.axelor.apps.bankpayment.xsd.sepa.pain_001_001_03.Document in project box-c by UNC-Libraries.

the class RunEnhancementsService method createMessage.

private void createMessage(ContentObjectRecord metadata, String username, Boolean force) {
    PID pid = metadata.getPid();
    Datastream originalDs = metadata.getDatastreamObject(ORIGINAL_FILE.getId());
    String resourceType = metadata.getResourceType();
    PID originalPid = (ResourceType.File.equals(resourceType) && originalDs != null) ? DatastreamPids.getOriginalFilePid(pid) : pid;
    Document msg = makeEnhancementOperationBody(username, originalPid, force);
    messageSender.sendMessage(msg);
}
Also used : Datastream(edu.unc.lib.boxc.search.api.models.Datastream) PID(edu.unc.lib.boxc.model.api.ids.PID) Document(org.jdom2.Document)

Aggregations

Document (org.jdom2.Document)1034 Element (org.jdom2.Element)587 Test (org.junit.Test)340 SAXBuilder (org.jdom2.input.SAXBuilder)271 IOException (java.io.IOException)266 XMLOutputter (org.jdom2.output.XMLOutputter)182 JDOMException (org.jdom2.JDOMException)162 File (java.io.File)148 ArrayList (java.util.ArrayList)75 InputStream (java.io.InputStream)74 StringReader (java.io.StringReader)63 Path (java.nio.file.Path)59 HashMap (java.util.HashMap)57 DocumentHelper.getDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getDocument)53 DocumentHelper.getElementsFromDocument (com.mulesoft.tools.migration.helper.DocumentHelper.getElementsFromDocument)53 MCRJDOMContent (org.mycore.common.content.MCRJDOMContent)48 PID (edu.unc.lib.boxc.model.api.ids.PID)47 Attribute (org.jdom2.Attribute)44 List (java.util.List)42 Namespace (org.jdom2.Namespace)39