Author: tmortagne
Date: 2007-10-05 17:19:12 +0200 (Fri, 05 Oct 2007)
New Revision: 5302

Modified:
   
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/Document.java
Log:
XWIKI-1779: Add getWikiName and getPrefixedFullName in 
com.xpn.xwiki.api.Document

Modified: 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/Document.java
===================================================================
--- 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/Document.java
   2007-10-05 15:18:55 UTC (rev 5301)
+++ 
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/api/Document.java
   2007-10-05 15:19:12 UTC (rev 5302)
@@ -66,7 +66,7 @@
 
     /**
      * this function is accessible only if you have the programming rights 
give access to the
-     * priviledged API of the Document
+     * privileged API of the Document
      */
     public XWikiDocument getDocument()
     {
@@ -112,7 +112,7 @@
     /**
      * return the name of the space of the document
      *
-     * for exemple if the fullName of a document is "MySpace.Mydoc", the name 
is MySpace
+     * for example if the fullName of a document is "MySpace.Mydoc", the name 
is MySpace
      *
      * @return the name of the space of the document
      */
@@ -120,6 +120,14 @@
     {
         return doc.getSpace();
     }
+    
+    /**
+     * @return the name of the wiki where this document is stored.
+     */
+    public String getWikiName()
+    {
+        return doc.getDatabase();
+    }
 
     /**
      * return the name of the space of the document
@@ -134,7 +142,7 @@
     }
 
     /**
-     * return the fullName of a doucment
+     * return the fullName of a document
      *
      * if a document has for name "MyDoc" and space "MySpace", the fullname is 
"MySpace.MyDoc" In a
      * wiki, all the documents have a different fullName.
@@ -143,6 +151,15 @@
     {
         return doc.getFullName();
     }
+    
+    /**
+     * @return the real full name of a document containing wiki name where 
document is stored.
+     * For document in "xwiki" wiki, with name "MyDoc" and space "MySpace" the 
extended full name is "xwiki:MySpace.MyDoc".
+     */
+    public String getPrefixedFullName()
+    {
+        return (getWikiName() != null ? getWikiName() + ":" : "") + 
getFullName();
+    }
 
     public Version getRCSVersion()
     {

_______________________________________________
notifications mailing list
notifications@xwiki.org
http://lists.xwiki.org/mailman/listinfo/notifications

Reply via email to