BaseObject object = (BaseObject) queryResult[0]; BaseProperty property = (BaseProperty) queryResult[1]; DocumentReference documentReference = object.getDocumentReference();
@Override public List<WikiComponent> buildComponents(BaseObject baseObject) throws WikiComponentException { try { String id = this.serializer.serialize(baseObject.getDocumentReference()); return Collections .<WikiComponent>singletonList(new PanelWikiUIExtension(baseObject, id, this.componentManager)); } catch (ComponentLookupException e) { throw new WikiComponentException( String.format("Failed to initialize Panel UI extension [%s]", baseObject.getReference()), e); } } }
/** * Sets objects required by the Job : XWiki, XWikiContext, WatchListPlugin, etc. * * @param jobContext Context of the request * @throws Exception when the init of components fails */ public void init(JobExecutionContext jobContext) throws Exception { JobDataMap data = jobContext.getJobDetail().getJobDataMap(); this.watchlist = Utils.getComponent(WatchList.class); this.schedulerJobObject = (BaseObject) data.get("xjob"); this.watchListJobObject = getXWikiContext().getWiki().getDocument(this.schedulerJobObject.getDocumentReference(), getXWikiContext()) .getXObject(WatchListJobClassDocumentInitializer.DOCUMENT_REFERENCE); }
renderGadgetProperty(gadgetTitle, sourceSyntax, xObject.getDocumentReference(), context); List<Block> contentBlocks = renderGadgetProperty(content, sourceSyntax, xObject.getDocumentReference(), context);
private void saveStatus(String status, BaseObject object, XWikiContext context) throws XWikiException { XWikiDocument jobHolder = context.getWiki().getDocument(object.getDocumentReference(), 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.getXObject(XWIKI_JOB_CLASSREFERENCE); job.setStringValue("status", status); jobHolder.setMinorEdit(true); context.getWiki().saveDocument(jobHolder, context); }
public java.lang.Object display(String name, String mode) { try { XWikiDocument doc = getXWikiContext().getWiki().getDocument(getBaseObject().getDocumentReference(), getXWikiContext()); return doc.display(name, mode, this.getBaseObject(), getXWikiContext()); } catch (XWikiException e) { return null; } }
public java.lang.Object get(String name) { try { XWikiDocument doc = getXWikiContext().getWiki().getDocument(getBaseObject().getDocumentReference(), getXWikiContext()); return doc.display(name, this.getBaseObject(), getXWikiContext()); } catch (XWikiException e) { return null; } }
+ this.defaultEntityReferenceSerializer.serialize(obj.getDocumentReference()) + "]", ex); return ""; } finally {
/** * Save the date of the execution in the watchlist job object. * * @throws XWikiException if the job document can't be retrieved or if the save action fails */ private void setPreviousFireTime() throws XWikiException { XWikiDocument doc = getXWikiContext().getWiki().getDocument(this.watchListJobObject.getDocumentReference(), getXWikiContext()); this.watchListJobObject.setDateValue(WatchListJobClassDocumentInitializer.LAST_FIRE_TIME_FIELD, new Date()); // Prevent version changes doc.setMetaDataDirty(false); doc.setContentDirty(false); getXWikiContext().getWiki().saveDocument(doc, "Updated last fire time", true, getXWikiContext()); }
/** * Note: BaseElement.setName() does not support setting reference anymore since 2.4M2. * * {@inheritDoc} * * @deprecated since 2.2M2 use {@link #setDocumentReference(org.xwiki.model.reference.DocumentReference)} */ @Deprecated @Override public void setName(String name) { DocumentReference reference = getDocumentReference(); if (reference != null) { // Make sure to not modify a reference that could comes from somewhere else reference = new DocumentReference(reference); EntityReference relativeReference = this.relativeEntityReferenceResolver.resolve(name, EntityType.DOCUMENT); reference.getLastSpaceReference().setName(relativeReference.extractReference(EntityType.SPACE).getName()); reference.setName(relativeReference.extractReference(EntityType.DOCUMENT).getName()); } else { reference = this.currentMixedDocumentReferenceResolver.resolve(name); } setDocumentReference(reference); }
if (!object.getDocumentReference().equals(doc.getDocumentReference())) { continue; newobject.setId(object.getId()); newobject.setClassName(object.getClassName()); newobject.setDocumentReference(object.getDocumentReference()); newobject.setNumber(object.getNumber()); newobject.setGuid(object.getGuid());
XWikiDocument cDoc = context.getWiki().getDocument(job.getDocumentReference(), context); scontext.setDoc(cDoc); } catch (Exception e) {