Coverage Report - org.paneris.bibliomania.SectionGroup
 
Classes in this File Line Coverage Branch Coverage Complexity
SectionGroup
10%
5/47
0%
0/22
1.545
SectionGroup$1
0%
0/2
N/A
1.545
 
 1  
 package org.paneris.bibliomania;
 2  
 
 3  
 import java.util.Enumeration;
 4  
 
 5  
 import org.melati.Melati;
 6  
 import org.melati.admin.AdminSpecialised;
 7  
 import org.melati.poem.CachedSelection;
 8  
 import org.melati.poem.CachedTailoredQuery;
 9  
 import org.melati.poem.Column;
 10  
 import org.melati.poem.Table;
 11  
 import org.melati.template.MarkupLanguage;
 12  
 import org.melati.poem.util.ArrayUtils;
 13  
 import org.melati.poem.util.EmptyEnumeration;
 14  
 import org.melati.poem.util.MappedEnumeration;
 15  
 import org.melati.poem.Treeable;
 16  
 import org.paneris.bibliomania.generated.SectionGroupBase;
 17  
 
 18  
 public class SectionGroup
 19  
   extends SectionGroupBase
 20  
   implements AdminSpecialised {
 21  
 
 22  16
   public SectionGroup() {
 23  16
   }
 24  
 
 25  16
   private CachedSelection sections = null;
 26  
 
 27  
   private boolean generic() {
 28  0
     Boolean genericL = getGeneric();
 29  0
     return genericL != null && genericL.booleanValue();
 30  
   }
 31  
 
 32  
   public Enumeration getSections() {
 33  0
     if (getTroid() == null)
 34  0
       return new EmptyEnumeration();
 35  
 
 36  0
     if (generic())
 37  0
       return getBibliomaniaDatabase().getSectionTable().selection();
 38  
 
 39  0
     if (sections == null)
 40  0
       sections =
 41  
         getBibliomaniaDatabase()
 42  
           .getSectionTable()
 43  
           .getGroupColumn()
 44  
           .cachedSelectionWhereEq(troid());
 45  
 
 46  0
     return sections.objects();
 47  
   }
 48  
 
 49  
   public Enumeration getProductAssociations() {
 50  0
     return new EmptyEnumeration();
 51  
   }
 52  
 
 53  
   public String getMetatag_description() {
 54  0
     return null;
 55  
   }
 56  
 
 57  
   public String getMetatag_keywords() {
 58  0
     return null;
 59  
   }
 60  
 
 61  
   public Enumeration getMembersSlowly() {
 62  0
     return getSections();
 63  
   }
 64  
 
 65  
   public Unit getParentUnit() {
 66  0
     return null;
 67  
   }
 68  
 
 69  
   public String getDisplayName() {
 70  0
     return getDisplayname();
 71  
   }
 72  
 
 73  
   public void appendCacheSubpath(StringBuffer buffer) {
 74  0
     buffer.append("/g/");
 75  0
     buffer.append(troid());
 76  0
   }
 77  
 
 78  
   public boolean contains(Section section) {
 79  0
     return generic() || section.getGroup() == this;
 80  
   }
 81  
 
 82  
   /**
 83  
    * FIXME
 84  
    */
 85  
 
 86  
   public long ftiTextID_start() {
 87  0
     return 0;
 88  
   }
 89  
 
 90  
   /**
 91  
    * FIXME
 92  
    */
 93  
 
 94  
   public long ftiTextID_limit() {
 95  0
     return Long.MAX_VALUE;
 96  
   }
 97  
 
 98  16
   private CachedTailoredQuery authorsWithBooks = null;
 99  
 
 100  
   public Enumeration getAuthorsWithBooks() {
 101  0
     BibliomaniaDatabase b = getBibliomaniaDatabase();
 102  
 
 103  0
     if (generic())
 104  0
       return b.getAuthorTable().selection();
 105  
 
 106  0
     if (authorsWithBooks == null) {
 107  0
       authorsWithBooks =
 108  
         new CachedTailoredQuery(
 109  
           "DISTINCT",
 110  
           new Column[] { b.getAuthorTable().troidColumn()},
 111  
           new Table[] { b.getBookTable(), b.getSectionTable()},
 112  
           "book.author = author.id AND book.section = section.id AND "
 113  
             + "section.\"group\" = "
 114  
             + troid(),
 115  
           null);
 116  
     }
 117  
 
 118  0
     final Table authorTable = b.getAuthorTable();
 119  0
     return new MappedEnumeration(authorsWithBooks.selection_firstRaw()) {
 120  
       public Object mapped(Object troid) {
 121  0
         return authorTable.getObject((Integer)troid);
 122  
       }
 123  
     };
 124  
   }
 125  
 
 126  
   public SectionGroup getReadArea() {
 127  0
     return this;
 128  
   }
 129  
 
 130  
   public Advert getAdvert() {
 131  0
     Advert a = null;
 132  0
     return a;
 133  
   }
 134  
   public Layout getLayout() {
 135  0
     Layout l = null;
 136  0
     return l;
 137  
   }
 138  
 
 139  
   public String adminHandle(
 140  
     Melati melatiContext,
 141  
     MarkupLanguage markupLanguage)
 142  
     throws Exception {
 143  0
     return null;
 144  
   }
 145  
 
 146  
   public String adminSpecialFacilities(
 147  
     Melati melatiContext,
 148  
     MarkupLanguage markupLanguage)
 149  
     throws Exception {
 150  0
     return getBibliomaniaDatabase().getWMTemplet("SectionGroup-specials");
 151  
   }
 152  
   
 153  
   /* 
 154  
    * @see org.melati.util.Treeable#getChildren()
 155  
    */
 156  16
    public Treeable[] children = null;
 157  
    
 158  
    public Treeable[] getChildren() {
 159  0
      if (children == null) {
 160  0
        Object[] kids = ArrayUtils.arrayOf(getSections());
 161  0
        children = new Treeable[kids.length];
 162  0
        for (int i=0; i<kids.length; i++) {
 163  0
          children[i] = (Treeable)kids[i];
 164  
        }
 165  
      }
 166  0
      return children;
 167  
    }
 168  
   /* 
 169  
    * @see org.melati.util.Treeable#getName()
 170  
    */
 171  
   public String getName() {
 172  0
     return getDisplayName();
 173  
   }
 174  
 
 175  
 
 176  
 }