use of org.xwiki.model.reference.LocalDocumentReference in project xwiki-platform by xwiki.
the class AbstractDocumentConfigurationSource method getBaseObject.
protected BaseObject getBaseObject() throws XWikiException {
DocumentReference documentReference = getFailsafeDocumentReference();
LocalDocumentReference classReference = getFailsafeClassReference();
if (documentReference != null && classReference != null) {
XWikiContext xcontext = this.xcontextProvider.get();
XWikiDocument document = xcontext.getWiki().getDocument(getDocumentReference(), xcontext);
return document.getXObject(classReference);
}
return null;
}
use of org.xwiki.model.reference.LocalDocumentReference in project xwiki-platform by xwiki.
the class AbstractXWikiPreferencesConfigurationSource method getBaseObject.
protected BaseObject getBaseObject(String language) throws XWikiException {
XWikiContext xcontext = this.xcontextProvider.get();
if (xcontext != null && xcontext.getWiki() != null) {
DocumentReference documentReference = getFailsafeDocumentReference();
LocalDocumentReference classReference = getFailsafeClassReference();
if (documentReference != null && classReference != null) {
XWikiDocument document = xcontext.getWiki().getDocument(getDocumentReference(), xcontext);
return getBaseObject(document, language);
}
}
return null;
}
use of org.xwiki.model.reference.LocalDocumentReference in project xwiki-platform by xwiki.
the class XAROutputFilterStream method beginWikiDocument.
@Override
public void beginWikiDocument(String name, FilterEventParameters parameters) throws FilterException {
this.currentDocument = name;
this.currentDocumentParameters = parameters;
this.currentDocumentReference = new LocalDocumentReference(this.currentDocument, this.currentSpaceReference);
}
use of org.xwiki.model.reference.LocalDocumentReference in project xwiki-platform by xwiki.
the class DocumentLocaleReader method sendBeginWikiDocumentLocale.
private void sendBeginWikiDocumentLocale(XARInputFilter proxyFilter, boolean force) throws FilterException {
if (force || (this.currentDocumentReference != null && this.currentDocumentLocale != null)) {
LocalDocumentReference reference = new LocalDocumentReference(this.currentDocumentReference, this.currentDocumentLocale);
if (this.properties.getEntities() != null && !this.properties.getEntities().matches(reference)) {
throw new SkipEntityException(reference);
}
sendBeginWikiDocument(proxyFilter, force);
if (canSendBeginWikiDocumentLocale(force)) {
if (!this.properties.isWithHistory()) {
this.currentDocumentLocaleParameters.remove(XWikiWikiDocumentFilter.PARAMETER_JRCSREVISIONS);
}
proxyFilter.beginWikiDocumentLocale(this.currentDocumentLocale, this.currentDocumentLocaleParameters);
this.sentBeginWikiDocumentLocale = true;
}
}
}
use of org.xwiki.model.reference.LocalDocumentReference in project xwiki-platform by xwiki.
the class XWikiMessageToolBridgeTest method before.
@Before
public void before() throws Exception {
Locale.setDefault(Locale.ROOT);
// checking
this.preferencesDocumentReference = new DocumentReference(this.oldcore.getXWikiContext().getWikiId(), "XWiki", "XWikiPreferences");
XWikiDocument preferencesDocument = new XWikiDocument(this.preferencesDocumentReference);
BaseObject preferencesObject = new BaseObject();
preferencesObject.setXClassReference(new LocalDocumentReference("XWiki", "XWikiPreferences"));
preferencesDocument.addXObject(preferencesObject);
preferencesDocument.setSyntax(Syntax.PLAIN_1_0);
this.oldcore.getSpyXWiki().saveDocument(preferencesDocument, "", this.oldcore.getXWikiContext());
this.defaultWikiTranslationReference = new DocumentReference(this.oldcore.getXWikiContext().getWikiId(), "XWiki", "Translations");
XWikiDocument defaultWikiTranslation = new XWikiDocument(this.defaultWikiTranslationReference);
defaultWikiTranslation.setSyntax(Syntax.PLAIN_1_0);
this.oldcore.getSpyXWiki().saveDocument(defaultWikiTranslation, "", this.oldcore.getXWikiContext());
// MessageTool
this.tool = new XWikiMessageTool(this.oldcore.getMocker().<ContextualLocalizationManager>getInstance(ContextualLocalizationManager.class));
}
Aggregations