Search in sources :

Example 1 with InputDescriptionType

use of net.opengis.wps10.InputDescriptionType in project sldeditor by robward-scisys.

the class GeoServerWPSClient method getInputParameter.

/**
 * Gets the input parameter.
 *
 * @param typeOfData the type of data
 * @param dataInputs the data inputs
 * @return the input parameter
 */
@SuppressWarnings("unused")
private boolean getInputParameter(DataTypeEnum typeOfData, DataInputsType dataInputs) {
    for (Object dataInput : dataInputs.getInput()) {
        InputDescriptionType input = (InputDescriptionType) dataInput;
        if (input instanceof InputDescriptionType) {
            InputDescriptionType inputDescription = (InputDescriptionType) input;
            LiteralInputType literal = inputDescription.getLiteralData();
            if (literal != null) {
                DomainMetadataType dataType = literal.getDataType();
            // System.out.println(dataType.getValue() + "/" + dataType.getReference());
            } else {
                SupportedCRSsType bbox = inputDescription.getBoundingBoxData();
                if (bbox != null) {
                // System.out.println(bbox);
                } else {
                    SupportedComplexDataType complex = inputDescription.getComplexData();
                    if (complex != null) {
                        ComplexDataCombinationsType parameterDataType = complex.getSupported();
                        if (isGeometry(typeOfData, parameterDataType)) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : DomainMetadataType(net.opengis.ows11.DomainMetadataType) InputDescriptionType(net.opengis.wps10.InputDescriptionType) SupportedCRSsType(net.opengis.wps10.SupportedCRSsType) SupportedComplexDataType(net.opengis.wps10.SupportedComplexDataType) LiteralInputType(net.opengis.wps10.LiteralInputType) ComplexDataCombinationsType(net.opengis.wps10.ComplexDataCombinationsType)

Example 2 with InputDescriptionType

use of net.opengis.wps10.InputDescriptionType in project sldeditor by robward-scisys.

the class SelectedProcessFunctionTest method testSetSelectedCustomFunction.

/**
 * Test method for
 * {@link com.sldeditor.rendertransformation.SelectedProcessFunction#setSelectedCustomFunction(net.opengis.wps10.ProcessDescriptionType)}.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void testSetSelectedCustomFunction() {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    String expectedFunctionName = "JTS:area";
    codeType.setValue(expectedFunctionName);
    process.setIdentifier(codeType);
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(1));
    inputDescription.setMaxOccurs(BigInteger.valueOf(1));
    LiteralInputType literal = Wps10FactoryImpl.init().createLiteralInputType();
    DomainMetadataType domainType = Ows11FactoryImpl.init().createDomainMetadataType();
    domainType.setValue("xs:int");
    literal.setDefaultValue("1234");
    literal.setDataType(domainType);
    inputDescription.setLiteralData(literal);
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    LanguageStringType title = Ows11FactoryImpl.init().createLanguageStringType();
    title.setValue(expectedFunctionName);
    process.setTitle(title);
    SelectedProcessFunction obj = new SelectedProcessFunction();
    obj.setSelectedCustomFunction(process);
    assertFalse(obj.isBuiltInSelected());
    assertTrue(obj.getFunctionName().getLocalPart().compareTo(expectedFunctionName) == 0);
    assertEquals(1, obj.getRowCount());
    assertFalse(obj.extractParameters().isEmpty());
    obj.setSelectedCustomFunction(null);
    assertFalse(obj.isBuiltInSelected());
    assertNull(obj.getFunctionName());
    assertEquals(0, obj.getRowCount());
    assertTrue(obj.extractParameters().isEmpty());
}
Also used : DomainMetadataType(net.opengis.ows11.DomainMetadataType) SelectedProcessFunction(com.sldeditor.rendertransformation.SelectedProcessFunction) InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) LanguageStringType(net.opengis.ows11.LanguageStringType) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) CodeType(net.opengis.ows11.CodeType) LiteralInputType(net.opengis.wps10.LiteralInputType) Test(org.junit.Test)

Example 3 with InputDescriptionType

use of net.opengis.wps10.InputDescriptionType in project sldeditor by robward-scisys.

the class CustomProcessFunction method extractParameters.

/**
 * Extract parameters.
 *
 * @param selectedCustomFunction the selected custom function
 * @return the list
 */
public List<ProcessFunctionParameterValue> extractParameters(ProcessDescriptionType selectedCustomFunction) {
    List<ProcessFunctionParameterValue> valueList = new ArrayList<ProcessFunctionParameterValue>();
    if (dataTypeMap.isEmpty()) {
        populateDataMap();
    }
    if (selectedCustomFunction != null) {
        for (int index = 0; index < selectedCustomFunction.getDataInputs().getInput().size(); index++) {
            InputDescriptionType input = (InputDescriptionType) selectedCustomFunction.getDataInputs().getInput().get(index);
            ProcessFunctionParameterValue value = new ProcessFunctionParameterValue();
            value.name = input.getIdentifier().getValue();
            getType(input, value);
            value.optional = isOptional(input);
            value.type = dataTypeMap.get(value.dataType);
            value.minOccurences = input.getMinOccurs().intValue();
            value.maxOccurences = input.getMaxOccurs().intValue();
            valueList.add(value);
        }
    }
    return valueList;
}
Also used : InputDescriptionType(net.opengis.wps10.InputDescriptionType) ArrayList(java.util.ArrayList)

Example 4 with InputDescriptionType

use of net.opengis.wps10.InputDescriptionType in project sldeditor by robward-scisys.

the class CustomProcessFunctionTest method createProcessDescriptionEnum.

/**
 * Test the process description enumeration values.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void createProcessDescriptionEnum() {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    codeType.setValue("JTS:area");
    process.setIdentifier(codeType);
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(1));
    inputDescription.setMaxOccurs(BigInteger.valueOf(1));
    AllowedValuesType allowedValues = Ows11FactoryImpl.init().createAllowedValuesType();
    EList allowedValueList = allowedValues.getValue();
    ValueType item1 = Ows11FactoryImpl.init().createValueType();
    item1.setValue("item 1");
    allowedValueList.add(item1);
    ValueType item2 = Ows11FactoryImpl.init().createValueType();
    item2.setValue("item 2");
    allowedValueList.add(item2);
    ValueType item3 = Ows11FactoryImpl.init().createValueType();
    item1.setValue("item 3");
    allowedValueList.add(item3);
    LiteralInputType literal = Wps10FactoryImpl.init().createLiteralInputType();
    literal.setAllowedValues(allowedValues);
    inputDescription.setLiteralData(literal);
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    CustomProcessFunction obj = new CustomProcessFunction();
    List<ProcessFunctionParameterValue> valueList = obj.extractParameters(process);
    assertEquals(1, valueList.size());
    ProcessFunctionParameterValue value = valueList.get(0);
    assertEquals(1, value.minOccurences);
    assertEquals(1, value.maxOccurences);
}
Also used : InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) ValueType(net.opengis.ows11.ValueType) AllowedValuesType(net.opengis.ows11.AllowedValuesType) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue) CustomProcessFunction(com.sldeditor.rendertransformation.CustomProcessFunction) CodeType(net.opengis.ows11.CodeType) LiteralInputType(net.opengis.wps10.LiteralInputType) Test(org.junit.Test)

Example 5 with InputDescriptionType

use of net.opengis.wps10.InputDescriptionType in project sldeditor by robward-scisys.

the class CustomProcessFunctionTest method createProcessDescriptionBBox.

/**
 * Test the process description boundaing box values.
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
@Test
public void createProcessDescriptionBBox() {
    ProcessDescriptionType process = Wps10FactoryImpl.init().createProcessDescriptionType();
    CodeType codeType = Ows11FactoryImpl.init().createCodeType();
    codeType.setValue("JTS:area");
    process.setIdentifier(codeType);
    InputDescriptionType inputDescription = Wps10FactoryImpl.init().createInputDescriptionType();
    CodeType codeType2 = Ows11FactoryImpl.init().createCodeType();
    codeType2.setValue("dummyParameter");
    inputDescription.setIdentifier(codeType2);
    inputDescription.setMinOccurs(BigInteger.valueOf(1));
    inputDescription.setMaxOccurs(BigInteger.valueOf(1));
    DataInputsType dataInputs = Wps10FactoryImpl.init().createDataInputsType();
    EList dataInputList = dataInputs.getInput();
    dataInputList.add(inputDescription);
    process.setDataInputs(dataInputs);
    SupportedCRSsType crs = Wps10FactoryImpl.init().createSupportedCRSsType();
    inputDescription.setBoundingBoxData(crs);
    CustomProcessFunction obj = new CustomProcessFunction();
    List<ProcessFunctionParameterValue> valueList = obj.extractParameters(process);
    assertEquals(1, valueList.size());
    ProcessFunctionParameterValue value = valueList.get(0);
    assertEquals(1, value.minOccurences);
    assertEquals(1, value.maxOccurences);
    assertTrue(value.dataType.compareTo("BBOX") == 0);
    SupportedComplexDataInputType complex = Wps10FactoryImpl.init().createSupportedComplexDataInputType();
    inputDescription.setComplexData(complex);
    inputDescription.setBoundingBoxData(null);
    valueList = obj.extractParameters(process);
    assertEquals(1, valueList.size());
    value = valueList.get(0);
    assertEquals(1, value.minOccurences);
    assertEquals(1, value.maxOccurences);
    assertTrue(value.dataType.compareTo("Geometry") == 0);
}
Also used : InputDescriptionType(net.opengis.wps10.InputDescriptionType) EList(org.eclipse.emf.common.util.EList) SupportedCRSsType(net.opengis.wps10.SupportedCRSsType) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) DataInputsType(net.opengis.wps10.DataInputsType) ProcessFunctionParameterValue(com.sldeditor.rendertransformation.ProcessFunctionParameterValue) CustomProcessFunction(com.sldeditor.rendertransformation.CustomProcessFunction) CodeType(net.opengis.ows11.CodeType) SupportedComplexDataInputType(net.opengis.wps10.SupportedComplexDataInputType) Test(org.junit.Test)

Aggregations

InputDescriptionType (net.opengis.wps10.InputDescriptionType)6 CodeType (net.opengis.ows11.CodeType)4 DataInputsType (net.opengis.wps10.DataInputsType)4 LiteralInputType (net.opengis.wps10.LiteralInputType)4 ProcessDescriptionType (net.opengis.wps10.ProcessDescriptionType)4 EList (org.eclipse.emf.common.util.EList)4 CustomProcessFunction (com.sldeditor.rendertransformation.CustomProcessFunction)3 ProcessFunctionParameterValue (com.sldeditor.rendertransformation.ProcessFunctionParameterValue)3 DomainMetadataType (net.opengis.ows11.DomainMetadataType)3 Test (org.junit.Test)3 SupportedCRSsType (net.opengis.wps10.SupportedCRSsType)2 SelectedProcessFunction (com.sldeditor.rendertransformation.SelectedProcessFunction)1 ArrayList (java.util.ArrayList)1 AllowedValuesType (net.opengis.ows11.AllowedValuesType)1 LanguageStringType (net.opengis.ows11.LanguageStringType)1 ValueType (net.opengis.ows11.ValueType)1 ComplexDataCombinationsType (net.opengis.wps10.ComplexDataCombinationsType)1 SupportedComplexDataInputType (net.opengis.wps10.SupportedComplexDataInputType)1 SupportedComplexDataType (net.opengis.wps10.SupportedComplexDataType)1