protected String getFullQueryPropertyName() { return "obj." + getName(); } }
public String displayHidden(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context) { return (pclass == null) ? "" : pclass.displayHidden(pclass.getName(), prefix, object, context); }
public String displayView(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context) { return (pclass == null) ? "" : pclass.displayView(pclass.getName(), prefix, object, context); }
public String displayEdit(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context) { return (pclass == null) ? "" : pclass.displayEdit(pclass.getName(), prefix, object, context); }
public String displaySearch(PropertyClass pclass, String prefix, XWikiCriteria criteria, XWikiContext context) { return (pclass == null) ? "" : pclass.displaySearch(pclass.getName(), prefix, criteria, context); }
/** * Compares two property definitions based on their index number. * * @param other the other property definition to be compared with * @return a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than * the specified object. * @see #getNumber() * @since 2.4M2 */ public int compareTo(PropertyClass other) { int result = this.getNumber() - other.getNumber(); // This should never happen, but just to remove the randomness in case it does happen, also compare their names. if (result == 0) { result = this.getName().compareTo(other.getName()); } return result; }
/** * Get the names of the class properties that are enabled. * * @return a list of enabled property names * @see #getEnabledProperties() * @see PropertyClass#isDisabled() * @since 2.4M2 */ public List<String> getEnabledPropertyNames() { List<com.xpn.xwiki.objects.classes.PropertyClass> properties = this.getBaseClass().getEnabledProperties(); List<String> result = new ArrayList<String>(properties.size()); for (com.xpn.xwiki.objects.classes.PropertyClass property : properties) { if (property != null) { result.add(property.getName()); } } return result; }
/** * Get the names of the class properties that are disabled. * * @return a list of disabled property names * @see #getDisabledProperties() * @see PropertyClass#isDisabled() * @since 2.4M2 */ public List<String> getDisabledPropertyNames() { List<com.xpn.xwiki.objects.classes.PropertyClass> properties = this.getBaseClass().getDisabledProperties(); List<String> result = new ArrayList<String>(properties.size()); for (com.xpn.xwiki.objects.classes.PropertyClass property : properties) { if (property != null) { result.add(property.getName()); } } return result; }
public String makeQuery(XWikiCriteria query) { List<String> criteriaList = new ArrayList<String>(); for (PropertyClass property : (Collection<PropertyClass>) getFieldList()) { String name = property.getName(); Map<String, Object> map = query.getParameters(getName() + "_" + name); if (map.size() > 0) { property.makeQuery(map, "", query, criteriaList); } } return StringUtils.join(criteriaList.toArray(), " and "); }
/** * Get the list of disabled properties that exist in a given object. This list is a subset of all the disabled * properties in a class, since the object could have been created and stored before some of the class properties * were added. The resulting list is unmodifiable, but the contained elements are live. * * @param object the instance of this class where the disabled properties must exist * @return an unmodifiable list containing the disabled properties of the given object * @see PropertyClass#isDisabled() * @since 2.4M2 */ public List<PropertyClass> getDisabledObjectProperties(BaseObject object) { List<PropertyClass> disabledProperties = getDisabledProperties(); if (disabledProperties == null) { return Collections.emptyList(); } List<PropertyClass> disabledObjectProperties = new ArrayList<PropertyClass>(disabledProperties.size()); for (PropertyClass property : disabledProperties) { try { if (object.get(property.getName()) != null) { disabledObjectProperties.add(property); } } catch (XWikiException ex) { // Not really gonna happen } } return Collections.unmodifiableList(disabledObjectProperties); }
/** * Get the names of the class properties that are disabled, and exist in the given object. This list is a subset of * all the disabled properties in a class, since the object could have been created and stored before some of the * class properties were added. * * @param object the instance of this class where the disabled properties must exist * @return a list of disabled property names * @see #getDisabledObjectProperties(Object) * @see PropertyClass#isDisabled() * @since 2.4M2 */ public List<String> getDisabledObjectPropertyNames(Object object) { List<com.xpn.xwiki.objects.classes.PropertyClass> properties = this.getBaseClass().getDisabledObjectProperties(object.getBaseObject()); List<String> result = new ArrayList<String>(properties.size()); for (com.xpn.xwiki.objects.classes.PropertyClass property : properties) { if (property != null) { result.add(property.getName()); } } return result; }
public String displayRendered(PropertyClass pclass, String prefix, BaseCollection object, XWikiContext context) throws XWikiException { String result = pclass.displayView(pclass.getName(), prefix, object, context); return getRenderedContent(result, Syntax.XWIKI_1_0.toIdString(), context); }
private static com.xpn.xwiki.objects.classes.PropertyClass getPropertyType(com.xpn.xwiki.XWiki xwiki, XWikiContext xwikiContext, com.xpn.xwiki.api.Object object, String propertyName) throws XWikiException { BaseClass c = xwiki.getClass(object.getxWikiClass().getName(), xwikiContext); for (Object o : c.getProperties()) { com.xpn.xwiki.objects.classes.PropertyClass propertyClass = (com.xpn.xwiki.objects.classes.PropertyClass) o; if (propertyClass.getName().equals(propertyName)) { return propertyClass; } } return null; }
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; }
public BaseCollection fromMap(Map<String, ? > map, BaseCollection object) { for (PropertyClass property : (Collection<PropertyClass>) getFieldList()) { String name = property.getName(); Object formvalues = map.get(name); if (formvalues != null) { BaseProperty objprop; if (formvalues instanceof String[]) { objprop = property.fromStringArray(((String[]) formvalues)); } else { objprop = property.fromString(formvalues.toString()); } if (objprop != null) { objprop.setObject(object); object.safeput(name, objprop); } } } return object; }
public Element toXML() { Element pel = new DOMElement(getName()); // Iterate over values sorted by field name so that the values are // exported to XML in a consistent order. Iterator it = getSortedIterator(); while (it.hasNext()) { BaseProperty bprop = (BaseProperty) it.next(); pel.add(bprop.toXML()); } Element el = new DOMElement("classType"); el.addText(getClassType()); pel.add(el); return pel; }
public boolean validateProperty(BaseProperty property, XWikiContext context) { String regexp = getValidationRegExp(); if ((regexp == null) || (regexp.trim().equals(""))) { return true; } String value = ((property == null) || (property.getValue() == null)) ? "" : property.getValue().toString(); try { if (context.getUtil().match(regexp, value)) { return true; } XWikiValidationStatus.addErrorToContext((getObject() == null) ? "" : getObject().getName(), getName(), getTranslatedPrettyName(context), getValidationMessage(), context); return false; } catch (Exception e) { XWikiValidationStatus.addExceptionToContext((getObject() == null) ? "" : getObject().getName(), getName(), e, context); return false; } }
BaseClass oldClass = (BaseClass) oldObject; for (PropertyClass newProperty : (Collection<PropertyClass>) getFieldList()) { String propertyName = newProperty.getName(); PropertyClass oldProperty = (PropertyClass) oldClass.get(propertyName); String propertyType = StringUtils.substringAfterLast(newProperty.getClassType(), "."); String propertyName = oldProperty.getName(); PropertyClass newProperty = (PropertyClass) get(propertyName); String propertyType = StringUtils.substringAfterLast(oldProperty.getClassType(), ".");