1 18 19 package sync4j.syncclient.spap; 20 21 import java.util.HashMap ; 22 import java.util.Map ; 23 24 46 47 public class AssetVersion { 48 49 51 public static final String PROPERTY_VERSION = "version"; 54 public static final String PROPERTY_RELEASE_DATE = "release_date"; 55 public static final String PROPERTY_RELEASE_NOTES = "release_notes"; 56 public static final String PROPERTY_URL = "url"; 57 public static final String PROPERTY_SIZE_ASSET_FILE = "size_asset_file"; 58 public static final String PROPERTY_INSTALL_PROGRAM = "install_program"; 59 public static final String PROPERTY_UNINSTALL_PROGRAM = "uninstall_program"; 60 public static final String PROPERTY_NEED_UNINSTALL_PREV = "need_uninstall_prev"; 61 62 65 private String version; 66 67 73 public void setVersion(String version) { 74 this.version = version; 75 } 76 77 80 public String getVersion() { 81 return version; 82 } 83 84 87 private String releaseDate; 88 89 95 public void setReleaseDate(String releaseDate) { 96 this.releaseDate = releaseDate; 97 } 98 99 102 public String getReleaseDate() { 103 return releaseDate; 104 } 105 106 109 private String releaseNotes; 110 111 117 public void setReleaseNotes(String releaseNotes) { 118 this.releaseNotes = releaseNotes; 119 } 120 121 124 public String getReleaseNotes() { 125 return releaseNotes; 126 } 127 128 132 private String url; 133 134 140 public void setUrl(String url) { 141 this.url = url; 142 } 143 144 147 public String getUrl() { 148 return url; 149 } 150 151 155 private String installProgram; 156 157 163 public void setInstallProgram(String installProgram) { 164 this.installProgram = installProgram; 165 } 166 167 170 public String getInstallProgram() { 171 return installProgram; 172 } 173 174 178 private String uninstallProgram; 179 180 186 public void setUninstallProgram(String uninstallProgram) { 187 this.uninstallProgram = uninstallProgram; 188 } 189 190 193 public String getUninstallProgram() { 194 return uninstallProgram; 195 } 196 197 201 private String needUninstallPrev; 202 203 210 public void setNeedUninstallPrev(String needUninstallPrev) { 211 this.needUninstallPrev = needUninstallPrev; 212 } 213 214 217 public String getNeedUninstallPrev() { 218 return needUninstallPrev; 219 } 220 221 224 private int sizeContentFile; 225 226 232 public void setSizeContentFile(int sizeContentFile) { 233 this.sizeContentFile = sizeContentFile; 234 } 235 236 239 public int getSizeContentFile() { 240 return sizeContentFile; 241 } 242 243 244 246 249 public AssetVersion(Map values) { 250 251 setVersion((String )values.get(PROPERTY_VERSION)); 252 setReleaseDate((String )values.get(PROPERTY_RELEASE_DATE)); 253 setReleaseNotes((String )values.get(PROPERTY_RELEASE_NOTES)); 254 setUrl((String )values.get(PROPERTY_URL)); 255 256 Object obj = values.get(PROPERTY_SIZE_ASSET_FILE); 257 if (obj!=null) { 258 try { 259 this.sizeContentFile = Integer.parseInt(obj.toString()); 260 } catch (NumberFormatException e) { 261 this.sizeContentFile = 0; 262 } 263 } 264 265 this.installProgram = (String )values.get(PROPERTY_INSTALL_PROGRAM); 266 this.uninstallProgram = (String )values.get(PROPERTY_INSTALL_PROGRAM); 267 this.needUninstallPrev = (String )values.get(PROPERTY_NEED_UNINSTALL_PREV); 268 } 269 270 271 275 public Map toMap() { 276 Map map = new HashMap (); 277 278 map.put(PROPERTY_VERSION,getVersion()); 279 map.put(PROPERTY_RELEASE_DATE,getReleaseDate()); 280 map.put(PROPERTY_RELEASE_NOTES,getReleaseNotes()); 281 map.put(PROPERTY_URL,getUrl()); 282 map.put(PROPERTY_SIZE_ASSET_FILE,""+getSizeContentFile()); 283 map.put(PROPERTY_INSTALL_PROGRAM,getInstallProgram()); 284 map.put(PROPERTY_NEED_UNINSTALL_PREV,getNeedUninstallPrev()); 285 return map; 286 } 287 288 292 public String toString() { 293 StringBuffer sb = new StringBuffer ("\tAsset version: \n"); 294 295 sb.append("\t\tVersion: "); 296 sb.append(getVersion()); 297 sb.append("\n\t\tRelease date: "); 298 sb.append( new java.util.Date (Long.parseLong(getReleaseDate()))); 299 sb.append(" ("); 300 sb.append(getReleaseDate()); 301 sb.append(")"); 302 sb.append("\n\t\tRelease notes: "); 303 sb.append(getReleaseNotes()); 304 sb.append("\n\t\tAsset file: "); 305 sb.append(getUrl()); 306 sb.append("\n\t\tSize Asset file: "); 307 sb.append(getSizeContentFile() ); 308 sb.append("\n\t\tInstall program: "); 309 sb.append(getInstallProgram()); 310 sb.append("\n\t\tNeed uninstall prev: "); 311 sb.append(getNeedUninstallPrev()); 312 313 return sb.toString(); 314 } 315 316 317 } | Popular Tags |