use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class FeedbackStepDefinitionConverter method createProcessArtifact.
@Override
protected Map<String, BaseElement> createProcessArtifact(FeedbackStepDefinition feedbackStepDefinition, WorkflowDefinitionConversion conversion) {
// See feedback-step.png in the resource folder to get a graphical understanding of the conversion below
Map<String, BaseElement> processElements = new HashMap<String, BaseElement>();
// The first user task, responsible for configuring the feedback
UserTask selectPeopleUserTask = createSelectPeopleUserTask(feedbackStepDefinition, conversion, processElements);
// Parallel gateways (forking/joining)
ParallelGateway fork = createForkParallelGateway(conversion, processElements);
addSequenceFlow(conversion, selectPeopleUserTask, fork);
// Gather feedback user task for the initiator of the feedback step
UserTask gatherFeedbackUserTask = createGatherFeedbackUserTask(feedbackStepDefinition, conversion, processElements);
addSequenceFlow(conversion, fork, gatherFeedbackUserTask);
// Global signal event
Signal signal = createSignalDeclaration(conversion);
// Signal throw event after the gather feedback task
ThrowEvent signalThrowEvent = createSignalThrow(conversion, signal);
addSequenceFlow(conversion, gatherFeedbackUserTask, signalThrowEvent);
// Povide feedback step
UserTask feedbackTask = createFeedbackUserTask(feedbackStepDefinition, conversion, processElements);
addSequenceFlow(conversion, fork, feedbackTask);
// Boundary signal catch to shut down all tasks if the 'gather feedback' task is completed
BoundaryEvent boundarySignalCatch = createBoundarySignalCatch(conversion, signal, feedbackTask);
// Exclusive gateway after the feedback task, needed to correctly merge the sequence flow
// such that the joining parallel gateway has exactly two incoming sequence flow
ExclusiveGateway mergingExclusiveGateway = createMergingExclusiveGateway(conversion);
addSequenceFlow(conversion, feedbackTask, mergingExclusiveGateway);
addSequenceFlow(conversion, boundarySignalCatch, mergingExclusiveGateway);
// Parallel gateway that will join it all together
ParallelGateway join = createJoinParallelGateway(conversion, processElements);
addSequenceFlow(conversion, signalThrowEvent, join);
addSequenceFlow(conversion, mergingExclusiveGateway, join);
// Set the last activity id, such that next steps can connect correctly
conversion.setLastActivityId(join.getId());
return processElements;
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class FeedbackStepDefinitionConverter method createFeedbackUserTask.
protected UserTask createFeedbackUserTask(FeedbackStepDefinition feedbackStepDefinition, WorkflowDefinitionConversion conversion, Map<String, BaseElement> processElements) {
UserTask feedbackTask = new UserTask();
feedbackTask.setId(conversion.getUniqueNumberedId(ConversionConstants.USER_TASK_ID_PREFIX));
feedbackTask.setName(getProvideFeedbackTaskName());
feedbackTask.setAssignee("${" + VARIABLE_FEEDBACK_PROVIDER + "}");
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = new MultiInstanceLoopCharacteristics();
multiInstanceLoopCharacteristics.setSequential(false);
multiInstanceLoopCharacteristics.setInputDataItem(VARIABLE_FEEDBACK_PROVIDERS);
multiInstanceLoopCharacteristics.setElementVariable(VARIABLE_FEEDBACK_PROVIDER);
feedbackTask.setLoopCharacteristics(multiInstanceLoopCharacteristics);
addFlowElement(conversion, feedbackTask);
processElements.put(FEEDBACK_USER_TASK, feedbackTask);
return feedbackTask;
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class BaseBpmnXMLConverter method writeFormProperties.
protected boolean writeFormProperties(FlowElement flowElement, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
List<FormProperty> propertyList = null;
if (flowElement instanceof UserTask) {
propertyList = ((UserTask) flowElement).getFormProperties();
} else if (flowElement instanceof StartEvent) {
propertyList = ((StartEvent) flowElement).getFormProperties();
}
if (propertyList != null) {
for (FormProperty property : propertyList) {
if (StringUtils.isNotEmpty(property.getId())) {
if (didWriteExtensionStartElement == false) {
xtw.writeStartElement(ELEMENT_EXTENSIONS);
didWriteExtensionStartElement = true;
}
xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_FORMPROPERTY, ACTIVITI_EXTENSIONS_NAMESPACE);
writeDefaultAttribute(ATTRIBUTE_FORM_ID, property.getId(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_NAME, property.getName(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_TYPE, property.getType(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_EXPRESSION, property.getExpression(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_VARIABLE, property.getVariable(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_DEFAULT, property.getDefaultExpression(), xtw);
writeDefaultAttribute(ATTRIBUTE_FORM_DATEPATTERN, property.getDatePattern(), xtw);
if (property.isReadable() == false) {
writeDefaultAttribute(ATTRIBUTE_FORM_READABLE, ATTRIBUTE_VALUE_FALSE, xtw);
}
if (property.isWriteable() == false) {
writeDefaultAttribute(ATTRIBUTE_FORM_WRITABLE, ATTRIBUTE_VALUE_FALSE, xtw);
}
if (property.isRequired()) {
writeDefaultAttribute(ATTRIBUTE_FORM_REQUIRED, ATTRIBUTE_VALUE_TRUE, xtw);
}
for (FormValue formValue : property.getFormValues()) {
if (StringUtils.isNotEmpty(formValue.getId())) {
xtw.writeStartElement(ACTIVITI_EXTENSIONS_PREFIX, ELEMENT_VALUE, ACTIVITI_EXTENSIONS_NAMESPACE);
xtw.writeAttribute(ATTRIBUTE_ID, formValue.getId());
xtw.writeAttribute(ATTRIBUTE_NAME, formValue.getName());
xtw.writeEndElement();
}
}
xtw.writeEndElement();
}
}
}
return didWriteExtensionStartElement;
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class UserTaskXMLConverter method writeCustomIdentities.
protected boolean writeCustomIdentities(BaseElement element, boolean didWriteExtensionStartElement, XMLStreamWriter xtw) throws Exception {
UserTask userTask = (UserTask) element;
if (userTask.getCustomUserIdentityLinks().isEmpty() && userTask.getCustomGroupIdentityLinks().isEmpty()) {
return didWriteExtensionStartElement;
}
if (didWriteExtensionStartElement == false) {
xtw.writeStartElement(ELEMENT_EXTENSIONS);
didWriteExtensionStartElement = true;
}
Set<String> identityLinkTypes = new HashSet<String>();
identityLinkTypes.addAll(userTask.getCustomUserIdentityLinks().keySet());
identityLinkTypes.addAll(userTask.getCustomGroupIdentityLinks().keySet());
for (String identityType : identityLinkTypes) {
writeCustomIdentities(userTask, identityType, userTask.getCustomUserIdentityLinks().get(identityType), userTask.getCustomGroupIdentityLinks().get(identityType), xtw);
}
return didWriteExtensionStartElement;
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class UserTaskXMLConverter method convertXMLToElement.
@Override
@SuppressWarnings("unchecked")
protected BaseElement convertXMLToElement(XMLStreamReader xtr, BpmnModel model) throws Exception {
String formKey = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_FORM_FORMKEY);
UserTask userTask = null;
if (StringUtils.isNotEmpty(formKey)) {
if (model.getUserTaskFormTypes() != null && model.getUserTaskFormTypes().contains(formKey)) {
userTask = new AlfrescoUserTask();
}
}
if (userTask == null) {
userTask = new UserTask();
}
BpmnXMLUtil.addXMLLocation(userTask, xtr);
userTask.setDueDate(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_DUEDATE));
userTask.setBusinessCalendarName(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_BUSINESS_CALENDAR_NAME));
userTask.setCategory(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CATEGORY));
userTask.setFormKey(formKey);
userTask.setAssignee(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_ASSIGNEE));
userTask.setOwner(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_OWNER));
userTask.setPriority(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_PRIORITY));
if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEUSERS))) {
String expression = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEUSERS);
userTask.getCandidateUsers().addAll(parseDelimitedList(expression));
}
if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEGROUPS))) {
String expression = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_CANDIDATEGROUPS);
userTask.getCandidateGroups().addAll(parseDelimitedList(expression));
}
userTask.setExtensionId(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_SERVICE_EXTENSIONID));
if (StringUtils.isNotEmpty(xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_SKIP_EXPRESSION))) {
String expression = xtr.getAttributeValue(ACTIVITI_EXTENSIONS_NAMESPACE, ATTRIBUTE_TASK_USER_SKIP_EXPRESSION);
userTask.setSkipExpression(expression);
}
BpmnXMLUtil.addCustomAttributes(xtr, userTask, defaultElementAttributes, defaultActivityAttributes, defaultUserTaskAttributes);
parseChildElements(getXMLElementName(), userTask, childParserMap, model, xtr);
return userTask;
}
Aggregations