本文整理汇总了Java中org.activiti.engine.task.Attachment类的典型用法代码示例。如果您正苦于以下问题:Java Attachment类的具体用法?Java Attachment怎么用?Java Attachment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Attachment类属于org.activiti.engine.task包,在下文中一共展示了Attachment类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: taskQueryTest
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
@Test
public void taskQueryTest() {
List<String> array = new ArrayList<>();
array.add("001");
array.add("002");
List<Task> taskList = taskService.createTaskQuery()
.processInstanceId("")
.processDefinitionKey("请假流程")
.processDefinitionId("")
.processDefinitionName("")
.processCategoryIn(array)
.processInstanceBusinessKey("")
// ...
.list();
logger.info("###================================================ taskList, {}", taskList);
taskList = taskService.createNativeTaskQuery()
.sql("")
.parameter("", "")
.list();
logger.info("###================================================ taskList, {}", taskList);
// 创建流程附件
Attachment attachment = taskService.createAttachment("", "", "", "", "", "");
logger.info("###================================================ attachment, {}", attachment);
}
开发者ID:Lzw2016,项目名称:study,代码行数:27,代码来源:TaskServiceTest.java
示例2: newFile
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
/**
* 文件类型的附件
*/
@RequestMapping(value = "new/file")
public String newFile(@RequestParam("taskId") String taskId, @RequestParam(value = "processInstanceId", required = false) String processInstanceId,
@RequestParam("attachmentName") String attachmentName, @RequestParam(value = "attachmentDescription", required = false) String attachmentDescription,
@RequestParam("file") MultipartFile file, HttpSession session) {
try {
String attachmentType = file.getContentType() + ";" + FilenameUtils.getExtension(file.getOriginalFilename());
identityService.setAuthenticatedUserId(UserUtil.getUserFromSession(session).getId());
Attachment attachment = taskService.createAttachment(attachmentType, taskId, processInstanceId, attachmentName, attachmentDescription,
file.getInputStream());
taskService.saveAttachment(attachment);
} catch (IOException e) {
e.printStackTrace();
}
return "redirect:/chapter6/task/getform/" + taskId;
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:19,代码来源:AttachmentController.java
示例3: AttachmentDetailPopupWindow
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
public AttachmentDetailPopupWindow(Attachment attachment) {
super(attachment.getName());
addStyleName(Reindeer.PANEL_LIGHT);
center();
setModal(true);
setResizable(false);
AttachmentRenderer renderer = ExplorerApp.get().getAttachmentRendererManager().getRenderer(attachment.getType());
Component detail = renderer.getDetailComponent(attachment);
if(detail instanceof ComponentContainer) {
setContent((ComponentContainer) detail);
} else {
addComponent(detail);
}
getContent().setSizeUndefined();
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:AttachmentDetailPopupWindow.java
示例4: getOverviewComponent
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
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()));
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:UrlAttachmentRenderer.java
示例5: getDetailComponent
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
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;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:UrlAttachmentRenderer.java
示例6: FileAttachmentEditorComponent
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
public FileAttachmentEditorComponent(Attachment attachment, String taskId, String processInstanceId) {
this.attachment = attachment;
this.taskId = taskId;
this.processInstanceId = processInstanceId;
this.i18nManager = ExplorerApp.get().getI18nManager();
taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
form = new Form();
form.setDescription(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_HELP));
setSizeFull();
addComponent(form);
initSuccessIndicator();
initFileUpload();
initName();
initDescription();
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:18,代码来源:FileAttachmentEditorComponent.java
示例7: getAttachment
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
public Attachment getAttachment() throws InvalidValueException {
// Force validation of the fields
form.commit();
// Check if file is uploaded
if(!fileUploaded) {
InvalidValueException ive = new InvalidValueException(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_FILE_REQUIRED));
form.setComponentError(ive);
throw ive;
}
if(attachment != null) {
applyValuesToAttachment();
} else {
// Create new attachment based on values
// TODO: use explorerApp to get services
attachment = taskService.createAttachment(mimeType, taskId, processInstanceId,
getAttachmentName(), getAttachmentDescription(), new ByteArrayInputStream(byteArrayOutputStream.toByteArray()));
}
return attachment;
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:22,代码来源:FileAttachmentEditorComponent.java
示例8: refreshTaskAttachments
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
public void refreshTaskAttachments() {
table.removeAllItems();
if (noContentLabel != null) {
contentLayout.removeComponent(noContentLabel);
}
List<Attachment> attachments = null;
if (task.getProcessInstanceId() != null){
attachments = (taskService.getProcessInstanceAttachments(task.getProcessInstanceId()));
} else {
attachments = taskService.getTaskAttachments(task.getId());
}
if(attachments.size() > 0) {
addAttachmentsToTable(attachments);
} else {
table.setVisible(false);
noContentLabel = new Label(i18nManager.getMessage(Messages.TASK_NO_RELATED_CONTENT));
noContentLabel.addStyleName(Reindeer.LABEL_SMALL);
contentLayout.addComponent(noContentLabel);
}
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:23,代码来源:TaskRelatedContentComponent.java
示例9: addAttachmentsToTable
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
protected void addAttachmentsToTable(List<Attachment> attachments) {
for (Attachment attachment : attachments) {
AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment);
Item attachmentItem = table.addItem(attachment.getId());
attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, this));
attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment)));
Embedded deleteButton = new Embedded(null, Images.DELETE);
deleteButton.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
deleteButton.addListener((ClickListener) new DeleteClickedListener(attachment));
attachmentItem.getItemProperty("delete").setValue(deleteButton);
}
if(table.getItemIds().size() > 0) {
table.setVisible(true);
}
table.setPageLength(table.size());
}
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:19,代码来源:TaskRelatedContentComponent.java
示例10: addAttachment
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
@Put
public AttachmentResponse addAttachment(Representation entity) {
if(authenticate() == false) return null;
String taskId = (String) getRequest().getAttributes().get("taskId");
try {
RestletFileUpload upload = new RestletFileUpload(new DiskFileItemFactory());
List<FileItem> items = upload.parseRepresentation(entity);
FileItem uploadItem = null;
for (FileItem fileItem : items) {
if(fileItem.getName() != null) {
uploadItem = fileItem;
}
}
String fileName = uploadItem.getName();
Attachment attachment = ActivitiUtil.getTaskService().createAttachment(
uploadItem.getContentType(), taskId, null, fileName, fileName, uploadItem.getInputStream());
return new AttachmentResponse(attachment);
} catch(Exception e) {
throw new ActivitiException("Unable to add new attachment to task " + taskId);
}
}
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:29,代码来源:TaskAttachmentAddResource.java
示例11: execute
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
public Attachment execute(CommandContext commandContext) {
verifyParameters(commandContext);
AttachmentEntity attachment = new AttachmentEntity();
attachment.setName(attachmentName);
attachment.setDescription(attachmentDescription);
attachment.setType(attachmentType);
attachment.setTaskId(taskId);
attachment.setProcessInstanceId(processInstanceId);
attachment.setUrl(url);
DbSqlSession dbSqlSession = commandContext.getDbSqlSession();
dbSqlSession.insert(attachment);
if (content != null) {
byte[] bytes = IoUtil.readInputStream(content, attachmentName);
ByteArrayEntity byteArray = ByteArrayEntity.createAndInsert(bytes);
attachment.setContentId(byteArray.getId());
}
commandContext.getHistoryManager()
.createAttachmentComment(taskId, processInstanceId, attachmentName, true);
return attachment;
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:27,代码来源:CreateAttachmentCmd.java
示例12: testTaskAttachmentWithProcessInstanceId
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
@Deployment(resources = { "org/activiti/engine/test/api/oneTaskProcess.bpmn20.xml" })
public void testTaskAttachmentWithProcessInstanceId() {
if (processEngineConfiguration.getHistoryLevel().isAtLeast(HistoryLevel.ACTIVITY)) {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
String processInstanceId = processInstance.getId();
taskService.createAttachment("web page", null, processInstanceId, "weatherforcast", "temperatures and more", "http://weather.com");
Attachment attachment = taskService.getProcessInstanceAttachments(processInstanceId).get(0);
assertEquals("weatherforcast", attachment.getName());
assertEquals("temperatures and more", attachment.getDescription());
assertEquals("web page", attachment.getType());
assertEquals(processInstanceId, attachment.getProcessInstanceId());
assertNull(attachment.getTaskId());
assertEquals("http://weather.com", attachment.getUrl());
assertNull(taskService.getAttachmentContent(attachment.getId()));
// Finally, clean up
taskService.deleteAttachment(attachment.getId());
// TODO: Bad API design. Need to fix attachment/comment properly
((TaskServiceImpl) taskService).deleteComments(null, processInstanceId);
}
}
开发者ID:springvelocity,项目名称:xbpm5,代码行数:25,代码来源:TaskServiceTest.java
示例13: downloadFile
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
/**
* 下载附件
*
* @throws IOException
*/
@RequestMapping(value = "download/{attachmentId}")
public void downloadFile(@PathVariable("attachmentId") String attachmentId, HttpServletResponse response) throws IOException {
Attachment attachment = taskService.getAttachment(attachmentId);
InputStream attachmentContent = taskService.getAttachmentContent(attachmentId);
String contentType = StringUtils.substringBefore(attachment.getType(), ";");
response.addHeader("Content-Type", contentType + ";charset=UTF-8");
String extensionFileName = StringUtils.substringAfter(attachment.getType(), ";");
String fileName = attachment.getName() + "." + extensionFileName;
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
IOUtils.copy(new BufferedInputStream(attachmentContent), response.getOutputStream());
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:17,代码来源:AttachmentController.java
示例14: viewHistoryTask
import org.activiti.engine.task.Attachment; //导入依赖的package包/类
/**
* 查看已结束任务
*/
@RequestMapping(value = "task/archived/{taskId}")
public ModelAndView viewHistoryTask(@PathVariable("taskId") String taskId) throws Exception {
String viewName = "chapter6/task-form-archived";
ModelAndView mav = new ModelAndView(viewName);
HistoricTaskInstance task = historyService.createHistoricTaskInstanceQuery().taskId(taskId).singleResult();
if (task.getParentTaskId() != null) {
HistoricTaskInstance parentTask = historyService.createHistoricTaskInstanceQuery().taskId(task.getParentTaskId()).singleResult();
mav.addObject("parentTask", parentTask);
}
mav.addObject("task", task);
// 读取子任务
List<HistoricTaskInstance> subTasks = historyService.createHistoricTaskInstanceQuery().taskParentTaskId(taskId).list();
mav.addObject("subTasks", subTasks);
// 读取附件
List<Attachment> attachments = null;
if (task.getTaskDefinitionKey() != null) {
attachments = taskService.getTaskAttachments(taskId);
} else {
attachments = taskService.getProcessInstanceAttachments(task.getProcessInstanceId());
}
mav.addObject("attachments", attachments);
return mav;
}
开发者ID:shawn-gogh,项目名称:myjavacode,代码行数:30,代码来源:TaskController.java
注:本文中的org.activiti.engine.task.Attachment类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论