Search in sources :

Example 6 with StringDataType

use of org.jbpm.process.core.datatype.impl.type.StringDataType in project drools-wb by kiegroup.

the class WorkItemsEditorServiceImpl method convertWorkItemParameters.

private Set<PortableParameterDefinition> convertWorkItemParameters(final Set<ParameterDefinition> parameters) {
    final Set<PortableParameterDefinition> pps = new HashSet<PortableParameterDefinition>();
    for (ParameterDefinition pd : parameters) {
        final DataType pdt = pd.getType();
        PortableParameterDefinition ppd = null;
        if (pdt instanceof BooleanDataType) {
            ppd = new PortableBooleanParameterDefinition();
        } else if (pdt instanceof FloatDataType) {
            ppd = new PortableFloatParameterDefinition();
        } else if (pdt instanceof IntegerDataType) {
            ppd = new PortableIntegerParameterDefinition();
        } else if (pdt instanceof ObjectDataType) {
            ppd = new PortableObjectParameterDefinition();
            final PortableObjectParameterDefinition oppd = (PortableObjectParameterDefinition) ppd;
            final ObjectDataType odt = (ObjectDataType) pdt;
            oppd.setClassName(odt.getClassName());
        } else if (pd.getType() instanceof StringDataType) {
            ppd = new PortableStringParameterDefinition();
        }
        if (ppd != null) {
            ppd.setName(pd.getName());
            pps.add(ppd);
        }
    }
    return pps;
}
Also used : PortableIntegerParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableIntegerParameterDefinition) FloatDataType(org.jbpm.process.core.datatype.impl.type.FloatDataType) PortableFloatParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition) IntegerDataType(org.jbpm.process.core.datatype.impl.type.IntegerDataType) PortableObjectParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableObjectParameterDefinition) PortableParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableParameterDefinition) ObjectDataType(org.jbpm.process.core.datatype.impl.type.ObjectDataType) PortableStringParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableStringParameterDefinition) StringDataType(org.jbpm.process.core.datatype.impl.type.StringDataType) DataType(org.jbpm.process.core.datatype.DataType) StringDataType(org.jbpm.process.core.datatype.impl.type.StringDataType) ObjectDataType(org.jbpm.process.core.datatype.impl.type.ObjectDataType) IntegerDataType(org.jbpm.process.core.datatype.impl.type.IntegerDataType) FloatDataType(org.jbpm.process.core.datatype.impl.type.FloatDataType) BooleanDataType(org.jbpm.process.core.datatype.impl.type.BooleanDataType) PortableBooleanParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition) BooleanDataType(org.jbpm.process.core.datatype.impl.type.BooleanDataType) HashSet(java.util.HashSet) PortableObjectParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableObjectParameterDefinition) ParameterDefinition(org.jbpm.process.core.ParameterDefinition) PortableParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableParameterDefinition) PortableStringParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableStringParameterDefinition) PortableBooleanParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableBooleanParameterDefinition) PortableIntegerParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableIntegerParameterDefinition) PortableFloatParameterDefinition(org.drools.workbench.models.datamodel.workitems.PortableFloatParameterDefinition)

Example 7 with StringDataType

use of org.jbpm.process.core.datatype.impl.type.StringDataType in project kie-wb-common by kiegroup.

the class BpmnProcessDataEventListenerTest method getProcessVariables.

private List<Variable> getProcessVariables() {
    List<Variable> processVariables = new ArrayList<>();
    Variable firstName = new Variable();
    firstName.setName("firstName");
    firstName.setType(new StringDataType());
    processVariables.add(firstName);
    Variable lastName = new Variable();
    lastName.setName("lastName");
    lastName.setType(new StringDataType());
    processVariables.add(lastName);
    Variable address = new Variable();
    address.setName("address");
    address.setType(new StringDataType());
    processVariables.add(address);
    // add first name again (could be a subprocess variable also called firstName
    Variable subprocessFirstName = new Variable();
    subprocessFirstName.setName("firstName");
    subprocessFirstName.setType(new StringDataType());
    processVariables.add(subprocessFirstName);
    return processVariables;
}
Also used : StringDataType(org.jbpm.process.core.datatype.impl.type.StringDataType) Variable(org.jbpm.process.core.context.variable.Variable) ArrayList(java.util.ArrayList)

Example 8 with StringDataType

use of org.jbpm.process.core.datatype.impl.type.StringDataType in project kie-wb-common by kiegroup.

the class WorkItemDefinitionParserTest method init.

@Before
public void init() {
    when(jbpmWorkDefinition.getName()).thenReturn(NAME);
    when(jbpmWorkDefinition.getCategory()).thenReturn(CATWGORY);
    when(jbpmWorkDefinition.getDescription()).thenReturn(DESC);
    when(jbpmWorkDefinition.getDisplayName()).thenReturn(DISPLAY_NAME);
    when(jbpmWorkDefinition.getDocumentation()).thenReturn(DOC);
    when(jbpmWorkDefinition.getDefaultHandler()).thenReturn(HANDLER);
    when(jbpmWorkDefinition.getPath()).thenReturn(PATH);
    when(jbpmWorkDefinition.getIcon()).thenReturn(ICON);
    when(dataUriProvider.apply(eq(ICON_PATH))).thenReturn(ICON_DATA);
    when(param1.getName()).thenReturn("param1");
    when(param1.getType()).thenReturn(new StringDataType());
    when(param2.getName()).thenReturn("param2");
    when(param2.getType()).thenReturn(new StringDataType());
    Set<ParameterDefinition> parameters = new HashSet<ParameterDefinition>(2) {

        {
            add(param1);
            add(param2);
        }
    };
    when(jbpmWorkDefinition.getParameters()).thenReturn(parameters);
}
Also used : StringDataType(org.jbpm.process.core.datatype.impl.type.StringDataType) ParameterDefinition(org.jbpm.process.core.ParameterDefinition) HashSet(java.util.HashSet) Before(org.junit.Before)

