use of com.xpn.xwiki.web.ObjectAddForm in project xwiki-platform by xwiki.
the class XWikiDocument method addXObjectFromRequest.
/**
* Adds an object from an new object creation form.
*
* @since 2.2M2
*/
public BaseObject addXObjectFromRequest(XWikiContext context) throws XWikiException {
// Read info in object
ObjectAddForm form = new ObjectAddForm();
form.setRequest(context.getRequest());
form.readRequest();
EntityReference classReference = getXClassEntityReferenceResolver().resolve(form.getClassName(), EntityType.DOCUMENT, getDocumentReference());
BaseObject object = newXObject(classReference, context);
BaseClass baseclass = object.getXClass(context);
baseclass.fromMap(form.getObject(LOCAL_REFERENCE_SERIALIZER.serialize(resolveClassReference(classReference))), object);
return object;
}
Aggregations