/** * Gets the value of the <code>title</code> property * * @return the title */ public String getTitle() { return task.getTitle(); }
/** * Gets the value of the <code>title</code> property * * @return the title */ public String getTitle() { return task.getTitle(); }
private String getMessageValue(WorkflowTask task) { String message = I18NUtil.getMessage(MessageFieldProcessor.MSG_VALUE_NONE); String description = (String)task.getProperties().get(WorkflowModel.PROP_DESCRIPTION); if (description != null) { String taskTitle = task.getTitle(); if (taskTitle == null || !taskTitle.equals(description)) { message = description; } } return message; }
private String getMessageValue(WorkflowTask task) { String message = I18NUtil.getMessage(MessageFieldProcessor.MSG_VALUE_NONE); String description = (String)task.getProperties().get(WorkflowModel.PROP_DESCRIPTION); if (description != null) { String taskTitle = task.getTitle(); if (taskTitle == null || !taskTitle.equals(description)) { message = description; } } return message; }
/** * Send workflow assigned email notification. * * @param taskId workflow global task id * @param taskType task type * @param assignedAuthorites assigned authorities * @param pooled true if pooled task, false otherwise */ public void sendWorkflowAssignedNotificationEMail(String taskId, String taskType, String[] assignedAuthorites, boolean pooled) { // Get the workflow task WorkflowTask workflowTask = workflowService.getTaskById(taskId); // Get the workflow properties Map<QName, Serializable> props = workflowTask.getProperties(); // Get the title and description String title = taskType == null ? workflowTask.getTitle() : taskType + ".title"; String description = (String)props.get(WorkflowModel.PROP_DESCRIPTION); // Get the duedate, priority and workflow package Date dueDate = (Date)props.get(WorkflowModel.PROP_DUE_DATE); Integer priority = (Integer)props.get(WorkflowModel.PROP_PRIORITY); NodeRef workflowPackage = workflowTask.getPath().getInstance().getWorkflowPackage(); // Send notification sendWorkflowAssignedNotificationEMail(taskId, title, description, dueDate, priority, workflowPackage, assignedAuthorites, pooled); }
/** * Send workflow assigned email notification. * * @param taskId workflow global task id * @param taskType task type * @param assignedAuthorites assigned authorities * @param pooled true if pooled task, false otherwise */ public void sendWorkflowAssignedNotificationEMail(String taskId, String taskType, String[] assignedAuthorites, boolean pooled) { // Get the workflow task WorkflowTask workflowTask = workflowService.getTaskById(taskId); // Get the workflow properties Map<QName, Serializable> props = workflowTask.getProperties(); // Get the title and description String title = taskType == null ? workflowTask.getTitle() : taskType + ".title"; String description = (String)props.get(WorkflowModel.PROP_DESCRIPTION); // Get the duedate, priority and workflow package Date dueDate = (Date)props.get(WorkflowModel.PROP_DUE_DATE); Integer priority = (Integer)props.get(WorkflowModel.PROP_PRIORITY); NodeRef workflowPackage = workflowTask.getPath().getInstance().getWorkflowPackage(); // Send notification sendWorkflowAssignedNotificationEMail(taskId, title, description, dueDate, priority, workflowPackage, assignedAuthorites, pooled); }
for (WorkflowTask task : tasks) out.println(" task id: " + task.getId() + " , name: " + task.getName() + ", title: " + task.getTitle() + " , desc: " + task.getDescription() + " , properties: " + task.getProperties().size()); out.println("id: " + task.getId()); out.println("name: " + task.getName()); out.println("title: " + task.getTitle()); out.println("description: " + task.getDescription()); out.println("state: " + task.getState());
for (WorkflowTask task : tasks) out.println(" task id: " + task.getId() + " , name: " + task.getName() + ", title: " + task.getTitle() + " , desc: " + task.getDescription() + " , properties: " + task.getProperties().size()); out.println("id: " + task.getId()); out.println("name: " + task.getName()); out.println("title: " + task.getTitle()); out.println("description: " + task.getDescription()); out.println("state: " + task.getState());
public void testGenerateMessage() throws Exception { String message = NO_MESSAGE; String fieldName = MessageFieldProcessor.KEY; Form form = processForm(fieldName); checkSingleProperty(form, fieldName, message); // add a description to the task and check it comes back message = "This is some text the user may have entered"; this.task.getProperties().put(PROP_DESCRIPTION, message); form = processForm(fieldName); checkSingleProperty(form, fieldName, message); // set the description to the same as the task title // and make sure the message comes back as null this.task.getProperties().put(PROP_DESCRIPTION, this.task.getTitle()); form = processForm(fieldName); checkSingleProperty(form, fieldName, NO_MESSAGE); }
@SuppressWarnings("deprecation") public LazyActivitiWorkflowTask(Task task, ActivitiTypeConverter typeConverter, TenantService tenantService, String workflowDefinitionName) { super(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, task.getId()), null, null, null, null, null, null, null); this.task = task; this.activitiTypeConverter = typeConverter; this.lazyPropertiesMap = new LazyPropertiesMap(); // Fetch task-definition and a partially-initialized WorkflowTask (not including properties and path) WorkflowTaskDefinition taskDefinition = activitiTypeConverter.getTaskDefinition(task); WorkflowTask partiallyInitialized = typeConverter.getWorkflowObjectFactory().createTask(task.getId(), taskDefinition, taskDefinition.getId(), task.getName(), task.getDescription(), WorkflowTaskState.IN_PROGRESS, null, workflowDefinitionName , lazyPropertiesMap); this.definition = taskDefinition; this.name = taskDefinition.getId(); this.title = partiallyInitialized.getTitle(); this.description = partiallyInitialized.getDescription(); this.state = partiallyInitialized.getState(); }
@SuppressWarnings("deprecation") public LazyActivitiWorkflowTask(Task task, ActivitiTypeConverter typeConverter, TenantService tenantService, String workflowDefinitionName) { super(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, task.getId()), null, null, null, null, null, null, null); this.task = task; this.activitiTypeConverter = typeConverter; this.lazyPropertiesMap = new LazyPropertiesMap(); // Fetch task-definition and a partially-initialized WorkflowTask (not including properties and path) WorkflowTaskDefinition taskDefinition = activitiTypeConverter.getTaskDefinition(task); WorkflowTask partiallyInitialized = typeConverter.getWorkflowObjectFactory().createTask(task.getId(), taskDefinition, taskDefinition.getId(), task.getName(), task.getDescription(), WorkflowTaskState.IN_PROGRESS, null, workflowDefinitionName , lazyPropertiesMap); this.definition = taskDefinition; this.name = taskDefinition.getId(); this.title = partiallyInitialized.getTitle(); this.description = partiallyInitialized.getDescription(); this.state = partiallyInitialized.getState(); }
assertEquals("Task", task.getTitle()); assertEquals(WorkflowTaskState.IN_PROGRESS, task.getState()); assertEquals("testUser", task.getProperties().get(ContentModel.PROP_OWNER)); assertEquals("Task", task.getTitle()); assertEquals(WorkflowTaskState.COMPLETED, task.getState()); assertEquals("testUser", task.getProperties().get(ContentModel.PROP_OWNER));
@SuppressWarnings("deprecation") public LazyActivitiWorkflowTask(HistoricTaskInstance historicTask, ActivitiTypeConverter typeConverter, TenantService tenantService) { super(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, historicTask.getId()), null, null, null, null, null, null, null); this.historicTask = historicTask; this.activitiTypeConverter = typeConverter; this.lazyPropertiesMap = new LazyPropertiesMap(); // Fetch task-definition and a partially-initialized WorkflowTask (not including properties and path) WorkflowTaskDefinition taskDefinition = activitiTypeConverter.getTaskDefinition(historicTask.getTaskDefinitionKey(), historicTask.getProcessDefinitionId()); String workflowDefinitionName = activitiTypeConverter.getWorkflowDefinitionName(historicTask.getProcessDefinitionId()); workflowDefinitionName = tenantService.getBaseName(workflowDefinitionName); WorkflowTask partiallyInitialized = typeConverter.getWorkflowObjectFactory().createTask(historicTask.getId(), taskDefinition, taskDefinition.getId(), historicTask.getName(), historicTask.getDescription(), WorkflowTaskState.COMPLETED, null, workflowDefinitionName , lazyPropertiesMap); this.definition = taskDefinition; this.name = taskDefinition.getId(); this.title = partiallyInitialized.getTitle(); this.description = partiallyInitialized.getDescription(); this.state = partiallyInitialized.getState(); }
@SuppressWarnings("deprecation") public LazyActivitiWorkflowTask(HistoricTaskInstance historicTask, ActivitiTypeConverter typeConverter, TenantService tenantService) { super(BPMEngineRegistry.createGlobalId(ActivitiConstants.ENGINE_ID, historicTask.getId()), null, null, null, null, null, null, null); this.historicTask = historicTask; this.activitiTypeConverter = typeConverter; this.lazyPropertiesMap = new LazyPropertiesMap(); // Fetch task-definition and a partially-initialized WorkflowTask (not including properties and path) WorkflowTaskDefinition taskDefinition = activitiTypeConverter.getTaskDefinition(historicTask.getTaskDefinitionKey(), historicTask.getProcessDefinitionId()); String workflowDefinitionName = activitiTypeConverter.getWorkflowDefinitionName(historicTask.getProcessDefinitionId()); workflowDefinitionName = tenantService.getBaseName(workflowDefinitionName); WorkflowTask partiallyInitialized = typeConverter.getWorkflowObjectFactory().createTask(historicTask.getId(), taskDefinition, taskDefinition.getId(), historicTask.getName(), historicTask.getDescription(), WorkflowTaskState.COMPLETED, null, workflowDefinitionName , lazyPropertiesMap); this.definition = taskDefinition; this.name = taskDefinition.getId(); this.title = partiallyInitialized.getTitle(); this.description = partiallyInitialized.getDescription(); this.state = partiallyInitialized.getState(); }
Assert.assertEquals("Task", finishedTask.getTitle()); Assert.assertEquals(WorkflowTaskState.COMPLETED, finishedTask.getState());