Search in sources :

Example 1 with FormData

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

the class WorkflowFormProcessorTest method processPersist.

private void processPersist(String dataKey, String value) {
    FormData data = new FormData();
    data.addFieldData(dataKey, value);
    WorkflowInstance persistedItem = (WorkflowInstance) processor.persist(item, data);
    assertEquals(newInstance, persistedItem);
}
Also used : FormData(org.alfresco.repo.forms.FormData) WorkflowInstance(org.alfresco.service.cmr.workflow.WorkflowInstance)

Example 2 with FormData

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

the class TaskFormProcessorTest method testPersistPropertyAndTransition.

@SuppressWarnings("unchecked")
public void testPersistPropertyAndTransition() throws Exception {
    FormData data = new FormData();
    data.addFieldData("prop_bpm_foo", "bar");
    String dataKey = makeDataKeyName(TransitionFieldProcessor.KEY);
    data.addFieldData(dataKey, "foo");
    WorkflowTask persistedItem = (WorkflowTask) processor.persist(item, data);
    // make sure task is correct and update and endTask were called
    assertEquals(newTask, persistedItem);
    verify(workflowService, times(1)).updateTask(eq(TASK_ID), anyMap(), anyMap(), anyMap());
    verify(workflowService, times(1)).endTask(TASK_ID, "foo");
}
Also used : FormData(org.alfresco.repo.forms.FormData) WorkflowTask(org.alfresco.service.cmr.workflow.WorkflowTask)

Example 3 with FormData

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

the class WorkflowFormProcessorTest method testGenerateDefaultForm.

public void testGenerateDefaultForm() throws Exception {
    Form form = processForm();
    List<String> fieldDefs = form.getFieldDefinitionNames();
    assertTrue(fieldDefs.contains(ASSIGNEE_NAME.toPrefixString(namespaceService)));
    assertTrue(fieldDefs.contains(PRIORITY_NAME.toPrefixString(namespaceService)));
    assertTrue(fieldDefs.contains(PackageItemsFieldProcessor.KEY));
    // Check 'default ignored fields' are proerly removed from defaults.
    assertFalse(fieldDefs.contains(ACTORS_NAME.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(PROP_PACKAGE_ACTION_GROUP.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(PROP_PACKAGE_ITEM_ACTION_GROUP.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(WorkflowModel.PROP_DESCRIPTION.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(WorkflowModel.PROP_DUE_DATE.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(WorkflowModel.PROP_PRIORITY.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(WorkflowModel.PROP_TASK_ID.toPrefixString(namespaceService)));
    Serializable fieldData = (Serializable) Collections.emptyList();
    FormData formData = form.getFormData();
    assertEquals(fieldData, formData.getFieldData("assoc_bpm_assignee").getValue());
    checkPackageActionGroups(formData);
    assertEquals(2, formData.getFieldData("prop_bpm_workflowPriority").getValue());
}
Also used : FormData(org.alfresco.repo.forms.FormData) Serializable(java.io.Serializable) Form(org.alfresco.repo.forms.Form)

Example 4 with FormData

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

the class TaskFormProcessorTest method processPersist.

private void processPersist(String dataKey, String value) {
    FormData data = new FormData();
    data.addFieldData(dataKey, value);
    WorkflowTask persistedItem = (WorkflowTask) processor.persist(item, data);
    assertEquals(newTask, persistedItem);
}
Also used : FormData(org.alfresco.repo.forms.FormData) WorkflowTask(org.alfresco.service.cmr.workflow.WorkflowTask)

Example 5 with FormData

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

the class TaskFormProcessorTest method testGenerateDefaultForm.

public void testGenerateDefaultForm() throws Exception {
    Form form = processForm();
    List<String> fieldDefs = form.getFieldDefinitionNames();
    assertTrue(fieldDefs.contains(ASSIGNEE_NAME.toPrefixString(namespaceService)));
    assertTrue(fieldDefs.contains(ASSOC_WITH_.toPrefixString(namespaceService)));
    assertTrue(fieldDefs.contains(DESC_NAME.toPrefixString(namespaceService)));
    assertTrue(fieldDefs.contains(STATUS_NAME.toPrefixString(namespaceService)));
    assertTrue(fieldDefs.contains(PROP_WITH_.toPrefixString(namespaceService)));
    assertTrue(fieldDefs.contains(PackageItemsFieldProcessor.KEY));
    assertTrue(fieldDefs.contains(TransitionFieldProcessor.KEY));
    // Check 'default ignored fields' are proerly removed from defaults.
    assertFalse(fieldDefs.contains(ACTORS_NAME.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(PROP_PACKAGE_ACTION_GROUP.toPrefixString(namespaceService)));
    assertFalse(fieldDefs.contains(PROP_PACKAGE_ITEM_ACTION_GROUP.toPrefixString(namespaceService)));
    Serializable fieldData = (Serializable) Arrays.asList(FAKE_NODE.toString());
    FormData formData = form.getFormData();
    assertEquals(fieldData, formData.getFieldData("assoc_bpm_assignee").getValue());
    checkPackageActionGroups(formData);
    assertEquals(WorkflowTaskState.IN_PROGRESS, formData.getFieldData("prop_bpm_status").getValue());
}
Also used : FormData(org.alfresco.repo.forms.FormData) Serializable(java.io.Serializable) Form(org.alfresco.repo.forms.Form)

Aggregations

FormData (org.alfresco.repo.forms.FormData)7 Serializable (java.io.Serializable)2 Form (org.alfresco.repo.forms.Form)2 Item (org.alfresco.repo.forms.Item)2 WorkflowTask (org.alfresco.service.cmr.workflow.WorkflowTask)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 Properties (java.util.Properties)1 NodeRef (org.alfresco.service.cmr.repository.NodeRef)1 WorkflowInstance (org.alfresco.service.cmr.workflow.WorkflowInstance)1