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);
}
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");
}
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());
}
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);
}
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());
}
Aggregations