Search in sources :

Example 21 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project geotoolkit by Geomatys.

the class XMLAdaptor method toWPS2Input.

@Override
public DataInput toWPS2Input(Node candidate) throws UnconvertibleObjectException {
    if (candidate instanceof ReferenceProxy) {
        return super.toWPS2Input(candidate);
    }
    final ComplexData cdt = new ComplexData();
    cdt.getContent().add(new org.geotoolkit.wps.xml.v200.Format(encoding, mimeType, schema, null));
    if (candidate instanceof Document) {
        candidate = ((Document) candidate).getDocumentElement();
    }
    cdt.getContent().add(candidate);
    final Data data = new Data();
    data.getContent().add(cdt);
    final DataInput dit = new DataInput();
    dit.setData(data);
    return dit;
}
Also used : ReferenceProxy(org.geotoolkit.wps.xml.ReferenceProxy) Format(org.geotoolkit.wps.xml.v200.Format) DataInput(org.geotoolkit.wps.xml.v200.DataInput) ComplexData(org.geotoolkit.wps.xml.v200.ComplexData) Data(org.geotoolkit.wps.xml.v200.Data) ComplexData(org.geotoolkit.wps.xml.v200.ComplexData) Document(org.w3c.dom.Document)

Example 22 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project geotoolkit by Geomatys.

the class ComplexAdaptor method toWPS2Input.

/**
 * Convert java object to WPS-2 input.
 *
 * <p>
 * Default implementation of this method only support objects of type Reference.
 * </p>
 *
 * @param candidate
 * @return
 */
@Override
public DataInput toWPS2Input(T candidate) throws UnconvertibleObjectException {
    if (candidate instanceof ReferenceProxy) {
        final Reference reference = ((ReferenceProxy) candidate).getReference();
        final Reference ref;
        if (reference instanceof Reference) {
            ref = (Reference) reference;
        } else {
            ref = new Reference();
            ref.setHref(reference.getHref());
            ref.setEncoding(reference.getEncoding());
            ref.setMimeType(reference.getMimeType());
            ref.setSchema(reference.getSchema());
            ref.setBody(reference.getBody());
        }
        final DataInput dit = new DataInput();
        dit.setReference(ref);
        return dit;
    }
    throw new UnconvertibleObjectException("Unsupported value.");
}
Also used : ReferenceProxy(org.geotoolkit.wps.xml.ReferenceProxy) DataInput(org.geotoolkit.wps.xml.v200.DataInput) UnconvertibleObjectException(org.apache.sis.util.UnconvertibleObjectException) Reference(org.geotoolkit.wps.xml.v200.Reference)

Example 23 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class InitializedVariableTest method testGetDataInput.

@Test
public void testGetDataInput() {
    final String SOURCE_VAR = "BooleanSource";
    final String DATA_INPUT_ID = "_Data-Input-TestInputX";
    final String DATA_INPUT_NAME = "Data Input Test";
    final String DATA_INPUT_ASSOCIATION_ID = "Data Input Test";
    final String DATA_INPUT_ASSOCIATION_VALUE = "BooleanSource";
    final String INIT_INPUT_VAR_ID = "Data-Input-Test";
    final String INIT_INPUT_VAR_TYPE = "Boolean";
    final VariableDeclaration varDeclaration = new VariableDeclaration("Data Input Test", "Boolean");
    InitializedVariable.InitializedInputVariable initializedInputVar = new InitializedVariable.InputVariableReference("", varScope, varDeclaration, SOURCE_VAR, new HashSet<>());
    DataInput dataInput = initializedInputVar.getDataInput();
    DataInputAssociation dataInputAssociation = initializedInputVar.getDataInputAssociation();
    List<ItemAwareElement> sourceRef = dataInputAssociation.getSourceRef();
    PropertyImpl source = (PropertyImpl) sourceRef.get(0);
    DataInput target = (DataInput) dataInputAssociation.getTargetRef();
    String dataInputId = dataInput.getId();
    String dataInputName = dataInput.getName();
    String dataInputAssociationID = target.getName();
    String dataInputAssociationValue = source.getId();
    String initVarID = initializedInputVar.getIdentifier();
    String initVarType = initializedInputVar.getType();
    assertEquals(dataInputId, DATA_INPUT_ID);
    assertEquals(dataInputName, DATA_INPUT_NAME);
    assertEquals(dataInputAssociationID, DATA_INPUT_ASSOCIATION_ID);
    assertEquals(dataInputAssociationValue, DATA_INPUT_ASSOCIATION_VALUE);
    assertEquals(initVarID, INIT_INPUT_VAR_ID);
    assertEquals(initVarType, INIT_INPUT_VAR_TYPE);
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) InitializedVariable(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.InitializedVariable) ItemAwareElement(org.eclipse.bpmn2.ItemAwareElement) VariableDeclaration(org.kie.workbench.common.stunner.bpmn.backend.converters.customproperties.VariableDeclaration) PropertyImpl(org.eclipse.bpmn2.impl.PropertyImpl) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Test(org.junit.Test)

