Search in sources :

Example 1 with ProcessDescriptionType

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

the class FunctionTableModel method populate.

/**
 * Populate using a custom function.
 *
 * @param selectedFunction the selected function
 */
public void populate(ProcessBriefType selectedFunction) {
    ProcessDescriptionType selectedCustomFunction = (ProcessDescriptionType) selectedFunction;
    this.selectedFunction.setSelectedCustomFunction(selectedCustomFunction);
    valueList = this.selectedFunction.extractParameters();
}
Also used : ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType)

Example 2 with ProcessDescriptionType

use of net.opengis.wps10.ProcessDescriptionType 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 3 with ProcessDescriptionType

use of net.opengis.wps10.ProcessDescriptionType 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<>();
    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.setName(input.getIdentifier().getValue());
            getType(input, value);
            value.setOptional(isOptional(input));
            value.setType(dataTypeMap.get(value.getDataType()));
            value.setMinOccurences(input.getMinOccurs().intValue());
            value.setMaxOccurences(input.getMaxOccurs().intValue());
            valueList.add(value);
        }
    }
    return valueList;
}
Also used : InputDescriptionType(net.opengis.wps10.InputDescriptionType) ArrayList(java.util.ArrayList)

Example 4 with ProcessDescriptionType

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

the class GeoServerWPSClient method getCapabilities.

/**
 * Gets the capabilities.
 *
 * @return returns true if capabilities read, false if error
 */
@SuppressWarnings({ "rawtypes" })
@Override
public boolean getCapabilities() {
    boolean ok = false;
    try {
        processList.clear();
        String connectionString = connection.getUrl().toURI().toASCIIString();
        URL url = new URL(connectionString + WPS_REQUEST_GET_CAPABILITIES);
        WebProcessingService wps = new WebProcessingService(url);
        WPSCapabilitiesType capabilities = wps.getCapabilities();
        ProcessOfferingsType processOfferings = capabilities.getProcessOfferings();
        EList processObjList = processOfferings.getProcess();
        for (Object processObj : processObjList) {
            ProcessBriefTypeImpl process = (ProcessBriefTypeImpl) processObj;
            String functionIdentifier = process.getIdentifier().getValue();
            // create a WebProcessingService as shown above,
            // then do a full describe process on my process
            DescribeProcessRequest descRequest = wps.createDescribeProcessRequest();
            // describe the double addition process
            descRequest.setIdentifier(functionIdentifier);
            // send the request and get the ProcessDescriptionType bean to create a WPSFactory
            DescribeProcessResponse descResponse = wps.issueRequest(descRequest);
            ProcessDescriptionsType processDesc = descResponse.getProcessDesc();
            ProcessDescriptionType pdt = (ProcessDescriptionType) processDesc.getProcessDescription().get(0);
            processList.add(pdt);
        }
        ok = true;
    } catch (URISyntaxException | IOException e) {
        ConsoleManager.getInstance().exception(this, e);
    } catch (ServiceException e) {
        ConsoleManager.getInstance().exception(this, e);
        ConsoleManager.getInstance().error(this, Localisation.getString(GeoServerWPSClient.class, "GeoServerWPSClient.noCapabilities"));
    }
    return ok;
}
Also used : DescribeProcessResponse(org.geotools.data.wps.response.DescribeProcessResponse) URISyntaxException(java.net.URISyntaxException) IOException(java.io.IOException) ProcessOfferingsType(net.opengis.wps10.ProcessOfferingsType) DescribeProcessRequest(org.geotools.data.wps.request.DescribeProcessRequest) URL(java.net.URL) ProcessDescriptionsType(net.opengis.wps10.ProcessDescriptionsType) ProcessBriefTypeImpl(net.opengis.wps10.impl.ProcessBriefTypeImpl) EList(org.eclipse.emf.common.util.EList) WebProcessingService(org.geotools.data.wps.WebProcessingService) ServiceException(org.geotools.ows.ServiceException) ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) WPSCapabilitiesType(net.opengis.wps10.WPSCapabilitiesType)

Example 5 with ProcessDescriptionType

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

the class GeoServerWPSClient method getRenderTransformations.

/**
 * Gets the render transformations.
 *
 * @param typeOfData the type of data
 * @return the render transformations
 */
@Override
public List<ProcessBriefType> getRenderTransformations(DataTypeEnum typeOfData) {
    List<ProcessBriefType> functionList = new ArrayList<>();
    for (ProcessDescriptionType processDescription : processList) {
        ConsoleManager.getInstance().information(this, processDescription.getTitle().getValue());
        boolean outputParameter = getOutputParameter(typeOfData, processDescription.getProcessOutputs());
        boolean inputParameter = true;
        if (inputParameter && outputParameter) {
            functionList.add(processDescription);
        }
    }
    return functionList;
}
Also used : ProcessDescriptionType(net.opengis.wps10.ProcessDescriptionType) ArrayList(java.util.ArrayList) ProcessBriefType(net.opengis.wps10.ProcessBriefType)

Aggregations

ProcessDescriptionType (net.opengis.wps10.ProcessDescriptionType)7 InputDescriptionType (net.opengis.wps10.InputDescriptionType)5 EList (org.eclipse.emf.common.util.EList)5 CodeType (net.opengis.ows11.CodeType)4 DataInputsType (net.opengis.wps10.DataInputsType)4 CustomProcessFunction (com.sldeditor.rendertransformation.CustomProcessFunction)3 ProcessFunctionParameterValue (com.sldeditor.rendertransformation.ProcessFunctionParameterValue)3 LiteralInputType (net.opengis.wps10.LiteralInputType)3 Test (org.junit.jupiter.api.Test)3 ArrayList (java.util.ArrayList)2 DomainMetadataType (net.opengis.ows11.DomainMetadataType)2 SelectedProcessFunction (com.sldeditor.rendertransformation.SelectedProcessFunction)1 IOException (java.io.IOException)1 URISyntaxException (java.net.URISyntaxException)1 URL (java.net.URL)1 AllowedValuesType (net.opengis.ows11.AllowedValuesType)1 LanguageStringType (net.opengis.ows11.LanguageStringType)1 ValueType (net.opengis.ows11.ValueType)1 ProcessBriefType (net.opengis.wps10.ProcessBriefType)1 ProcessDescriptionsType (net.opengis.wps10.ProcessDescriptionsType)1