...
This method should only be used to check that the inputs are available it should not check the values of inputs because they are not guaranteed to be available at this point during execution. If your component needs resources such as a template file referred to in the action sequence as "new-employee-greeting", you can check that the resource is available by calling isDefinedResource() is called with "new-employee-greeting" )as the argument.
If your component needs an input called 'employee-id', you can check that it has been defined in the action sequence by calling isDefinedInput isDefinedInput() with "employee-id" )as the argument.
If your component needs an output called "employee-greeting-email-text", you can check that it has been defined in the action sequence by calling isDefinedOutput() with "employee-greeting-email-text" )as the argument.
Your validateAction() method would now look like this
...
Notice that we are only checking to see if the input has been defined and we are not trying to get the input value.
The validateAction() of the EmailComponent looks like this:
...
You do not have to call for each individual resource, input, or output. If you prefer, you can work with java.util.Set objects that contain the names of the available items. These sets can be obtained by calling getResourceNames(), getInputNames(), and getOutputNames(). For example
Code Block |
---|
Set inputNames = getInputNames(); if( !inputNames.contains( "param1" ) && !inputNames.contains( "param2" ) ) { error( "I need both param1 and param2" ); return false; } |