Search in sources :

Example 1 with Item

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

the class TypeAndAspectsFormProcessor method parseItems.

private void parseItems(Item item) {
    typeItem = null;
    aspectsItems = new ArrayList<String>();
    String id = item.getId();
    List<String> parsedIds = parseIds(id);
    // typeItem
    typeItem = new Item("type", parsedIds.get(0));
    Iterator<String> iterator = parsedIds.iterator();
    iterator.next();
    while (iterator.hasNext()) {
        String nextAspect = iterator.next();
        aspectsItems.add(nextAspect);
    }
}
Also used : Item(org.alfresco.repo.forms.Item)

Example 2 with Item

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

the class WorkflowFormProcessorTest method testGenerateSetsItemAndUrl.

public void testGenerateSetsItemAndUrl() throws Exception {
    Form form = ((WorkflowFormProcessor) processor).generate(item, null, null, null);
    Item formItem = form.getItem();
    assertEquals(item.getId(), formItem.getId());
    assertEquals(item.getKind(), formItem.getKind());
    assertEquals(WF_DEF_NAME, formItem.getType());
    assertEquals("api/workflow-definitions/" + definition.getId(), formItem.getUrl());
}
Also used : Item(org.alfresco.repo.forms.Item) Form(org.alfresco.repo.forms.Form)

Example 3 with Item

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

the class WorkflowFormProcessorTest method setUp.

/*
     * @see junit.framework.TestCase#setUp()
     */
@Override
protected void setUp() throws Exception {
    super.setUp();
    super.item = new Item("workflow", WF_DEF_NAME);
    definition = makeWorkflowDefinition();
    super.workflowService = makeWorkflowService();
    super.nodeService = makeNodeService();
    DictionaryService dictionaryService = makeDictionaryService();
    super.namespaceService = makeNamespaceService();
    MockFieldProcessorRegistry fieldProcessorRegistry = new MockFieldProcessorRegistry(namespaceService, dictionaryService);
    DefaultFieldProcessor defaultProcessor = super.makeDefaultFieldProcessor(dictionaryService);
    super.processor = makeWorkflowFormProcessor(dictionaryService, fieldProcessorRegistry, defaultProcessor);
}
Also used : Item(org.alfresco.repo.forms.Item) MockFieldProcessorRegistry(org.alfresco.repo.forms.processor.node.MockFieldProcessorRegistry) DictionaryService(org.alfresco.service.cmr.dictionary.DictionaryService) DefaultFieldProcessor(org.alfresco.repo.forms.processor.node.DefaultFieldProcessor)

Example 4 with Item

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

the class TaskFormProcessorTest method testGenerateSetsItemAndUrl.

public void testGenerateSetsItemAndUrl() throws Exception {
    Form form = ((TaskFormProcessor) processor).generate(item, null, null, null);
    Item formItem = form.getItem();
    assertEquals(item.getId(), formItem.getId());
    assertEquals(item.getKind(), formItem.getKind());
    String expType = NamespaceService.BPM_MODEL_PREFIX + ":" + TASK_DEF_NAME;
    assertEquals(expType, formItem.getType());
    assertEquals("api/task-instances/" + TASK_ID, formItem.getUrl());
}
Also used : Item(org.alfresco.repo.forms.Item) Form(org.alfresco.repo.forms.Form)

Example 5 with Item

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

the class WorkflowFormProcessorTest method testGetTypedItem.

public void testGetTypedItem() throws Exception {
    try {
        processor.getTypedItem(null);
        fail("Should have thrown an Exception here!");
    } catch (FormNotFoundException e) {
    // Do nothing!
    }
    try {
        processor.getTypedItem(new Item("task", "bad id"));
        fail("Should have thrown an Exception here!");
    } catch (FormNotFoundException e) {
    // Do nothing!
    }
    WorkflowDefinition result = ((WorkflowFormProcessor) processor).getTypedItem(item);
    assertNotNull(result);
    assertEquals(WF_DEF_NAME, result.getName());
}
Also used : Item(org.alfresco.repo.forms.Item) FormNotFoundException(org.alfresco.repo.forms.FormNotFoundException) WorkflowDefinition(org.alfresco.service.cmr.workflow.WorkflowDefinition)

Aggregations

Item (org.alfresco.repo.forms.Item)14 Form (org.alfresco.repo.forms.Form)5 FormNotFoundException (org.alfresco.repo.forms.FormNotFoundException)3 FormData (org.alfresco.repo.forms.FormData)2 DefaultFieldProcessor (org.alfresco.repo.forms.processor.node.DefaultFieldProcessor)2 MockFieldProcessorRegistry (org.alfresco.repo.forms.processor.node.MockFieldProcessorRegistry)2 DictionaryService (org.alfresco.service.cmr.dictionary.DictionaryService)2 BaseAlfrescoSpringTest (org.alfresco.util.BaseAlfrescoSpringTest)2 Test (org.junit.Test)2 File (java.io.File)1 FileInputStream (java.io.FileInputStream)1 InputStream (java.io.InputStream)1 Locale (java.util.Locale)1 Properties (java.util.Properties)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 WorkflowDefinition (org.alfresco.service.cmr.workflow.WorkflowDefinition)1 WorkflowTask (org.alfresco.service.cmr.workflow.WorkflowTask)1