public String display(String prop, String mode) { if ("edit".equals(mode) || "editnopre".equals(mode)) { return docApi.display(prop, mode); } else { return get(prop); } }
public List getLastModifications(XWikiContext context) throws XWikiException { String key = this.doc.getSpace() + "-lastmodifications"; ArrayList<Modification> list = null; this.plugin.getProjectManager().initProjectsCache(context); XWikiCache projectCache = this.plugin.getProjectManager().getProjectsCache(); synchronized (key) { try { list = (ArrayList<Modification>) projectCache.getFromCache(key); } catch (XWikiCacheNeedsRefreshException e) { projectCache.cancelUpdate(key); list = new ArrayList<Modification>(); String hql = " where doc.web='" + doc.getSpace() + "' and doc.name != 'WebPreferences'" + "order by doc.date desc"; List docList = context.getWiki().getStore().searchDocumentsNames(hql, context); for (Iterator i = docList.iterator(); i.hasNext();) { String modName = (String) i.next(); XWikiDocument modDoc = context.getWiki().getDocument(modName, context); Date date = modDoc.getDate(); list.add(new Modification(modDoc.getFullName(), modDoc.getDisplayTitle(context), modDoc.getComment(), date, this.doc.display("name", "view"))); } projectCache.putInCache(key, list); } } return list; }
/** * Retrieves the value of a string property. */ protected String getStringValue(String mapping, Document doc, XWikiContext context) throws XWikiException { PropertySelector ps = new PropertySelector(mapping); if (ps.getClassName() == null) { return doc.display(ps.getPropertyName()); } else { XWikiDocument xdoc = context.getWiki().getDocument(doc.getFullName(), context); return xdoc.getObject(ps.getClassName(), ps.getObjectIndex()).getStringValue(ps.getPropertyName()); } }