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

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


    AlfrescoTransitionsPropertyDefinition def = (AlfrescoTransitionsPropertyDefinition) propertyDefinition;
   
    String propertyName = contentType.getName() + AlfrescoConversionConstants.PROPERTY_TRANSITIONS_SUFFIX;
   
    // Add to content model
    M2Property property = new M2Property();
    property.setMandatory(new M2Mandatory(def.isMandatory()));
    property.setName(propertyName);
    property.setPropertyType(AlfrescoConversionConstants.PROPERTY_TYPE_TEXT);
   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    contentType.getProperties().add(property);
   
    // Create constraint for the values
    if(def.getTransitions() != null && !def.getTransitions().isEmpty()) {
      M2Constraint valueConstraint = new M2Constraint();
      valueConstraint.setType(AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_TYPE_LIST);
      valueConstraint.setName(propertyName + AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_TYPE_LIST.toLowerCase());
     
      List<String> values = new ArrayList<String>(def.getTransitions().size());
      for(ListPropertyEntry entry : def.getTransitions()) {
        values.add(entry.getValue());
      }
      valueConstraint.getParameters().add(new M2NamedValue(AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_ALLOWED_VALUES, null, values));
     
      // Add constraint to the root model instead of the type itself and reference it from within the property
      // for readability and reuse of the model
      model.getConstraints().add(valueConstraint);
     
      M2Constraint reference = new M2Constraint();
      reference.setRef(valueConstraint.getName());
      property.getConstraints().add(reference);
    }
   
    // Add a pointer to the transition-property as well, using an override
    M2PropertyOverride override = new M2PropertyOverride();
    override.setDefaultValue(AlfrescoConversionUtil.getUrlQualifiedPropertyName(propertyName, model.getNamespaces().get(0)));
View Full Code Here


  public void convertProperty(M2Type contentType, String formSet, Form form, FormPropertyDefinition propertyDefinition, WorkflowDefinitionConversion conversion) {
    BooleanPropertyDefinition booleanDefinition = (BooleanPropertyDefinition) propertyDefinition;
    String propertyName = getPropertyName(propertyDefinition, conversion);
   
    // Add to content model
    M2Property property = new M2Property();
    property.setMandatory(new M2Mandatory(booleanDefinition.isMandatory()));
    property.setName(propertyName);
    property.setPropertyType(AlfrescoConversionConstants.PROPERTY_TYPE_BOOLEAN);
   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Aspect aspect = model.getAspect(propertyName);
    if(aspect != null) {
      // In case the "shared" aspect doesn't have the actual property set yet, we
View Full Code Here

    ListPropertyDefinition dateDefinition = (ListPropertyDefinition) propertyDefinition;
   
    String propertyName = getPropertyName(propertyDefinition, conversion);
   
    // Add to content model
    M2Property property = new M2Property();
    property.setMandatory(new M2Mandatory(dateDefinition.isMandatory()));
    property.setName(propertyName);
    property.setPropertyType(AlfrescoConversionConstants.PROPERTY_TYPE_TEXT);
   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Aspect aspect = model.getAspect(propertyName);
    if(aspect != null) {
      // In case the "shared" aspect doesn't have the actual property set yet, we
      // do this here
      if(aspect.getProperties().isEmpty()) {
        aspect.getProperties().add(property);
      }
      contentType.getMandatoryAspects().add(propertyName);
    } else {
      contentType.getProperties().add(property);
    }
   
    // Create constraint for the values
    if(dateDefinition.getEntries() != null && !dateDefinition.getEntries().isEmpty()) {
      M2Constraint valueConstraint = new M2Constraint();
      valueConstraint.setType(AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_TYPE_LIST);
      valueConstraint.setName(propertyName + AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_TYPE_LIST.toLowerCase());
     
      List<String> values = new ArrayList<String>(dateDefinition.getEntries().size());
      for(ListPropertyEntry entry : dateDefinition.getEntries()) {
        // TODO: i18n file using labels in properties-file, a part of deployment?
        values.add(entry.getValue());
      }
      valueConstraint.getParameters().add(new M2NamedValue(AlfrescoConversionConstants.CONTENT_MODEL_CONSTRAINT_ALLOWED_VALUES, null, values));
     
      // Add constraint to the root model instead of the type itself and reference it from within the property
      // for readability and reuse of the model
      model.getConstraints().add(valueConstraint);
     
      M2Constraint reference = new M2Constraint();
      reference.setRef(valueConstraint.getName());
      property.getConstraints().add(reference);
    }
   
    // Add form configuration
    form.getFormFieldVisibility().addShowFieldElement(propertyName);
    FormField formField = form.getFormAppearance().addFormField(propertyName, propertyDefinition.getName(), formSet);
View Full Code Here

  public void convertProperty(M2Type contentType, String formSet, Form form, FormPropertyDefinition propertyDefinition, WorkflowDefinitionConversion conversion) {
    DatePropertyDefinition dateDefinition = (DatePropertyDefinition) propertyDefinition;
    String propertyName = getPropertyName(propertyDefinition, conversion);
   
    // Add to content model
    M2Property property = new M2Property();
    property.setMandatory(new M2Mandatory(dateDefinition.isMandatory()));
    property.setName(propertyName);
   
    if(dateDefinition.isShowTime()) {
      property.setPropertyType(AlfrescoConversionConstants.PROPERTY_TYPE_DATETIME);
    } else {
      property.setPropertyType(AlfrescoConversionConstants.PROPERTY_TYPE_DATE);
    }
   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Aspect aspect = model.getAspect(propertyName);
    if(aspect != null) {
View Full Code Here

  public void convertProperty(M2Type contentType, String formSet, Form form, FormPropertyDefinition propertyDefinition, WorkflowDefinitionConversion conversion) {
    NumberPropertyDefinition numberPropertyDefinition = (NumberPropertyDefinition) propertyDefinition;
    String propertyName = getPropertyName(propertyDefinition, conversion);
   
    // Add to content model
    M2Property property = new M2Property();
    property.setMandatory(new M2Mandatory(numberPropertyDefinition.isMandatory()));
    property.setName(propertyName);
    property.setPropertyType(AlfrescoConversionConstants.PROPERTY_TYPE_DOUBLE);
   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Aspect aspect = model.getAspect(propertyName);
    if(aspect != null) {
      // In case the "shared" aspect doesn't have the actual property set yet, we
View Full Code Here

  public void convertProperty(M2Type contentType, String formSet, Form form, FormPropertyDefinition propertyDefinition, WorkflowDefinitionConversion conversion) {
    TextPropertyDefinition textDefinition = (TextPropertyDefinition) propertyDefinition;
    String propertyName = getPropertyName(textDefinition, conversion);
   
    // Add to content model
    M2Property property = new M2Property();
    property.setMandatory(new M2Mandatory(textDefinition.isMandatory()));
    property.setName(propertyName);
    property.setPropertyType(AlfrescoConversionConstants.PROPERTY_TYPE_TEXT);
   
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    M2Aspect aspect = model.getAspect(propertyName);
    if(aspect != null) {
      // In case the "shared" aspect doesn't have the actual property set yet, we
View Full Code Here

    assertNotNull(model);
    M2Type type = model.getTypes().get(0);
    assertNotNull(type);
   
    // Simple text
    M2Property property = getPropertyFromType("text", type);
    assertEquals("d:text", property.getPropertyType());
    assertEquals(Boolean.TRUE, property.getMandatory().isMandatory());
  }
View Full Code Here

TOP

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

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.