/** * I will return the resources to match the system language. * * @return Resource */ public Resource getResource() { final String language = Locale.getDefault().getLanguage(); Logger.debug(language); Resource defaultResouce = null; for (final Resource res : this.resources) { Logger.debug(res); if (language.equals(res.getLocale())) { return res; } else if ("en".equals(res.getLocale())) { defaultResouce = res; } } return defaultResouce; }
/** * I will return the value that is set to Package.ExpirationDate tag * * @return Date */ public Date getExpirationDate() { Logger.start(); Date date = this.getDate(Package.ExpirationDate); if (date != null) { date = new Date((date.getTime() + (1 * 24 * 60 * 60)) - 1); } return date; }
/** * I will return the value that is set to Package.ExpirationDate tag * * @return String */ public String getExpirationDateString() { Logger.start(); String date = this.getString(Package.ExpirationDate); if (date != null) { StringTokenizer strt = new StringTokenizer(date, "T"); if (strt.hasMoreTokens()) { date = strt.nextToken(); } } return date; }
/** * Package initialize * * @param json */ public Package(final JSONObject json) { super(json); try { final JSONArray resources = json.getJSONArray(Package.Resources); for (int i = 0; i < resources.length(); i++) { final JSONObject obj = resources.getJSONObject(i); this.resources.add(new Resource(obj)); } } catch (final JSONException ex) { Logger.err(ex); } }
/** * I will return the value that is set to Package.CreateAt tag * * @return Date */ public Date getCreateAt() { Logger.start(); return this.getDate(Package.CreateAt); }
/** * I will return the value that is set to Package.Application tag * * @return String */ public String getApplication() { Logger.start(); return super.getString(Package.Application); }
/** * I will return the value that is set to Package.Sale tag * * @return String */ public String getSale() { Logger.start(); return super.getString(Package.Sale); }
/** * I will return the value that is set to Package.Preference tag * * @return int */ public int getPreference() { Logger.start(); return super.getInt(Package.Preference); }
/** * I will return the value that is set to Package.Password tag * * @return String */ public String getPassword() { Logger.start(); return super.getString(Package.Password); }
/** * I will return the value that is set to Package.Name tag * * @return String */ public String getName() { Logger.start(); return super.getString(Package.Name); }