/** * Retrieves all the XWiki.XWikiUsers who have requested to be notified by changes, i.e. who have an Object of class * WATCHLIST_CLASS attached AND who have chosen the current job for their notifications. * * @return a collection of document names pointing to the XWikiUsers wishing to get notified. */ private Collection<String> getSubscribers() { return this.watchlist.getStore().getSubscribers(this.schedulerJobObject.getName()); }
/** * {@inheritDoc} * * @see com.xpn.xwiki.objects.BaseCollection#hashCode() */ @Override public int hashCode() { String str = getName() + getClassName(); int nb = getNumber(); if (nb > 0) { str += "_" + nb; } return str.hashCode(); }
/** * Compute a cross-document unique {@link com.xpn.xwiki.objects.BaseObject} id, by concatenating its name (it's * document holder full name, such as "SomeSpace.SomeDoc") and it's instance number inside this document. * <p/> * The scheduler uses this unique object id to assure the unicity of jobs * * @return a unique String that can identify the object */ private String getObjectUniqueId(BaseObject object, XWikiContext context) { return context.getDatabase() + ":" + object.getName() + "_" + object.getNumber(); }
/** * Compute a cross-document unique {@link com.xpn.xwiki.objects.BaseObject} id, by concatenating its name (it's * document holder full name, such as "SomeSpace.SomeDoc") and it's instance number inside this document. * <p> * The scheduler uses this unique object id to assure the unicity of jobs * * @return a unique String that can identify the object */ private String getObjectUniqueId(BaseObject object, XWikiContext context) { return getWikiIdPrefix(context.getWikiId()) + object.getName() + "_" + object.getNumber(); }
private void saveStatus(String status, BaseObject object, XWikiContext context) throws XWikiException { XWikiDocument jobHolder = context.getWiki().getDocument(object.getName(), context); // We need to retrieve the object BaseObject the document again. Otherwise, modifications made to the // BaseObject passed as argument will not be saved (XWikiDocument#getObject clones the document // and returns the BaseObject from the clone) // TODO refactor the plugin in order to stop passing BaseObject around, passing document references instead. BaseObject job = jobHolder.getObject(XWIKI_JOB_CLASS); job.setStringValue("status", status); jobHolder.setMinorEdit(true); context.getWiki().saveDocument(jobHolder, context); }
XWikiDocument jobDocument = context.getWiki().getDocument(object.getName(), context); context.setDoc(jobDocument); context.put("sdoc", jobDocument);
public TableDataSource(BaseObject defObject, XWikiContext context) throws DataSourceException { init(defObject.getName(), defObject.getIntValue(TABLE_NUMBER), defObject.getStringValue(RANGE) == "" ? DEFAULT_RANGE : defObject.getStringValue(RANGE), defObject.getIntValue(HAS_HEADER_ROW) == 1, defObject .getIntValue(HAS_HEADER_COLUMN) == 1, defObject.getStringValue(DECIMAL_SYMBOL) == "" ? DEFAULT_DECIMAL_SYMBOL : defObject.getStringValue(DECIMAL_SYMBOL), defObject.getIntValue(IGNORE_ALPHA) == 1, context); }
protected XObject newObject(XObject xObject, BaseObject baseObject, boolean withViewDisplayers, boolean withEditDisplayers, XWikiContext context) xObject.setName(baseObject.getName()); xObject.setNumber(baseObject.getNumber()); xObject.setClassName(baseObject.getClassName());
XWikiDocument jobDocument = getXWikiContext().getWiki().getDocument(object.getName(), getXWikiContext()); getXWikiContext().setDoc(jobDocument); getXWikiContext().put("sdoc", jobDocument);
oel.add(exportProperty("name", getName())); oel.add(exportProperty("number", String.valueOf(getNumber()))); oel.add(exportProperty("className", getClassName()));
try { context.setWikiId(cDb); XWikiDocument jobHolder = context.getWiki().getDocument(job.getName(), context); jobHolder.setMinorEdit(true); context.getWiki().saveDocument(jobHolder, context);