use of com.xpn.xwiki.objects.DBStringListProperty in project xwiki-platform by xwiki.
the class TagPlugin method createTagProperty.
/**
* Create and add the main tag property to the provided tag object. The new property corresponds to the definition
* in the tag class, but in case of an error, the default type is a relational-stored list.
*
* @param tagObject the target tag object
* @param context the current request context
* @return the created property
* @see #TAG_PROPERTY
*/
private BaseProperty createTagProperty(BaseObject tagObject, XWikiContext context) {
BaseProperty tagProperty;
try {
BaseClass tagClass = context.getWiki().getClass(TAG_CLASS, context);
PropertyClass tagPropertyDefinition = (PropertyClass) tagClass.getField(TAG_PROPERTY);
tagProperty = tagPropertyDefinition.newProperty();
} catch (XWikiException ex) {
LOGGER.warn("Failed to properly create tag property for the tag object, creating a default one");
tagProperty = new DBStringListProperty();
}
tagProperty.setName(TAG_PROPERTY);
tagProperty.setObject(tagObject);
tagObject.safeput(TAG_PROPERTY, tagProperty);
return tagProperty;
}
Aggregations