Search in sources :

Example 1 with DomainMetadataType

use of org.geotoolkit.ows.xml.v200.DomainMetadataType 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 DomainMetadataType

use of org.geotoolkit.ows.xml.v200.DomainMetadataType in project sldeditor by robward-scisys.

the class GeoServerWPSClient method getOutputParameter.

/**
 * Gets the input parameter.
 *
 * @param typeOfData the type of data
 * @param dataInputs the data inputs
 * @return the input parameter
 */
/*
        private boolean getInputParameter(DataTypeEnum typeOfData, DataInputsType dataInputs) {
            ConsoleManager.getInstance().information(this,
                    "Inputs");

            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();

                        ConsoleManager.getInstance().information(this,
                                dataType.getValue());
                        } else {
                        SupportedCRSsType bbox = inputDescription.getBoundingBoxData();
                        if (bbox != null) {
                            ConsoleManager.getInstance().information(this,
                                    "BBox");
                        } else {
                            SupportedComplexDataType complex = inputDescription.getComplexData();
                            if (complex != null) {
                                ComplexDataCombinationsType parameterDataType = complex.getSupported();
                                if (isGeometry(typeOfData, parameterDataType)) {
                                    return true;
                                }
                            }
                        }
                    }
                }
            }
            return false;
        }
    */
/**
 * Gets the output parameter.
 *
 * @param typeOfData the type of data
 * @param processOutputs the process outputs
 * @return the output parameter
 */
private boolean getOutputParameter(DataTypeEnum typeOfData, ProcessOutputsType processOutputs) {
    ConsoleManager.getInstance().information(this, "Outputs");
    for (Object o : processOutputs.getOutput()) {
        if (o instanceof OutputDescriptionType) {
            OutputDescriptionType oo = (OutputDescriptionType) o;
            LiteralOutputType literal = oo.getLiteralOutput();
            if (literal != null) {
                DomainMetadataType dataType = literal.getDataType();
                if (dataType != null) {
                    ConsoleManager.getInstance().information(this, dataType.getValue());
                }
            } else {
                SupportedCRSsType bbox = oo.getBoundingBoxOutput();
                if (bbox != null) {
                    ConsoleManager.getInstance().information(this, "BBox");
                } else {
                    SupportedComplexDataType complex = oo.getComplexOutput();
                    if (complex != null) {
                        ComplexDataCombinationsType parameterDataType = complex.getSupported();
                        if (isGeometry(typeOfData, parameterDataType)) {
                            return true;
                        }
                    }
                }
            }
        }
    }
    return false;
}
Also used : DomainMetadataType(net.opengis.ows11.DomainMetadataType) SupportedCRSsType(net.opengis.wps10.SupportedCRSsType) OutputDescriptionType(net.opengis.wps10.OutputDescriptionType) SupportedComplexDataType(net.opengis.wps10.SupportedComplexDataType) LiteralOutputType(net.opengis.wps10.LiteralOutputType) ComplexDataCombinationsType(net.opengis.wps10.ComplexDataCombinationsType)

Example 3 with DomainMetadataType

use of org.geotoolkit.ows.xml.v200.DomainMetadataType 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.jupiter.api.Test)

Example 4 with DomainMetadataType

use of org.geotoolkit.ows.xml.v200.DomainMetadataType in project geotoolkit by Geomatys.

the class LiteralAdaptorTest method stringWPS2.

@Test
public void stringWPS2() {
    final DomainMetadataType metaType = new DomainMetadataType("String", "http://www.w3.org/TR/xmlschema-2/#string");
    final LiteralDataDomain domain = new LiteralDataDomain();
    domain.setDataType(metaType);
    final LiteralAdaptor adaptor = LiteralAdaptor.create(domain);
    assertEquals(String.class, adaptor.getValueClass());
    final DataOutput output = new DataOutput();
    final LiteralValue lit = new LiteralValue();
    lit.setValue("hello world");
    final Data data = new Data(lit);
    output.setData(data);
    final Object result = adaptor.fromWPS2Input(output);
    assertEquals("hello world", result);
}
Also used : DomainMetadataType(org.geotoolkit.ows.xml.v200.DomainMetadataType) DataOutput(org.geotoolkit.wps.xml.v200.DataOutput) LiteralValue(org.geotoolkit.wps.xml.v200.LiteralValue) Data(org.geotoolkit.wps.xml.v200.Data) LiteralDataDomain(org.geotoolkit.wps.xml.v200.LiteralDataDomain) Test(org.junit.Test)

Example 5 with DomainMetadataType

use of org.geotoolkit.ows.xml.v200.DomainMetadataType in project geotoolkit by Geomatys.

the class LiteralAdaptorTest method booleanWPS2.

@Test
public void booleanWPS2() {
    final DomainMetadataType metaType = new DomainMetadataType(null, "xs:boolean");
    final LiteralDataDomain domain = new LiteralDataDomain();
    domain.setDataType(metaType);
    final LiteralAdaptor adaptor = LiteralAdaptor.create(domain);
    assertEquals(Boolean.class, adaptor.getValueClass());
    final DataOutput output = new DataOutput();
    final LiteralValue lit = new LiteralValue();
    lit.setValue("true");
    final Data data = new Data(lit);
    output.setData(data);
    final Object result = adaptor.fromWPS2Input(output);
    assertEquals(true, result);
}
Also used : DomainMetadataType(org.geotoolkit.ows.xml.v200.DomainMetadataType) DataOutput(org.geotoolkit.wps.xml.v200.DataOutput) LiteralValue(org.geotoolkit.wps.xml.v200.LiteralValue) Data(org.geotoolkit.wps.xml.v200.Data) LiteralDataDomain(org.geotoolkit.wps.xml.v200.LiteralDataDomain) Test(org.junit.Test)

Aggregations

DomainMetadataType (net.opengis.ows11.DomainMetadataType)4 InputDescriptionType (net.opengis.wps10.InputDescriptionType)3 LiteralInputType (net.opengis.wps10.LiteralInputType)3 DomainMetadataType (org.geotoolkit.ows.xml.v200.DomainMetadataType)3 Data (org.geotoolkit.wps.xml.v200.Data)3 DataOutput (org.geotoolkit.wps.xml.v200.DataOutput)3 LiteralDataDomain (org.geotoolkit.wps.xml.v200.LiteralDataDomain)3 LiteralValue (org.geotoolkit.wps.xml.v200.LiteralValue)3 Test (org.junit.Test)3 CodeType (net.opengis.ows11.CodeType)2 ComplexDataCombinationsType (net.opengis.wps10.ComplexDataCombinationsType)2 DataInputsType (net.opengis.wps10.DataInputsType)2 ProcessDescriptionType (net.opengis.wps10.ProcessDescriptionType)2 SupportedCRSsType (net.opengis.wps10.SupportedCRSsType)2 SupportedComplexDataType (net.opengis.wps10.SupportedComplexDataType)2 EList (org.eclipse.emf.common.util.EList)2 CustomProcessFunction (com.sldeditor.rendertransformation.CustomProcessFunction)1 ProcessFunctionParameterValue (com.sldeditor.rendertransformation.ProcessFunctionParameterValue)1 SelectedProcessFunction (com.sldeditor.rendertransformation.SelectedProcessFunction)1 LanguageStringType (net.opengis.ows11.LanguageStringType)1