- Timestamp:
- 2022-06-07T10:05:30+12:00 (22 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/gli/src/org/greenstone/gatherer/cdm/SearchMeta.java
r36185 r36241 44 44 public static final String TYPE_SORT = "sort"; 45 45 public static final String TYPE_FACET = "facet"; 46 47 // gs2 all meta have the same type, as there is currently no distinction in 48 // config file 49 public static final String TYPE_SEARCH = "search"; 46 50 47 51 // public SearchMeta() { … … 51 55 */ 52 56 public SearchMeta(Element element) { 53 System.err.println("new search meta, elem = ");54 System.err.println(XMLTools.xmlNodeToString(element));55 57 this.element = element; 56 58 } … … 62 64 public SearchMeta(String name, String type) { 63 65 this(name, type, Configuration.getLanguage()); 64 // element = CollectionConfiguration.createElement(StaticStrings.SEARCHMETADATA_ELEMENT);65 // element.setAttribute(StaticStrings.NAME_ATTRIBUTE, name);66 // element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, Configuration.getLanguage());67 // element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR);68 // element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type);69 66 } 70 67 … … 75 72 element.setAttribute(StaticStrings.LANGUAGE_ATTRIBUTE, language); 76 73 element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, StaticStrings.FALSE_STR); 77 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type); 74 if (Gatherer.GS3) { 75 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type); 76 } else { 77 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, TYPE_SEARCH); 78 } 78 79 } 79 80 … … 104 105 */ 105 106 public boolean equals(Object object) { 106 // System.err.println("running search meta equals");107 // if (object instanceof SearchMeta) {108 // if (compareTo(object) == 0 && getType().equals(((SearchMeta)object).getType())) {109 // return true;110 // }111 // }112 // return false;113 107 return (compareTo(object) == 0); 114 108 } 115 109 116 // public Element getElement() {117 // return element;118 // }119 120 // /** Method to retrieve the value of language.121 // * @return the value of language as a <strong>String</strong>.122 // */123 // public String getLanguage() {124 // // Retrieve the language string125 // return element.getAttribute(StaticStrings.LANGUAGE_ATTRIBUTE);126 // }127 128 // /** Method to retrieve the value of name.129 // * @return the name attribute of the collection meta as a String130 // */131 // public String getName() {132 // return element.getAttribute(StaticStrings.NAME_ATTRIBUTE);133 // }134 // /** Method to retrieve the value of value (well great choice of name there).135 // * @return The value of value as a <strong>String</strong>.136 // */137 // public String getValue(boolean text_value) {138 // String raw_value = XMLTools.getValue(element);139 // // Decode the raw value depending on whether the user asked for the TEXT or GREENSTONE version140 // if(text_value == TEXT) {141 // return Codec.transform(raw_value, Codec.DOM_TO_TEXT);142 // }143 // else {144 // return Codec.transform(raw_value, Codec.DOM_TO_GREENSTONE);145 // }146 // }147 148 // public boolean isAssigned() {149 // return (element != null && !element.getAttribute(StaticStrings.ASSIGNED_ATTRIBUTE).equals(StaticStrings.FALSE_STR));150 // }151 152 // public boolean isDummy() {153 // return dummy;154 // }155 156 // /** Determine if this metadata is one of the four special pieces of metadata.157 // * @return true if this metadata is special, false otherwise.158 // */159 // public boolean isSpecial() {160 // return (element != null && element.getAttribute(StaticStrings.SPECIAL_ATTRIBUTE).equals(StaticStrings.TRUE_STR));161 // }162 163 // public void setAssigned(boolean assigned) {164 // if(element != null) {165 // element.setAttribute(StaticStrings.ASSIGNED_ATTRIBUTE, (assigned ? StaticStrings.TRUE_STR : StaticStrings.FALSE_STR));166 // }167 // }168 169 // public void setElement(Element element) {170 // this.element = element;171 // text = null;172 // }173 174 // /** Change the value of value.175 // * @param raw_value the new value as a String.176 // */177 // public void setValue(String raw_value) {178 // setValue(raw_value, false);179 // }180 181 // public void setValue(String raw_value, boolean preserveTags) {182 // // we need to check if the value has changed183 // String current_value = XMLTools.getValue(element);184 185 // String new_value = preserveTags ?186 // Codec.transform(raw_value, Codec.TEXT_TO_DOM_PRESERVE_TAGS)187 // : Codec.transform(raw_value, Codec.TEXT_TO_DOM);188 // if (!current_value.equals(new_value)) {189 // // Only raw html text can be given to setValue so we need to encode it190 // XMLTools.setValue(element, new_value);191 // text = null; // Reset text192 // // And determine if this makes the metadata assigned193 // setAssigned(raw_value != null && raw_value.length() > 0);194 // }195 // }196 110 197 111 public void setType(String type) { 198 112 if(element != null) { 199 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type); 113 if (Gatherer.GS3) { 114 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, type); 115 } else { 116 element.setAttribute(StaticStrings.TYPE_ATTRIBUTE, TYPE_SEARCH); 117 } 200 118 } 201 119 } 202 120 public String getType() { 203 121 if (element != null) { 122 204 123 return element.getAttribute(StaticStrings.TYPE_ATTRIBUTE); 205 124 }
Note:
See TracChangeset
for help on using the changeset viewer.