AsnOperationHandler handler = factory.makeOperationHandler(context);
// ensure a valid value if required
AsnValue asnValue = context.getOperation().getValue();
if (asnValue != null) {
AsnValueType asnValueType = asnValue.getValueType();
if (asnValueType != null) {
String val = Val.chkStr(rOptions.getValue());
int maxChars = asnValueType.getMaxCharacters();
if (asnValueType.getRequired() && (val.length() == 0) && (request != null)) {
val = Val.chkStr(this.readInputCharacters(request,maxChars));
if (val.length() == 0) val = null;
rOptions.setValue(val);
}
if ((maxChars >= 0) && (val != null) && (val.length() > maxChars)) {
val = Val.chkStr(val.substring(0,maxChars));
}
if ((val != null) && (val.length() > 0)) {
AsnValueFilter vFilter = asnValueType.makeValueFilter(context);
if (vFilter != null) {
val = Val.chkStr(vFilter.filter(val));
}
}
AsnSupportedValues supported = asnValueType.getSupportedValues();
if (supported != null) {
val = supported.getSupportedValue(val);
if (val != null) {
asnValue.setTextValue(val);
} else {
String msg = "The supplied value is not supported - "+val;
throw new AsnInvalidOperationException(msg);
}
} else {
if ((val != null) && (val.length() == 0)) val = null;
asnValue.setTextValue(val);
if (asnValueType.getRequired() && (val == null)) {
String msg = "A value is required.";
throw new AsnInvalidOperationException(msg);
}
}
}