Package org.intalio.tempo.workflow.task.attachments

Examples of org.intalio.tempo.workflow.task.attachments.AttachmentMetadata


        String task1ID = nextRandom();
        PATask task1 = new PATask(task1ID, new URI("http://localhost/1"), "processID", "urn:completeSOAPAction", Utils.createXMLDocument());
        task1.getUserOwners().add("test.system-test");
        task1.getUserOwners().add("intalio\\admin");
        Attachment attachment1 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a1"));
        task1.addAttachment(attachment1);
        Attachment attachment2 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a2"));
        task1.addAttachment(attachment2);
        tms.create(task1);

        PATask task2 = (PATask) tms.getTask(task1.getID());
        Assert.assertEquals(2, task2.getAttachments().size());
View Full Code Here


        OMElementQueue rootQueue = new OMElementQueue(rootElement);

        OMElement metadataElement = this.requireElement(rootQueue, "attachmentMetadata");
        OMElementQueue metadataQueue = new OMElementQueue(metadataElement);

        AttachmentMetadata metadata = new AttachmentMetadata();
        String mimeType = this.expectElementValue(metadataQueue, "mimeType");
        if (mimeType != null) {
            metadata.setMimeType(mimeType);
        }
        String fileName = this.expectElementValue(metadataQueue, "fileName");
        if (fileName != null) {
            metadata.setFileName(fileName);
        }
        String title = this.expectElementValue(metadataQueue, "title");
        if (title != null) {
            metadata.setTitle(title);
        }
        String description = this.expectElementValue(metadataQueue, "description");
        if (description != null) {
            metadata.setDescription(description);
        }
        String creationDateStr = this.expectElementValue(metadataQueue, "creationDate");
        if ((creationDateStr != null) && ! ("".equals(creationDateStr))) {
            metadata.setCreationDate(new XsdDateTime(creationDateStr).getTime());
        }

        String payloadURLStr = this.requireElementValue(rootQueue, "payloadUrl");
        return new Attachment(metadata, payloadURLStr);
    }
View Full Code Here

                com.intalio.bpms.workflow.taskManagementServices20051109.Attachment xmlAttachment = xmlAttachments
                        .addNewAttachment();
                com.intalio.bpms.workflow.taskManagementServices20051109.AttachmentMetadata xmlAttachmentMetadata = xmlAttachment
                        .addNewAttachmentMetadata();

                AttachmentMetadata metadata = attachment.getMetadata();
                xmlAttachmentMetadata.setMimeType(metadata.getMimeType());
                xmlAttachmentMetadata.setFileName(metadata.getFileName());
                xmlAttachmentMetadata.setTitle(metadata.getTitle());
                xmlAttachmentMetadata.setDescription(metadata.getDescription());
                Calendar attachmentCreateDate = Calendar.getInstance();
                attachmentCreateDate.setTime(metadata.getCreationDate());
                xmlAttachmentMetadata.setCreationDate(attachmentCreateDate);

                final URL payloadURL = attachment.getPayloadURL();
                xmlAttachment.setPayloadUrl(payloadURL.toString());
            }
View Full Code Here

    }

    private static Attachment transformAttachment(org.intalio.tempo.workflow.task.attachments.Attachment attachment) {
        AttachmentMetadataImpl metadata = (AttachmentMetadataImpl) com.intalio.bpms.workflow.taskManagementServices20051109.AttachmentMetadata.Factory
                        .newInstance();
        AttachmentMetadata data = attachment.getMetadata();
        Calendar cal = Calendar.getInstance();
        cal.setTime(data.getCreationDate());
        metadata.setCreationDate(cal);
        metadata.setDescription(data.getDescription());
        metadata.setFileName(data.getFileName());
        metadata.setMimeType(data.getMimeType());
        metadata.setTitle(data.getTitle());

        Attachment att = (Attachment) Attachment.Factory.newInstance();
        att.setAttachmentMetadata(metadata);
        att.setPayloadUrl(attachment.getPayloadURL().toString());
        return att;
View Full Code Here

    public static void main(String[] args) {
        junit.textui.TestRunner.run(AttachmentMarshallerTest.class);
    }

    public void testAttachmentMarshaller() throws Exception {
        Attachment attachment1 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a1"));
        OMElement att = AttachmentMarshaller.marshalAttachment(attachment1);

        _logger.debug(TestUtils.toPrettyXML(att));
    }
View Full Code Here

        _logger.debug(TestUtils.toPrettyXML(att));
    }

    public void testAttachmentsMarshaller() throws Exception {
        Attachment[] attachments = new Attachment[2];
        Attachment attachment1 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a1"));
        Attachment attachment2 = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a2"));
        attachments[0] = attachment1;
        attachments[1] = attachment2;
        OMElement att = AttachmentMarshaller.marshalAttachments(attachments);

        _logger.debug(TestUtils.toPrettyXML(att));
View Full Code Here

      Assert.assertFalse(task.isAvailableTo(niko));
    }

    public void testAttachments() throws Exception {
        PATask task = this.createPATask();
        Attachment attachment = new Attachment(new AttachmentMetadata(), new URL("http://localhost/a1"));
        Assert.assertNull(task.addAttachment(attachment));
        Assert.assertTrue(task.getAttachments().size() == 1);
        Assert.assertEquals(attachment, task.getAttachments().iterator().next());
        Assert.assertEquals(attachment, task.removeAttachment(attachment.getPayloadURL()));
        Assert.assertTrue(task.getAttachments().isEmpty());
View Full Code Here

        task.getUserOwners().add("test/user1");
        task.getRoleOwners().add("test.role1");
        task.getRoleOwners().add("test\\role2");
        task.setOutput(TestUtils.createXMLDocument());
     
        task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
        AttachmentMetadata metadata = new AttachmentMetadata();
        metadata.setMimeType("image/jpeg");
        task.addAttachment(new Attachment(metadata, new URL("http://localhost/url2")));

        this.testTaskMarshalling(task);
    }
View Full Code Here

        task.getUserOwners().add("test/user1");
        task.getRoleOwners().add("test.role1");
        task.getRoleOwners().add("test\\role2");
        task.setOutput(TestUtils.createXMLDocument());

        task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
        AttachmentMetadata metadata = new AttachmentMetadata();
        metadata.setMimeType("image/jpeg");
        task.addAttachment(new Attachment(metadata, new URL("http://localhost/url2")));

        this.testTaskMetadataMarshalling(task, null);
    }
View Full Code Here

        task.setPriority(1);
        task.setProcessID("processID1");
        task.authorizeActionForUser("claim", "test/user1");
        task.authorizeActionForRole("revoke", "test/role1");

        task.addAttachment(new Attachment(new AttachmentMetadata(), new URL("http://localhost/url1")));
        AttachmentMetadata metadata = new AttachmentMetadata();
        metadata.setMimeType("image/jpeg");
        task.addAttachment(new Attachment(metadata, new URL("http://localhost/url2")));

        this.testTaskMarshalling(task);
   
View Full Code Here

TOP

Related Classes of org.intalio.tempo.workflow.task.attachments.AttachmentMetadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.