|
@@ -0,0 +1,54 @@
|
|
|
|
|
+package com.psi.gabontel.mobileapp.helper;
|
|
|
|
|
+
|
|
|
|
|
+import java.io.StringWriter;
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
|
+import java.util.LinkedHashMap;
|
|
|
|
|
+import java.util.Map;
|
|
|
|
|
+
|
|
|
|
|
+import javax.ejb.Remote;
|
|
|
|
|
+import javax.ejb.Stateless;
|
|
|
|
|
+
|
|
|
|
|
+import org.jboss.logging.Logger;
|
|
|
|
|
+import org.json.simple.JSONValue;
|
|
|
|
|
+
|
|
|
|
|
+import com.psi.applicationmanager.AppManagerFunction;
|
|
|
|
|
+import com.psi.applicationmanager.AppMessage;
|
|
|
|
|
+import com.psi.common.transactions.Message;
|
|
|
|
|
+import com.psi.gabontel.mobileapp.helper.objects.SatconPackages.Package;
|
|
|
|
|
+
|
|
|
|
|
+import com.psi.gabontel.mobileapp.helper.objects.SatconPackages;
|
|
|
|
|
+
|
|
|
|
|
+@Stateless
|
|
|
|
|
+@Remote(AppManagerFunction.class)
|
|
|
|
|
+public class GetSatconPackage implements AppManagerFunction {
|
|
|
|
|
+
|
|
|
|
|
+ private static final Logger log = Logger.getLogger(GetSatconPackage.class);
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public String processTransaction(String refid, String msisdn, String message, Map<String, String> syntax) {
|
|
|
|
|
+ return manageTransaction(refid, msisdn, message, syntax).getMessage();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public AppMessage manageTransaction(String refid, String msisdn, String message, Map<String, String> syntax) {
|
|
|
|
|
+
|
|
|
|
|
+ try {
|
|
|
|
|
+ ArrayList<Package> jsondata = null;
|
|
|
|
|
+
|
|
|
|
|
+ jsondata = SatconPackages.getPackages();
|
|
|
|
|
+
|
|
|
|
|
+ StringWriter out = new StringWriter();
|
|
|
|
|
+ JSONValue.writeJSONString(jsondata, out);
|
|
|
|
|
+ out.toString();
|
|
|
|
|
+
|
|
|
|
|
+ return new Message(0, 0, out.toString());
|
|
|
|
|
+
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("Awts Error", e);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return new Message(0, 0, "{}");
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+}
|