+ * A class that is responsible for converting a single {@link StepDefinition} to + * all required artifacts needed. This includes process-elements, content-types + * and forms. + *
+ * + *+ * Please note that {@link StepDefinitionConverter} instances are reused and + * should be state-less. + *
+ * + * @author Frederik Heremans + */ +public interface StepDefinitionConverter { + + /** + * @return class that this converter is capable of handling. + */ + Class< ? extends StepDefinition> getHandledClass(); + + /** + * Convert given {@link StepDefinition} to correct artifacts and adds them to + * process, models and forms. + * + * @param stepDefinition + * the {@link StepDefinition} + * @param conversion + * context to add artifacts to + */ + void convertStepDefinition(StepDefinition stepDefinition, WorkflowDefinitionConversion conversion); + +} diff --git a/modules/activiti-simple-workflow/src/main/java/org/activiti/workflow/simple/converter/WorkflowDefinitionConversion.java b/modules/activiti-simple-workflow/src/main/java/org/activiti/workflow/simple/converter/WorkflowDefinitionConversion.java new file mode 100644 index 0000000000000000000000000000000000000000..4f19138712d4249bf82bc376e87c6e590c017acd --- /dev/null +++ b/modules/activiti-simple-workflow/src/main/java/org/activiti/workflow/simple/converter/WorkflowDefinitionConversion.java @@ -0,0 +1,175 @@ +/* Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.activiti.workflow.simple.converter; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; + +import org.activiti.bpmn.converter.BpmnXMLConverter; +import org.activiti.bpmn.model.BpmnModel; +import org.activiti.bpmn.model.Process; +import org.activiti.engine.ActivitiException; +import org.activiti.workflow.simple.definition.StepDefinition; +import org.activiti.workflow.simple.definition.WorkflowDefinition; +import org.activiti.workflow.simple.diagram.WorkflowDIGenerator; + +/** + * Context that holds all artifacts and meta-data required when converting + * {@link WorkflowDefinition}s into required artifacts for deployment. + * + * @see StepDefinitionConverter + * + * @author Frederik Heremans + * @author Joram Barrez + */ +public class WorkflowDefinitionConversion { + + // Input + protected WorkflowDefinition workflowDefinition; + + // Artifacts of the conversion + protected BpmnModel bpmnModel; + protected Process process; + protected Map