public Object getCustomMappingValue() { return getValue(); } }
public String toText() { Object value = getValue(); return (value == null) ? "" : value.toString(); }
/** * @return The hash algorithm configured for this XProperty. */ public String getHashAlgorithm() { BaseProperty alg = (BaseProperty) this.getField(PasswordMetaClass.ALGORITHM_KEY); if (alg != null && alg.getValue() != null && !alg.getValue().toString().trim().equals("")) { return alg.getValue().toString(); } return DEFAULT_HASH_ALGORITHM; }
/** * @return The encryption algorithm configured for this XProperty. */ public String getCryptAlgorithm() { BaseProperty alg = (BaseProperty) this.getField(PasswordMetaClass.ALGORITHM_KEY); if (alg != null && alg.getValue() != null && !alg.getValue().toString().trim().equals("")) { return alg.getValue().toString(); } return DEFAULT_CRYPT_ALGORITHM; }
public List<String> getTagsList(XWikiContext context) { List<String> tagList = null; BaseProperty prop = getTagProperty(context); if (prop != null) { tagList = (List<String>) prop.getValue(); } return tagList; }
/** * @return One of 'Clear', 'Hash' or 'Encrypt'. */ public String getStorageType() { BaseProperty st = (BaseProperty) this.getField("storageType"); if (st != null) { String type = st.getValue().toString().trim(); if (!type.equals("")) { return type; } } return DEFAULT_STORAGE; }
private void getObjectContentAsText(StringBuilder contentText, BaseObject baseObject, String property, XWikiContext context) { BaseProperty baseProperty = (BaseProperty) baseObject.getField(property); // FIXME Can baseProperty really be null? if (baseProperty != null && baseProperty.getValue() != null) { if (!(baseObject.getXClass(context).getField(property) instanceof PasswordClass)) { contentText.append(StringUtils.lowerCase(baseProperty.getValue().toString())); } } }
@Override public void write(BaseProperty xclassProperty, Object filter, BasePropertyFilter propertyFilter, DocumentInstanceInputProperties properties) throws WikiStreamException { // * WikiObjectProperty propertyFilter.onWikiObjectProperty(xclassProperty.getName(), xclassProperty.getValue(), FilterEventParameters.EMPTY); } }
public java.lang.Object getValue(String fieldName, Object object) { if (object != null) { try { return ((BaseProperty) object.getBaseObject().safeget(fieldName)).getValue(); } catch (NullPointerException e) { return null; } } return null; }
/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.PropertyInterface#toXML() */ public Element toXML() { Element el = new DOMElement(getName()); Object value = getValue(); el.setText((value == null) ? "" : value.toString()); return el; }
protected Object getBaseProperty(String propertyName, String language, boolean text) throws XWikiException { // First we try to get a translated preference object BaseObject baseObject = getBaseObject(language); if (baseObject != null) { BaseProperty property = (BaseProperty) baseObject.getField(propertyName); return property != null ? (text ? property.toText() : property.getValue()) : null; } return null; }
@Override public void fromSearchMap(XWikiQuery query, Map<String, String[]> map) { String[] data = map.get(""); if (data != null) { Number[] data2 = new Number[data.length]; for (int i = 0; i < data.length; i++) { data2[i] = (Number) fromString(data[i]).getValue(); } query.setParam(getObject().getName() + "_" + getName(), data2); } } }
private List<String> getTagsFromDocument(String documentId) throws XWikiException { XWikiDocument document = Utils.getXWiki(componentManager).getDocument(documentId, Utils.getXWikiContext(componentManager)); BaseObject object = document.getObject("XWiki.TagClass"); if (object != null) { BaseProperty prop = (BaseProperty) object.safeget("tags"); if (prop != null) { return (List<String>) prop.getValue(); } } return new ArrayList<String>(); } }
protected Object getBaseProperty(String propertyName, boolean text) throws XWikiException { BaseObject baseObject = getBaseObject(); if (baseObject != null) { BaseProperty property = (BaseProperty) baseObject.getField(propertyName); Object value = property != null ? (text ? property.toText() : property.getValue()) : null; // TODO: In the future we would need the notion of initialized/not-initialized property values in the wiki. // When this is implemented modify the code below. if (isEmpty(value)) { value = null; } return value; } return null; }
@Override public void fromSearchMap(XWikiQuery query, Map<String, String[]> map) { String[] data = map.get(""); if ((data != null) && (data.length == 1)) { query.setParam(getObject().getName() + "_" + getName(), fromString(data[0]).getValue()); } else { data = map.get("lessthan"); if ((data != null) && (data.length == 1)) { query.setParam(getObject().getName() + "_" + getName() + "_lessthan", fromString(data[0]).getValue()); } data = map.get("morethan"); if ((data != null) && (data.length == 1)) { query.setParam(getObject().getName() + "_" + getName() + "_morethan", fromString(data[0]).getValue()); } } } }
/** * @return the actual value of the property, as a String, Number or List. */ public java.lang.Object getValue() { // This is evil, any property which happens to be called 'password' will be masked. TODO fix. if (element.getName().equals("password") && !getXWikiContext().getWiki().getRightService().hasProgrammingRights( getXWikiContext())) { return null; } return ((BaseProperty) element).getValue(); } }
/** * {@inheritDoc} * * @see DocumentAccessBridge#getProperty(String, String, int, String) */ public Object getProperty(String documentReference, String className, int objectNumber, String propertyName) { try { XWikiContext xcontext = getContext(); return ((BaseProperty) xcontext.getWiki().getDocument(documentReference, xcontext).getObject(className, objectNumber).get(propertyName)).getValue(); } catch (Exception ex) { return null; } }
/** * {@inheritDoc} * * @see DocumentAccessBridge#getProperty(String, String) */ public Object getProperty(String documentReference, String propertyName) { try { XWikiContext xcontext = getContext(); return ((BaseProperty) xcontext.getWiki().getDocument(documentReference, xcontext).getFirstObject( propertyName, xcontext).get(propertyName)).getValue(); } catch (Exception ex) { return null; } }