Search in sources :

Example 11 with FormFieldControl

use of org.activiti.workflow.simple.alfresco.model.config.FormFieldControl in project Activiti by Activiti.

the class AlfrescoReferencePropertyConverter method addEmailNotificationReference.

protected void addEmailNotificationReference(Form form, String formSet, M2Type type, ReferencePropertyDefinition def) {
    // Only relevant on a start-form
    if (form.isStartForm()) {
        boolean forced = extractBooleanFromParameters(def.getParameters(), AlfrescoConversionConstants.PARAMETER_FORCE_NOTOFICATIONS, false);
        if (forced) {
            // Notifications are needed, add an override to the model
            if (type.getPropertyOverride(AlfrescoConversionConstants.PROPERTY_SEND_EMAIL_NOTIFICATIONS) == null) {
                M2PropertyOverride override = new M2PropertyOverride();
                override.setName(AlfrescoConversionConstants.PROPERTY_SEND_EMAIL_NOTIFICATIONS);
                override.setDefaultValue(Boolean.TRUE.toString());
                type.getPropertyOverrides().add(override);
            }
        } else {
            // Render a control to select whether notifications are needed or not
            form.getFormFieldVisibility().addShowFieldElement(AlfrescoConversionConstants.PROPERTY_SEND_EMAIL_NOTIFICATIONS);
            FormField formField = form.getFormAppearance().addFormField(AlfrescoConversionConstants.PROPERTY_SEND_EMAIL_NOTIFICATIONS, null, formSet);
            formField.setControl(new FormFieldControl(AlfrescoConversionConstants.FORM_EMAIL_NOTIFICATION_TEMPLATE));
            form.getFormAppearance().addFormAppearanceElement(formField);
        }
    }
}
Also used : M2PropertyOverride(org.activiti.workflow.simple.alfresco.model.M2PropertyOverride) FormFieldControl(org.activiti.workflow.simple.alfresco.model.config.FormFieldControl) FormField(org.activiti.workflow.simple.alfresco.model.config.FormField)

Example 12 with FormFieldControl

use of org.activiti.workflow.simple.alfresco.model.config.FormFieldControl in project Activiti by Activiti.

the class AlfrescoReferencePropertyConverter method addAssociation.

protected void addAssociation(Form form, String formSet, ReferencePropertyDefinition referenceDefinition, M2Type contentType, WorkflowDefinitionConversion conversion) {
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    // Check if model contains an aspect for the property
    String propertyName = getPropertyName(referenceDefinition, conversion);
    M2ClassAssociation association = new M2ClassAssociation();
    association.setName(propertyName);
    association.setTitle(referenceDefinition.getName());
    M2AssociationSource source = new M2AssociationSource();
    source.setMany(false);
    source.setMandatory(true);
    M2AssociationTarget target = new M2AssociationTarget();
    target.setClassName(referenceDefinition.getType());
    target.setMandatory(referenceDefinition.isMandatory());
    // Determine whether or not it's allowed to select multiple targets
    boolean isTargetMany = extractBooleanFromParameters(referenceDefinition.getParameters(), AlfrescoConversionConstants.PARAMETER_REFERENCE_MANY, false);
    target.setMany(isTargetMany);
    association.setTarget(target);
    association.setSource(source);
    M2Aspect aspect = model.getAspect(propertyName);
    if (aspect != null) {
        if (aspect.getAssociations().isEmpty()) {
            aspect.getAssociations().add(association);
        }
        contentType.getMandatoryAspects().add(propertyName);
    } else {
        contentType.getAssociations().add(association);
    }
    // Add field to form
    form.getFormFieldVisibility().addShowFieldElement(propertyName);
    FormField field = new FormField();
    form.getFormAppearance().addFormAppearanceElement(field);
    field.setId(propertyName);
    field.setSet(formSet);
    // of the normal document picker, starting from the default location
    if (AlfrescoConversionConstants.CONTENT_TYPE_CONTENT.equals(referenceDefinition.getType())) {
        FormFieldControl control = new FormFieldControl(AlfrescoConversionConstants.FORM_PACKAGE_ITEMS_TEMPLATE);
        control.addControlParameter(AlfrescoConversionConstants.FORM_PACKAGE_ITEMS_PARAM_ROOTNODE, AlfrescoConversionConstants.FORM_PACKAGE_ITEMS_PARAM_ROOTNODE_DEFAULT);
        field.setControl(control);
        // Since we use the "package" template, we need to set the special action-parameters. This might
        // impact the general package actions, but it's the bes we can do without custom coding/template
        addOrAlterPackageItemActions(contentType, true, true);
    }
    // Wire in variable output to process, if needed
    addOutputProperty(referenceDefinition, propertyName, contentType.getName(), conversion);
}
Also used : M2AssociationTarget(org.activiti.workflow.simple.alfresco.model.M2AssociationTarget) FormFieldControl(org.activiti.workflow.simple.alfresco.model.config.FormFieldControl) M2Model(org.activiti.workflow.simple.alfresco.model.M2Model) M2AssociationSource(org.activiti.workflow.simple.alfresco.model.M2AssociationSource) M2Aspect(org.activiti.workflow.simple.alfresco.model.M2Aspect) FormField(org.activiti.workflow.simple.alfresco.model.config.FormField) M2ClassAssociation(org.activiti.workflow.simple.alfresco.model.M2ClassAssociation)

