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;
}
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.");
}
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);
}
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();
}
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());
}
Aggregations