use of org.xwiki.annotation.rest.model.jaxb.AnnotationField in project xwiki-platform by xwiki.
the class AbstractFormUrlEncodedAnnotationRequestReader method saveField.
/**
* Helper function to save a parameter in the read object. To implement in subclasses to provide type specific
* behaviour.
*
* @param readObject the request to fill with data
* @param key the key of the field
* @param value the value of the field
* @param objectFactory the objects factory to create the annotation fields
* @return true if the field was saved at this level, false otherwise
*/
protected boolean saveField(T readObject, String key, String value, ObjectFactory objectFactory) {
// if the field is a requested field, put it in the requested fields list
if (REQUESTED_FIELD.equals(key)) {
readObject.getRequest().getFields().add(value);
return true;
}
// if the field is a filter field, direct it to the filter fields collection
if (key.startsWith(FILTER_FIELD_PREFIX)) {
AnnotationField filterField = objectFactory.createAnnotationField();
// put only the name of the prop to filter for, not the filter prefix too
filterField.setName(key.substring(FILTER_FIELD_PREFIX.length()));
filterField.setValue(value);
readObject.getFilter().getFields().add(filterField);
return true;
}
return false;
}
Aggregations