Changeset 4509 for vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/DataRoot.java
- Timestamp:
- 02/13/14 14:42:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vlo/branches/vlo-3.0/vlo-commons/src/main/java/eu/clarin/cmdi/vlo/config/DataRoot.java
r4480 r4509 1 2 1 package eu.clarin.cmdi.vlo.config; 3 2 4 3 import java.io.File; 5 import org.simpleframework.xml.Element;6 import org.simpleframework.xml.Root;4 import javax.xml.bind.annotation.XmlElement; 5 import javax.xml.bind.annotation.XmlRootElement; 7 6 8 7 /** 9 8 * A dataRoot describes the meta data sources. 10 * 9 * 11 10 * In an XML file, a dataRoot is reflected like this:<br><br> 12 * 13 * {@literal <DataRoot>} 11 * 12 * {@literal <DataRoot>} 14 13 * {@literal<originName>}name{@literal</originName>} 15 14 * {@literal<rootFile>}topLevelMetadataDirectory/{@literal</rootFile>} … … 18 17 * {@literal<deleteFirst>}falseOrTrue{@literal</deleteFirst>} 19 18 * {@literal</DataRoot>} 20 * 19 * 21 20 * @author keeloo 22 21 */ 23 @ Root // Simple directive22 @XmlRootElement(name = "DataRoot") 24 23 public class DataRoot extends Object { 25 24 26 25 /** 27 26 * Constructor method 28 27 */ 29 public DataRoot (){30 } 31 28 public DataRoot() { 29 } 30 32 31 /** 33 32 * Constructor method 34 * 33 * 35 34 * @param originName name describing the meta data 36 35 * @param rootFile top level directory in which the meta data is stored 37 36 * @param prefix left part of the rootFile 38 * @param toStrip if you want to create the URL to the meta data, this is 37 * @param toStrip if you want to create the URL to the meta data, this is 39 38 * the part to be removed from the rootFile 40 * @param deleteFirst 39 * @param deleteFirst 41 40 */ 42 41 public DataRoot(String originName, File rootFile, String prefix, String toStrip, Boolean deleteFirst) { … … 44 43 this.rootFile = rootFile; 45 44 this.prefix = prefix; 46 this.to strip = toStrip;45 this.toStrip = toStrip; 47 46 this.deleteFirst = deleteFirst; 48 47 } 49 48 50 49 /** 51 50 * Test for equality of the object itself and the object passed to it 52 * 51 * 53 52 * @param dataRoot 54 53 * @return true if the object equals this, false otherwise 55 54 */ 56 55 @Override 57 public boolean equals (Object object){56 public boolean equals(Object object) { 58 57 boolean equal = false; 59 58 60 59 if (object == null) { 61 60 // define this object to be different from nothing 62 61 } else { 63 if (! 62 if (!(object instanceof DataRoot)) { 64 63 // the object is not a DataRoot, define it not to be equal 65 64 } else { … … 67 66 equal = this.rootFile.equals(((DataRoot) object).rootFile) && equal; 68 67 equal = this.prefix.equals(((DataRoot) object).prefix) && equal; 69 equal = this.to strip.equals(((DataRoot) object).tostrip) && equal;68 equal = this.toStrip.equals(((DataRoot) object).toStrip) && equal; 70 69 71 70 equal = this.deleteFirst == ((DataRoot) object).deleteFirst && equal; 72 71 } 73 72 } 74 73 75 74 return equal; 76 75 } … … 78 77 /** 79 78 * Generate by the ide 80 * 79 * 81 80 * @return hash code 82 81 */ … … 87 86 hash = 29 * hash + (this.rootFile != null ? this.rootFile.hashCode() : 0); 88 87 hash = 29 * hash + (this.prefix != null ? this.prefix.hashCode() : 0); 89 hash = 29 * hash + (this.to strip != null ? this.tostrip.hashCode() : 0);88 hash = 29 * hash + (this.toStrip != null ? this.toStrip.hashCode() : 0); 90 89 hash = 29 * hash + (this.deleteFirst ? 1 : 0); 91 90 return hash; … … 95 94 * name describing the meta data 96 95 */ 97 @Element // Simple directive98 96 private String originName; 99 97 100 98 /** 101 99 * top level directory in which the meta data is stored 102 100 */ 103 @Element104 101 private File rootFile; 105 106 /** 107 * Web equivalent of the toStrip. For example: 108 * 102 103 /** 104 * Web equivalent of the toStrip. For example: 105 * 109 106 * /lat/apache/htdocs/ 110 107 */ 111 @Element112 108 private String prefix; 113 109 114 110 /** 115 * Left part of the rootFile 111 * Left part of the rootFile 116 112 * 117 113 * By first removing {@literal tostrip} from {@literal rootFile} and then … … 119 115 * the URL to the meta data. 120 116 */ 121 @ Element122 private String to strip;123 117 @XmlElement(name = "tostrip") 118 private String toStrip; 119 124 120 /** 125 121 * Flag to signal the removal of records from the Solr server 126 * 127 * The value of this flag overrides the value defined in the { @lieteral128 * VloConfig.xml} file. With the deleteFirst flag you can control the129 * removal of the records originating from originName.130 * /131 @Element122 * 123 * The value of this flag overrides the value defined in the { 124 * 125 * @lieteral VloConfig.xml} file. With the deleteFirst flag you can control 126 * the removal of the records originating from originName. 127 */ 132 128 private boolean deleteFirst = false; 133 129 … … 135 131 * Get the value of the prefix element<br><br> 136 132 * 137 * For a description of the element, refer to the general VLO 138 * documentation. 133 * For a description of the element, refer to the general VLO documentation. 139 134 * 140 135 * @return the value … … 147 142 * Set the value of the prefix element<br><br> 148 143 * 149 * For a description of the element, refer to the general VLO 150 * documentation. 144 * For a description of the element, refer to the general VLO documentation. 151 145 * 152 146 * @param prefix the value … … 159 153 * Get the value of the {@literal tostrip} element<br><br> 160 154 * 161 * For a description of the element, refer to the general VLO 162 * documentation. 155 * For a description of the element, refer to the general VLO documentation. 163 156 * 164 157 * @return the value 165 158 */ 166 159 public String getToStrip() { 167 return to strip;160 return toStrip; 168 161 } 169 162 … … 171 164 * Set the value of the {@literal tostrip} element<br><br> 172 165 * 173 * For a description of the element, refer to the general VLO 174 * documentation. 166 * For a description of the element, refer to the general VLO documentation. 175 167 * 176 168 * @param tostrip the value 177 169 */ 178 170 public void setTostrip(String tostrip) { 179 this.to strip = tostrip;171 this.toStrip = tostrip; 180 172 } 181 173 … … 183 175 * Get the value of the originName element<br><br> 184 176 * 185 * For a description of the element, refer to the general VLO 186 * documentation. 187 * 188 * @return the value 189 */ 177 * For a description of the element, refer to the general VLO documentation. 178 * 179 * @return the value 180 */ 190 181 public String getOriginName() { 191 182 return originName; … … 195 186 * Set the value of the originName element<br><br> 196 187 * 197 * For a description of the element, refer to the general VLO 198 * documentation. 188 * For a description of the element, refer to the general VLO documentation. 199 189 * 200 190 * @param originName the value 201 */ 191 */ 202 192 public void setOriginName(String originName) { 203 193 this.originName = originName; … … 207 197 * Get the value of the rootFile element<br><br> 208 198 * 209 * For a description of the element, refer to the general VLO 210 * documentation. 211 * 212 * @return the value 213 */ 199 * For a description of the element, refer to the general VLO documentation. 200 * 201 * @return the value 202 */ 214 203 public File getRootFile() { 215 204 return rootFile; … … 219 208 * Set the value of the rootFile element<br><br> 220 209 * 221 * For a description of the element, refer to the general VLO 222 * documentation. 210 * For a description of the element, refer to the general VLO documentation. 223 211 * 224 212 * @param rootFile the value 225 */ 213 */ 226 214 public void setRootFile(File rootFile) { 227 215 this.rootFile = rootFile; … … 231 219 * Set the value of the deleteFirst element<br><br> 232 220 * 233 * For a description of the element, refer to the general VLO 234 * documentation. 221 * For a description of the element, refer to the general VLO documentation. 235 222 * 236 223 * @param deleteFirst the value 237 */ 224 */ 238 225 public void setDeleteFirst(boolean deleteFirst) { 239 226 this.deleteFirst = deleteFirst; … … 243 230 * Get the value of the deleteFirst element<br><br> 244 231 * 245 * For a description of the element, refer to the general VLO 246 * documentation. 247 * 248 * @return the value 249 */ 232 * For a description of the element, refer to the general VLO documentation. 233 * 234 * @return the value 235 */ 250 236 public boolean deleteFirst() { 251 237 return deleteFirst; 252 238 } 239 240 @Override 241 public String toString() { 242 return String.format("originName: %s; rootFile: %s; prefix: %s; toStrip: %s; deleteFirst: %b", originName, rootFile, prefix, toStrip, deleteFirst); 243 } 244 253 245 } 254
Note: See TracChangeset
for help on using the changeset viewer.