Example 9 with StringDataType

use of org.jbpm.process.core.datatype.impl.type.StringDataType in project kie-wb-common by kiegroup.

the class BpmnProcessDataEventListenerTest method getProcessVariables.

private List<Variable> getProcessVariables() {
    List<Variable> processVariables = new ArrayList<>();
    Variable firstName = new Variable();
    firstName.setName("firstName");
    firstName.setType(new StringDataType());
    processVariables.add(firstName);
    Variable lastName = new Variable();
    lastName.setName("lastName");
    lastName.setType(new StringDataType());
    processVariables.add(lastName);
    Variable address = new Variable();
    address.setName("address");
    address.setType(new StringDataType());
    processVariables.add(address);
    // add first name again (could be a subprocess variable also called firstName
    Variable subprocessFirstName = new Variable();
    subprocessFirstName.setName("firstName");
    subprocessFirstName.setType(new StringDataType());
    processVariables.add(subprocessFirstName);
    return processVariables;
}
Also used : StringDataType(org.jbpm.process.core.datatype.impl.type.StringDataType) Variable(org.jbpm.process.core.context.variable.Variable) ArrayList(java.util.ArrayList)

Example 10 with StringDataType

use of org.jbpm.process.core.datatype.impl.type.StringDataType in project jbpm by kiegroup.

the class DefinitionsHandler method setVariableDataType.

private void setVariableDataType(Variable variable, Map<String, ItemDefinition> itemDefinitions, ClassLoader cl) {
    // retrieve type from item definition
    String itemSubjectRef = (String) variable.getMetaData("ItemSubjectRef");
    if (UndefinedDataType.getInstance().equals(variable.getType()) && itemDefinitions != null && itemSubjectRef != null) {
        DataType dataType = new ObjectDataType();
        ItemDefinition itemDefinition = itemDefinitions.get(itemSubjectRef);
        if (itemDefinition != null) {
            String structureRef = itemDefinition.getStructureRef();
            if ("java.lang.Boolean".equals(structureRef) || "Boolean".equals(structureRef)) {
                dataType = new BooleanDataType();
            } else if ("java.lang.Integer".equals(structureRef) || "Integer".equals(structureRef)) {
                dataType = new IntegerDataType();
            } else if ("java.lang.Float".equals(structureRef) || "Float".equals(structureRef)) {
                dataType = new FloatDataType();
            } else if ("java.lang.String".equals(structureRef) || "String".equals(structureRef)) {
                dataType = new StringDataType();
            } else if ("java.lang.Object".equals(structureRef) || "Object".equals(structureRef)) {
                // use FQCN of Object
                dataType = new ObjectDataType("java.lang.Object");
            } else {
                dataType = new ObjectDataType(structureRef, cl);
            }
        }
        variable.setType(dataType);
    }
}
Also used : StringDataType(org.jbpm.process.core.datatype.impl.type.StringDataType) FloatDataType(org.jbpm.process.core.datatype.impl.type.FloatDataType) IntegerDataType(org.jbpm.process.core.datatype.impl.type.IntegerDataType) ItemDefinition(org.jbpm.bpmn2.core.ItemDefinition) ObjectDataType(org.jbpm.process.core.datatype.impl.type.ObjectDataType) IntegerDataType(org.jbpm.process.core.datatype.impl.type.IntegerDataType) UndefinedDataType(org.jbpm.process.core.datatype.impl.type.UndefinedDataType) FloatDataType(org.jbpm.process.core.datatype.impl.type.FloatDataType) DataType(org.jbpm.process.core.datatype.DataType) StringDataType(org.jbpm.process.core.datatype.impl.type.StringDataType) BooleanDataType(org.jbpm.process.core.datatype.impl.type.BooleanDataType) ObjectDataType(org.jbpm.process.core.datatype.impl.type.ObjectDataType) BooleanDataType(org.jbpm.process.core.datatype.impl.type.BooleanDataType)

Aggregations

StringDataType (org.jbpm.process.core.datatype.impl.type.StringDataType)10 IntegerDataType (org.jbpm.process.core.datatype.impl.type.IntegerDataType)7 ObjectDataType (org.jbpm.process.core.datatype.impl.type.ObjectDataType)7 Variable (org.jbpm.process.core.context.variable.Variable)6 ArrayList (java.util.ArrayList)5 HashSet (java.util.HashSet)5 ParameterDefinition (org.jbpm.process.core.ParameterDefinition)5 DataType (org.jbpm.process.core.datatype.DataType)4 BooleanDataType (org.jbpm.process.core.datatype.impl.type.BooleanDataType)4 FloatDataType (org.jbpm.process.core.datatype.impl.type.FloatDataType)4 ItemDefinition (org.jbpm.bpmn2.core.ItemDefinition)3 Work (org.jbpm.process.core.Work)3 ParameterDefinitionImpl (org.jbpm.process.core.impl.ParameterDefinitionImpl)3 WorkImpl (org.jbpm.process.core.impl.WorkImpl)3 RuleFlowProcess (org.jbpm.ruleflow.core.RuleFlowProcess)3 EndNode (org.jbpm.workflow.core.node.EndNode)3 StartNode (org.jbpm.workflow.core.node.StartNode)3 VariableScope (org.jbpm.process.core.context.variable.VariableScope)2 HumanTaskNode (org.jbpm.workflow.core.node.HumanTaskNode)2 WorkItemNode (org.jbpm.workflow.core.node.WorkItemNode)2