|
@@ -1,6 +1,10 @@
|
|
|
package com.usai.ratradefiling.dataprovider;
|
|
package com.usai.ratradefiling.dataprovider;
|
|
|
|
|
|
|
|
|
|
+import android.app.Activity;
|
|
|
|
|
+import android.app.AlertDialog;
|
|
|
import android.content.Context;
|
|
import android.content.Context;
|
|
|
|
|
+import android.content.DialogInterface;
|
|
|
|
|
+import android.content.Intent;
|
|
|
import android.content.SharedPreferences.Editor;
|
|
import android.content.SharedPreferences.Editor;
|
|
|
import android.content.pm.PackageInfo;
|
|
import android.content.pm.PackageInfo;
|
|
|
import android.content.pm.PackageManager;
|
|
import android.content.pm.PackageManager;
|
|
@@ -9,11 +13,17 @@ import android.database.Cursor;
|
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
import android.database.sqlite.SQLiteDatabase;
|
|
|
import android.database.sqlite.SQLiteStatement;
|
|
import android.database.sqlite.SQLiteStatement;
|
|
|
import android.os.Bundle;
|
|
import android.os.Bundle;
|
|
|
|
|
+import android.os.Handler;
|
|
|
|
|
+import android.os.Looper;
|
|
|
import android.text.TextUtils;
|
|
import android.text.TextUtils;
|
|
|
import android.util.Log;
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
//import com.usai.apex.TradeFilingApplication;
|
|
//import com.usai.apex.TradeFilingApplication;
|
|
|
|
|
+import androidx.localbroadcastmanager.content.LocalBroadcastManager;
|
|
|
|
|
+
|
|
|
|
|
+import com.usai.ratradefiling.RootActivity;
|
|
|
import com.usai.ratradefiling.TradeFilingApplication;
|
|
import com.usai.ratradefiling.TradeFilingApplication;
|
|
|
|
|
+import com.usai.ratradefiling.my.CheckSavedActivity;
|
|
|
import com.usai.redant.rautils.utils.FileManager;
|
|
import com.usai.redant.rautils.utils.FileManager;
|
|
|
import com.usai.redant.rautils.utils.RAUtil;
|
|
import com.usai.redant.rautils.utils.RAUtil;
|
|
|
|
|
|
|
@@ -57,13 +67,17 @@ public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
|
|
|
// out
|
|
// out
|
|
|
// 20
|
|
// 20
|
|
|
// secs;
|
|
// secs;
|
|
|
- public static int AP_USER_AUTH = 1;
|
|
|
|
|
- public static int AP_USER_NOT_AUTH = 2;
|
|
|
|
|
- public static int AP_USER_NOT_EXIST = 3;
|
|
|
|
|
- public static int AP_SESSION_EXPIRED = 4;
|
|
|
|
|
|
|
|
|
|
- public static int AP_MESSAGE_NEW = 5;
|
|
|
|
|
- public static int AP_MESSAGE_NONE = 6;
|
|
|
|
|
|
|
+ public static final int RESULT_LOGIN_ON_OTHER_DEVICE = -1;
|
|
|
|
|
+
|
|
|
|
|
+ public static final int RESULT_ERROR = 1;
|
|
|
|
|
+// public static int AP_USER_AUTH = 1;
|
|
|
|
|
+// public static int AP_USER_NOT_AUTH = 2;
|
|
|
|
|
+// public static int AP_USER_NOT_EXIST = 3;
|
|
|
|
|
+// public static int AP_SESSION_EXPIRED = 4;
|
|
|
|
|
+//
|
|
|
|
|
+// public static int AP_MESSAGE_NEW = 5;
|
|
|
|
|
+// public static int AP_MESSAGE_NONE = 6;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -307,10 +321,52 @@ public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
|
|
|
try {
|
|
try {
|
|
|
JSONObject json = new JSONObject(jsonStr);
|
|
JSONObject json = new JSONObject(jsonStr);
|
|
|
String msg = json.optString("msg");
|
|
String msg = json.optString("msg");
|
|
|
- if (msg != null) {
|
|
|
|
|
|
|
+ if (!TextUtils.isEmpty(msg)) {
|
|
|
|
|
+ json.put("err_msg",msg);
|
|
|
|
|
+ }
|
|
|
|
|
+ msg = json.optString("message");
|
|
|
|
|
+ if (!TextUtils.isEmpty(msg)) {
|
|
|
json.put("err_msg",msg);
|
|
json.put("err_msg",msg);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ int result = json.optInt("result");
|
|
|
|
|
+ if(result==RESULT_LOGIN_ON_OTHER_DEVICE)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Handler handler = new Handler(Looper.getMainLooper());
|
|
|
|
|
+ final String finalMsg = msg;
|
|
|
|
|
+ final Activity activity = RAUtil.getCurrentActivity();
|
|
|
|
|
+ handler.post(new Runnable() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void run() {
|
|
|
|
|
+ AlertDialog.Builder builder = new AlertDialog.Builder(activity);
|
|
|
|
|
+ builder.setTitle("Warning");
|
|
|
|
|
+ builder.setMessage(finalMsg);
|
|
|
|
|
+ builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onClick(DialogInterface dialog, int which) {
|
|
|
|
|
+ TradeFilingApplication.logout();
|
|
|
|
|
+
|
|
|
|
|
+ dialog.dismiss();
|
|
|
|
|
+ activity.finish();
|
|
|
|
|
+// RAUtil.getCurrentActivity().finish();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ Intent bintent = new Intent("Login");
|
|
|
|
|
+ bintent.putExtra("state", false);
|
|
|
|
|
+ LocalBroadcastManager.getInstance(TradeFilingApplication.get_instance())
|
|
|
|
|
+ .sendBroadcast(bintent);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ builder.show();
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
return json;
|
|
return json;
|
|
|
} catch (JSONException e) {
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -415,6 +471,7 @@ public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
|
|
|
params = new Bundle();
|
|
params = new Bundle();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ params.putString("os","Android");
|
|
|
String password = params.getString("password");
|
|
String password = params.getString("password");
|
|
|
|
|
|
|
|
String user = params.getString("user");
|
|
String user = params.getString("user");
|
|
@@ -438,7 +495,7 @@ public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
|
|
|
params.putString("language",languageCode);
|
|
params.putString("language",languageCode);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- params.putString("os","android");
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
params.putString("app_ver",SHORT_VER);
|
|
params.putString("app_ver",SHORT_VER);
|
|
@@ -501,277 +558,277 @@ public class OnlineDataProvider extends com.usai.redant.rautils.utils.Network
|
|
|
// return parse_authinfo(jstr, name, password, parms);
|
|
// return parse_authinfo(jstr, name, password, parms);
|
|
|
// }
|
|
// }
|
|
|
|
|
|
|
|
- private static int parse_authinfo(String json, String user, String pass, Bundle parms)
|
|
|
|
|
- {
|
|
|
|
|
- if(true)
|
|
|
|
|
- throw new AssertionError("OnlineDataProvider::parse_authinfo not impl");
|
|
|
|
|
- String TAG = "net_dbg@parse_authinfo";
|
|
|
|
|
- Log.d(TAG, json);
|
|
|
|
|
- // JSONArray array;
|
|
|
|
|
- JSONObject jsobj;
|
|
|
|
|
- SQLiteDatabase db = null;
|
|
|
|
|
- try
|
|
|
|
|
-
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- // array = new JSONArray(json);
|
|
|
|
|
- jsobj = new JSONObject(json);
|
|
|
|
|
- if (jsobj.length() > 0)
|
|
|
|
|
- {
|
|
|
|
|
- // JSONObject objresult = jsobj.get.getJSONObject(0);// result
|
|
|
|
|
- // the
|
|
|
|
|
- // server result
|
|
|
|
|
- // ;
|
|
|
|
|
- if (jsobj.getInt("result") != OnlineDataProvider.AP_USER_AUTH)
|
|
|
|
|
- {
|
|
|
|
|
- TradeFilingApplication.logout();
|
|
|
|
|
- // user not authorized return
|
|
|
|
|
- Log.d(TAG,
|
|
|
|
|
- "USER NOT AUTHORIZED CODE="
|
|
|
|
|
- + jsobj.getInt("result"));
|
|
|
|
|
- return RESULT_FALSE;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- JSONObject objheader = jsobj.getJSONObject("header");
|
|
|
|
|
- String required_ver = objheader.getString("client_ver");
|
|
|
|
|
- //String ver = objheader.getString("ver");
|
|
|
|
|
- String current_ver = TradeFilingApplication.get_instance()
|
|
|
|
|
- .getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
|
|
|
|
|
- if (current_ver.compareTo(required_ver) < 0)
|
|
|
|
|
- return RESULT_VER_LOW;
|
|
|
|
|
- // JSONObject objsessionid = jsobj.getJSONObject(1); // session
|
|
|
|
|
- // id
|
|
|
|
|
- // on
|
|
|
|
|
- // server;
|
|
|
|
|
- // ApexTrackingApplication.put_sessionid(objheader
|
|
|
|
|
- // .getString("sessionid"));
|
|
|
|
|
- // ApexTrackingApplication.put_user(user);
|
|
|
|
|
- // ApexTrackingApplication.put_password(pass);
|
|
|
|
|
- // ApexTrackingApplication.put_authorization(true);
|
|
|
|
|
-// TradeFilingApplication.login(
|
|
|
|
|
-// user, pass,jsobj);
|
|
|
|
|
-// Log.d(TAG, "sessionid=" + objheader.getString("sessionid"));
|
|
|
|
|
- // JSONObject objupdate = array.getJSONObject(3); // whether
|
|
|
|
|
- // need
|
|
|
|
|
- // update ;
|
|
|
|
|
- if (objheader.getBoolean("update") == false)
|
|
|
|
|
- {
|
|
|
|
|
- // no update on the server;
|
|
|
|
|
- return RESULT_TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- // JSONObject objver = array.getJSONObject(4); // new version
|
|
|
|
|
- // get
|
|
|
|
|
- // from server;
|
|
|
|
|
-
|
|
|
|
|
- Editor editor = TradeFilingApplication
|
|
|
|
|
- .get_instance()
|
|
|
|
|
- .getSharedPreferences(user + "_Apex_auth",
|
|
|
|
|
- Context.MODE_PRIVATE).edit();
|
|
|
|
|
-
|
|
|
|
|
- editor.putInt("AuthInfoVer", objheader.getInt("ver"));
|
|
|
|
|
- JSONObject objfuncs = jsobj.getJSONObject("functions");
|
|
|
|
|
- Iterator<?> it = objfuncs.keys();
|
|
|
|
|
-// db = dbUtil.OpenDB(TradeFilingApplication.get_instance(),
|
|
|
|
|
-// null, true);
|
|
|
|
|
-// String sql = "insert into fields_info(name,aname,field_type,function_name,behavior,priority,show,user) values(?,?,?,?,?,?,?,?)";
|
|
|
|
|
-// String sql1 = "insert into actions_info(name,function_name,user,priority) values(?,?,?,?)";
|
|
|
|
|
|
|
+// private static int parse_authinfo(String json, String user, String pass, Bundle parms)
|
|
|
|
|
+// {
|
|
|
|
|
+// if(true)
|
|
|
|
|
+// throw new AssertionError("OnlineDataProvider::parse_authinfo not impl");
|
|
|
|
|
+// String TAG = "net_dbg@parse_authinfo";
|
|
|
|
|
+// Log.d(TAG, json);
|
|
|
|
|
+// // JSONArray array;
|
|
|
|
|
+// JSONObject jsobj;
|
|
|
|
|
+// SQLiteDatabase db = null;
|
|
|
|
|
+// try
|
|
|
//
|
|
//
|
|
|
-// SQLiteStatement stat = db.compileStatement(sql);
|
|
|
|
|
-// SQLiteStatement stat1 = db.compileStatement(sql1);
|
|
|
|
|
|
|
+// {
|
|
|
//
|
|
//
|
|
|
-// db.beginTransaction();
|
|
|
|
|
-// db.execSQL("update fields_info set abandon = 1 where user ='"
|
|
|
|
|
-// + user + "'");
|
|
|
|
|
-// db.execSQL("update actions_info set abandon = 1 where user ='"
|
|
|
|
|
-// + user + "'");
|
|
|
|
|
|
|
+// // array = new JSONArray(json);
|
|
|
|
|
+// jsobj = new JSONObject(json);
|
|
|
|
|
+// if (jsobj.length() > 0)
|
|
|
|
|
+// {
|
|
|
|
|
+// // JSONObject objresult = jsobj.get.getJSONObject(0);// result
|
|
|
|
|
+// // the
|
|
|
|
|
+// // server result
|
|
|
|
|
+// // ;
|
|
|
|
|
+// if (jsobj.getInt("result") != OnlineDataProvider.AP_USER_AUTH)
|
|
|
|
|
+// {
|
|
|
|
|
+// TradeFilingApplication.logout();
|
|
|
|
|
+// // user not authorized return
|
|
|
|
|
+// Log.d(TAG,
|
|
|
|
|
+// "USER NOT AUTHORIZED CODE="
|
|
|
|
|
+// + jsobj.getInt("result"));
|
|
|
|
|
+// return RESULT_FALSE;
|
|
|
|
|
+// }
|
|
|
//
|
|
//
|
|
|
-// String field_name, field_type, alias_name;
|
|
|
|
|
-// while (it.hasNext()) // loop for each function
|
|
|
|
|
|
|
+// JSONObject objheader = jsobj.getJSONObject("header");
|
|
|
|
|
+// String required_ver = objheader.getString("client_ver");
|
|
|
|
|
+// //String ver = objheader.getString("ver");
|
|
|
|
|
+// String current_ver = TradeFilingApplication.get_instance()
|
|
|
|
|
+// .getPackageManager().getPackageInfo("com.usai.apex", 0).versionName;
|
|
|
|
|
+// if (current_ver.compareTo(required_ver) < 0)
|
|
|
|
|
+// return RESULT_VER_LOW;
|
|
|
|
|
+// // JSONObject objsessionid = jsobj.getJSONObject(1); // session
|
|
|
|
|
+// // id
|
|
|
|
|
+// // on
|
|
|
|
|
+// // server;
|
|
|
|
|
+// // ApexTrackingApplication.put_sessionid(objheader
|
|
|
|
|
+// // .getString("sessionid"));
|
|
|
|
|
+// // ApexTrackingApplication.put_user(user);
|
|
|
|
|
+// // ApexTrackingApplication.put_password(pass);
|
|
|
|
|
+// // ApexTrackingApplication.put_authorization(true);
|
|
|
|
|
+//// TradeFilingApplication.login(
|
|
|
|
|
+//// user, pass,jsobj);
|
|
|
|
|
+//// Log.d(TAG, "sessionid=" + objheader.getString("sessionid"));
|
|
|
|
|
+// // JSONObject objupdate = array.getJSONObject(3); // whether
|
|
|
|
|
+// // need
|
|
|
|
|
+// // update ;
|
|
|
|
|
+// if (objheader.getBoolean("update") == false)
|
|
|
// {
|
|
// {
|
|
|
-// String func_name = (String) it.next();
|
|
|
|
|
|
|
+// // no update on the server;
|
|
|
|
|
+// return RESULT_TRUE;
|
|
|
|
|
+// }
|
|
|
|
|
+// // JSONObject objver = array.getJSONObject(4); // new version
|
|
|
|
|
+// // get
|
|
|
|
|
+// // from server;
|
|
|
//
|
|
//
|
|
|
-// // Set<String> funset = new HashSet<String>();
|
|
|
|
|
-// JSONObject objfun = objfuncs.getJSONObject(func_name);
|
|
|
|
|
-// int behavior, priority = 999;
|
|
|
|
|
-// int show = 1;
|
|
|
|
|
-// JSONObject objbehavior = objfun.getJSONObject("search");
|
|
|
|
|
-// Iterator<?> itbehavior = objbehavior.keys();
|
|
|
|
|
-// behavior = BEHAVIOR_SEARCH;
|
|
|
|
|
-// while (itbehavior.hasNext()) // loop for search fields in
|
|
|
|
|
-// // certain function
|
|
|
|
|
-// {
|
|
|
|
|
-// String field = (String) itbehavior.next();
|
|
|
|
|
-// JSONObject field_info = objbehavior
|
|
|
|
|
-// .getJSONObject(field);
|
|
|
|
|
-// field_name = field_info.getString("name");
|
|
|
|
|
-// field_type = field_info.getString("type");
|
|
|
|
|
-// alias_name = field_info.getString("alias");
|
|
|
|
|
-// priority = field_info.getInt("priority");
|
|
|
|
|
-// if (priority == 999)
|
|
|
|
|
-// show = 0;
|
|
|
|
|
-// else
|
|
|
|
|
-// show = 1;
|
|
|
|
|
-// int id = dbUtil.get_recordid(db, "fields_info",
|
|
|
|
|
-// "name='" + field_name + "' and behavior="
|
|
|
|
|
-// + behavior + " and function_name='"
|
|
|
|
|
-// + func_name + "' and user='" + user
|
|
|
|
|
-// + "'");
|
|
|
|
|
-// if (id >= 0) // record exist;
|
|
|
|
|
-// {
|
|
|
|
|
-// db.execSQL("update fields_info set abandon = 0 where _id ="
|
|
|
|
|
-// + id);
|
|
|
|
|
-// }
|
|
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-// stat.bindString(1, field_name);
|
|
|
|
|
-// stat.bindString(2, alias_name);
|
|
|
|
|
-// stat.bindString(3, field_type);
|
|
|
|
|
-// stat.bindString(4, func_name);
|
|
|
|
|
-// stat.bindLong(5, behavior);
|
|
|
|
|
-// stat.bindLong(6, priority);
|
|
|
|
|
-// stat.bindLong(7, show);
|
|
|
|
|
-// stat.bindString(8, user);
|
|
|
|
|
-// stat.executeInsert();
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+// Editor editor = TradeFilingApplication
|
|
|
|
|
+// .get_instance()
|
|
|
|
|
+// .getSharedPreferences(user + "_Apex_auth",
|
|
|
|
|
+// Context.MODE_PRIVATE).edit();
|
|
|
//
|
|
//
|
|
|
-// objbehavior = objfun.getJSONObject("result");
|
|
|
|
|
-// Iterator<?> itresult = objbehavior.keys();
|
|
|
|
|
-// behavior = BEHAVIOR_RESULT;
|
|
|
|
|
-// while (itresult.hasNext()) // loop for result fields in
|
|
|
|
|
-// // certain function
|
|
|
|
|
-// {
|
|
|
|
|
-// String field = (String) itresult.next();
|
|
|
|
|
-// JSONObject field_info = objbehavior
|
|
|
|
|
-// .getJSONObject(field);
|
|
|
|
|
-// field_name = field_info.getString("name");
|
|
|
|
|
-// field_type = field_info.getString("type");
|
|
|
|
|
-// alias_name = field_info.getString("alias");
|
|
|
|
|
-// priority = field_info.getInt("priority");
|
|
|
|
|
-// if (priority == 999)
|
|
|
|
|
-// show = 0;
|
|
|
|
|
-// else
|
|
|
|
|
-// show = 1;
|
|
|
|
|
-// int id = dbUtil.get_recordid(db, "fields_info",
|
|
|
|
|
-// "name='" + field_name + "' and behavior="
|
|
|
|
|
-// + behavior + " and function_name='"
|
|
|
|
|
-// + func_name + "' and user='" + user
|
|
|
|
|
-// + "'");
|
|
|
|
|
-// if (id >= 0) // record exist;
|
|
|
|
|
-// {
|
|
|
|
|
-// db.execSQL("update fields_info set abandon = 0 where _id ="
|
|
|
|
|
-// + id);
|
|
|
|
|
-// }
|
|
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-// stat.bindString(1, field_name);
|
|
|
|
|
-// stat.bindString(2, alias_name);
|
|
|
|
|
-// stat.bindString(3, field_type);
|
|
|
|
|
-// stat.bindString(4, func_name);
|
|
|
|
|
-// stat.bindLong(5, behavior);
|
|
|
|
|
-// stat.bindLong(6, priority);
|
|
|
|
|
-// stat.bindLong(7, show);
|
|
|
|
|
-// stat.bindString(8, user);
|
|
|
|
|
-// stat.executeInsert();
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+// editor.putInt("AuthInfoVer", objheader.getInt("ver"));
|
|
|
|
|
+// JSONObject objfuncs = jsobj.getJSONObject("functions");
|
|
|
|
|
+// Iterator<?> it = objfuncs.keys();
|
|
|
|
|
+//// db = dbUtil.OpenDB(TradeFilingApplication.get_instance(),
|
|
|
|
|
+//// null, true);
|
|
|
|
|
+//// String sql = "insert into fields_info(name,aname,field_type,function_name,behavior,priority,show,user) values(?,?,?,?,?,?,?,?)";
|
|
|
|
|
+//// String sql1 = "insert into actions_info(name,function_name,user,priority) values(?,?,?,?)";
|
|
|
|
|
+////
|
|
|
|
|
+//// SQLiteStatement stat = db.compileStatement(sql);
|
|
|
|
|
+//// SQLiteStatement stat1 = db.compileStatement(sql1);
|
|
|
|
|
+////
|
|
|
|
|
+//// db.beginTransaction();
|
|
|
|
|
+//// db.execSQL("update fields_info set abandon = 1 where user ='"
|
|
|
|
|
+//// + user + "'");
|
|
|
|
|
+//// db.execSQL("update actions_info set abandon = 1 where user ='"
|
|
|
|
|
+//// + user + "'");
|
|
|
|
|
+////
|
|
|
|
|
+//// String field_name, field_type, alias_name;
|
|
|
|
|
+//// while (it.hasNext()) // loop for each function
|
|
|
|
|
+//// {
|
|
|
|
|
+//// String func_name = (String) it.next();
|
|
|
|
|
+////
|
|
|
|
|
+//// // Set<String> funset = new HashSet<String>();
|
|
|
|
|
+//// JSONObject objfun = objfuncs.getJSONObject(func_name);
|
|
|
|
|
+//// int behavior, priority = 999;
|
|
|
|
|
+//// int show = 1;
|
|
|
|
|
+//// JSONObject objbehavior = objfun.getJSONObject("search");
|
|
|
|
|
+//// Iterator<?> itbehavior = objbehavior.keys();
|
|
|
|
|
+//// behavior = BEHAVIOR_SEARCH;
|
|
|
|
|
+//// while (itbehavior.hasNext()) // loop for search fields in
|
|
|
|
|
+//// // certain function
|
|
|
|
|
+//// {
|
|
|
|
|
+//// String field = (String) itbehavior.next();
|
|
|
|
|
+//// JSONObject field_info = objbehavior
|
|
|
|
|
+//// .getJSONObject(field);
|
|
|
|
|
+//// field_name = field_info.getString("name");
|
|
|
|
|
+//// field_type = field_info.getString("type");
|
|
|
|
|
+//// alias_name = field_info.getString("alias");
|
|
|
|
|
+//// priority = field_info.getInt("priority");
|
|
|
|
|
+//// if (priority == 999)
|
|
|
|
|
+//// show = 0;
|
|
|
|
|
+//// else
|
|
|
|
|
+//// show = 1;
|
|
|
|
|
+//// int id = dbUtil.get_recordid(db, "fields_info",
|
|
|
|
|
+//// "name='" + field_name + "' and behavior="
|
|
|
|
|
+//// + behavior + " and function_name='"
|
|
|
|
|
+//// + func_name + "' and user='" + user
|
|
|
|
|
+//// + "'");
|
|
|
|
|
+//// if (id >= 0) // record exist;
|
|
|
|
|
+//// {
|
|
|
|
|
+//// db.execSQL("update fields_info set abandon = 0 where _id ="
|
|
|
|
|
+//// + id);
|
|
|
|
|
+//// }
|
|
|
|
|
+//// else
|
|
|
|
|
+//// {
|
|
|
|
|
+//// stat.bindString(1, field_name);
|
|
|
|
|
+//// stat.bindString(2, alias_name);
|
|
|
|
|
+//// stat.bindString(3, field_type);
|
|
|
|
|
+//// stat.bindString(4, func_name);
|
|
|
|
|
+//// stat.bindLong(5, behavior);
|
|
|
|
|
+//// stat.bindLong(6, priority);
|
|
|
|
|
+//// stat.bindLong(7, show);
|
|
|
|
|
+//// stat.bindString(8, user);
|
|
|
|
|
+//// stat.executeInsert();
|
|
|
|
|
+//// }
|
|
|
|
|
+//// }
|
|
|
|
|
+////
|
|
|
|
|
+//// objbehavior = objfun.getJSONObject("result");
|
|
|
|
|
+//// Iterator<?> itresult = objbehavior.keys();
|
|
|
|
|
+//// behavior = BEHAVIOR_RESULT;
|
|
|
|
|
+//// while (itresult.hasNext()) // loop for result fields in
|
|
|
|
|
+//// // certain function
|
|
|
|
|
+//// {
|
|
|
|
|
+//// String field = (String) itresult.next();
|
|
|
|
|
+//// JSONObject field_info = objbehavior
|
|
|
|
|
+//// .getJSONObject(field);
|
|
|
|
|
+//// field_name = field_info.getString("name");
|
|
|
|
|
+//// field_type = field_info.getString("type");
|
|
|
|
|
+//// alias_name = field_info.getString("alias");
|
|
|
|
|
+//// priority = field_info.getInt("priority");
|
|
|
|
|
+//// if (priority == 999)
|
|
|
|
|
+//// show = 0;
|
|
|
|
|
+//// else
|
|
|
|
|
+//// show = 1;
|
|
|
|
|
+//// int id = dbUtil.get_recordid(db, "fields_info",
|
|
|
|
|
+//// "name='" + field_name + "' and behavior="
|
|
|
|
|
+//// + behavior + " and function_name='"
|
|
|
|
|
+//// + func_name + "' and user='" + user
|
|
|
|
|
+//// + "'");
|
|
|
|
|
+//// if (id >= 0) // record exist;
|
|
|
|
|
+//// {
|
|
|
|
|
+//// db.execSQL("update fields_info set abandon = 0 where _id ="
|
|
|
|
|
+//// + id);
|
|
|
|
|
+//// }
|
|
|
|
|
+//// else
|
|
|
|
|
+//// {
|
|
|
|
|
+//// stat.bindString(1, field_name);
|
|
|
|
|
+//// stat.bindString(2, alias_name);
|
|
|
|
|
+//// stat.bindString(3, field_type);
|
|
|
|
|
+//// stat.bindString(4, func_name);
|
|
|
|
|
+//// stat.bindLong(5, behavior);
|
|
|
|
|
+//// stat.bindLong(6, priority);
|
|
|
|
|
+//// stat.bindLong(7, show);
|
|
|
|
|
+//// stat.bindString(8, user);
|
|
|
|
|
+//// stat.executeInsert();
|
|
|
|
|
+//// }
|
|
|
|
|
+//// }
|
|
|
|
|
+////
|
|
|
|
|
+//// // objfun.has("actions")
|
|
|
|
|
+//// objbehavior = objfun.getJSONObject("actions");
|
|
|
|
|
+//// Iterator<?> itactions = objbehavior.keys();
|
|
|
|
|
+//// // behavior = BEHAVIOR_RESULT;
|
|
|
|
|
+//// while (itactions.hasNext()) // loop for result fields in
|
|
|
|
|
+//// // certain function
|
|
|
|
|
+//// {
|
|
|
|
|
+//// String actionname = (String) itactions.next();
|
|
|
|
|
+//// int action_priority = objbehavior.getInt(actionname);
|
|
|
|
|
+////
|
|
|
|
|
+//// int id = dbUtil.get_recordid(db, "actions_info",
|
|
|
|
|
+//// "name='" + actionname + "' and function_name='"
|
|
|
|
|
+//// + func_name + "' and user='" + user
|
|
|
|
|
+//// + "'");
|
|
|
|
|
+//// if (id >= 0) // record exist;
|
|
|
|
|
+//// {
|
|
|
|
|
+//// db.execSQL("update actions_info set abandon = 0 , priority="
|
|
|
|
|
+//// + action_priority + " where _id =" + id);
|
|
|
|
|
+//// }
|
|
|
|
|
+//// else
|
|
|
|
|
+//// {
|
|
|
|
|
+//// stat1.bindString(1, actionname);
|
|
|
|
|
+//// stat1.bindString(2, func_name);
|
|
|
|
|
+//// stat1.bindString(3, user);
|
|
|
|
|
+//// stat1.bindLong(4, action_priority);
|
|
|
|
|
+//// stat1.executeInsert();
|
|
|
|
|
+////
|
|
|
|
|
+//// }
|
|
|
|
|
+//// }
|
|
|
|
|
+//// }
|
|
|
|
|
+//// db.execSQL("delete from fields_info where abandon = 1");
|
|
|
|
|
+//// db.execSQL("delete from actions_info where abandon = 1");
|
|
|
|
|
+//// db.setTransactionSuccessful();
|
|
|
|
|
+//// db.endTransaction();
|
|
|
|
|
+//// editor.commit();
|
|
|
|
|
+////
|
|
|
|
|
+//// // 删除Result固定显示字段 及 更新显示最多三条
|
|
|
|
|
+//// dbUtil.deleteResultFields(db);
|
|
|
|
|
+//// dbUtil.updateResultDisplayFields(db);
|
|
|
//
|
|
//
|
|
|
-// // objfun.has("actions")
|
|
|
|
|
-// objbehavior = objfun.getJSONObject("actions");
|
|
|
|
|
-// Iterator<?> itactions = objbehavior.keys();
|
|
|
|
|
-// // behavior = BEHAVIOR_RESULT;
|
|
|
|
|
-// while (itactions.hasNext()) // loop for result fields in
|
|
|
|
|
-// // certain function
|
|
|
|
|
-// {
|
|
|
|
|
-// String actionname = (String) itactions.next();
|
|
|
|
|
-// int action_priority = objbehavior.getInt(actionname);
|
|
|
|
|
|
|
+// return RESULT_TRUE;
|
|
|
|
|
+// }
|
|
|
|
|
+// Log.d(TAG, "json is wrong");
|
|
|
|
|
+// return RESULT_USERAUTH_ERROR;
|
|
|
|
|
+// }
|
|
|
|
|
+// catch (JSONException e1)
|
|
|
|
|
+// {
|
|
|
|
|
+// // TODO Auto-generated catch block
|
|
|
|
|
+// TradeFilingApplication.logout();
|
|
|
//
|
|
//
|
|
|
-// int id = dbUtil.get_recordid(db, "actions_info",
|
|
|
|
|
-// "name='" + actionname + "' and function_name='"
|
|
|
|
|
-// + func_name + "' and user='" + user
|
|
|
|
|
-// + "'");
|
|
|
|
|
-// if (id >= 0) // record exist;
|
|
|
|
|
-// {
|
|
|
|
|
-// db.execSQL("update actions_info set abandon = 0 , priority="
|
|
|
|
|
-// + action_priority + " where _id =" + id);
|
|
|
|
|
-// }
|
|
|
|
|
-// else
|
|
|
|
|
-// {
|
|
|
|
|
-// stat1.bindString(1, actionname);
|
|
|
|
|
-// stat1.bindString(2, func_name);
|
|
|
|
|
-// stat1.bindString(3, user);
|
|
|
|
|
-// stat1.bindLong(4, action_priority);
|
|
|
|
|
-// stat1.executeInsert();
|
|
|
|
|
//
|
|
//
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// }
|
|
|
|
|
-// db.execSQL("delete from fields_info where abandon = 1");
|
|
|
|
|
-// db.execSQL("delete from actions_info where abandon = 1");
|
|
|
|
|
-// db.setTransactionSuccessful();
|
|
|
|
|
-// db.endTransaction();
|
|
|
|
|
-// editor.commit();
|
|
|
|
|
|
|
+// parms.putString("module_name", "Log");
|
|
|
|
|
+// parms.putString("action_type", "save");
|
|
|
|
|
+// parms.putString("return", json);
|
|
|
//
|
|
//
|
|
|
-// // 删除Result固定显示字段 及 更新显示最多三条
|
|
|
|
|
-// dbUtil.deleteResultFields(db);
|
|
|
|
|
-// dbUtil.updateResultDisplayFields(db);
|
|
|
|
|
-
|
|
|
|
|
- return RESULT_TRUE;
|
|
|
|
|
- }
|
|
|
|
|
- Log.d(TAG, "json is wrong");
|
|
|
|
|
- return RESULT_USERAUTH_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
- catch (JSONException e1)
|
|
|
|
|
- {
|
|
|
|
|
- // TODO Auto-generated catch block
|
|
|
|
|
- TradeFilingApplication.logout();
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- parms.putString("module_name", "Log");
|
|
|
|
|
- parms.putString("action_type", "save");
|
|
|
|
|
- parms.putString("return", json);
|
|
|
|
|
-
|
|
|
|
|
- String jstr = getJson(OnlineDataProvider.URL_LOG, parms);
|
|
|
|
|
-
|
|
|
|
|
- e1.printStackTrace();
|
|
|
|
|
- Log.d(TAG, "json is wrong");
|
|
|
|
|
- }
|
|
|
|
|
- catch (NameNotFoundException e)
|
|
|
|
|
- {
|
|
|
|
|
- // TODO Auto-generated catch block
|
|
|
|
|
-
|
|
|
|
|
- TradeFilingApplication.logout();
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- parms.putString("module_name", "Log");
|
|
|
|
|
- parms.putString("action_type", "save");
|
|
|
|
|
- parms.putString("return", json);
|
|
|
|
|
- String jstr = getJson(OnlineDataProvider.URL_LOG, parms);
|
|
|
|
|
- e.printStackTrace();
|
|
|
|
|
- }
|
|
|
|
|
- finally
|
|
|
|
|
- {
|
|
|
|
|
-// dbUtil.CloseDB(db);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // try
|
|
|
|
|
- // {
|
|
|
|
|
- // m_RemoteVerCode = Integer
|
|
|
|
|
- // .parseInt(obj.getString("verCode"));
|
|
|
|
|
- // m_RemoteVerName = obj.getString("verName");
|
|
|
|
|
- // m_NewVerUrl = obj.getString("URL");
|
|
|
|
|
- // }
|
|
|
|
|
- // catch (Exception e)
|
|
|
|
|
- // {
|
|
|
|
|
- // m_RemoteVerCode = -1;
|
|
|
|
|
- // m_RemoteVerName = "";
|
|
|
|
|
- // m_NewVerUrl = "";
|
|
|
|
|
- // dbgUtil.Log(Log.INFO,TAG, "download failed json file wrong!");
|
|
|
|
|
- // return false;
|
|
|
|
|
- // }
|
|
|
|
|
- Log.d(TAG, "json is wrong");
|
|
|
|
|
- return RESULT_USERAUTH_ERROR;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// String jstr = getJson(OnlineDataProvider.URL_LOG, parms);
|
|
|
|
|
+//
|
|
|
|
|
+// e1.printStackTrace();
|
|
|
|
|
+// Log.d(TAG, "json is wrong");
|
|
|
|
|
+// }
|
|
|
|
|
+// catch (NameNotFoundException e)
|
|
|
|
|
+// {
|
|
|
|
|
+// // TODO Auto-generated catch block
|
|
|
|
|
+//
|
|
|
|
|
+// TradeFilingApplication.logout();
|
|
|
|
|
+//
|
|
|
|
|
+//
|
|
|
|
|
+// parms.putString("module_name", "Log");
|
|
|
|
|
+// parms.putString("action_type", "save");
|
|
|
|
|
+// parms.putString("return", json);
|
|
|
|
|
+// String jstr = getJson(OnlineDataProvider.URL_LOG, parms);
|
|
|
|
|
+// e.printStackTrace();
|
|
|
|
|
+// }
|
|
|
|
|
+// finally
|
|
|
|
|
+// {
|
|
|
|
|
+//// dbUtil.CloseDB(db);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// // try
|
|
|
|
|
+// // {
|
|
|
|
|
+// // m_RemoteVerCode = Integer
|
|
|
|
|
+// // .parseInt(obj.getString("verCode"));
|
|
|
|
|
+// // m_RemoteVerName = obj.getString("verName");
|
|
|
|
|
+// // m_NewVerUrl = obj.getString("URL");
|
|
|
|
|
+// // }
|
|
|
|
|
+// // catch (Exception e)
|
|
|
|
|
+// // {
|
|
|
|
|
+// // m_RemoteVerCode = -1;
|
|
|
|
|
+// // m_RemoteVerName = "";
|
|
|
|
|
+// // m_NewVerUrl = "";
|
|
|
|
|
+// // dbgUtil.Log(Log.INFO,TAG, "download failed json file wrong!");
|
|
|
|
|
+// // return false;
|
|
|
|
|
+// // }
|
|
|
|
|
+// Log.d(TAG, "json is wrong");
|
|
|
|
|
+// return RESULT_USERAUTH_ERROR;
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
// private void writeData(JSONObject allData)
|
|
// private void writeData(JSONObject allData)
|
|
|
// {
|
|
// {
|