Search in sources :

Example 16 with Form

use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.

the class WorkflowFormProcessorTest method testGenerateSingleProperty.

public void testGenerateSingleProperty() {
    // Check Status field is added to Form.
    String fieldName = PRIORITY_NAME.toPrefixString(namespaceService);
    List<String> fields = Arrays.asList(fieldName);
    Form form = processForm(fields);
    checkSingleProperty(form, fieldName, 2);
    // Check Status field is added to Form, when explicitly typed as a
    // property.
    String fullPropertyName = "prop:" + fieldName;
    fields = Arrays.asList(fullPropertyName);
    form = processForm(fields);
    checkSingleProperty(form, fieldName, 2);
    checkPackageActionGroups(form.getFormData());
}
Also used : Form(org.alfresco.repo.forms.Form)

Example 17 with Form

use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.

the class WorkflowFormProcessorTest method testGenerateSingleAssociation.

public void testGenerateSingleAssociation() {
    Serializable values = (Serializable) Collections.emptyList();
    // Check Assignee field is added to Form.
    String fieldName = ASSIGNEE_NAME.toPrefixString(namespaceService);
    List<String> fields = Arrays.asList(fieldName);
    Form form = processForm(fields);
    checkSingleAssociation(form, fieldName, values);
    // Check Assignee field is added to Form, when explicitly typed as an
    // association.
    String fullAssociationName = "assoc:" + fieldName;
    fields = Arrays.asList(fullAssociationName);
    form = processForm(fields);
    checkSingleAssociation(form, fieldName, values);
    checkPackageActionGroups(form.getFormData());
}
Also used : Serializable(java.io.Serializable) Form(org.alfresco.repo.forms.Form)

Example 18 with Form

use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.

the class WorkflowFormProcessorTest method testGeneratePackageItems.

public void testGeneratePackageItems() throws Exception {
    // Check empty package
    String fieldName = PackageItemsFieldProcessor.KEY;
    Form form = processForm(fieldName);
    Serializable packageItems = (Serializable) Collections.emptyList();
    checkSingleAssociation(form, fieldName, packageItems);
}
Also used : Serializable(java.io.Serializable) Form(org.alfresco.repo.forms.Form)

Example 19 with Form

use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.

the class TaskFormProcessorTest method testEscapeMultiValuedProperty.

public void testEscapeMultiValuedProperty() throws Exception {
    try {
        ExtendedPropertyFieldProcessor extendedProcessor = new ExtendedPropertyFieldProcessor();
        extendedProcessor.addEscapedPropertyName(STATUS_NAME);
        processor.setExtendedPropertyFieldProcessor(extendedProcessor);
        // Check Status field is added to Form.
        String fieldName = STATUS_NAME.toPrefixString(namespaceService);
        List<String> fields = Arrays.asList(fieldName);
        Form form = processForm(fields);
        checkSingleProperty(form, fieldName, WorkflowTaskState.IN_PROGRESS);
        // Check Status field is added to Form, when explicitly typed as a
        // property.
        String fullPropertyName = "prop:" + fieldName;
        fields = Arrays.asList(fullPropertyName);
        form = processForm(fields);
        checkSingleProperty(form, fieldName, WorkflowTaskState.IN_PROGRESS);
        checkPackageActionGroups(form.getFormData());
    } finally {
        processor.setExtendedPropertyFieldProcessor(null);
    }
}
Also used : Form(org.alfresco.repo.forms.Form)

Example 20 with Form

use of org.alfresco.repo.forms.Form in project alfresco-repository by Alfresco.

the class TaskFormProcessorTest method testGenerateSingleAssociation.

public void testGenerateSingleAssociation() {
    // Check Assignee field is added to Form.
    String fieldName = ASSIGNEE_NAME.toPrefixString(namespaceService);
    List<String> fields = Arrays.asList(fieldName);
    Form form = processForm(fields);
    Serializable fieldData = (Serializable) Arrays.asList(FAKE_NODE.toString());
    checkSingleAssociation(form, fieldName, fieldData);
    // Check Assignee field is added to Form, when explicitly typed as an
    // association.
    String fullAssociationName = "assoc:" + fieldName;
    fields = Arrays.asList(fullAssociationName);
    form = processForm(fields);
    checkSingleAssociation(form, fieldName, fieldData);
    checkPackageActionGroups(form.getFormData());
}
Also used : Serializable(java.io.Serializable) Form(org.alfresco.repo.forms.Form)

Aggregations

Form (org.alfresco.repo.forms.Form)20 Serializable (java.io.Serializable)7 Item (org.alfresco.repo.forms.Item)5 FormData (org.alfresco.repo.forms.FormData)2 Locale (java.util.Locale)1 AssociationFieldDefinition (org.alfresco.repo.forms.AssociationFieldDefinition)1 FieldDefinition (org.alfresco.repo.forms.FieldDefinition)1 PropertyFieldDefinition (org.alfresco.repo.forms.PropertyFieldDefinition)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 WorkflowTransition (org.alfresco.service.cmr.workflow.WorkflowTransition)1 BaseAlfrescoSpringTest (org.alfresco.util.BaseAlfrescoSpringTest)1 Test (org.junit.Test)1