コード例 #1
0
 protected String getAppearanceForGroup(FormPropertyGroup group) {
   if (group.getTitle() != null && !group.getTitle().isEmpty()) {
     return AlfrescoConversionConstants.FORM_SET_APPEARANCE_TITLE;
   } else {
     return null;
   }
 }
コード例 #2
0
  public void createForm(
      M2Type contentType,
      Form formConfig,
      FormDefinition formDefinition,
      WorkflowDefinitionConversion conversion) {
    if (formDefinition != null && formDefinition.getFormGroups() != null) {

      for (FormPropertyGroup group : formDefinition.getFormGroups()) {
        // Create a group in the form-config
        String groupId = null;
        if (group.getId() != null) {
          groupId = AlfrescoConversionUtil.getValidIdString(group.getId());
        } else {
          groupId = AlfrescoConversionUtil.getValidIdString(group.getTitle());
        }

        FormSet formSet =
            formConfig
                .getFormAppearance()
                .addFormSet(
                    groupId,
                    getAppearanceForGroup(group),
                    group.getTitle(),
                    getTemplateForGroup(group));

        // Convert all properties
        AlfrescoFormPropertyConverter converter = null;
        for (FormPropertyDefinition property : group.getFormPropertyDefinitions()) {
          converter = propertyConverters.get(property.getClass());
          if (converter == null) {
            throw new AlfrescoSimpleWorkflowException(
                "Unsupported property type: " + property.getClass().getName());
          }
          converter.convertProperty(contentType, formSet.getId(), formConfig, property, conversion);
        }
      }
    }

    // Finally, add "transitions" if not already added
    // TODO: check if added once transitions are supported
    formConfig
        .getFormAppearance()
        .addFormSet(AlfrescoConversionConstants.FORM_SET_RESPONSE, null, null, null);
    formConfig
        .getFormFieldVisibility()
        .addShowFieldElement(AlfrescoConversionConstants.FORM_FIELD_TRANSITIONS);
    formConfig
        .getFormAppearance()
        .addFormField(
            AlfrescoConversionConstants.FORM_FIELD_TRANSITIONS,
            null,
            AlfrescoConversionConstants.FORM_SET_RESPONSE);
  }