Thank you very much Arun for your help. Actually I have already
used velocity and was able to do whatever I needed through velocity.
But my requirements changed and now I need to do exactly the
same thing is pure java. If you can help me in that will really be
appreciated.
at the bottom of the following link
this line of code
com.xpn.xwiki.doc.XWikiDocument doc =
context.getWiki().getDocument("theSpace.theDoc", context); // any
document
where this contest is coming from?
If I have a class how do I get the context?
On Sat, Nov 7, 2009 at 7:47 PM, Arun Reddy <vipunreddy.n(a)gmail.com> wrote:
Hi Richard,
On Sun, Nov 8, 2009 at 6:14 AM, Vivian Richard <kanpsack(a)gmail.com> wrote:
Hello devs,
got a really newbie question and sitting on it for hours.
Your help will be appreciated. All I am trying to do is
- writing a Java class which has a method - when called
with doc name/ID will return the document title. That is all.
If you are looking for a method which returns document title of a particular
doc name/ID , You can use velocity to achive that easily on the fly by
putting the code inside your wiki pages itself.
You can have a look at these :
velocity scripting guide :
http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting#HXWiki27sVeloci…
XWiki API :
http://platform.xwiki.org/xwiki/bin/view/DevGuide/API
$doc.getTitle() -> to get title of current doc.
$xwiki.getDocument(java.lang.String web,java.lang.String
fullname).getTitle()
And many more methods, kindly check the API (link given above).
The following code is what Itried:
import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.api.Api;
import com.xpn.xwiki.api.XWiki;
import com.xpn.xwiki.doc.XWikiDocument;
public class SampleService extends Api
{
public SampleService()
{
super(); /// I guess there should be XwikiContext
parameter in
the constructor
}
public String myDocTitle(String:name)
{
com.xpn.xwiki.doc.XWikiDocument docu =
context.getWiki().getDocument("theSpace.theDoc", context); // I do
not where to get this context from
return docu.getTitle();
}
}
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
--
Best Regards,
Arun Reddy
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs