public BaseObject getFirstObject(String fieldname, XWikiContext context) { Collection<List<BaseObject>> objectscoll = getXObjects().values(); if (objectscoll == null) { return null; } for (List<BaseObject> objects : objectscoll) { for (BaseObject obj : objects) { if (obj != null) { BaseClass bclass = obj.getXClass(context); if (bclass != null) { Set<String> set = bclass.getPropertyList(); if ((set != null) && set.contains(fieldname)) { return obj; } } Set<String> set = obj.getPropertyList(); if ((set != null) && set.contains(fieldname)) { return obj; } } } } return null; }
/** * {@inheritDoc} * <p> * This insures natural ordering between properties. * * @see com.xpn.xwiki.objects.BaseCollection#addField(java.lang.String, com.xpn.xwiki.objects.PropertyInterface) */ @Override public void addField(String name, PropertyInterface element) { Set<String> properties = getPropertyList(); if (!properties.contains(name)) { if (((BaseCollection) element).getNumber() == 0) { ((BaseCollection) element).setNumber(properties.size() + 1); } } super.addField(name, element); }
if (bclass.getPropertyList().size() == 0) { return ""; result.append("{table}\n"); boolean first = true; for (String propertyName : bclass.getPropertyList()) { if (first == true) { first = false; if (object != null) { first = true; for (String propertyName : bclass.getPropertyList()) { if (first == true) { first = false;
if (bclass.getPropertyList().size() == 0) { return ""; for (String propertyName : bclass.getPropertyList()) { PropertyClass pclass = (PropertyClass) bclass.getField(propertyName); vcontext.put(pclass.getName(), pclass.getPrettyName()); BaseObject object = objects.get(i); if (object != null) { for (String name : bclass.getPropertyList()) { vcontext.put(name, display(name, object, context));
public XWikiQuery(XWikiRequest request, String className, XWikiContext context) throws XWikiException { super(); String[] columns = request.getParameterValues(className + "_" + "searchcolumns"); setDisplayProperties(columns); String[] order = request.getParameterValues(className + "_" + "searchorder"); setOrderProperties(order); BaseClass bclass = context.getWiki().getDocument(className, context).getxWikiClass(); Set<String> properties = bclass.getPropertyList(); Iterator<String> propid = properties.iterator(); while (propid.hasNext()) { String propname = (String) propid.next(); Map<String, String[]> map = Util.getObject(request, className + "_" + propname); ((PropertyClass) (bclass.get(propname))).fromSearchMap(this, map); } }
@Override public void onEvent(Event event, Object source, Object data) { XWikiContext context = (XWikiContext) data; XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference(doc.getDocumentReference().getRoot().getName(), PHENOTIPS_CODE_SPACE, "PatientClass")); if (patientRecordObj == null) { return; } BaseClass patientRecordClass = patientRecordObj.getXClass(context); for (String targetPropertyName : patientRecordClass.getPropertyList()) { if (!targetPropertyName.contains("phenotype")) { continue; } for (String phenotype : (List<String>) patientRecordObj.getListValue(targetPropertyName)) { if (!phenotype.matches("HP:[0-9]+")) { List<String> category = getParameter(targetPropertyName + "__" + phenotype.replaceAll("[^a-zA-Z0-9_]+", "_") + "__category", patientRecordObj.getNumber()); if (category != null && !category.isEmpty()) { storeCategory(phenotype, category, targetPropertyName, doc, context); } } } } }
for (String targetPropertyName : patientRecordClass.getPropertyList()) { if (!targetPropertyName.contains("phenotype")) { continue;
for (String targetPropertyName : patientRecordClass.getPropertyList()) { if (!targetPropertyName.contains("phenotype")) { continue;
@Override public void onEvent(Event event, Object source, Object data) { XWikiContext context = (XWikiContext) data; XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(new DocumentReference(doc.getDocumentReference().getWikiReference().getName(), Constants.CODE_SPACE, "PatientClass")); if (patientRecordObj == null) { return; } BaseClass patientRecordClass = patientRecordObj.getXClass(context); for (String targetPropertyName : patientRecordClass.getPropertyList()) { if (!targetPropertyName.contains("phenotype")) { continue; } @SuppressWarnings("unchecked") List<String> phenotypes = patientRecordObj.getListValue(targetPropertyName); for (String phenotype : phenotypes) { if (!phenotype.matches("HP:[0-9]+")) { List<String> category = getParameter(targetPropertyName + "__" + phenotype.replaceAll("[^a-zA-Z0-9_]+", "_") + "__category", patientRecordObj.getNumber()); if (category != null && !category.isEmpty()) { storeCategory(phenotype, category, targetPropertyName, doc, context); } } } } }