use of org.activiti.workflow.simple.exception.SimpleWorkflowException in project Activiti by Activiti.
the class PropertyReference method validate.
public void validate(M2Model model) {
String namespacePrefix = model.getNamespaces().get(0).getPrefix();
boolean valid = false;
if (propertyName.contains(":")) {
// Already prefixed. Check if we import that namespace...
for (M2Namespace imported : model.getImports()) {
if (propertyName.startsWith(imported.getPrefix())) {
valid = true;
break;
}
}
if (!valid && !propertyName.startsWith(AlfrescoConversionConstants.WORKFLOW_NAMESPACE.getPrefix()) && !propertyName.startsWith(AlfrescoConversionConstants.BPM_NAMESPACE.getPrefix())) {
throw new SimpleWorkflowException("Property reference: " + this.getPlaceholder() + " references a property for a namespace that is not imported in the BPM-model");
} else {
valid = true;
}
}
if (!valid && !model.isContainedInModel(getQualifiedName(namespacePrefix))) {
throw new SimpleWorkflowException("Property reference: " + this.getPlaceholder() + " does not reference an existing property.");
}
}
use of org.activiti.workflow.simple.exception.SimpleWorkflowException in project Activiti by Activiti.
the class WorkflowDefinitionConversion method convert.
/**
* Call this method to actually execute the conversion of the {@link WorkflowDefinition}
* which was provided in the constructor.
*/
public void convert() {
if (workflowDefinition == null) {
throw new SimpleWorkflowException("Cannot start conversion: need to set a WorkflowDefinition first!");
}
this.incrementalIdMapping = new HashMap<String, Integer>();
this.additionalArtifacts = new HashMap<String, Object>();
// Create new process
bpmnModel = new BpmnModel();
process = new Process();
bpmnModel.addProcess(process);
// Let conversion listeners know initialization is finished
if (conversionFactory.getAllWorkflowDefinitionConversionListeners() != null) {
for (WorkflowDefinitionConversionListener conversionListener : conversionFactory.getAllWorkflowDefinitionConversionListeners()) {
conversionListener.beforeStepsConversion(this);
}
}
// Convert each step
convertSteps(workflowDefinition.getSteps());
// Let conversion listeners know step conversion is done
if (conversionFactory.getAllWorkflowDefinitionConversionListeners() != null) {
for (WorkflowDefinitionConversionListener conversionListener : conversionFactory.getAllWorkflowDefinitionConversionListeners()) {
conversionListener.afterStepsConversion(this);
}
}
// Add DI information to bpmn model
BpmnAutoLayout bpmnAutoLayout = new BpmnAutoLayout(bpmnModel);
bpmnAutoLayout.execute();
}
use of org.activiti.workflow.simple.exception.SimpleWorkflowException in project Activiti by Activiti.
the class AlfrescoTransitionsPropertyDefinition method setValues.
@Override
public void setValues(FormPropertyDefinition otherDefinition) {
if (!(otherDefinition instanceof AlfrescoTransitionsPropertyDefinition)) {
throw new SimpleWorkflowException("An instance of AlfrescoTransitionProperty is required to set values");
}
AlfrescoTransitionsPropertyDefinition propDef = (AlfrescoTransitionsPropertyDefinition) otherDefinition;
setName(propDef.getName());
setMandatory(propDef.isMandatory());
setWritable(propDef.isWritable());
// Copy the entries from the other definition
if (entries == null) {
entries = new ArrayList<ListPropertyEntry>();
} else {
entries.clear();
}
if (propDef.getTransitions() != null) {
ListPropertyEntry newEntry = null;
for (ListPropertyEntry entry : propDef.getTransitions()) {
newEntry = new ListPropertyEntry(entry.getValue(), entry.getName());
entries.add(newEntry);
}
}
if (otherDefinition.getParameters() != null) {
setParameters(new HashMap<String, Object>(otherDefinition.getParameters()));
}
}
Aggregations