コード例 #1
0
  /** {@inheritDoc} */
  public List getCollections(ContentCollection collection) {
    ContentHostingHandler chh = collection.getContentHandler();
    if (chh != null) {
      return chh.getCollections(collection);
    } else {
      List allCollections = storage.getCollections(collection); // the real collections

      // Find any virtual *resources* which are really *collections*
      List l = storage.getResources(collection);
      for (java.util.Iterator i = l.iterator(); i.hasNext(); ) {
        ContentResource o = (ContentResource) i.next();
        ContentResource cr = getResource(o.getId());
        if (cr != null) {
          ResourceProperties p = cr.getProperties();
          if (p != null
              && p.getProperty(CHH_BEAN_NAME) != null
              && p.getProperty(CHH_BEAN_NAME).length() > 0) {
            allCollections.add(
                getVirtualChild(
                    cr.getId() + Entity.SEPARATOR, cr, true)); // this one is a virtual collection!
          }
        }
      }
      return allCollections;
    }
  }
コード例 #2
0
 /** {@inheritDoc} */
 public List getResources(ContentCollection collection) {
   ContentHostingHandler chh = collection.getContentHandler();
   if (chh != null) {
     return chh.getResources(collection);
   } else {
     List l = storage.getResources(collection);
     for (java.util.Iterator i = l.iterator(); i.hasNext(); ) {
       ContentResource o = (ContentResource) i.next();
       ContentResource cr = getResource(o.getId());
       if (cr != null) {
         ResourceProperties p = cr.getProperties();
         if (p != null
             && p.getProperty(CHH_BEAN_NAME) != null
             && p.getProperty(CHH_BEAN_NAME).length() > 0)
           i.remove(); // this one is a virtual collection!
       }
     }
     return l;
   }
 }