Example 13 with FormFieldControl

use of org.activiti.workflow.simple.alfresco.model.config.FormFieldControl in project Activiti by Activiti.

the class AlfrescoReferencePropertyConverter method addDueDateReference.

protected void addDueDateReference(Form form, String formSet, boolean writable) {
    String fieldName = null;
    if (form.isStartForm()) {
        fieldName = AlfrescoConversionConstants.PROPERTY_WORKFLOW_DUE_DATE;
    } else {
        fieldName = AlfrescoConversionConstants.PROPERTY_DUE_DATE;
    }
    form.getFormFieldVisibility().addShowFieldElement(fieldName);
    FormField formField = form.getFormAppearance().addFormField(fieldName, AlfrescoConversionConstants.FORM_WORKFLOW_DUE_DATE_LABEL, formSet);
    if (form.isStartForm() || writable) {
        formField.setControl(new FormFieldControl(AlfrescoConversionConstants.FORM_DATE_TEMPLATE));
        formField.getControl().getControlParameters().add(new FormFieldControlParameter(AlfrescoConversionConstants.FORM_DATE_PARAM_SHOW_TIME, Boolean.FALSE.toString()));
        formField.getControl().getControlParameters().add(new FormFieldControlParameter(AlfrescoConversionConstants.FORM_DATE_PARAM_SUBMIT_TIME, Boolean.FALSE.toString()));
    } else {
        formField.setControl(new FormFieldControl(AlfrescoConversionConstants.FORM_READONLY_TEMPLATE));
    }
    form.getFormAppearance().addFormAppearanceElement(formField);
}
Also used : FormFieldControl(org.activiti.workflow.simple.alfresco.model.config.FormFieldControl) FormFieldControlParameter(org.activiti.workflow.simple.alfresco.model.config.FormFieldControlParameter) FormField(org.activiti.workflow.simple.alfresco.model.config.FormField)

Example 14 with FormFieldControl

use of org.activiti.workflow.simple.alfresco.model.config.FormFieldControl in project Activiti by Activiti.

the class AlfrescoReferencePropertyConverter method addWorkflowDescriptionReference.

protected void addWorkflowDescriptionReference(Form form, String formSet) {
    String fieldName = null;
    if (form.isStartForm()) {
        fieldName = AlfrescoConversionConstants.PROPERTY_WORKFLOW_DESCRIPTION;
    } else {
        fieldName = AlfrescoConversionConstants.PROPERTY_DESCRIPTION;
    }
    form.getFormFieldVisibility().addShowFieldElement(fieldName);
    FormField descriptionField = new FormField();
    descriptionField.setId(fieldName);
    descriptionField.setLabelId(AlfrescoConversionConstants.FORM_WORKFLOW_DESCRIPTION_LABEL);
    descriptionField.setSet(formSet);
    if (form.isStartForm()) {
        descriptionField.setControl(new FormFieldControl(AlfrescoConversionConstants.FORM_MULTILINE_TEXT_TEMPLATE));
    } else {
        descriptionField.setControl(new FormFieldControl(AlfrescoConversionConstants.FORM_READONLY_TEMPLATE));
    }
    form.getFormAppearance().addFormAppearanceElement(descriptionField);
}
Also used : FormFieldControl(org.activiti.workflow.simple.alfresco.model.config.FormFieldControl) FormField(org.activiti.workflow.simple.alfresco.model.config.FormField)

Aggregations

FormField (org.activiti.workflow.simple.alfresco.model.config.FormField)14 FormFieldControl (org.activiti.workflow.simple.alfresco.model.config.FormFieldControl)14 M2Model (org.activiti.workflow.simple.alfresco.model.M2Model)7 M2Aspect (org.activiti.workflow.simple.alfresco.model.M2Aspect)6 M2Mandatory (org.activiti.workflow.simple.alfresco.model.M2Mandatory)6 M2Property (org.activiti.workflow.simple.alfresco.model.M2Property)6 ArrayList (java.util.ArrayList)2 M2Constraint (org.activiti.workflow.simple.alfresco.model.M2Constraint)2 M2NamedValue (org.activiti.workflow.simple.alfresco.model.M2NamedValue)2 M2PropertyOverride (org.activiti.workflow.simple.alfresco.model.M2PropertyOverride)2 FormFieldControlParameter (org.activiti.workflow.simple.alfresco.model.config.FormFieldControlParameter)2 ListPropertyEntry (org.activiti.workflow.simple.definition.form.ListPropertyEntry)2 AlfrescoSimpleWorkflowException (org.activiti.workflow.simple.alfresco.conversion.exception.AlfrescoSimpleWorkflowException)1 PropertyReference (org.activiti.workflow.simple.alfresco.conversion.script.PropertyReference)1 AlfrescoTransitionsPropertyDefinition (org.activiti.workflow.simple.alfresco.form.AlfrescoTransitionsPropertyDefinition)1 M2AssociationSource (org.activiti.workflow.simple.alfresco.model.M2AssociationSource)1 M2AssociationTarget (org.activiti.workflow.simple.alfresco.model.M2AssociationTarget)1 M2ClassAssociation (org.activiti.workflow.simple.alfresco.model.M2ClassAssociation)1 Form (org.activiti.workflow.simple.alfresco.model.config.Form)1 BooleanPropertyDefinition (org.activiti.workflow.simple.definition.form.BooleanPropertyDefinition)1