Examples of ITaskWithAttachments


Examples of org.intalio.tempo.workflow.task.traits.ITaskWithAttachments

            ICompleteReportingTask crTask = (ICompleteReportingTask) task;
            taskMetadataElement.setUserProcessCompleteSOAPAction(crTask.getCompleteSOAPAction());
        }

        if (task instanceof ITaskWithAttachments) {
            ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
            Attachments xmlAttachments = taskMetadataElement.addNewAttachments();
            for (Attachment attachment : taskWithAttachments.getAttachments()) {
                com.intalio.bpms.workflow.taskManagementServices20051109.Attachment xmlAttachment = xmlAttachments
                        .addNewAttachment();
                com.intalio.bpms.workflow.taskManagementServices20051109.AttachmentMetadata xmlAttachmentMetadata = xmlAttachment
                        .addNewAttachmentMetadata();
View Full Code Here

Examples of org.intalio.tempo.workflow.task.traits.ITaskWithAttachments

            UnavailableTaskException, AccessDeniedException {
        UserRoles credentials = _authProvider.authenticate(participantToken);
        Task task = dao.fetchTaskIfExists(taskID);
        checkIsAvailable(taskID, task, credentials);
        if (task instanceof ITaskWithAttachments) {
            ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
            return taskWithAttachments.getAttachments().toArray(new Attachment[] {});
        } else {
            throw new RuntimeException("Task (" + taskID + ") does not have attachment");
        }
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.task.traits.ITaskWithAttachments

        Task task = dao.fetchTaskIfExists(taskID);
        checkIsAvailable(taskID, task, credentials);
        if (task instanceof ITaskWithAttachments == false) {
            throw new UnavailableTaskException("Task does not support attachments");
        }
        ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
        taskWithAttachments.addAttachment(attachment);
        dao.updateTask(task);
        dao.commit();
        if (_logger.isDebugEnabled())
            _logger.debug(credentials.getUserID() + " has added attachment " + attachment + "to Workflow Task " + task);
    }
View Full Code Here

Examples of org.intalio.tempo.workflow.task.traits.ITaskWithAttachments

        UserRoles credentials = _authProvider.authenticate(participantToken);
        try {
            task = dao.fetchTaskIfExists(taskID);
            availableTask = task instanceof ITaskWithAttachments && task.isAvailableTo(credentials);
            if (availableTask) {
                ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) task;
                Attachment removedAttachment = taskWithAttachments.removeAttachment(attachmentURL);
                availableAttachment = (removedAttachment != null);
                if (availableAttachment) {
                    dao.updateTask(task);
                    dao.commit();
                    if (_logger.isDebugEnabled())
View Full Code Here

Examples of org.intalio.tempo.workflow.task.traits.ITaskWithAttachments

        if (ICompleteReportingTask.class.isAssignableFrom(taskClass)) {
            ((ICompleteReportingTask) resultTask).setCompleteSOAPAction(completeSOAPAction);
        }
        if (ITaskWithAttachments.class.isAssignableFrom(taskClass)) {
            ITaskWithAttachments taskWithAttachments = (ITaskWithAttachments) resultTask;

            if (attachmentsElement != null) {
                for (int i = 0; i < attachmentsElement.sizeOfAttachmentArray(); i++) {
                    com.intalio.bpms.workflow.taskManagementServices20051109.Attachment attachmentElement = attachmentsElement.getAttachmentArray(i);

                    if (attachmentElement != null) {
                        // The following line has been added to handle the case
                        // where an attachment element is present
                        // but do not contain any data: no title,
                        // nodescription , ect...
                        // The reason why is this is added is to
                        // handle the initial initialization on
                        // Designer
                        // In which designer generates by default an
                        // attachment element as a part of the
                        // initialization of the message
                        // even if no attachment is used

                        // TODO: When Designer and Server will
                        // support "lazy initialization", this line
                        // can be omitted

                        XmlCursor attCursor = attachmentElement.newCursor();
                        try {
                            if (attCursor.getTextValue().trim().length() != 0) {
                                com.intalio.bpms.workflow.taskManagementServices20051109.AttachmentMetadata attachmentMetadata = attachmentElement
                                                .getAttachmentMetadata();
                                AttachmentMetadata metadata = new AttachmentMetadata();
                                String mimeType = attachmentMetadata.getMimeType();
                                if (mimeType != null) {
                                    metadata.setMimeType(mimeType);
                                }
                                String fileName = attachmentMetadata.getFileName();
                                if (fileName != null)
                                    metadata.setFileName(fileName);
                                String title = attachmentMetadata.getTitle();
                                if (title != null)
                                    metadata.setTitle(title);
                                String description2 = attachmentMetadata.getDescription();
                                if (description2 != null)
                                    metadata.setDescription(description2);

                                try {
                                    Calendar cal = attachmentMetadata.getCreationDate();
                                    if ((cal != null)) {
                                        metadata.setCreationDate(new XsdDateTime(cal.toString()).getTime());
                                    }
                                } catch (Exception e) {
                                    _logger.warn("Error in unmarshalling creation date in attachment from metadata");
                                    metadata.setCreationDate(new Date());
                                }

                                String payloadURLStr = attachmentElement.getPayloadUrl();
                                URL payloadURL;
                                try {
                                    payloadURL = new URL(payloadURLStr);
                                } catch (MalformedURLException e) {
                                    throw new InvalidInputFormatException(e);
                                }

                                Attachment attachment = new Attachment(metadata, payloadURL);
                                taskWithAttachments.addAttachment(attachment);
                            }
                        } finally {
                            attCursor.dispose();
                        }
                    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.