1 20 package org.jahia.data.templates; 21 22 import java.io.File ; 23 import java.util.Vector ; 24 25 31 public class JahiaTemplatesPackage { 32 33 34 private String m_FileName; 35 36 private String m_FilePath; 37 38 private int m_Type ; 40 private static final int JAR = 1; 41 42 private static final int DIR = 2; 43 44 45 private String m_Name; 46 47 private String m_RootFolder; 48 49 private String m_ClassesFile; 50 51 private String m_Provider; 52 53 private String m_Thumbnail; 54 55 57 private Vector m_TemplatesList = new Vector (); 58 59 60 private int m_ID; 61 62 65 public static final String DESCR_FILE = "templates_descr.txt"; 66 67 71 public JahiaTemplatesPackage ( 72 String name, 73 String rootFolder, 74 String classesFile, 75 String providerName, 76 String thumbnail 77 ) 78 { 79 m_Name = name; 80 m_RootFolder = rootFolder; 81 m_ClassesFile = classesFile; 82 m_Provider = providerName; 83 m_Thumbnail = thumbnail; 84 } 85 86 91 public int getID(){ 92 93 return m_ID; 94 } 95 96 97 101 public void setID(int id){ 102 103 m_ID = id; 104 } 105 106 107 112 public String getName(){ 113 114 return m_Name; 115 } 116 117 118 122 protected void setName(String name){ 123 124 m_Name = name; 125 } 126 127 128 133 public String getRootFolder(){ 134 135 return m_RootFolder; 136 } 137 138 139 144 protected void setRootFolder(String folder){ 145 146 m_RootFolder = folder; 147 } 148 149 150 155 public String getClassesFile(){ 156 157 return m_ClassesFile; 158 } 159 160 161 166 protected void setClassesFile(String classesFile){ 167 168 m_ClassesFile = classesFile; 169 } 170 171 172 177 public boolean hasClasses(){ 178 179 return (m_ClassesFile != null && m_ClassesFile.length()>0); 180 } 181 182 183 188 public String getProvider(){ 189 190 return m_Provider; 191 } 192 193 194 198 protected void setProvider(String provider){ 199 200 m_Provider = provider; 201 } 202 203 204 209 public String getThumbnail(){ 210 211 return m_Thumbnail; 212 } 213 214 215 219 public void setThumbnail(String val){ 220 221 m_Thumbnail = val; 222 } 223 224 225 230 public JahiaTemplateDef getHomePageTemplate(){ 231 232 int size = m_TemplatesList.size(); 233 JahiaTemplateDef template = null; 234 for ( int i=0 ; i<size ; i++ ){ 235 template = (JahiaTemplateDef)m_TemplatesList.get(i); 236 if ( template.isHomePage() ){ 237 return template; 238 } 239 } 240 return null; 241 } 242 243 248 protected void setTemplates(Vector templatesList){ 249 250 m_TemplatesList = templatesList; 251 252 } 253 254 259 public Vector getTemplates(){ 260 261 return m_TemplatesList; 262 } 263 264 265 270 public void addTemplateDef(JahiaTemplateDef tempDef ){ 271 272 m_TemplatesList.add(tempDef); 273 } 274 275 276 280 public String getFileName(){ 281 return this.m_FileName; 282 } 283 284 285 289 protected void setFileName(String name){ 290 this.m_FileName = name; 291 292 if ( name.endsWith(".jar") ){ 293 m_Type = JAR; 294 } else { 295 m_Type = DIR; 296 } 297 } 298 299 300 304 public String getFilePath(){ 305 return this.m_FilePath; 306 } 307 308 309 313 public void setFilePath(String path){ 314 this.m_FilePath = path; 315 File f = new File (path); 316 this.setFileName(f.getName()); 317 } 318 319 320 324 public boolean isFile(){ 325 return (m_Type == JAR); 326 } 327 328 329 333 public boolean isDirectory(){ 334 return ( m_Type == DIR ); 335 } 336 337 338 339 } | Popular Tags |