Package org.activiti.workflow.simple.alfresco.model

Examples of org.activiti.workflow.simple.alfresco.model.M2Namespace


    return prefix + ":" + getValidIdString(name);
  }
 
  public static M2Namespace createNamespace(String prefix) {
    String uri  = MessageFormat.format(CONTENT_MODEL_NAMESPACE_URL, prefix);
    return new M2Namespace(uri, prefix);
  }
View Full Code Here


  public UserTask convertStepDefinition(StepDefinition stepDefinition, WorkflowDefinitionConversion conversion) {
    HumanStepDefinition humanStep = (HumanStepDefinition) stepDefinition;
    validate(humanStep);
   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Namespace modelNamespace = model.getNamespaces().get(0);
   
    // Let superclass handle BPMN-specific conversion
    UserTask userTask = super.convertStepDefinition(stepDefinition, conversion);
   
    // Clear form-properties in the BPMN file, as we use custom form-mapping in Alfresco
    userTask.getFormProperties().clear();
   
    userTask.setName(humanStep.getName() != null ? humanStep.getName() : humanStep.getId());
   
    // Create the content model for the task
    M2Type type = new M2Type();
    model.getTypes().add(type);
    type.setName(AlfrescoConversionUtil.getQualifiedName(modelNamespace.getPrefix(),
        humanStep.getId()));
    type.setParentName(AlfrescoConversionConstants.DEFAULT_BASE_FORM_TYPE);
   
    // Update task-key on the task itself
    userTask.setFormKey(type.getName());
   
    // Create a form-config for the task
    Module shareModule = AlfrescoConversionUtil.getExtension(conversion).getModules().get(0);
    Configuration configuration = shareModule.addConfiguration(AlfrescoConversionConstants.EVALUATOR_TASK_TYPE
        , type.getName());
    Form formConfig = configuration.createForm();
   
    // Populate model and form based on FormDefinition
    formCreator.createForm(type, formConfig, humanStep.getForm(), conversion);
   
    // Set up property sharing using task-listeners
    addPropertySharing(humanStep, conversion, userTask);
   
    // Special handling for assignee that reference form-properties, before BPMN
    // is created
    if (humanStep.getAssignmentType() == HumanStepAssignmentType.USER) {
      String assignee = humanStep.getAssignment().getAssignee();

      if (assignee != null && PropertyReference.isPropertyReference(assignee)) {
        PropertyReference reference = PropertyReference.createReference(assignee);
        AlfrescoConversionUtil.getPropertyReferences(conversion).add(reference);
        userTask.setAssignee(reference.getUsernameReferenceExpression(modelNamespace.getPrefix()));
      }
    } else if (humanStep.getAssignmentType() == HumanStepAssignmentType.USERS) {
      if(humanStep.getAssignment().getCandidateUsers() != null) {
        userTask.setCandidateUsers(resolveUserPropertyReferences(humanStep.getAssignment().getCandidateUsers(), modelNamespace.getPrefix(), conversion));
      }
    } else if (humanStep.getAssignmentType() == HumanStepAssignmentType.GROUPS) {
      if(humanStep.getAssignment().getCandidateGroups() != null) {
        userTask.setCandidateGroups(resolveGroupPropertyReferences(humanStep.getAssignment().getCandidateGroups(), modelNamespace.getPrefix(), conversion));
      }
    }
   
    return userTask;
  }
View Full Code Here

  }

  @Override
  public void afterStepsConversion(WorkflowDefinitionConversion conversion) {
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Namespace modelNamespace = model.getNamespaces().get(0);
   
    for(FlowElement flowElement : conversion.getProcess().getFlowElements()) {
      if(flowElement instanceof StartEvent) {
        StartEvent startEvent = (StartEvent) flowElement;
        if(startEvent.getFormKey() == null) {
         
          Module module = AlfrescoConversionUtil.getExtension(conversion).getModules().get(0);
          Configuration detailsForm = module.addConfiguration(EVALUATOR_STRING_COMPARE,
              MessageFormat.format(EVALUATOR_CONDITION_ACTIVITI, conversion.getProcess().getId()));
         
          // No form-key is set, either use the default or generate of start-form if this
          // is available
          if(conversion.getWorkflowDefinition().getStartFormDefinition() != null
              && !conversion.getWorkflowDefinition().getStartFormDefinition().getFormGroups().isEmpty()) {
           
            // Create the content model for the start-task
            M2Type type = new M2Type();
         
            model.getTypes().add(type);
            type.setName(AlfrescoConversionUtil.getQualifiedName(modelNamespace.getPrefix(),
                AlfrescoConversionConstants.START_TASK_SIMPLE_NAME));
            type.setParentName(AlfrescoConversionConstants.DEFAULT_START_FORM_TYPE);
           
            // Create a form-config for the start-task
            Module shareModule = AlfrescoConversionUtil.getExtension(conversion).getModules().get(0);
View Full Code Here

    // Set general model properties
    M2Model model = new M2Model();
    model.setName(AlfrescoConversionUtil.getQualifiedName(processId,
        CONTENT_MODEL_UNQUALIFIED_NAME));
   
    M2Namespace namespace = AlfrescoConversionUtil.createNamespace(processId);
    model.getNamespaces().add(namespace);
   
   
    // Import required alfresco models
    model.getImports().add(DICTIONARY_NAMESPACE);
    model.getImports().add(CONTENT_NAMESPACE);
    model.getImports().add(BPM_NAMESPACE);
   
    // Store model in the conversion artifacts to be accessed later
    AlfrescoConversionUtil.storeContentModel(model, conversion);
    AlfrescoConversionUtil.storeModelNamespacePrefix(namespace.getPrefix(), conversion);
   
    return model;
  }
View Full Code Here

TOP

Related Classes of org.activiti.workflow.simple.alfresco.model.M2Namespace

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.