/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.BaseProperty#getValue() */ @Override public Object getValue() { return getList(); }
/** * Constructor that copies the data from an XProperty value. * * @param property the disorder XProperty * @param value the specific value from the property represented by this object * @throws IllegalArgumentException if one of the arguments is {@code null} or otherwise malformed for the ontology */ public PhenoTipsDisorder(ListProperty property, String value) { super((value != null && StringUtils.equals(property.getName(), "omim_id") && OMIM_TERM_PATTERN.matcher( value).matches()) ? MIM_PREFIX + value : value); }
public void setSetValue(String name, Set< ? > value) { ListProperty property = new ListProperty(); property.setValue(value); safeput(name, property); }
/** * {@inheritDoc} * <p> * This is important.. Otherwise we can get a stackoverflow calling toXML() * * @see com.xpn.xwiki.objects.BaseProperty#toString() */ @Override public String toString() { if ((getList() instanceof PersistentCollection) && (!((PersistentCollection) getList()).wasInitialized())) { return ""; } return toXMLString(); } }
/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.BaseProperty#clone() */ @Override public Object clone() { ListProperty property = (ListProperty) super.clone(); List<String> list = new ArrayList<String>(); for (String entry : getList()) { list.add(entry); } property.setValue(list); return property; }
/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.BaseProperty#toXML() */ @Override public Element toXML() { Element el = new DOMElement(getName()); List<String> list = getList(); for (String value : list) { if (value != null) { Element vel = new DOMElement("value"); vel.setText(value); el.add(vel); } } return el; }
/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.BaseProperty#setValue(java.lang.Object) */ @Override public void setValue(Object value) { this.setList((List<String>) value); }
public Set< ? > getSetValue(String name) { ListProperty prop = (ListProperty) safeget(name); if (prop == null) { return new HashSet<Object>(); } else { return new HashSet<Object>((Collection< ? >) prop.getValue()); } }
public void setStringListValue(String name, List value) { ListProperty property = (ListProperty) safeget(name); if (property == null) { property = new StringListProperty(); } property.setValue(value); safeput(name, property); }
public String getTextValue() { return toFormString(); }
public String getTags(XWikiContext context) { ListProperty prop = (ListProperty) getTagProperty(context); return prop != null ? prop.getTextValue() : ""; }
@Override public BaseProperty fromStringArray(String[] strings) { if (!isMultiSelect()) { return fromString(strings[0]); } BaseProperty prop = newProperty(); if (prop instanceof StringProperty) { return fromString(strings[0]); } List<String> list = new ArrayList<String>(); ((ListProperty) prop).setList(list); if (strings.length == 0) { return prop; } if ((strings.length == 1) && (getDisplayType().equals("input") || isMultiSelect())) { ((ListProperty) prop).setList(getListFromString(strings[0], getSeparators(), false)); return prop; } // If Multiselect and multiple results for (int i = 0; i < strings.length; i++) { String item = strings[i]; if (!item.trim().equals("")) { list.add(item); } } return prop; }
public List getListValue(String name) { ListProperty prop = (ListProperty) safeget(name); if (prop == null) { return new ArrayList(); } else { return (List) prop.getValue(); } }
public void setDBStringListValue(String name, List value) { ListProperty property = (ListProperty) safeget(name); if (property == null) { property = new DBStringListProperty(); } property.setValue(value); safeput(name, property); }
/** * Constructor that copies the data from an XProperty value. * * @param property the disorder XProperty * @param value the specific value from the property represented by this object * @throws IllegalArgumentException if one of the arguments is {@code null} or otherwise malformed for the ontology */ public PhenoTipsDisorder(ListProperty property, String value) { super((value != null && StringUtils.equals(property.getName(), "omim_id") && OMIM_TERM_PATTERN.matcher( value).matches()) ? MIM_PREFIX + value : value); }
@Override public BaseProperty fromString(String value) { BaseProperty prop = newProperty(); if (isMultiSelect()) { ((ListProperty) prop).setList(getListFromString(value, getSeparators(), false)); } else { prop.setValue(value); } return prop; }
/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.BaseProperty#toFormString() */ @Override public String toFormString() { CharacterFilter filter = new CharacterFilter(); filter.addAttribute(this.formStringSeparator, "\\" + this.formStringSeparator); List<String> list = getList(); Iterator<String> it = list.iterator(); if (!it.hasNext()) { return ""; } StringBuffer result = new StringBuffer(); result.append(it.next()); while (it.hasNext()) { result.append(this.formStringSeparator); result.append(filter.process(it.next())); } return result.toString(); }
this.propertyName = property.getName(); Matcher nameMatch = NEGATIVE_PREFIX.matcher(this.propertyName); this.present = !nameMatch.lookingAt();
@Override public void displayView(StringBuffer buffer, String name, String prefix, BaseCollection object, XWikiContext context) { List<String> selectlist; BaseProperty prop = (BaseProperty) object.safeget(name); if (prop == null) { selectlist = new ArrayList<String>(); } else if (prop instanceof ListProperty) { selectlist = ((ListProperty) prop).getList(); } else { selectlist = new ArrayList<String>(); selectlist.add(String.valueOf(prop.getValue())); } String result = displayFlatView(selectlist, context); if (result.equals("")) { super.displayView(buffer, name, prefix, object, context); } else { buffer.append(result); } }