Search in sources :

Example 1 with CamundaFormField

use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField in project camunda-bpmn-model by camunda.

the class CamundaFormFieldImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(CamundaFormField.class, CAMUNDA_ELEMENT_FORM_FIELD).namespaceUri(CAMUNDA_NS).instanceProvider(new ModelTypeInstanceProvider<CamundaFormField>() {

        public CamundaFormField newInstance(ModelTypeInstanceContext instanceContext) {
            return new CamundaFormFieldImpl(instanceContext);
        }
    });
    camundaIdAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_ID).namespace(CAMUNDA_NS).build();
    camundaLabelAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_LABEL).namespace(CAMUNDA_NS).build();
    camundaTypeAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_TYPE).namespace(CAMUNDA_NS).build();
    camundaDatePatternAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DATE_PATTERN).namespace(CAMUNDA_NS).build();
    camundaDefaultValueAttribute = typeBuilder.stringAttribute(CAMUNDA_ATTRIBUTE_DEFAULT_VALUE).namespace(CAMUNDA_NS).build();
    SequenceBuilder sequenceBuilder = typeBuilder.sequence();
    camundaPropertiesChild = sequenceBuilder.element(CamundaProperties.class).build();
    camundaValidationChild = sequenceBuilder.element(CamundaValidation.class).build();
    camundaValueCollection = sequenceBuilder.elementCollection(CamundaValue.class).build();
    typeBuilder.build();
}
Also used : SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) CamundaFormField(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 2 with CamundaFormField

use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField in project camunda-bpmn-model by camunda.

the class CamundaExtensionsTest method testFormData.

@Test
public void testFormData() {
    CamundaFormData formData = userTask.getExtensionElements().getElementsQuery().filterByType(CamundaFormData.class).singleResult();
    CamundaFormField formField = formData.getCamundaFormFields().iterator().next();
    assertThat(formField.getCamundaId()).isEqualTo(TEST_STRING_XML);
    assertThat(formField.getCamundaLabel()).isEqualTo(TEST_STRING_XML);
    assertThat(formField.getCamundaType()).isEqualTo(TEST_STRING_XML);
    assertThat(formField.getCamundaDatePattern()).isEqualTo(TEST_STRING_XML);
    assertThat(formField.getCamundaDefaultValue()).isEqualTo(TEST_STRING_XML);
    formField.setCamundaId(TEST_STRING_API);
    formField.setCamundaLabel(TEST_STRING_API);
    formField.setCamundaType(TEST_STRING_API);
    formField.setCamundaDatePattern(TEST_STRING_API);
    formField.setCamundaDefaultValue(TEST_STRING_API);
    assertThat(formField.getCamundaId()).isEqualTo(TEST_STRING_API);
    assertThat(formField.getCamundaLabel()).isEqualTo(TEST_STRING_API);
    assertThat(formField.getCamundaType()).isEqualTo(TEST_STRING_API);
    assertThat(formField.getCamundaDatePattern()).isEqualTo(TEST_STRING_API);
    assertThat(formField.getCamundaDefaultValue()).isEqualTo(TEST_STRING_API);
    CamundaProperty property = formField.getCamundaProperties().getCamundaProperties().iterator().next();
    assertThat(property.getCamundaId()).isEqualTo(TEST_STRING_XML);
    assertThat(property.getCamundaValue()).isEqualTo(TEST_STRING_XML);
    property.setCamundaId(TEST_STRING_API);
    property.setCamundaValue(TEST_STRING_API);
    assertThat(property.getCamundaId()).isEqualTo(TEST_STRING_API);
    assertThat(property.getCamundaValue()).isEqualTo(TEST_STRING_API);
    CamundaConstraint constraint = formField.getCamundaValidation().getCamundaConstraints().iterator().next();
    assertThat(constraint.getCamundaName()).isEqualTo(TEST_STRING_XML);
    assertThat(constraint.getCamundaConfig()).isEqualTo(TEST_STRING_XML);
    constraint.setCamundaName(TEST_STRING_API);
    constraint.setCamundaConfig(TEST_STRING_API);
    assertThat(constraint.getCamundaName()).isEqualTo(TEST_STRING_API);
    assertThat(constraint.getCamundaConfig()).isEqualTo(TEST_STRING_API);
    CamundaValue value = formField.getCamundaValues().iterator().next();
    assertThat(value.getCamundaId()).isEqualTo(TEST_STRING_XML);
    assertThat(value.getCamundaName()).isEqualTo(TEST_STRING_XML);
    value.setCamundaId(TEST_STRING_API);
    value.setCamundaName(TEST_STRING_API);
    assertThat(value.getCamundaId()).isEqualTo(TEST_STRING_API);
    assertThat(value.getCamundaName()).isEqualTo(TEST_STRING_API);
}
Also used : CamundaFormData(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormData) CamundaProperty(org.camunda.bpm.model.bpmn.instance.camunda.CamundaProperty) CamundaConstraint(org.camunda.bpm.model.bpmn.instance.camunda.CamundaConstraint) CamundaFormField(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField) CamundaValue(org.camunda.bpm.model.bpmn.instance.camunda.CamundaValue) Test(org.junit.Test)

Example 3 with CamundaFormField

use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField in project camunda-bpmn-model by camunda.

the class AbstractStartEventBuilder method camundaFormField.

/**
 * Creates a new camunda form field extension element.
 *
 * @return the builder object
 */
public CamundaStartEventFormFieldBuilder camundaFormField() {
    CamundaFormData camundaFormData = getCreateSingleExtensionElement(CamundaFormData.class);
    CamundaFormField camundaFormField = createChild(camundaFormData, CamundaFormField.class);
    return new CamundaStartEventFormFieldBuilder(modelInstance, element, camundaFormField);
}
Also used : CamundaFormData(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormData) CamundaFormField(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField)

Example 4 with CamundaFormField

use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField in project camunda-bpmn-model by camunda.

the class AbstractUserTaskBuilder method camundaFormField.

/**
 * Creates a new camunda form field extension element.
 *
 * @return the builder object
 */
public CamundaUserTaskFormFieldBuilder camundaFormField() {
    CamundaFormData camundaFormData = getCreateSingleExtensionElement(CamundaFormData.class);
    CamundaFormField camundaFormField = createChild(camundaFormData, CamundaFormField.class);
    return new CamundaUserTaskFormFieldBuilder(modelInstance, element, camundaFormField);
}
Also used : CamundaFormData(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormData) CamundaFormField(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField)

Example 5 with CamundaFormField

use of org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField in project camunda-bpmn-model by camunda.

the class ProcessBuilderTest method assertCamundaFormField.

protected void assertCamundaFormField(BaseElement element) {
    assertThat(element.getExtensionElements()).isNotNull();
    CamundaFormData camundaFormData = element.getExtensionElements().getElementsQuery().filterByType(CamundaFormData.class).singleResult();
    assertThat(camundaFormData).isNotNull();
    List<CamundaFormField> camundaFormFields = new ArrayList<CamundaFormField>(camundaFormData.getCamundaFormFields());
    assertThat(camundaFormFields).hasSize(2);
    CamundaFormField camundaFormField = camundaFormFields.get(0);
    assertThat(camundaFormField.getCamundaId()).isEqualTo("myFormField_1");
    assertThat(camundaFormField.getCamundaLabel()).isEqualTo("Form Field One");
    assertThat(camundaFormField.getCamundaType()).isEqualTo("string");
    assertThat(camundaFormField.getCamundaDefaultValue()).isEqualTo("myDefaultVal_1");
    camundaFormField = camundaFormFields.get(1);
    assertThat(camundaFormField.getCamundaId()).isEqualTo("myFormField_2");
    assertThat(camundaFormField.getCamundaLabel()).isEqualTo("Form Field Two");
    assertThat(camundaFormField.getCamundaType()).isEqualTo("integer");
    assertThat(camundaFormField.getCamundaDefaultValue()).isEqualTo("myDefaultVal_2");
}
Also used : CamundaFormData(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormData) ArrayList(java.util.ArrayList) CamundaFormField(org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField)

Aggregations

CamundaFormField (org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormField)5 CamundaFormData (org.camunda.bpm.model.bpmn.instance.camunda.CamundaFormData)4 ArrayList (java.util.ArrayList)1 CamundaConstraint (org.camunda.bpm.model.bpmn.instance.camunda.CamundaConstraint)1 CamundaProperty (org.camunda.bpm.model.bpmn.instance.camunda.CamundaProperty)1 CamundaValue (org.camunda.bpm.model.bpmn.instance.camunda.CamundaValue)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 SequenceBuilder (org.camunda.bpm.model.xml.type.child.SequenceBuilder)1 Test (org.junit.Test)1