|
|
@@ -1,138 +0,0 @@
|
|
|
-package com.psi.gabontel.mobileapp.helper.objects;
|
|
|
-
|
|
|
-import java.util.ArrayList;
|
|
|
-import java.util.Iterator;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
-
|
|
|
-import org.json.simple.JSONObject;
|
|
|
-
|
|
|
-import com.psi.common.db.DataRow;
|
|
|
-import com.psi.common.db.DataRowCollection;
|
|
|
-import com.psi.common.db.DbWrapper;
|
|
|
-
|
|
|
-
|
|
|
-public class OcsPackages {
|
|
|
-
|
|
|
- public static LinkedHashMap<String, LinkedHashMap<String, ArrayList<Package>>> getPackages() {
|
|
|
- return packages;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- private static DbWrapper db = DbWrapper.getInstance();
|
|
|
- private static LinkedHashMap<String,LinkedHashMap<String,ArrayList<Package>>> packages;
|
|
|
-
|
|
|
- static {
|
|
|
- packages = new LinkedHashMap<String,LinkedHashMap<String,ArrayList<Package>>>();
|
|
|
-
|
|
|
- DataRowCollection rows = db.QueryDataRows("SELECT BUNDLEID,BUNDLENAME,PRICEFR / 100 as PRICEFR ,DESCRIPTION FROM TBLAIRBUNDLE WHERE STATUS = 1 AND (BUNDLENAME LIKE 'L%' OR BUNDLENAME LIKE 'M%') ORDER BY BUNDLENAME ASC,PRICEFR ASC ");
|
|
|
-
|
|
|
- Iterator<DataRow> iterator = rows.iterator();
|
|
|
- while(iterator.hasNext()) {
|
|
|
- DataRow row = iterator.next();
|
|
|
-
|
|
|
- String bundlekey = row.getString("BUNDLENAME");
|
|
|
-
|
|
|
- Package pckge = new Package();
|
|
|
- pckge.setBundleId(row.getString("BUNDLEID"));
|
|
|
- pckge.setBundlename(row.getString("BUNDLENAME"));
|
|
|
- pckge.setDescription(row.getString("DESCRIPTION"));
|
|
|
- pckge.setPrice(row.getString("PRICEFR"));
|
|
|
-
|
|
|
-
|
|
|
- if(bundlekey.startsWith("L")) {
|
|
|
-
|
|
|
- if(packages.containsKey("LIBERTIES")) {
|
|
|
- LinkedHashMap<String, ArrayList<Package>> network = packages.get("LIBERTIES");
|
|
|
- if(!network.containsKey(bundlekey)) {
|
|
|
- ArrayList<Package> pckges = new ArrayList<Package>();
|
|
|
- pckges.add(pckge);
|
|
|
- network.put(bundlekey, pckges);
|
|
|
- }else {
|
|
|
- network.get(bundlekey).add(pckge);
|
|
|
- }
|
|
|
- }else {
|
|
|
- ArrayList<Package> pckges = new ArrayList<Package>();
|
|
|
- pckges.add(pckge);
|
|
|
- LinkedHashMap<String, ArrayList<Package>> network = new LinkedHashMap<String, ArrayList<Package>>();
|
|
|
- network.put(bundlekey, pckges);
|
|
|
- packages.put("LIBERTIES", network);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }else if(bundlekey.startsWith("M")) {
|
|
|
- if(packages.containsKey("MOOV")) {
|
|
|
- LinkedHashMap<String, ArrayList<Package>> network = packages.get("MOOV");
|
|
|
- if(!network.containsKey(bundlekey)) {
|
|
|
- ArrayList<Package> pckges = new ArrayList<Package>();
|
|
|
- pckges.add(pckge);
|
|
|
- network.put(bundlekey, pckges);
|
|
|
- }else {
|
|
|
- network.get(bundlekey).add(pckge);
|
|
|
- }
|
|
|
- }else {
|
|
|
- ArrayList<Package> pckges = new ArrayList<Package>();
|
|
|
- pckges.add(pckge);
|
|
|
- LinkedHashMap<String, ArrayList<Package>> network = new LinkedHashMap<String, ArrayList<Package>>();
|
|
|
- network.put(bundlekey, pckges);
|
|
|
- packages.put("MOOV", network);
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- public static class Package{
|
|
|
- private String bundleName;
|
|
|
- private String bundleId;
|
|
|
- private String price;
|
|
|
- private String description;
|
|
|
-
|
|
|
- public String getBundlename() {
|
|
|
- return bundleName;
|
|
|
- }
|
|
|
- public void setBundlename(String bundlename) {
|
|
|
- this.bundleName = bundlename;
|
|
|
- }
|
|
|
- public String getBundleId() {
|
|
|
- return bundleId;
|
|
|
- }
|
|
|
- public void setBundleId(String bundleId) {
|
|
|
- this.bundleId = bundleId;
|
|
|
- }
|
|
|
- public String getPrice() {
|
|
|
- return price;
|
|
|
- }
|
|
|
- public void setPrice(String price) {
|
|
|
- this.price = price;
|
|
|
- }
|
|
|
- public String getDescription() {
|
|
|
- return description;
|
|
|
- }
|
|
|
- public void setDescription(String description) {
|
|
|
- this.description = description;
|
|
|
- }
|
|
|
-
|
|
|
- public String toString () {
|
|
|
- JSONObject obj = new JSONObject();
|
|
|
- obj.put("bundleName", this.bundleName);
|
|
|
- obj.put("bundleId", this.bundleId);
|
|
|
- obj.put("price", this.price);
|
|
|
- obj.put("description", this.description);
|
|
|
- return obj.toJSONString();
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|