use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class StringClass method fromString.
@Override
public BaseProperty fromString(String value) {
BaseProperty property = newProperty();
property.setValue(value);
return property;
}
use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class UsersClass method fromStringArray.
@Override
public BaseProperty fromStringArray(String[] strings) {
List<String> list = new ArrayList<>();
for (int i = 0; i < strings.length; i++) {
if (!StringUtils.isBlank(strings[i])) {
list.add(strings[i]);
}
}
BaseProperty prop = newProperty();
prop.setValue(StringUtils.join(list, ','));
return prop;
}
use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class UsersClass method newProperty.
@Override
public BaseProperty newProperty() {
BaseProperty property = new LargeStringProperty();
property.setName(getName());
return property;
}
use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class BaseClass method fromValueMap.
public BaseCollection fromValueMap(Map<String, ?> map, BaseCollection object) {
for (PropertyClass property : (Collection<PropertyClass>) getFieldList()) {
String name = property.getName();
Object formvalue = map.get(name);
if (formvalue != null) {
BaseProperty objprop;
objprop = property.fromValue(formvalue);
if (objprop != null) {
objprop.setObject(object);
object.safeput(name, objprop);
}
}
}
return object;
}
use of com.xpn.xwiki.objects.BaseProperty in project xwiki-platform by xwiki.
the class BaseClass method validateObject.
public boolean validateObject(BaseObject obj, XWikiContext context) throws XWikiException {
boolean isValid = true;
Object[] props = getPropertyNames();
for (Object prop : props) {
String propname = (String) prop;
BaseProperty property = (BaseProperty) obj.get(propname);
PropertyClass propclass = (PropertyClass) get(propname);
isValid &= propclass.validateProperty(property, context);
}
String validSript = getValidationScript();
if ((validSript != null) && (!validSript.trim().equals(""))) {
isValid &= executeValidationScript(obj, validSript, context);
}
return isValid;
}
Aggregations