protected List<FormPropertyHandler> formPropertyHandlers = new ArrayList<FormPropertyHandler>();
public void parseConfiguration(Element activityElement, DeploymentEntity deployment, ProcessDefinitionEntity processDefinition, BpmnParse bpmnParse) {
this.deploymentId = deployment.getId();
ExpressionManager expressionManager = Context
.getProcessEngineConfiguration()
.getExpressionManager();
String formKeyAttribute = activityElement.attributeNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "formKey");
if (formKeyAttribute != null) {
this.formKey = expressionManager.createExpression(formKeyAttribute);
}
Element extensionElement = activityElement.element("extensionElements");
if (extensionElement != null) {
FormTypes formTypes = Context
.getProcessEngineConfiguration()
.getFormTypes();
List<Element> formPropertyElements = extensionElement.elementsNS(BpmnParser.ACTIVITI_BPMN_EXTENSIONS_NS, "formProperty");
for (Element formPropertyElement : formPropertyElements) {
FormPropertyHandler formPropertyHandler = new FormPropertyHandler();
String id = formPropertyElement.attribute("id");
if (id==null) {
bpmnParse.addError("attribute 'id' is required", formPropertyElement);
}
formPropertyHandler.setId(id);
String name = formPropertyElement.attribute("name");
formPropertyHandler.setName(name);
AbstractFormType type = formTypes.parseFormPropertyType(formPropertyElement, bpmnParse);
formPropertyHandler.setType(type);
String requiredText = formPropertyElement.attribute("required", "false");
Boolean required = bpmnParse.parseBooleanAttribute(requiredText);
if (required!=null) {
formPropertyHandler.setRequired(required);
} else {
bpmnParse.addError("attribute 'required' must be one of {on|yes|true|enabled|active|off|no|false|disabled|inactive}", formPropertyElement);
}
String readableText = formPropertyElement.attribute("readable", "true");
Boolean readable = bpmnParse.parseBooleanAttribute(readableText);
if (readable!=null) {
formPropertyHandler.setReadable(readable);
} else {
bpmnParse.addError("attribute 'readable' must be one of {on|yes|true|enabled|active|off|no|false|disabled|inactive}", formPropertyElement);
}
String writableText = formPropertyElement.attribute("writable", "true");
Boolean writable = bpmnParse.parseBooleanAttribute(writableText);
if (writable!=null) {
formPropertyHandler.setWritable(writable);
} else {
bpmnParse.addError("attribute 'writable' must be one of {on|yes|true|enabled|active|off|no|false|disabled|inactive}", formPropertyElement);
}
String variableName = formPropertyElement.attribute("variable");
formPropertyHandler.setVariableName(variableName);
String expressionText = formPropertyElement.attribute("expression");
if (expressionText!=null) {
Expression expression = expressionManager.createExpression(expressionText);
formPropertyHandler.setVariableExpression(expression);
}
String defaultExpressionText = formPropertyElement.attribute("default");
if (defaultExpressionText!=null) {
Expression defaultExpression = expressionManager.createExpression(defaultExpressionText);
formPropertyHandler.setDefaultExpression(defaultExpression);
}
formPropertyHandlers.add(formPropertyHandler);
}