Pre-configure wps-js


The wps-js client provides functionalities to pre-configure in-/outputs, including values, formats and whether the in-/output should be requested as reference. The pre-configured properties will be set after the respective process is selected. The pre-confugiration is done via a javascript variable called clientSideDefaultValues. The structure of the underlying json is as follows:

var clientSideDefaultValues = {
	"processIdentifier" : {
		"inputs" : {
			"input-identifier-1" : [
					{
					    "value" : "theValue",
					    "mimeType" : "theMimeType",
					    "schema" : "theSchema",
					    "encoding" : "theEncoding",
					    "hidden" : true,
					    "asReference" : true
					},
					{
					    "value" : "theValue",
					    "mimeType" : "theMimeType",
					} ],
			"input-identifier-2" : [
					{
					    "value" : "theValue",
					}]
		},
		"outputs" : {
			"output-identifier-1" : {
				"mimeType" : "theMimeType",
				"schema" : "theSchema",
				"encoding" : "theEncoding",
				"asReference" : true
			},
			"output-identifier-2" : {
				"mimeType" : "theMimeType",
				"schema" : "theSchema",
				"encoding" : "theEncoding",
				"hidden" : true
			}
		}
	}
};

Pre-configuring inputs

Each input that should be pre-configured needs to be added to the "inputs"-object. As there can be multiple inputs with the same identifier, each input identifier needs an array of json objects assigned as value. For each input the value and format (mime type, schema, encoding) can be pre-configured and whether the input should be requested as reference by the WPS. There is no difference in the structure of the value json object for complex-, literal,- or boundingboxinputs. Literal,- and boundingboxinputs do not need a format specification and they also cannot be requested as reference by the WPS. The respective properties will be ignored. Pre-configured inputs can be hidden, see Hide in-/outputs.

Pre-configuring outputs

The method to pre-configure outputs is mostly analog to pre-configuring inputs. The exception is that for each output there is only one json object as value. Also there is no value-property necessary for outputs. Outputs that appear in the "outputs" object will have the request this output checkbox set to true.

Hide in-/outputs

In-/outputs can be hidden in two ways: Inputs that should not appear later in the client can be left out of the inputs-object. For inputs that should have a preconfigured value but should not appear in the client, the hidden flag can be set. The behavior is analog for outputs.

Example

//array for storing literalvalues, used to obtain the defaultvalues that are defined by the client for this input
var clientSideDefaultValues = {
	"org.n52.wps.server.algorithm.test.MultiReferenceBinaryInputAlgorithm" : {
		"inputs" : {
			"data" : [
			{
			    "value" : "iVBORw0KGgoAAAANSUhEUgAAAeAAAAHgCAMAAABKCk6nAAAAA1BMVEX///+nxBvIAAAA9klEQVR4"
				+ "nO3BAQ0AAADCoPdPbQ8HFAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
				+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
				+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
				+ "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
				+ "AAAAAAAAAAAAAAD8G4YNAAGL73n/AAAAAElFTkSuQmCC",
			    "mimeType" : "image/png",
			    "schema" : "",
			    "encoding" : "base64",
			    "hidden" : true
			},
			{
			    "value" : "http://localhost:8080/testdata/52n346x346-transp.png",
			    "mimeType" : "image/png",
			    "schema" : "",
			    "encoding" : "",
			    "asReference" : true
			} ]
		},
		"outputs" : {
			"result" : {
				"mimeType" : "image/png",
				"schema" : "",
				"encoding" : "base64",
				"asReference" : true
			},
			"result2" : {
				"mimeType" : "image/png",
				"schema" : "",
				"encoding" : "base64",
				"hidden" : true
			}
		}
	}
};

Will result in:
2014-11-06-wps-js.png
Topic revision: r1 - 06 Nov 2014, benjaminpross
Legal Notice | Privacy Statement


This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback