Hi,
(Hopefully, I’ve got the nomenclature correct…)
I’m writing an extension that needs to check whether a Document has an xobject attached as that object (of a particular type of xclass) acts as a flag for performing additional functionality that the extension provides.
The extension is currently using an injected reference to the XWikiContext
via a provider…
@Inject
private Provider<XWikiContext> xwikiContextProvider;
…and uses that to access the Document XObjects…
final XWikiContext xwikiContext = xwikiContextProvider.get();
final XWiki wiki = xwikiContext.getWiki();
final XWikiDocument document = wiki.getDocument(docRef, xwikiContext);
final BaseObject object = document.getXObject(FLAG_OBJECT);
FLAG_OBJECT
is a LocalDocumentReference
that refers to the xclass name.
However, this creates a dependency on the oldcore so I was wondering whether there is a new way to do this?
My extension is actually an AuthorizationSettler
so that API gives me EntityReferences. I was wondering whether there’s a way to access xobjects via Document/Entity References? I found documentation on a PageObjectReferenceResolver
but couldn’t quite work out how to use it.
Thanks in advance,
Alex