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