I currently do very basic Node validation of input. For instance I may have a start date field that I store the value in settings:
// Setting the configuration value directly from JSpinner: configuration.setStartDate((Date)spnStartDate.getValue()); // Retrieving stored value from settings: String sd = settings.getString(CFG_START_DATE,"");
Then in the NodeModel I will validate that there is a value:
// Load settings into Configuration POJO: configuration.load(settings); // Validate value is set: if (configuration.getStartDate() == null ) { throw new InvalidSettingsException("Start Date is required."); }
This works great for typical Node use (i.e. user enters values into the dialog fields), but fails when user uses Flow Variables as the validation fails. User then has to enter a "dummy" value into the dialog field so that dialog will save. The flow variable is still used in the workflow but the user-experience feels clunky then.
I've seen this same issue in other Nodes (so I'm not the only one making this mistake) but I've also seen cases where Nodes seem to handle this better....
So my question - how do I better do validation taking into account either user entered values OR FlowVariables?