use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class SubProcessConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("start1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof StartEvent);
assertEquals("start1", flowElement.getId());
flowElement = model.getMainProcess().getFlowElement("userTask1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("userTask1", flowElement.getId());
UserTask userTask = (UserTask) flowElement;
assertTrue(userTask.getCandidateUsers().size() == 1);
assertTrue(userTask.getCandidateGroups().size() == 1);
assertTrue(userTask.getFormProperties().size() == 2);
flowElement = model.getMainProcess().getFlowElement("subprocess1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SubProcess);
assertEquals("subprocess1", flowElement.getId());
SubProcess subProcess = (SubProcess) flowElement;
assertTrue(subProcess.getLoopCharacteristics().isSequential());
assertEquals("10", subProcess.getLoopCharacteristics().getLoopCardinality());
assertEquals("${assignee == \"\"}", subProcess.getLoopCharacteristics().getCompletionCondition());
assertTrue(subProcess.getFlowElements().size() == 5);
assertEquals(1, subProcess.getExecutionListeners().size());
ActivitiListener listenerSubProcess = subProcess.getExecutionListeners().get(0);
assertEquals("SubProcessTestClass", listenerSubProcess.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listenerSubProcess.getImplementationType());
assertEquals("start", listenerSubProcess.getEvent());
flowElement = model.getMainProcess().getFlowElement("boundaryEvent1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof BoundaryEvent);
assertEquals("boundaryEvent1", flowElement.getId());
BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement;
assertNotNull(boundaryEvent.getAttachedToRef());
assertEquals("subprocess1", boundaryEvent.getAttachedToRef().getId());
assertEquals(1, boundaryEvent.getEventDefinitions().size());
assertTrue(boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition);
assertEquals(1, model.getMainProcess().getExecutionListeners().size());
ActivitiListener listenerMainProcess = model.getMainProcess().getExecutionListeners().get(0);
assertEquals("TestClass", listenerMainProcess.getImplementation());
assertEquals(ImplementationType.IMPLEMENTATION_TYPE_CLASS, listenerMainProcess.getImplementationType());
assertEquals("start", listenerMainProcess.getEvent());
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class CompleteConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("userTask1");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("userTask1", flowElement.getId());
flowElement = model.getMainProcess().getFlowElement("catchsignal");
assertNotNull(flowElement);
assertTrue(flowElement instanceof IntermediateCatchEvent);
assertEquals("catchsignal", flowElement.getId());
IntermediateCatchEvent catchEvent = (IntermediateCatchEvent) flowElement;
assertEquals(1, catchEvent.getEventDefinitions().size());
assertTrue(catchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition);
SignalEventDefinition signalEvent = (SignalEventDefinition) catchEvent.getEventDefinitions().get(0);
assertEquals("testSignal", signalEvent.getSignalRef());
flowElement = model.getMainProcess().getFlowElement("subprocess");
assertNotNull(flowElement);
assertTrue(flowElement instanceof SubProcess);
assertEquals("subprocess", flowElement.getId());
SubProcess subProcess = (SubProcess) flowElement;
flowElement = subProcess.getFlowElement("receiveTask");
assertNotNull(flowElement);
assertTrue(flowElement instanceof ReceiveTask);
assertEquals("receiveTask", flowElement.getId());
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class EncodingConverterTest method validateModel.
private void validateModel(BpmnModel model) {
FlowElement flowElement = model.getMainProcess().getFlowElement("writeReportTask");
assertNotNull(flowElement);
assertTrue(flowElement instanceof UserTask);
assertEquals("writeReportTask", flowElement.getId());
UserTask userTask = (UserTask) flowElement;
assertEquals("writeReportTask", userTask.getId());
assertEquals("Fazer relatório", userTask.getName());
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class BpmnDeployer method localizeFlowElements.
protected boolean localizeFlowElements(Collection<FlowElement> flowElements, ObjectNode infoNode) {
boolean localizationValuesChanged = false;
if (flowElements == null)
return localizationValuesChanged;
CommandContext commandContext = Context.getCommandContext();
DynamicBpmnService dynamicBpmnService = commandContext.getProcessEngineConfiguration().getDynamicBpmnService();
for (FlowElement flowElement : flowElements) {
if (flowElement instanceof UserTask || flowElement instanceof SubProcess) {
List<ExtensionElement> localizationElements = flowElement.getExtensionElements().get("localization");
if (localizationElements != null) {
for (ExtensionElement localizationElement : localizationElements) {
if (BpmnXMLConstants.ACTIVITI_EXTENSIONS_PREFIX.equals(localizationElement.getNamespacePrefix())) {
String locale = localizationElement.getAttributeValue(null, "locale");
String name = localizationElement.getAttributeValue(null, "name");
String documentation = null;
List<ExtensionElement> documentationElements = localizationElement.getChildElements().get("documentation");
if (documentationElements != null) {
for (ExtensionElement documentationElement : documentationElements) {
documentation = StringUtils.trimToNull(documentationElement.getElementText());
break;
}
}
String flowElementId = flowElement.getId();
if (isEqualToCurrentLocalizationValue(locale, flowElementId, "name", name, infoNode) == false) {
dynamicBpmnService.changeLocalizationName(locale, flowElementId, name, infoNode);
localizationValuesChanged = true;
}
if (documentation != null && isEqualToCurrentLocalizationValue(locale, flowElementId, "description", documentation, infoNode) == false) {
dynamicBpmnService.changeLocalizationDescription(locale, flowElementId, documentation, infoNode);
localizationValuesChanged = true;
}
break;
}
}
}
if (flowElement instanceof SubProcess) {
SubProcess subprocess = (SubProcess) flowElement;
boolean isFlowElementLocalizationChanged = localizeFlowElements(subprocess.getFlowElements(), infoNode);
boolean isDataObjectLocalizationChanged = localizeDataObjectElements(subprocess.getDataObjects(), infoNode);
if (isFlowElementLocalizationChanged || isDataObjectLocalizationChanged) {
localizationValuesChanged = true;
}
}
}
}
return localizationValuesChanged;
}
use of org.activiti.bpmn.model.UserTask in project Activiti by Activiti.
the class UserTaskXMLConverter method writeAdditionalAttributes.
@Override
@SuppressWarnings("unchecked")
protected void writeAdditionalAttributes(BaseElement element, BpmnModel model, XMLStreamWriter xtw) throws Exception {
UserTask userTask = (UserTask) element;
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_ASSIGNEE, userTask.getAssignee(), xtw);
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_OWNER, userTask.getOwner(), xtw);
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CANDIDATEUSERS, convertToDelimitedString(userTask.getCandidateUsers()), xtw);
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CANDIDATEGROUPS, convertToDelimitedString(userTask.getCandidateGroups()), xtw);
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_DUEDATE, userTask.getDueDate(), xtw);
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_BUSINESS_CALENDAR_NAME, userTask.getBusinessCalendarName(), xtw);
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_CATEGORY, userTask.getCategory(), xtw);
writeQualifiedAttribute(ATTRIBUTE_FORM_FORMKEY, userTask.getFormKey(), xtw);
if (userTask.getPriority() != null) {
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_PRIORITY, userTask.getPriority().toString(), xtw);
}
if (StringUtils.isNotEmpty(userTask.getExtensionId())) {
writeQualifiedAttribute(ATTRIBUTE_TASK_SERVICE_EXTENSIONID, userTask.getExtensionId(), xtw);
}
if (userTask.getSkipExpression() != null) {
writeQualifiedAttribute(ATTRIBUTE_TASK_USER_SKIP_EXPRESSION, userTask.getSkipExpression(), xtw);
}
// write custom attributes
BpmnXMLUtil.writeCustomAttributes(userTask.getAttributes().values(), xtw, defaultElementAttributes, defaultActivityAttributes, defaultUserTaskAttributes);
}
Aggregations