Search in sources :

Example 6 with TextPropertyDefinition

use of org.activiti.workflow.simple.definition.form.TextPropertyDefinition in project Activiti by Activiti.

the class WorkflowDefinitionConversionTest method testHumanStepBasicFormField.

/**
	 * Test basic form-fields (text, number, date, list, ...)
	 */
@Test
public void testHumanStepBasicFormField() throws Exception {
    // TODO: finish test once all types are present
    WorkflowDefinition definition = new WorkflowDefinition();
    definition.setId("process");
    HumanStepDefinition humanStep = new HumanStepDefinition();
    humanStep.setId("step1");
    FormDefinition form = new FormDefinition();
    humanStep.setForm(form);
    FormPropertyGroup group = new FormPropertyGroup();
    group.setId("group");
    group.setTitle("My group");
    humanStep.getForm().addFormPropertyGroup(group);
    // Add simple text
    TextPropertyDefinition textProperty = new TextPropertyDefinition();
    textProperty.setName("text");
    textProperty.setMandatory(true);
    group.addFormProperty(textProperty);
    definition.addStep(humanStep);
    WorkflowDefinitionConversion conversion = conversionFactory.createWorkflowDefinitionConversion(definition);
    conversion.convert();
    // Check content-model
    M2Model model = AlfrescoConversionUtil.getContentModel(conversion);
    assertNotNull(model);
    M2Type type = model.getTypes().get(0);
    assertNotNull(type);
    // Simple text
    M2Property property = getPropertyFromType("text", type);
    assertEquals("d:text", property.getPropertyType());
    assertEquals(Boolean.TRUE, property.getMandatory().isMandatory());
}
Also used : WorkflowDefinitionConversion(org.activiti.workflow.simple.converter.WorkflowDefinitionConversion) HumanStepDefinition(org.activiti.workflow.simple.definition.HumanStepDefinition) M2Type(org.activiti.workflow.simple.alfresco.model.M2Type) TextPropertyDefinition(org.activiti.workflow.simple.definition.form.TextPropertyDefinition) M2Property(org.activiti.workflow.simple.alfresco.model.M2Property) M2Model(org.activiti.workflow.simple.alfresco.model.M2Model) WorkflowDefinition(org.activiti.workflow.simple.definition.WorkflowDefinition) FormPropertyGroup(org.activiti.workflow.simple.definition.form.FormPropertyGroup) FormDefinition(org.activiti.workflow.simple.definition.form.FormDefinition) Test(org.junit.Test)

Aggregations

TextPropertyDefinition (org.activiti.workflow.simple.definition.form.TextPropertyDefinition)6 FormDefinition (org.activiti.workflow.simple.definition.form.FormDefinition)4 Test (org.junit.Test)4 HumanStepDefinition (org.activiti.workflow.simple.definition.HumanStepDefinition)3 WorkflowDefinition (org.activiti.workflow.simple.definition.WorkflowDefinition)3 M2Model (org.activiti.workflow.simple.alfresco.model.M2Model)2 M2Property (org.activiti.workflow.simple.alfresco.model.M2Property)2 WorkflowDefinitionConversion (org.activiti.workflow.simple.converter.WorkflowDefinitionConversion)2 FormPropertyDefinition (org.activiti.workflow.simple.definition.form.FormPropertyDefinition)2 FormPropertyGroup (org.activiti.workflow.simple.definition.form.FormPropertyGroup)2 ListPropertyDefinition (org.activiti.workflow.simple.definition.form.ListPropertyDefinition)2 ListPropertyEntry (org.activiti.workflow.simple.definition.form.ListPropertyEntry)2 NumberPropertyDefinition (org.activiti.workflow.simple.definition.form.NumberPropertyDefinition)2 CheckBox (com.vaadin.ui.CheckBox)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 OutputStreamWriter (java.io.OutputStreamWriter)1 Writer (java.io.Writer)1 FlowElement (org.activiti.bpmn.model.FlowElement)1 FormProperty (org.activiti.bpmn.model.FormProperty)1 FormValue (org.activiti.bpmn.model.FormValue)1