public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext.getAttachmentEntityManager().findById(attachment.getId()); String processInstanceId = updateAttachment.getProcessInstanceId(); String processDefinitionId = null; if (updateAttachment.getProcessInstanceId() != null) { ExecutionEntity process = commandContext.getExecutionEntityManager().findById(processInstanceId); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); } } updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext.getProcessEngineConfiguration().getEventDispatcher() .dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, attachment, processInstanceId, processInstanceId, processDefinitionId)); } return null; } }
@Override public String getDescription() { return activiti5Attachment.getDescription(); }
public void open(Attachment picture) { System.out.println("I am the PhotoViewer. You are viewing a picture of " + picture.getDescription()); }
public Component getOverviewComponent(final Attachment attachment, final RelatedContentComponent parent) { // If the attachment has no description, overview link is link to actual page // instead of showing popup with details. if(attachment.getDescription() != null && !"".equals(attachment.getDescription())) { Button attachmentLink = new Button(attachment.getName()); attachmentLink.addStyleName(Reindeer.BUTTON_LINK); attachmentLink.addListener(new ClickListener() { private static final long serialVersionUID = 1L; public void buttonClick(ClickEvent event) { parent.showAttachmentDetail(attachment); } }); return attachmentLink; } else { return new Link(attachment.getName(), new ExternalResource(attachment.getUrl())); } }
public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext .getDbSqlSession() .selectById(AttachmentEntity.class, attachment.getId()); updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); return null; } }
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSpacing(true); verticalLayout.setMargin(true); verticalLayout.addComponent(new Label(attachment.getDescription())); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Icon linkLayout.addComponent(new Embedded(null, Images.RELATED_CONTENT_URL)); // Link Link link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }
@Override public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext .getDbSqlSession() .selectById(AttachmentEntity.class, attachment.getId()); updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { // Forced to fetch the process-instance to associate the right process definition String processDefinitionId = null; String processInstanceId = updateAttachment.getProcessInstanceId(); if (updateAttachment.getProcessInstanceId() != null) { ExecutionEntity process = commandContext.getExecutionEntityManager().findExecutionById(processInstanceId); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); } } commandContext.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent( ActivitiEventBuilder.createEntityEvent(FlowableEngineEventType.ENTITY_UPDATED, attachment, processInstanceId, processInstanceId, processDefinitionId)); } return null; } }
public Object execute(CommandContext commandContext) { AttachmentEntity updateAttachment = commandContext.getAttachmentEntityManager().findById(attachment.getId()); String processInstanceId = updateAttachment.getProcessInstanceId(); String processDefinitionId = null; if (updateAttachment.getProcessInstanceId() != null) { ExecutionEntity process = commandContext.getExecutionEntityManager().findById(processInstanceId); if (process != null) { processDefinitionId = process.getProcessDefinitionId(); if (Activiti5Util.isActiviti5ProcessDefinitionId(commandContext, process.getProcessDefinitionId())) { Activiti5CompatibilityHandler activiti5CompatibilityHandler = Activiti5Util.getActiviti5CompatibilityHandler(); activiti5CompatibilityHandler.saveAttachment(attachment); return null; } } } updateAttachment.setName(attachment.getName()); updateAttachment.setDescription(attachment.getDescription()); if (commandContext.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) { commandContext.getProcessEngineConfiguration().getEventDispatcher() .dispatchEvent(ActivitiEventBuilder.createEntityEvent(ActivitiEventType.ENTITY_UPDATED, attachment, processInstanceId, processInstanceId, processDefinitionId)); } return null; } }
public AttachmentResponse createAttachmentResponse(Attachment attachment, RestUrlBuilder urlBuilder) { AttachmentResponse result = new AttachmentResponse(); result.setId(attachment.getId()); result.setName(attachment.getName()); result.setDescription(attachment.getDescription()); result.setTime(attachment.getTime()); result.setType(attachment.getType()); result.setUserId(attachment.getUserId()); if (attachment.getUrl() == null && attachment.getTaskId() != null) { // Attachment content can be streamed result.setContentUrl(urlBuilder.buildUrl(RestUrls.URL_TASK_ATTACHMENT_DATA, attachment.getTaskId(), attachment.getId())); } else { result.setExternalUrl(attachment.getUrl()); } if (attachment.getTaskId() != null) { result.setUrl(urlBuilder.buildUrl(RestUrls.URL_TASK_ATTACHMENT, attachment.getTaskId(), attachment.getId())); result.setTaskUrl(urlBuilder.buildUrl(RestUrls.URL_TASK, attachment.getTaskId())); } if (attachment.getProcessInstanceId() != null) { result.setProcessInstanceUrl(urlBuilder.buildUrl(RestUrls.URL_PROCESS_INSTANCE, attachment.getProcessInstanceId())); } return result; }
verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description);
verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description);