1 54 package org.apache.jetspeed.om.cms.slide; 55 56 import java.util.Vector ; 57 import java.util.TreeMap ; 58 import java.util.Comparator ; 59 60 import org.apache.jetspeed.om.cms.*; 61 62 69 public class SlideCatalog extends SlideResource implements Catalog 70 { 71 72 protected String logicalName = ""; 73 private String title = ""; 74 private String parentUri =""; 75 public static String TYPE="Catalog"; 76 private TreeMap items = new TreeMap (new ItemComparator()); 77 78 81 public SlideCatalog() 82 { 83 super(); 84 descriptor.setProperty("resourcetype","<collection/>"); 85 } 86 87 public void addResource(String itemKey, Resource resource) 88 { 89 items.put(itemKey, resource); 90 } 91 92 public Vector getItems() 93 { 94 return new Vector (items.values()); } 96 97 101 public String getKey() 102 { 103 return "1" + this.getTitle( ); } 106 107 public void setLogicalName(String logicalName) 108 { 109 if (descriptor != null) 110 { 111 descriptor.setProperty("logicalName", logicalName); 112 } 113 114 this.logicalName = logicalName; 115 } 116 117 public String getLogicalName() 118 { 119 if (descriptor != null) 120 { 121 this.logicalName = (String ) this.getProperty("logicalName"); 122 } 123 124 return this.logicalName; 125 } 126 127 public void setTitle(String title) 128 { 129 if (descriptor != null) 130 { 131 descriptor.setProperty("title", title); 132 } 133 134 this.title = title; 135 } 136 137 public String getTitle() 138 { 139 if (descriptor != null) 140 { 141 this.title = (String ) this.getProperty("title"); 142 } 143 144 return this.title; 145 } 146 147 148 public void setParentUri(String parentUri) 149 { 150 if (descriptor != null) 151 { 152 descriptor.setProperty("parentUri", parentUri); 153 } 154 155 this.parentUri = parentUri; 156 } 157 158 public String getParentUri() 159 { 160 if (descriptor != null) 161 { 162 this.parentUri = (String ) this.getProperty("parentUri"); 163 if (parentUri == null) parentUri = ""; 164 } 165 166 return this.parentUri; 167 } 168 169 public String getType() 170 { 171 return SlideCatalog.TYPE; 172 } 173 174 class ItemComparator implements Comparator 175 { 176 public int compare (Object key1, Object key2) 177 { 178 return ((String ) key1).compareTo((String )key2); 179 } 180 } 181 } 182 | Popular Tags |