Hi Giordano.
Is it possible for you to modify your method to have a list of spaces
instead of the space name? Or better: having a DocumentReference as input?
If not, it means that you need to parse your "wikiSpace" input, get the
list of spaces from it, and then create a clean DocumentReference.
You should use a SpaceReferenceResolver to get a clean space reference.
Example:
@Inject
@Named("current")
private SpaceReferenceResolver<String> spaceReferenceResolver;
public void myMethod(String wikiName, String wikiSpace, String wikiPage) {
// resolve the spaces:
SpaceReference spaceRef = spaceReferenceResolver.resolve(wikiSpace, new
WikiReference(wikiName));
// Create a clean DocumentReference:
DocumentReference docRef = new DocumentReference(wikiPage, spaceRef);
// Work with the docRef
XWikiDocument doc = xwiki.getDocument(docRef, xcontext);
// ...
}
Similar code in Groovy:
{{groovy}}
def spaceReferenceResolver =
services.component.getInstance(org.xwiki.model.reference.SpaceReferenceResolver.TYPE_STRING,
"current");
def spaceRef = spaceReferenceResolver.resolve("AB.CD\\.E.F", new
org.xwiki.model.reference.WikiReference('hello'));
def docRef = new org.xwiki.model.reference.DocumentReference('page',
spaceRef);
{{/groovy}}
I hope it helps,
Guillaume
2016-01-12 16:27 GMT+01:00 Giordano NinonĂ <giordano.ninona(a)gmail.com>om>:
Hi users,
I have a problem with my Java component. I have a hjava method wich take as
input 3 strings: wikiName, wikiSpace and the wiki page to retrieve the doc,
thus the content and perform modification.
Ok, when I try to delete a terminal page inside a nested page, there is no
problem, the component retrieve the page's document and can delete it, it
works!
But when I want to delete a terminal page that is inside a nested page
which is inside another nested page it stops working. The point is that I
can't retrieve the terminal page's document, probably because of the
wikiSpace variable.
I have tried "NestedPage1.NestedPage2" but it is not woking at all, it is
keep creating and successively deleting new documents(thus pages).
Thank you,
Giordano.
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users
--
Guillaume Delhumeau (gdelhumeau(a)xwiki.com)
Research & Development Engineer at XWiki SAS
Committer on the
XWiki.org project