You are viewing a plain text version of this content. The canonical link for it is here.
Posted to graffito-commits@incubator.apache.org by ta...@apache.org on 2005/02/04 19:57:08 UTC

svn commit: r151399 - in incubator/graffito/trunk: api/src/java/org/apache/portals/graffito/ components/src/java/org/apache/portals/graffito/impl/ components/src/java/org/apache/portals/graffito/persistence/ components/src/java/org/apache/portals/graffito/persistence/impl/ components/src/java/org/apache/portals/graffito/store/ components/src/java/org/apache/portals/graffito/store/impl/fs/ components/src/java/org/apache/portals/graffito/store/impl/ojb/

Author: taylor
Date: Fri Feb  4 11:57:05 2005
New Revision: 151399

URL: http://svn.apache.org/viewcvs?view=rev&rev=151399
Log:
getLinks api


Modified:
    incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentModelService.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/impl/ContentModelServiceImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/impl/ContentPersistenceServiceImpl.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java
    incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java

Modified: incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentModelService.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentModelService.java?view=diff&r1=151398&r2=151399
==============================================================================
--- incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentModelService.java (original)
+++ incubator/graffito/trunk/api/src/java/org/apache/portals/graffito/ContentModelService.java Fri Feb  4 11:57:05 2005
@@ -218,6 +218,15 @@
     public Collection getDocuments(String parentUri) throws ContentManagementException;
 
     /**
+     * Get all links found in a parent uri. 
+     * 
+     * @param parentUri The uri from which the links have be retrieved. It can be an server scope or a folder uri.
+     * @return a collection of {@link Link}
+     * @throws ContentManagementException
+     */
+    public Collection getLinks(String parentUri) throws ContentManagementException;
+    
+    /**
      * Get all folders found in a parent uri. 
      * 
      * @param parentUri The uri from which the folders have be retrieved. It can be an server scope or a folder uri.

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/impl/ContentModelServiceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/impl/ContentModelServiceImpl.java?view=diff&r1=151398&r2=151399
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/impl/ContentModelServiceImpl.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/impl/ContentModelServiceImpl.java Fri Feb  4 11:57:05 2005
@@ -497,6 +497,14 @@
     {
         return persistence.getFolders(parentUri);
     }
+
+    /**
+     * @see org.apache.portals.graffito.ContentModelService#getLinks(java.lang.String)
+     */
+    public Collection getLinks(String parentUri) throws ContentManagementException
+    {
+        return persistence.getLinks(parentUri);
+    }
     
     /**
      * Check if the cms object uri is correct

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java?view=diff&r1=151398&r2=151399
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/ContentPersistenceService.java Fri Feb  4 11:57:05 2005
@@ -196,12 +196,21 @@
     
     /**
      * Get documents found in a parent uri.
-     * @param uri The parent folder uri from which the folders have to be retrieved. it can be a server scope or a parent folder uri.
+     * @param uri The parent folder uri from which the documents have to be retrieved. it can be a server scope or a parent folder uri.
      * @return the folder children found
      * 
      * @throws ContentPersistenceException when it is not possible to find the associated store
      */
     public Collection getDocuments(String uri) throws ContentPersistenceException;    
+
+    /**
+     * Get links found in a parent uri.
+     * @param uri The parent folder uri from which the links have to be retrieved. it can be a server scope or a parent folder uri.
+     * @return the children found
+     * 
+     * @throws ContentPersistenceException when it is not possible to find the associated store
+     */
+    public Collection getLinks(String uri) throws ContentPersistenceException;    
     
     /**
      * Add a new history element

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/impl/ContentPersistenceServiceImpl.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/impl/ContentPersistenceServiceImpl.java?view=diff&r1=151398&r2=151399
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/impl/ContentPersistenceServiceImpl.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/persistence/impl/ContentPersistenceServiceImpl.java Fri Feb  4 11:57:05 2005
@@ -294,6 +294,19 @@
         }
         return store.getDocuments(uri);  
     }
+
+    /**
+     * @see org.apache.portals.graffito.persistence.ContentPersistenceService#getLinks(java.lang.String)
+     */
+    public Collection getLinks(String uri) throws ContentPersistenceException
+    {
+        ContentStore store = findPersistenceStore(uri);
+        if (store == null)
+        {
+            throw new ContentPersistenceException("Impossible to find the associated store");
+        }
+        return store.getLinks(uri);  
+    }
     
     /**
      * @see org.apache.portals.graffito.persistence.ContentPersistenceService#getFolders(java.lang.String)

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java?view=diff&r1=151398&r2=151399
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/ContentStore.java Fri Feb  4 11:57:05 2005
@@ -65,6 +65,13 @@
      * @return a collection of document children found
      */
     public Collection getDocuments(String parentUri);     
+
+    /**
+     * Get links found in a parent folder.
+     * @param parentUri The parent folder uri from which the links have to be retrieved
+     * @return a collection of link children found
+     */
+    public Collection getLinks(String parentUri);     
     
     /**
      * Add a new history element

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java?view=diff&r1=151398&r2=151399
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/fs/FileSystemContentStore.java Fri Feb  4 11:57:05 2005
@@ -99,6 +99,12 @@
         return null;
     }
 
+    public Collection getLinks(String parentUri)
+    {
+        // TODO Auto-generated method stub
+        return null;        
+    }
+    
     /* (non-Javadoc)
      * @see org.apache.portals.graffito.store.ContentStore#insertHistoryElement(org.apache.portals.graffito.model.HistoryElement)
      */

Modified: incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java
URL: http://svn.apache.org/viewcvs/incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java?view=diff&r1=151398&r2=151399
==============================================================================
--- incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java (original)
+++ incubator/graffito/trunk/components/src/java/org/apache/portals/graffito/store/impl/ojb/GraffitoOJBStore.java Fri Feb  4 11:57:05 2005
@@ -21,9 +21,6 @@
 import java.util.Enumeration;
 import java.util.Iterator;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
 import org.apache.ojb.broker.PBKey;
 import org.apache.ojb.broker.PersistenceBroker;
 import org.apache.ojb.broker.metadata.ConnectionRepository;
@@ -46,6 +43,7 @@
 import org.apache.portals.graffito.exception.CmsPermissionException;
 import org.apache.portals.graffito.model.CmsObject;
 import org.apache.portals.graffito.model.Document;
+import org.apache.portals.graffito.model.Link;
 import org.apache.portals.graffito.model.Folder;
 import org.apache.portals.graffito.model.HistoryElement;
 import org.apache.portals.graffito.model.GraffitoServer;
@@ -188,6 +186,22 @@
 
     }
 
+    public Collection getLinks(String parentUri)
+    {
+        Filter filter = this.newFilter();
+
+        // Check if the parenturi is the root store uri
+        if (this.scope.equals(parentUri))
+        {
+            filter.addIsNull("parentId");
+        }
+        else
+        {
+            filter.addEqualTo("parentFolder.uri", parentUri);
+        }
+
+        return this.getCollectionByQuery(Link.class, filter);
+    }
     
     
     /**