...
- The attibuteId's should be passed via the options as string key / value pairs
- Have \@Input fields with the same name as the key from the string options
- The custom transformation should implement the interface LocationAttributeValuesProviderConsumer
- Store the LocationAttributeValuesProvider from the setLocationAttributeValuesProvider method as a field
- Get the attribute values from the LocationAttributeValuesProvider via the getXXXValue (single value) or getXXXValues (multivalued) methods
Example config:
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8"?> <transformationModule version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.wldelft.nl/fews" xsi:schemaLocation="http://www.wldelft.nl/fews http://fews.wldelft.nl/schemas/version1.0/transformationModule.xsd"> <variable> <variableId>input</variableId> <timeSeriesSet> <moduleInstanceId>UserDefinedFunctionTest</moduleInstanceId> <valueType>scalar</valueType> <parameterId>Q.m</parameterId> <locationSetId>locationAttributeTest</locationSetId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="day" multiplier="1"/> <relativeViewPeriod unit="day" start="0" end="1"/> <readWriteMode>editing visible to all future task runs</readWriteMode> </timeSeriesSet> </variable> <variable> <variableId>output</variableId> <timeSeriesSet> <moduleInstanceId>UserDefinedFunctionTest</moduleInstanceId> <valueType>scalar</valueType> <parameterId>Q.dis</parameterId> <locationSetId>locationAttributeTest</locationSetId> <timeSeriesType>external historical</timeSeriesType> <timeStep unit="day" multiplier="1"/> <relativeViewPeriod unit="day" start="0" end="1"/> <readWriteMode>editing visible to all future task runs</readWriteMode> </timeSeriesSet> </variable> <transformation id="userDefinedFunctionTestWithLocationAttributes"> <custom> <userDefined> <input> <fieldName>input</fieldName> <inputVariable> <variableId>input</variableId> </inputVariable> </input> <options> <string key="stringAttributeID" value="stringAttributeKey"></string> <string key="booleanAttributeID" value="booleanAttributeKey"></string> <string key="dateTimeAttributeID" value="dateTimeAttributeKey"></string> <string key="doubleAttributeID" value="doubleAttributeKey"></string> </options> <output> <fieldName>output</fieldName> <outputVariable> <variableId>output</variableId> </outputVariable> </output> <className>nl.wldelft.fews.openapi.transformationmodule.CustomTestFunctionWithLocationAttributes</className> </userDefined> </custom> </transformation> </transformationModule> |
...