Example 24 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class AssociationsTest method findAssignment.

private String findAssignment(List<DataInputAssociation> associations, String varName) {
    return associations.stream().filter(a -> {
        DataInput in = (DataInput) a.getTargetRef();
        return in.getName().equals(varName);
    }).map(a -> {
        Assignment assignment = a.getAssignment().get(0);
        FormalExpression expr = (FormalExpression) assignment.getFrom();
        return expr.getBody();
    }).findFirst().get();
}
Also used : StartEvent(org.eclipse.bpmn2.StartEvent) FormalExpression(org.eclipse.bpmn2.FormalExpression) FlatVariableScope(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.FlatVariableScope) UserTask(org.kie.workbench.common.stunner.bpmn.definition.UserTask) View(org.kie.workbench.common.stunner.core.graph.content.view.View) HashSet(java.util.HashSet) DataInput(org.eclipse.bpmn2.DataInput) Property(org.eclipse.bpmn2.Property) DefinitionsConverter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.DefinitionsConverter) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Definitions(org.eclipse.bpmn2.Definitions) Ids(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Ids) AssignmentsInfo(org.kie.workbench.common.stunner.bpmn.definition.property.dataio.AssignmentsInfo) Process(org.eclipse.bpmn2.Process) DataInputAssociation(org.eclipse.bpmn2.DataInputAssociation) Factories.bpmn2(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.Factories.bpmn2) Test(org.junit.Test) Metadata(org.kie.workbench.common.stunner.core.diagram.Metadata) List(java.util.List) Graph(org.kie.workbench.common.stunner.core.graph.Graph) Assignment(org.eclipse.bpmn2.Assignment) CatchEventPropertyWriter(org.kie.workbench.common.stunner.bpmn.backend.converters.fromstunner.properties.CatchEventPropertyWriter) BPMNDiagramMarshallerBaseTest(org.kie.workbench.common.stunner.bpmn.backend.service.diagram.marshalling.BPMNDiagramMarshallerBaseTest) Node(org.kie.workbench.common.stunner.core.graph.Node) TestCase.assertEquals(junit.framework.TestCase.assertEquals) DataInput(org.eclipse.bpmn2.DataInput) Assignment(org.eclipse.bpmn2.Assignment) FormalExpression(org.eclipse.bpmn2.FormalExpression)

Example 25 with DataInput

use of org.geotoolkit.wps.xml.v200.DataInput in project kie-wb-common by kiegroup.

the class MultipleInstanceActivityPropertyReaderTest method testGetEmptyDataInput.

@Test
public void testGetEmptyDataInput() {
    DataInput item = mockDataInput(ITEM_ID, null);
    when(miloop.getInputDataItem()).thenReturn(item);
    assertEquals(ITEM_ID + DELIMITER + DATA_TYPE, reader.getDataInput());
}
Also used : DataInput(org.eclipse.bpmn2.DataInput) ActivityPropertyReaderTest.mockDataInput(org.kie.workbench.common.stunner.bpmn.backend.converters.tostunner.properties.ActivityPropertyReaderTest.mockDataInput) Test(org.junit.Test)

Aggregations

DataInput (org.eclipse.bpmn2.DataInput)38 DataInputAssociation (org.eclipse.bpmn2.DataInputAssociation)21 DataInput (org.geotoolkit.wps.xml.v200.DataInput)19 DataOutput (org.eclipse.bpmn2.DataOutput)17 Data (org.geotoolkit.wps.xml.v200.Data)15 FormalExpression (org.eclipse.bpmn2.FormalExpression)14 Test (org.junit.Test)14 ArrayList (java.util.ArrayList)13 DataOutputAssociation (org.eclipse.bpmn2.DataOutputAssociation)12 Assignment (org.eclipse.bpmn2.Assignment)11 ItemAwareElement (org.eclipse.bpmn2.ItemAwareElement)11 List (java.util.List)10 ReferenceProxy (org.geotoolkit.wps.xml.ReferenceProxy)10 Format (org.geotoolkit.wps.xml.v200.Format)10 UnconvertibleObjectException (org.apache.sis.util.UnconvertibleObjectException)9 InputSet (org.eclipse.bpmn2.InputSet)9 InputOutputSpecification (org.eclipse.bpmn2.InputOutputSpecification)8 SimpleFeatureMapEntry (org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry)8 ComplexData (org.geotoolkit.wps.xml.v200.ComplexData)8 IOException (java.io.IOException)6