1 package org.jahia.services.pages; 2 3 import java.util.HashMap ; 4 import java.util.Iterator ; 5 import java.util.Set ; 6 import java.io.Serializable ; 7 8 19 20 public class PageProperty implements Serializable { 21 22 public final static String SHARED_LANGUAGE_MARKER = "shared"; 23 24 public final static String PAGE_URL_KEY_PROPNAME = "pageURLKey"; 25 26 private int pageID; 27 private String name; 28 private HashMap languageValues; 32 33 protected PageProperty (int pageID, String name) { 34 this.pageID = pageID; 35 this.name = name; 36 languageValues = new HashMap (); 37 } 38 39 44 public int getPageID () { 45 return pageID; 46 } 47 48 53 public String getName () { 54 return name; 55 } 56 57 64 public String getValue () { 65 return getValue (SHARED_LANGUAGE_MARKER); 66 } 67 68 81 public String getValue (String languageCode) { 82 if (languageValues.containsKey (languageCode)) { 83 return (String ) languageValues.get (languageCode); 84 } 85 86 if (languageValues.containsKey (SHARED_LANGUAGE_MARKER)) { 87 return (String ) languageValues.get (SHARED_LANGUAGE_MARKER); 88 } 89 90 return ""; 91 } 92 93 101 public void setValue (String value) { 102 setValue (value, SHARED_LANGUAGE_MARKER); 103 } 104 105 113 public void setValue (String value, String languageCode) { 114 languageValues.put (languageCode, value); 115 } 116 117 124 public Iterator getLanguageCodes () { 125 Set languagesCodeSet = languageValues.keySet (); 126 return languagesCodeSet.iterator (); 127 } 128 129 } 130 | Popular Tags |