* index that shows where it is the UICommand component inside a UIData
* @return validation result
*/
private ValidationError processParam(FacesContext context, UIParameter parameter, int rowIndex) {
UIParameterExtension param = (UIParameterExtension) parameter;
UIComponent parent = parameter.getParent();
String parentClientId = parent.getClientId(context);
Map<String, String> requestMap = context.getExternalContext().getRequestParameterMap();
String requestValue = requestMap.get(param.getName());
String realValue;
if (rowIndex < 0) {
// May be -1 when commandLink finds a facet in a table,
// in the footer for example
// In these cases value has been stored in the 0 position
rowIndex = 0;
}
realValue = param.getValue(parentClientId).toString();
if (log.isDebugEnabled()) {
log.debug("requestValue:" + requestValue);
log.debug("realValue:" + realValue);
}
if (requestValue == null) {
ValidationError error = new ValidationError();
error.setErrorKey(HDIVErrorCodes.REQUIRED_PARAMETERS);
error.setErrorParam(param.getId());
error.setErrorValue(requestValue);
error.setErrorComponent(param.getClientId(context));
return error;
}
if (!requestValue.equals(realValue)) {
ValidationError error = new ValidationError();
error.setErrorKey(HDIVErrorCodes.PARAMETER_VALUE_INCORRECT);
error.setErrorParam(param.getId());
error.setErrorValue(requestValue);
error.setErrorComponent(param.getClientId(context));
return error;
}
return null;
}