mirror of
https://github.com/freeedcom/ai-codereviewer.git
synced 2025-06-30 21:04:16 +00:00
add project adins
This commit is contained in:
parent
ad06ac5505
commit
f8f85d679d
5299 changed files with 625430 additions and 0 deletions
|
@ -0,0 +1,497 @@
|
|||
package com.adins.mss.coll;
|
||||
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.NewMainActivity;
|
||||
import com.adins.mss.base.about.activity.AboutActivity;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.mainmenu.NewMenuItem;
|
||||
import com.adins.mss.base.timeline.NewTimelineFragment;
|
||||
import com.adins.mss.base.todolist.ToDoList;
|
||||
import com.adins.mss.base.todolist.form.PriorityTabFragment;
|
||||
import com.adins.mss.base.todolist.form.TaskListFragment_new;
|
||||
import com.adins.mss.base.todolist.form.TaskList_Fragment;
|
||||
import com.adins.mss.base.todolist.todayplanrepository.TodayPlanRepository;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.LocaleHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.coll.closingtask.models.ClosingTaskListResponse;
|
||||
import com.adins.mss.coll.closingtask.models.ClosingTaskRequest;
|
||||
import com.adins.mss.coll.closingtask.senders.ClosingTaskSender;
|
||||
import com.adins.mss.coll.dashboardcollection.view.DashboardCollectionView;
|
||||
import com.adins.mss.coll.fragments.CollectionActivityFragment;
|
||||
import com.adins.mss.coll.fragments.DashBoardFragment;
|
||||
import com.adins.mss.coll.fragments.DepositReportACFragment;
|
||||
import com.adins.mss.coll.fragments.DepositReportFragmentNew;
|
||||
import com.adins.mss.coll.fragments.DepositReportPCFragment;
|
||||
import com.adins.mss.coll.fragments.GuidelineFaqFragment;
|
||||
import com.adins.mss.coll.fragments.InstallmentScheduleFragment;
|
||||
import com.adins.mss.coll.fragments.PaymentHistoryFragment;
|
||||
import com.adins.mss.coll.fragments.ReceiptHistoryFragment;
|
||||
import com.adins.mss.coll.fragments.ReportSummaryFragment;
|
||||
import com.adins.mss.coll.models.DocumentListResponse;
|
||||
import com.adins.mss.coll.services.MCLocationTrackingService;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Emergency;
|
||||
import com.adins.mss.dao.GeneralParameter;
|
||||
import com.adins.mss.foundation.db.dataaccess.EmergencyDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.GeneralParameterDataAccess;
|
||||
import com.adins.mss.foundation.db.dataaccess.MenuDataAccess;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.firebase.analytics.FirebaseAnalytics;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
import com.services.ForegroundServiceNotification;
|
||||
import com.services.MainServices;
|
||||
import com.services.NotificationThread;
|
||||
import com.services.plantask.ChangePlanService;
|
||||
import com.services.plantask.ConnectivityChangeReceiver;
|
||||
import com.services.plantask.StartVisitJob;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
|
||||
public class NewMCMainActivity extends NewMainActivity {
|
||||
|
||||
private FirebaseAnalytics screenName;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
NewMainActivity.setMss(this.getClass());
|
||||
/**
|
||||
* Nendi | 2019.06.17
|
||||
* Update Foreground Service
|
||||
* @support Android >= 8.0
|
||||
*/
|
||||
startLocationHistoryService();
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
screenName = FirebaseAnalytics.getInstance(this);
|
||||
|
||||
try {
|
||||
NewMCMainActivity.mnTaskList.setCounter(String.valueOf(ToDoList.getCounterTaskList(this)));
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
|
||||
Tool.installProvider(getApplicationContext());
|
||||
|
||||
if(savedInstanceState ==null) {
|
||||
Fragment fragment1 = new NewTimelineFragment();
|
||||
FragmentTransaction transaction = fragmentManager.beginTransaction();
|
||||
transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
|
||||
transaction.add(com.adins.mss.base.R.id.content_frame, fragment1);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
//new
|
||||
try {
|
||||
Global.FEATURE_REVISIT_COLLECTION = MenuDataAccess.isHaveReVisitMenu(getApplicationContext());
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
Global.installmentSchIntent = new Intent(getApplicationContext(), InstallmentScheduleFragment.class);
|
||||
Global.paymentHisIntent = new Intent(getApplicationContext(), PaymentHistoryFragment.class);
|
||||
Global.collectionActIntent = new Intent(getApplicationContext(), CollectionActivityFragment.class);
|
||||
Global.receiptHistoryIntent = new Intent(getApplicationContext(), ReceiptHistoryFragment.class);
|
||||
}
|
||||
|
||||
private void checkPlanTaskMode() {
|
||||
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
GeneralParameter planTaskGP = GeneralParameterDataAccess.getOne(this,uuid_user,Global.GS_PLAN_TASK);
|
||||
if(planTaskGP != null && planTaskGP.getGs_value().equals("1")){
|
||||
Global.PLAN_TASK_ENABLED = true;
|
||||
}else {
|
||||
Global.PLAN_TASK_ENABLED = false;
|
||||
}
|
||||
|
||||
TodayPlanRepository todayPlanRepository = GlobalData.getSharedGlobalData().getTodayPlanRepo();
|
||||
if(todayPlanRepository == null && Global.PLAN_TASK_ENABLED){
|
||||
todayPlanRepository = new TodayPlanRepository(getApplicationContext());
|
||||
GlobalData.getSharedGlobalData().setTodayPlanRepo(todayPlanRepository);
|
||||
}else if(!Global.PLAN_TASK_ENABLED && todayPlanRepository != null){
|
||||
todayPlanRepository = null;//clear
|
||||
}
|
||||
|
||||
if(todayPlanRepository != null && Global.PLAN_TASK_ENABLED){
|
||||
todayPlanRepository.checkPlanAfterSync();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerNetworkCallbacks() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
nCallback = new ConnectivityChangeReceiver(new ConnectivityChangeReceiver.ConnectivityListener() {
|
||||
@Override
|
||||
public void onOnline() {
|
||||
//do task when online
|
||||
String uuid_user = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
GeneralParameter planTaskGP = GeneralParameterDataAccess
|
||||
.getOne(getApplicationContext(),uuid_user,Global.GS_PLAN_TASK);
|
||||
if(planTaskGP != null && planTaskGP.getGs_value().equals("1")){
|
||||
Global.PLAN_TASK_ENABLED = true;
|
||||
}else {
|
||||
Global.PLAN_TASK_ENABLED = false;
|
||||
}
|
||||
|
||||
if(Global.PLAN_TASK_ENABLED){
|
||||
//sync start visit
|
||||
TodayPlanRepository todayPlanRepo = GlobalData.getSharedGlobalData().getTodayPlanRepo();
|
||||
if(todayPlanRepo == null){
|
||||
todayPlanRepo = new TodayPlanRepository(getApplicationContext());
|
||||
}
|
||||
if(todayPlanRepo.isNeedSync()){
|
||||
Intent startVisitServ = new Intent(getApplicationContext(), StartVisitJob.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(startVisitServ);
|
||||
}
|
||||
else
|
||||
startService(startVisitServ);
|
||||
}
|
||||
|
||||
//sync change plan
|
||||
String[] lastOffChangePlan = todayPlanRepo.getLastOffChangePlanInfo();
|
||||
if(lastOffChangePlan != null && lastOffChangePlan.length > 0){
|
||||
Intent changePlanServ = new Intent(getApplicationContext(), ChangePlanService.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(changePlanServ);
|
||||
}
|
||||
else
|
||||
startService(changePlanServ);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onOffline() {
|
||||
//do task when offline
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
super.registerNetworkCallbacks();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
Context context = newBase;
|
||||
Locale locale;
|
||||
try{
|
||||
locale = new Locale(GlobalData.getSharedGlobalData().getLocale());
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} catch (Exception e) {
|
||||
locale = new Locale(LocaleHelper.ENGLSIH);
|
||||
context = LocaleHelper.wrap(newBase, locale);
|
||||
} finally {
|
||||
super.attachBaseContext(context);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Intent getLocationServiceIntent() {
|
||||
return new Intent(this, MCLocationTrackingService.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onNewIntent(Intent intent) {
|
||||
super.onNewIntent(intent);
|
||||
actionFromNotif(intent);
|
||||
}
|
||||
|
||||
protected void actionFromNotif(Intent intent){
|
||||
try {
|
||||
String action = intent.getAction();
|
||||
if(action!=null && action.equals(NotificationThread.TASKLIST_NOTIFICATION_KEY)){
|
||||
if(Global.PLAN_TASK_ENABLED){
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.mn_plantask));
|
||||
TaskListFragment_new tasklistFragment = new TaskListFragment_new();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putInt(TaskList_Fragment.BUND_KEY_PAGE,1);
|
||||
tasklistFragment.setArguments(bundle);
|
||||
FragmentTransaction fragmentTransaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
fragmentTransaction.replace(com.adins.mss.base.R.id.content_frame,tasklistFragment);
|
||||
fragmentTransaction.addToBackStack(null);
|
||||
fragmentTransaction.commit();
|
||||
return;
|
||||
}
|
||||
logEventCountMenuAccessed(getString(com.adins.mss.base.R.string.title_mn_tasklist));
|
||||
Fragment fragment1 = new PriorityTabFragment();
|
||||
FragmentTransaction transaction = NewMainActivity.fragmentManager.beginTransaction();
|
||||
transaction.setCustomAnimations(com.adins.mss.base.R.anim.activity_open_translate, com.adins.mss.base.R.anim.activity_close_scale, com.adins.mss.base.R.anim.activity_open_scale, com.adins.mss.base.R.anim.activity_close_translate);
|
||||
transaction.replace(com.adins.mss.base.R.id.content_frame, fragment1);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commitAllowingStateLoss();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
//Set Firebase screen name
|
||||
screenName.setCurrentScreen(this,getString(R.string.screen_name_coll_main_menu),null);
|
||||
|
||||
checkPlanTaskMode();
|
||||
if (Global.REDIRECT_TIMELINE.equals(Global.getREDIRECT())){
|
||||
super.openTimeline();
|
||||
Global.setREDIRECT(null);
|
||||
return;
|
||||
}
|
||||
|
||||
Global.syncIntent = new Intent(getApplicationContext(), MCSynchronizeActivity.class);
|
||||
if(NewMainActivity.getMss()==null) {
|
||||
NewMainActivity.setMss(this.getClass());
|
||||
MainServices.mainClass = mss;
|
||||
}
|
||||
NewMainActivity.setMainMenuClass(NewMCMainActivity.class);
|
||||
try {
|
||||
NewMCMainActivity.mnTaskList.setCounter(String.valueOf(ToDoList.getCounterTaskList(this)));
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O && !ForegroundServiceNotification.isServiceAvailable(this, MCLocationTrackingService.class)) {
|
||||
startLocationHistoryService();
|
||||
}
|
||||
if(null != GlobalData.getSharedGlobalData().getUser().getIs_emergency() &&
|
||||
(GlobalData.getSharedGlobalData().getUser().getIs_emergency().equalsIgnoreCase(Global.EMERGENCY_SEND_SUCCESS)
|
||||
||GlobalData.getSharedGlobalData().getUser().getIs_emergency().equalsIgnoreCase(Global.EMERGENCY_SEND_PENDING))){
|
||||
Emergency emergency = new Emergency();
|
||||
emergency.setUser(GlobalData.getSharedGlobalData().getUser());
|
||||
EmergencyDataAccess.addOrReplace(getApplicationContext(),emergency);
|
||||
Intent intent = new Intent(this,EmergencyLockActivity.class);
|
||||
startActivity(intent);
|
||||
}else{
|
||||
List<Emergency> emergencies = EmergencyDataAccess.getByUser(getApplicationContext(),GlobalData.getSharedGlobalData().getUser().getUuid_user());
|
||||
if(!emergencies.isEmpty()){
|
||||
Intent intent = new Intent(this,EmergencyLockActivity.class);
|
||||
startActivity(intent);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void startLocationHistoryService() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startForegroundService(getLocationServiceIntent());
|
||||
} else {
|
||||
startService(getLocationServiceIntent());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
super.onBackPressed();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Intent getIntentSynchronize() {
|
||||
return new Intent(this, MCSynchronizeActivity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void ApplicationMenu(NewMenuItem menuItem) {
|
||||
super.ApplicationMenu(menuItem);
|
||||
|
||||
if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_reportsummary))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_reportsummary));
|
||||
gotoReportSummary();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_depositreport))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_depositreport));
|
||||
gotoDepositReport();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_depositreportAC))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_depositreportAC));
|
||||
gotoDepositReportAC();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_depositreportPC))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_depositreportPC));
|
||||
gotoDepositReportPC();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_closing_task))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_closing_task));
|
||||
gotoClosingTask();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_dashboard))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_dashboard));
|
||||
goToDashBoard();
|
||||
} else if (menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_dashboard_collection))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_dashboard_collection));
|
||||
goToDashboardCollection();
|
||||
} else if(menuItem.getName().equalsIgnoreCase(getString(R.string.title_mn_guideline_faq))) {
|
||||
logEventCountMenuAccessed(getString(R.string.title_mn_guideline_faq));
|
||||
goToGuidelineFaq();
|
||||
}
|
||||
}
|
||||
|
||||
protected void goToGuidelineFaq(){
|
||||
new GetDocumentList(getApplicationContext()).execute();
|
||||
}
|
||||
|
||||
public class GetDocumentList extends AsyncTask<Void, Void, String>{
|
||||
private ProgressDialog progressDialog;
|
||||
private Context context;
|
||||
|
||||
public GetDocumentList(Context context){
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPreExecute() {
|
||||
progressDialog = ProgressDialog.show(NewMCMainActivity.this, "", getString(R.string.progressWait), true);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doInBackground(Void... voids) {
|
||||
try {
|
||||
if(Tool.isInternetconnected(NewMCMainActivity.this)){
|
||||
String result = null;
|
||||
MssRequestType requestType = new MssRequestType();
|
||||
requestType.setAudit(GlobalData.getSharedGlobalData().getAuditData());
|
||||
|
||||
String json = GsonHelper.toJson(requestType);
|
||||
String url = GlobalData.getSharedGlobalData().getURL_GET_DOCUMENT_LIST();
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(NewMCMainActivity.this, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
// Firebase Performance Trace Network Request
|
||||
HttpMetric networkMetric = FirebasePerformance.getInstance().newHttpMetric(
|
||||
url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
|
||||
if(serverResult != null){
|
||||
if(serverResult.isOK()){
|
||||
try{
|
||||
result = serverResult.getResult();
|
||||
}catch (Exception e){
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}catch (Exception e){
|
||||
FireCrash.log(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(String result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if(progressDialog != null && progressDialog.isShowing()){
|
||||
progressDialog.dismiss();
|
||||
}
|
||||
|
||||
DocumentListResponse documentListResponse = new DocumentListResponse();
|
||||
if(result != null){
|
||||
documentListResponse = GsonHelper.fromJson(result, DocumentListResponse.class);
|
||||
|
||||
GuidelineFaqFragment guidelineFaqFragment = GuidelineFaqFragment.newInstance(documentListResponse.getDocumentList());
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, guidelineFaqFragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gotoTimeline() {
|
||||
super.gotoTimeline();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void gotoAbout() {
|
||||
AboutActivity.setChangeLog(ChangeLog.getChangeLog(this), 0);
|
||||
super.gotoAbout();
|
||||
}
|
||||
|
||||
protected void gotoReportSummary() {
|
||||
fragment = new ReportSummaryFragment();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoDepositReport() {
|
||||
fragment = new DepositReportFragmentNew();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
|
||||
protected void gotoDepositReportAC() {
|
||||
fragment = new DepositReportACFragment();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
|
||||
protected void gotoDepositReportPC() {
|
||||
fragment = new DepositReportPCFragment();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void goToDashBoard() {
|
||||
fragment = new DashBoardFragment();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.setCustomAnimations(R.anim.activity_open_translate,R.anim.activity_close_scale,R.anim.activity_open_scale,R.anim.activity_close_translate);
|
||||
transaction.replace(R.id.content_frame, fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void goToDashboardCollection(){
|
||||
DashboardCollectionView fragment = new DashboardCollectionView();
|
||||
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
|
||||
transaction.replace(R.id.content_frame,fragment);
|
||||
transaction.addToBackStack(null);
|
||||
transaction.commit();
|
||||
}
|
||||
|
||||
protected void gotoClosingTask() {
|
||||
ClosingTaskRequest request = new ClosingTaskRequest();
|
||||
request.setFlag(ClosingTaskRequest.CLOSING_TASK_LIST);
|
||||
ClosingTaskSender<ClosingTaskListResponse> sender = new ClosingTaskSender<>(
|
||||
this, request, ClosingTaskListResponse.class);
|
||||
sender.execute();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.mikepenz.aboutlibraries.util;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
|
||||
/**
|
||||
* Created by mikepenz on 08.09.14.
|
||||
*/
|
||||
public class Util {
|
||||
public static PackageInfo getPackageInfo(Context ctx) {
|
||||
//get the packageManager to load and read some values :D
|
||||
PackageManager pm = ctx.getPackageManager();
|
||||
//get the packageName
|
||||
String packageName = ctx.getPackageName();
|
||||
//Try to load the applicationInfo
|
||||
PackageInfo packageInfo = null;
|
||||
try {
|
||||
packageInfo = pm.getPackageInfo(packageName, 0);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
return packageInfo;
|
||||
}
|
||||
|
||||
public static ApplicationInfo getApplicationInfo(Context ctx) {
|
||||
//get the packageManager to load and read some values :D
|
||||
PackageManager pm = ctx.getPackageManager();
|
||||
//get the packageName
|
||||
String packageName = ctx.getPackageName();
|
||||
//Try to load the applicationInfo
|
||||
ApplicationInfo appInfo = null;
|
||||
try {
|
||||
appInfo = pm.getApplicationInfo(packageName, 0);
|
||||
} catch (Exception ex) {
|
||||
}
|
||||
return appInfo;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,68 @@
|
|||
package com.adins.mss.foundation.location;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.dao.LocationInfo;
|
||||
import com.adins.mss.foundation.db.dataaccess.LocationInfoDataAccess;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author gigin.ginanjar
|
||||
*/
|
||||
public class UserLocationBean extends LocationInfo {
|
||||
|
||||
/**
|
||||
* Gets List of Locations from Database
|
||||
*
|
||||
* @param context
|
||||
* @return all Location
|
||||
*/
|
||||
|
||||
public static List<LocationInfo> getFromDB(Context context) {
|
||||
String uuid = GlobalData.getSharedGlobalData().getUser().getUuid_user();
|
||||
return LocationInfoDataAccess.getAll(context, uuid);
|
||||
}
|
||||
|
||||
// public String toSubmitString() {
|
||||
// Gson gson = new Gson();
|
||||
// return gson.toJson(this);
|
||||
// }
|
||||
|
||||
/**
|
||||
* Set a location
|
||||
*
|
||||
* @param locationInfo
|
||||
*/
|
||||
public void setLocation(LocationInfo locationInfo) {
|
||||
this.setUuid_location_info(locationInfo.getUuid_location_info());
|
||||
this.setLatitude(locationInfo.getLatitude());
|
||||
this.setLongitude(locationInfo.getLongitude());
|
||||
this.setMcc(locationInfo.getMcc());
|
||||
this.setMnc(locationInfo.getMnc());
|
||||
this.setLac(locationInfo.getLac());
|
||||
this.setCid(locationInfo.getCid());
|
||||
this.setHandset_time(locationInfo.getHandset_time());
|
||||
this.setMode(locationInfo.getMode());
|
||||
this.setAccuracy(locationInfo.getAccuracy());
|
||||
this.setGps_time(locationInfo.getGps_time());
|
||||
this.setIs_gps_time(locationInfo.getIs_gps_time());
|
||||
this.setUsr_crt(locationInfo.getUsr_crt());
|
||||
this.setDtm_crt(locationInfo.getDtm_crt());
|
||||
this.setUuid_user(locationInfo.getUuid_user());
|
||||
}
|
||||
|
||||
public String toAnswerString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(getLatitude()).append(",")
|
||||
.append(getLongitude()).append(",")
|
||||
.append(getCid()).append(",")
|
||||
.append(getMcc()).append(",")
|
||||
.append(getMnc()).append(",")
|
||||
.append(getLac());
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
/*
|
||||
* This source is part of the
|
||||
* _____ ___ ____
|
||||
* __ / / _ \/ _ | / __/___ _______ _
|
||||
* / // / , _/ __ |/ _/_/ _ \/ __/ _ `/
|
||||
* \___/_/|_/_/ |_/_/ (_)___/_/ \_, /
|
||||
* /___/
|
||||
* repository.
|
||||
*
|
||||
* Copyright (C) 2013 Benoit 'BoD' Lubek (BoD@JRAF.org)
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.acra.jraf.android.util.activitylifecyclecallbackscompat;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.Application.ActivityLifecycleCallbacks;
|
||||
import android.os.Bundle;
|
||||
|
||||
/**
|
||||
* Wraps an {@link ActivityLifecycleCallbacksCompat} into an {@link ActivityLifecycleCallbacks}.
|
||||
*/
|
||||
/* package */class ActivityLifecycleCallbacksWrapper implements ActivityLifecycleCallbacks {
|
||||
private org.acra.jraf.android.util.activitylifecyclecallbackscompat.ActivityLifecycleCallbacksCompat mCallback;
|
||||
|
||||
public ActivityLifecycleCallbacksWrapper(org.acra.jraf.android.util.activitylifecyclecallbackscompat.ActivityLifecycleCallbacksCompat callback) {
|
||||
mCallback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
|
||||
mCallback.onActivityCreated(activity, savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStarted(Activity activity) {
|
||||
mCallback.onActivityStarted(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityResumed(Activity activity) {
|
||||
mCallback.onActivityResumed(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityPaused(Activity activity) {
|
||||
mCallback.onActivityPaused(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityStopped(Activity activity) {
|
||||
mCallback.onActivityStopped(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
|
||||
mCallback.onActivitySaveInstanceState(activity, outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityDestroyed(Activity activity) {
|
||||
mCallback.onActivityDestroyed(activity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare the current wrapped callback with another object wrapped callback
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (!(object instanceof ActivityLifecycleCallbacksWrapper))
|
||||
return false;
|
||||
ActivityLifecycleCallbacksWrapper that = (ActivityLifecycleCallbacksWrapper) object;
|
||||
return null == mCallback ? null == that.mCallback : mCallback.equals(that.mCallback);
|
||||
}
|
||||
|
||||
/**
|
||||
* return wrapped callback object hashCode
|
||||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return null != mCallback ? mCallback.hashCode() : 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,79 @@
|
|||
package com.adins.mss.base.timeline.comment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.dao.Comment;
|
||||
import com.adins.mss.foundation.formatter.Formatter;
|
||||
import com.androidquery.AQuery;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class CommentArrayAdapter extends ArrayAdapter<Comment> {
|
||||
private Context mContext;
|
||||
private List<Comment> comments;
|
||||
private AQuery query;
|
||||
|
||||
/**
|
||||
* Inisialisasi Comment Array Adapter
|
||||
*
|
||||
* @param context - Context
|
||||
* @param comments - List of Comment
|
||||
*/
|
||||
public CommentArrayAdapter(Context context, List<Comment> comments) {
|
||||
super(context, R.layout.comment_item_layout, comments);
|
||||
this.mContext = context;
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
int count = 0;
|
||||
try {
|
||||
count = comments.size();
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
count = 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||
|
||||
if (null == convertView) {
|
||||
convertView = LayoutInflater.from(getContext()).inflate(R.layout.comment_item_layout, parent, false);
|
||||
} else {
|
||||
|
||||
}
|
||||
query = new AQuery(convertView);
|
||||
if (comments == null) {
|
||||
getLayoutIfDataNotFound();
|
||||
} else {
|
||||
Comment comment = comments.get(position);
|
||||
String usr_crt = comment.getUsr_crt();
|
||||
String content = comment.getComment();
|
||||
Date dtm_crt = comment.getDtm_crt();
|
||||
String time = Formatter.formatDate(dtm_crt, Global.DATE_TIMESEC_TIMELINE_FORMAT);
|
||||
|
||||
query.id(R.id.txt_usrCrt).text(usr_crt).visible();
|
||||
query.id(R.id.contentComment).text(content);
|
||||
query.id(R.id.txt_timeCrt).text(time).visible();
|
||||
}
|
||||
|
||||
return convertView;
|
||||
}
|
||||
|
||||
public void getLayoutIfDataNotFound() {
|
||||
query.id(R.id.txt_usrCrt).visibility(View.GONE);
|
||||
query.id(R.id.txt_timeCrt).visibility(View.GONE);
|
||||
query.id(R.id.contentComment).text("No Comment");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,92 @@
|
|||
package com.adins.mss.foundation.broadcast;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.AsyncTask;
|
||||
|
||||
import com.adins.mss.base.GlobalData;
|
||||
import com.adins.mss.base.R;
|
||||
import com.adins.mss.base.crashlytics.FireCrash;
|
||||
import com.adins.mss.base.util.GsonHelper;
|
||||
import com.adins.mss.base.util.Utility;
|
||||
import com.adins.mss.constant.Global;
|
||||
import com.adins.mss.foundation.db.dataaccess.BroadcastDataAccess;
|
||||
import com.adins.mss.foundation.formatter.Tool;
|
||||
import com.adins.mss.foundation.http.HttpConnectionResult;
|
||||
import com.adins.mss.foundation.http.HttpCryptedConnection;
|
||||
import com.adins.mss.foundation.http.MssResponseType;
|
||||
import com.google.firebase.perf.FirebasePerformance;
|
||||
import com.google.firebase.perf.metrics.HttpMetric;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SubmitReadBroadcastTask extends AsyncTask<Void, Void, Boolean> {
|
||||
private Context context;
|
||||
private String uuidUser, uuidNotif;
|
||||
private String errMsg;
|
||||
|
||||
public SubmitReadBroadcastTask(Context context, String uuidUser, String uuidNotif) {
|
||||
this.context = context;
|
||||
this.uuidUser = uuidUser;
|
||||
this.uuidNotif = uuidNotif;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Boolean doInBackground(Void... voids) {
|
||||
SubmitReadBroadcastRequest request = new SubmitReadBroadcastRequest();
|
||||
request.setUuidUser(uuidUser);
|
||||
request.setUuidNotification(uuidNotif);
|
||||
|
||||
String json = GsonHelper.toJson(request);
|
||||
String url = "";
|
||||
boolean encrypt = GlobalData.getSharedGlobalData().isEncrypt();
|
||||
boolean decrypt = GlobalData.getSharedGlobalData().isDecrypt();
|
||||
HttpCryptedConnection httpConn = new HttpCryptedConnection(context, encrypt, decrypt);
|
||||
HttpConnectionResult serverResult = null;
|
||||
|
||||
//Firebase Performance Trace HTTP Request
|
||||
HttpMetric networkMetric =
|
||||
FirebasePerformance.getInstance().newHttpMetric(url, FirebasePerformance.HttpMethod.POST);
|
||||
Utility.metricStart(networkMetric, json);
|
||||
|
||||
try {
|
||||
if(!Tool.isInternetconnected(context)){
|
||||
errMsg = context.getString(R.string.no_internet_connection);
|
||||
return false;
|
||||
}
|
||||
|
||||
serverResult = httpConn.requestToServer(url, json, Global.DEFAULTCONNECTIONTIMEOUT);
|
||||
Utility.metricStop(networkMetric, serverResult);
|
||||
|
||||
if (serverResult == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!serverResult.isOK()){
|
||||
errMsg = serverResult.getResult();
|
||||
return false;
|
||||
}
|
||||
|
||||
MssResponseType responseType = GsonHelper.fromJson(serverResult.getResult(), MssResponseType.class);
|
||||
if(responseType.getStatus().getCode() != 0){
|
||||
errMsg = responseType.getStatus().getMessage();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (Exception e) {
|
||||
FireCrash.log(e);
|
||||
e.printStackTrace();
|
||||
errMsg = e.getMessage();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPostExecute(Boolean result) {
|
||||
super.onPostExecute(result);
|
||||
|
||||
if(result){
|
||||
BroadcastDataAccess.deleteByUuid(context, uuidNotif);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,78 @@
|
|||
package com.adins.mss.svy.reassignment;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class JsonRequestSubmitAssign extends MssRequestType{
|
||||
/** Property uuid_user */
|
||||
@SerializedName("uuidUserAssign")
|
||||
String uuidUserAssign;
|
||||
|
||||
/** Property uuid_task_h */
|
||||
@SerializedName("uuid_task_h")
|
||||
String uuid_task_h;
|
||||
|
||||
/** Property flag */
|
||||
@SerializedName("flag")
|
||||
String flag;
|
||||
|
||||
/** Property notes */
|
||||
@SerializedName("notes")
|
||||
String notes;
|
||||
|
||||
/**
|
||||
* Gets the uuid_user
|
||||
*/
|
||||
public String getUuidUserAssign() {
|
||||
return this.uuidUserAssign;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the uuid_user
|
||||
*/
|
||||
public void setUuidUserAssign(String value) {
|
||||
this.uuidUserAssign = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the uuid_task_h
|
||||
*/
|
||||
public String getUuid_task_h() {
|
||||
return this.uuid_task_h;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the uuid_task_h
|
||||
*/
|
||||
public void setUuid_task_h(String value) {
|
||||
this.uuid_task_h = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the flag
|
||||
*/
|
||||
public String getFlag() {
|
||||
return this.flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the flag
|
||||
*/
|
||||
public void setFlag(String value) {
|
||||
this.flag = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the notes
|
||||
*/
|
||||
public String getNotes() {
|
||||
return this.notes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the notes
|
||||
*/
|
||||
public void setNotes(String value) {
|
||||
this.notes = value;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.adins.mss.base.todolist.todayplanrepository;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class RequestChangePlan extends MssRequestType {
|
||||
@SerializedName("new_uuid_task_h")
|
||||
private String newUuidTaskHPlan;
|
||||
@SerializedName("old_uuid_task_h")
|
||||
private String oldUuidTaskHPlan;
|
||||
|
||||
public RequestChangePlan() {
|
||||
}
|
||||
|
||||
public RequestChangePlan(String newUuidTaskHPlan, String oldUuidTaskHPlan) {
|
||||
this.newUuidTaskHPlan = newUuidTaskHPlan;
|
||||
this.oldUuidTaskHPlan = oldUuidTaskHPlan;
|
||||
}
|
||||
|
||||
public String getNewUuidTaskHPlan() {
|
||||
return newUuidTaskHPlan;
|
||||
}
|
||||
|
||||
public void setNewUuidTaskHPlan(String newUuidTaskHPlan) {
|
||||
this.newUuidTaskHPlan = newUuidTaskHPlan;
|
||||
}
|
||||
|
||||
public String getOldUuidTaskHPlan() {
|
||||
return oldUuidTaskHPlan;
|
||||
}
|
||||
|
||||
public void setOldUuidTaskHPlan(String oldUuidTaskHPlan) {
|
||||
this.oldUuidTaskHPlan = oldUuidTaskHPlan;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package com.adins.mss.base.todolist.form.followup;
|
||||
|
||||
import com.adins.mss.foundation.http.MssRequestType;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class SubmitFormRequest extends MssRequestType {
|
||||
@SerializedName("uuidTaskH")
|
||||
private String uuidTaskH;
|
||||
|
||||
@SerializedName("followUpNotes")
|
||||
private String followUpNotes;
|
||||
|
||||
@SerializedName("flagtask")
|
||||
private String flagTask;
|
||||
|
||||
public String getUuidTaskH() {
|
||||
return uuidTaskH;
|
||||
}
|
||||
|
||||
public void setUuidTaskH(String uuidTaskH) {
|
||||
this.uuidTaskH = uuidTaskH;
|
||||
}
|
||||
|
||||
public String getFollowUpNotes() {
|
||||
return followUpNotes;
|
||||
}
|
||||
|
||||
public void setFollowUpNotes(String followUpNotes) {
|
||||
this.followUpNotes = followUpNotes;
|
||||
}
|
||||
|
||||
public String getFlagTask() {
|
||||
return flagTask;
|
||||
}
|
||||
|
||||
public void setFlagTask(String flagTask) {
|
||||
this.flagTask = flagTask;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,489 @@
|
|||
package com.adins.mss.dao;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import android.database.Cursor;
|
||||
|
||||
import de.greenrobot.dao.AbstractDao;
|
||||
import de.greenrobot.dao.Property;
|
||||
import de.greenrobot.dao.internal.SqlUtils;
|
||||
import de.greenrobot.dao.internal.DaoConfig;
|
||||
import de.greenrobot.dao.database.Database;
|
||||
import de.greenrobot.dao.database.DatabaseStatement;
|
||||
import de.greenrobot.dao.query.Query;
|
||||
import de.greenrobot.dao.query.QueryBuilder;
|
||||
|
||||
import com.adins.mss.dao.TaskD;
|
||||
|
||||
// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
|
||||
/**
|
||||
* DAO for table "TR_TASK_D".
|
||||
*/
|
||||
public class TaskDDao extends AbstractDao<TaskD, String> {
|
||||
|
||||
public static final String TABLENAME = "TR_TASK_D";
|
||||
|
||||
/**
|
||||
* Properties of entity TaskD.<br/>
|
||||
* Can be used for QueryBuilder and for referencing column names.
|
||||
*/
|
||||
public static class Properties {
|
||||
public final static Property Uuid_task_d = new Property(0, String.class, "uuid_task_d", true, "UUID_TASK_D");
|
||||
public final static Property Question_group_id = new Property(1, String.class, "question_group_id", false, "QUESTION_GROUP_ID");
|
||||
public final static Property Question_id = new Property(2, String.class, "question_id", false, "QUESTION_ID");
|
||||
public final static Property Option_answer_id = new Property(3, String.class, "option_answer_id", false, "OPTION_ANSWER_ID");
|
||||
public final static Property Text_answer = new Property(4, String.class, "text_answer", false, "TEXT_ANSWER");
|
||||
public final static Property Image = new Property(5, byte[].class, "image", false, "IMAGE");
|
||||
public final static Property Is_final = new Property(6, String.class, "is_final", false, "IS_FINAL");
|
||||
public final static Property Is_sent = new Property(7, String.class, "is_sent", false, "IS_SENT");
|
||||
public final static Property Lov = new Property(8, String.class, "lov", false, "LOV");
|
||||
public final static Property Usr_crt = new Property(9, String.class, "usr_crt", false, "USR_CRT");
|
||||
public final static Property Dtm_crt = new Property(10, java.util.Date.class, "dtm_crt", false, "DTM_CRT");
|
||||
public final static Property Uuid_task_h = new Property(11, String.class, "uuid_task_h", false, "UUID_TASK_H");
|
||||
public final static Property Question_label = new Property(12, String.class, "question_label", false, "QUESTION_LABEL");
|
||||
public final static Property Latitude = new Property(13, String.class, "latitude", false, "LATITUDE");
|
||||
public final static Property Longitude = new Property(14, String.class, "longitude", false, "LONGITUDE");
|
||||
public final static Property Mcc = new Property(15, String.class, "mcc", false, "MCC");
|
||||
public final static Property Mnc = new Property(16, String.class, "mnc", false, "MNC");
|
||||
public final static Property Lac = new Property(17, String.class, "lac", false, "LAC");
|
||||
public final static Property Cid = new Property(18, String.class, "cid", false, "CID");
|
||||
public final static Property Gps_time = new Property(19, java.util.Date.class, "gps_time", false, "GPS_TIME");
|
||||
public final static Property Accuracy = new Property(20, Integer.class, "accuracy", false, "ACCURACY");
|
||||
public final static Property Regex = new Property(21, String.class, "regex", false, "REGEX");
|
||||
public final static Property Is_readonly = new Property(22, String.class, "is_readonly", false, "IS_READONLY");
|
||||
public final static Property Location_image = new Property(23, byte[].class, "location_image", false, "LOCATION_IMAGE");
|
||||
public final static Property Is_visible = new Property(24, String.class, "is_visible", false, "IS_VISIBLE");
|
||||
public final static Property Uuid_lookup = new Property(25, String.class, "uuid_lookup", false, "UUID_LOOKUP");
|
||||
public final static Property Tag = new Property(26, String.class, "tag", false, "TAG");
|
||||
public final static Property Count = new Property(27, String.class, "count", false, "COUNT");
|
||||
public final static Property Image_timestamp = new Property(28, java.util.Date.class, "image_timestamp", false, "IMAGE_TIMESTAMP");
|
||||
public final static Property Data_dukcapil = new Property(29, String.class, "data_dukcapil", false, "DATA_DUKCAPIL");
|
||||
};
|
||||
|
||||
private DaoSession daoSession;
|
||||
|
||||
private Query<TaskD> taskH_TaskDListQuery;
|
||||
|
||||
public TaskDDao(DaoConfig config) {
|
||||
super(config);
|
||||
}
|
||||
|
||||
public TaskDDao(DaoConfig config, DaoSession daoSession) {
|
||||
super(config, daoSession);
|
||||
this.daoSession = daoSession;
|
||||
}
|
||||
|
||||
/** Creates the underlying database table. */
|
||||
public static void createTable(Database db, boolean ifNotExists) {
|
||||
String constraint = ifNotExists? "IF NOT EXISTS ": "";
|
||||
db.execSQL("CREATE TABLE " + constraint + "\"TR_TASK_D\" (" + //
|
||||
"\"UUID_TASK_D\" TEXT PRIMARY KEY NOT NULL ," + // 0: uuid_task_d
|
||||
"\"QUESTION_GROUP_ID\" TEXT," + // 1: question_group_id
|
||||
"\"QUESTION_ID\" TEXT," + // 2: question_id
|
||||
"\"OPTION_ANSWER_ID\" TEXT," + // 3: option_answer_id
|
||||
"\"TEXT_ANSWER\" TEXT," + // 4: text_answer
|
||||
"\"IMAGE\" BLOB," + // 5: image
|
||||
"\"IS_FINAL\" TEXT," + // 6: is_final
|
||||
"\"IS_SENT\" TEXT," + // 7: is_sent
|
||||
"\"LOV\" TEXT," + // 8: lov
|
||||
"\"USR_CRT\" TEXT," + // 9: usr_crt
|
||||
"\"DTM_CRT\" INTEGER," + // 10: dtm_crt
|
||||
"\"UUID_TASK_H\" TEXT," + // 11: uuid_task_h
|
||||
"\"QUESTION_LABEL\" TEXT," + // 12: question_label
|
||||
"\"LATITUDE\" TEXT," + // 13: latitude
|
||||
"\"LONGITUDE\" TEXT," + // 14: longitude
|
||||
"\"MCC\" TEXT," + // 15: mcc
|
||||
"\"MNC\" TEXT," + // 16: mnc
|
||||
"\"LAC\" TEXT," + // 17: lac
|
||||
"\"CID\" TEXT," + // 18: cid
|
||||
"\"GPS_TIME\" INTEGER," + // 19: gps_time
|
||||
"\"ACCURACY\" INTEGER," + // 20: accuracy
|
||||
"\"REGEX\" TEXT," + // 21: regex
|
||||
"\"IS_READONLY\" TEXT," + // 22: is_readonly
|
||||
"\"LOCATION_IMAGE\" BLOB," + // 23: location_image
|
||||
"\"IS_VISIBLE\" TEXT," + // 24: is_visible
|
||||
"\"UUID_LOOKUP\" TEXT," + // 25: uuid_lookup
|
||||
"\"TAG\" TEXT," + // 26: tag
|
||||
"\"COUNT\" TEXT," + // 27: count
|
||||
"\"IMAGE_TIMESTAMP\" INTEGER," + // 28: image_timestamp
|
||||
"\"DATA_DUKCAPIL\" TEXT);"); // 29: data_dukcapil
|
||||
}
|
||||
|
||||
/** Drops the underlying database table. */
|
||||
public static void dropTable(Database db, boolean ifExists) {
|
||||
String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"TR_TASK_D\"";
|
||||
db.execSQL(sql);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected void bindValues(DatabaseStatement stmt, TaskD entity) {
|
||||
stmt.clearBindings();
|
||||
stmt.bindString(1, entity.getUuid_task_d());
|
||||
|
||||
String question_group_id = entity.getQuestion_group_id();
|
||||
if (question_group_id != null) {
|
||||
stmt.bindString(2, question_group_id);
|
||||
}
|
||||
|
||||
String question_id = entity.getQuestion_id();
|
||||
if (question_id != null) {
|
||||
stmt.bindString(3, question_id);
|
||||
}
|
||||
|
||||
String option_answer_id = entity.getOption_answer_id();
|
||||
if (option_answer_id != null) {
|
||||
stmt.bindString(4, option_answer_id);
|
||||
}
|
||||
|
||||
String text_answer = entity.getText_answer();
|
||||
if (text_answer != null) {
|
||||
stmt.bindString(5, text_answer);
|
||||
}
|
||||
|
||||
byte[] image = entity.getImage();
|
||||
if (image != null) {
|
||||
stmt.bindBlob(6, image);
|
||||
}
|
||||
|
||||
String is_final = entity.getIs_final();
|
||||
if (is_final != null) {
|
||||
stmt.bindString(7, is_final);
|
||||
}
|
||||
|
||||
String is_sent = entity.getIs_sent();
|
||||
if (is_sent != null) {
|
||||
stmt.bindString(8, is_sent);
|
||||
}
|
||||
|
||||
String lov = entity.getLov();
|
||||
if (lov != null) {
|
||||
stmt.bindString(9, lov);
|
||||
}
|
||||
|
||||
String usr_crt = entity.getUsr_crt();
|
||||
if (usr_crt != null) {
|
||||
stmt.bindString(10, usr_crt);
|
||||
}
|
||||
|
||||
java.util.Date dtm_crt = entity.getDtm_crt();
|
||||
if (dtm_crt != null) {
|
||||
stmt.bindLong(11, dtm_crt.getTime());
|
||||
}
|
||||
|
||||
String uuid_task_h = entity.getUuid_task_h();
|
||||
if (uuid_task_h != null) {
|
||||
stmt.bindString(12, uuid_task_h);
|
||||
}
|
||||
|
||||
String question_label = entity.getQuestion_label();
|
||||
if (question_label != null) {
|
||||
stmt.bindString(13, question_label);
|
||||
}
|
||||
|
||||
String latitude = entity.getLatitude();
|
||||
if (latitude != null) {
|
||||
stmt.bindString(14, latitude);
|
||||
}
|
||||
|
||||
String longitude = entity.getLongitude();
|
||||
if (longitude != null) {
|
||||
stmt.bindString(15, longitude);
|
||||
}
|
||||
|
||||
String mcc = entity.getMcc();
|
||||
if (mcc != null) {
|
||||
stmt.bindString(16, mcc);
|
||||
}
|
||||
|
||||
String mnc = entity.getMnc();
|
||||
if (mnc != null) {
|
||||
stmt.bindString(17, mnc);
|
||||
}
|
||||
|
||||
String lac = entity.getLac();
|
||||
if (lac != null) {
|
||||
stmt.bindString(18, lac);
|
||||
}
|
||||
|
||||
String cid = entity.getCid();
|
||||
if (cid != null) {
|
||||
stmt.bindString(19, cid);
|
||||
}
|
||||
|
||||
java.util.Date gps_time = entity.getGps_time();
|
||||
if (gps_time != null) {
|
||||
stmt.bindLong(20, gps_time.getTime());
|
||||
}
|
||||
|
||||
Integer accuracy = entity.getAccuracy();
|
||||
if (accuracy != null) {
|
||||
stmt.bindLong(21, accuracy);
|
||||
}
|
||||
|
||||
String regex = entity.getRegex();
|
||||
if (regex != null) {
|
||||
stmt.bindString(22, regex);
|
||||
}
|
||||
|
||||
String is_readonly = entity.getIs_readonly();
|
||||
if (is_readonly != null) {
|
||||
stmt.bindString(23, is_readonly);
|
||||
}
|
||||
|
||||
byte[] location_image = entity.getLocation_image();
|
||||
if (location_image != null) {
|
||||
stmt.bindBlob(24, location_image);
|
||||
}
|
||||
|
||||
String is_visible = entity.getIs_visible();
|
||||
if (is_visible != null) {
|
||||
stmt.bindString(25, is_visible);
|
||||
}
|
||||
|
||||
String uuid_lookup = entity.getUuid_lookup();
|
||||
if (uuid_lookup != null) {
|
||||
stmt.bindString(26, uuid_lookup);
|
||||
}
|
||||
|
||||
String tag = entity.getTag();
|
||||
if (tag != null) {
|
||||
stmt.bindString(27, tag);
|
||||
}
|
||||
|
||||
String count = entity.getCount();
|
||||
if (count != null) {
|
||||
stmt.bindString(28, count);
|
||||
}
|
||||
|
||||
java.util.Date image_timestamp = entity.getImage_timestamp();
|
||||
if (image_timestamp != null) {
|
||||
stmt.bindLong(29, image_timestamp.getTime());
|
||||
}
|
||||
|
||||
String data_dukcapil = entity.getData_dukcapil();
|
||||
if (data_dukcapil != null) {
|
||||
stmt.bindString(30, data_dukcapil);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachEntity(TaskD entity) {
|
||||
super.attachEntity(entity);
|
||||
entity.__setDaoSession(daoSession);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String readKey(Cursor cursor, int offset) {
|
||||
return cursor.getString(offset + 0);
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public TaskD readEntity(Cursor cursor, int offset) {
|
||||
TaskD entity = new TaskD( //
|
||||
cursor.getString(offset + 0), // uuid_task_d
|
||||
cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // question_group_id
|
||||
cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2), // question_id
|
||||
cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // option_answer_id
|
||||
cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4), // text_answer
|
||||
cursor.isNull(offset + 5) ? null : cursor.getBlob(offset + 5), // image
|
||||
cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6), // is_final
|
||||
cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7), // is_sent
|
||||
cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8), // lov
|
||||
cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9), // usr_crt
|
||||
cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)), // dtm_crt
|
||||
cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11), // uuid_task_h
|
||||
cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12), // question_label
|
||||
cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13), // latitude
|
||||
cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14), // longitude
|
||||
cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15), // mcc
|
||||
cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16), // mnc
|
||||
cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17), // lac
|
||||
cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18), // cid
|
||||
cursor.isNull(offset + 19) ? null : new java.util.Date(cursor.getLong(offset + 19)), // gps_time
|
||||
cursor.isNull(offset + 20) ? null : cursor.getInt(offset + 20), // accuracy
|
||||
cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21), // regex
|
||||
cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22), // is_readonly
|
||||
cursor.isNull(offset + 23) ? null : cursor.getBlob(offset + 23), // location_image
|
||||
cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24), // is_visible
|
||||
cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25), // uuid_lookup
|
||||
cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26), // tag
|
||||
cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27), // count
|
||||
cursor.isNull(offset + 28) ? null : new java.util.Date(cursor.getLong(offset + 28)), // image_timestamp
|
||||
cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29) // data_dukcapil
|
||||
);
|
||||
return entity;
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public void readEntity(Cursor cursor, TaskD entity, int offset) {
|
||||
entity.setUuid_task_d(cursor.getString(offset + 0));
|
||||
entity.setQuestion_group_id(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
|
||||
entity.setQuestion_id(cursor.isNull(offset + 2) ? null : cursor.getString(offset + 2));
|
||||
entity.setOption_answer_id(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
|
||||
entity.setText_answer(cursor.isNull(offset + 4) ? null : cursor.getString(offset + 4));
|
||||
entity.setImage(cursor.isNull(offset + 5) ? null : cursor.getBlob(offset + 5));
|
||||
entity.setIs_final(cursor.isNull(offset + 6) ? null : cursor.getString(offset + 6));
|
||||
entity.setIs_sent(cursor.isNull(offset + 7) ? null : cursor.getString(offset + 7));
|
||||
entity.setLov(cursor.isNull(offset + 8) ? null : cursor.getString(offset + 8));
|
||||
entity.setUsr_crt(cursor.isNull(offset + 9) ? null : cursor.getString(offset + 9));
|
||||
entity.setDtm_crt(cursor.isNull(offset + 10) ? null : new java.util.Date(cursor.getLong(offset + 10)));
|
||||
entity.setUuid_task_h(cursor.isNull(offset + 11) ? null : cursor.getString(offset + 11));
|
||||
entity.setQuestion_label(cursor.isNull(offset + 12) ? null : cursor.getString(offset + 12));
|
||||
entity.setLatitude(cursor.isNull(offset + 13) ? null : cursor.getString(offset + 13));
|
||||
entity.setLongitude(cursor.isNull(offset + 14) ? null : cursor.getString(offset + 14));
|
||||
entity.setMcc(cursor.isNull(offset + 15) ? null : cursor.getString(offset + 15));
|
||||
entity.setMnc(cursor.isNull(offset + 16) ? null : cursor.getString(offset + 16));
|
||||
entity.setLac(cursor.isNull(offset + 17) ? null : cursor.getString(offset + 17));
|
||||
entity.setCid(cursor.isNull(offset + 18) ? null : cursor.getString(offset + 18));
|
||||
entity.setGps_time(cursor.isNull(offset + 19) ? null : new java.util.Date(cursor.getLong(offset + 19)));
|
||||
entity.setAccuracy(cursor.isNull(offset + 20) ? null : cursor.getInt(offset + 20));
|
||||
entity.setRegex(cursor.isNull(offset + 21) ? null : cursor.getString(offset + 21));
|
||||
entity.setIs_readonly(cursor.isNull(offset + 22) ? null : cursor.getString(offset + 22));
|
||||
entity.setLocation_image(cursor.isNull(offset + 23) ? null : cursor.getBlob(offset + 23));
|
||||
entity.setIs_visible(cursor.isNull(offset + 24) ? null : cursor.getString(offset + 24));
|
||||
entity.setUuid_lookup(cursor.isNull(offset + 25) ? null : cursor.getString(offset + 25));
|
||||
entity.setTag(cursor.isNull(offset + 26) ? null : cursor.getString(offset + 26));
|
||||
entity.setCount(cursor.isNull(offset + 27) ? null : cursor.getString(offset + 27));
|
||||
entity.setImage_timestamp(cursor.isNull(offset + 28) ? null : new java.util.Date(cursor.getLong(offset + 28)));
|
||||
entity.setData_dukcapil(cursor.isNull(offset + 29) ? null : cursor.getString(offset + 29));
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected String updateKeyAfterInsert(TaskD entity, long rowId) {
|
||||
return entity.getUuid_task_d();
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
public String getKey(TaskD entity) {
|
||||
if(entity != null) {
|
||||
return entity.getUuid_task_d();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/** @inheritdoc */
|
||||
@Override
|
||||
protected boolean isEntityUpdateable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Internal query to resolve the "taskDList" to-many relationship of TaskH. */
|
||||
public List<TaskD> _queryTaskH_TaskDList(String uuid_task_h) {
|
||||
synchronized (this) {
|
||||
if (taskH_TaskDListQuery == null) {
|
||||
QueryBuilder<TaskD> queryBuilder = queryBuilder();
|
||||
queryBuilder.where(Properties.Uuid_task_h.eq(null));
|
||||
taskH_TaskDListQuery = queryBuilder.build();
|
||||
}
|
||||
}
|
||||
Query<TaskD> query = taskH_TaskDListQuery.forCurrentThread();
|
||||
query.setParameter(0, uuid_task_h);
|
||||
return query.list();
|
||||
}
|
||||
|
||||
private String selectDeep;
|
||||
|
||||
protected String getSelectDeep() {
|
||||
if (selectDeep == null) {
|
||||
StringBuilder builder = new StringBuilder("SELECT ");
|
||||
SqlUtils.appendColumns(builder, "T", getAllColumns());
|
||||
builder.append(',');
|
||||
SqlUtils.appendColumns(builder, "T0", daoSession.getTaskHDao().getAllColumns());
|
||||
builder.append(',');
|
||||
SqlUtils.appendColumns(builder, "T1", daoSession.getLookupDao().getAllColumns());
|
||||
builder.append(" FROM TR_TASK_D T");
|
||||
builder.append(" LEFT JOIN TR_TASK_H T0 ON T.\"UUID_TASK_H\"=T0.\"UUID_TASK_H\"");
|
||||
builder.append(" LEFT JOIN MS_LOOKUP T1 ON T.\"UUID_LOOKUP\"=T1.\"UUID_LOOKUP\"");
|
||||
builder.append(' ');
|
||||
selectDeep = builder.toString();
|
||||
}
|
||||
return selectDeep;
|
||||
}
|
||||
|
||||
protected TaskD loadCurrentDeep(Cursor cursor, boolean lock) {
|
||||
TaskD entity = loadCurrent(cursor, 0, lock);
|
||||
int offset = getAllColumns().length;
|
||||
|
||||
TaskH taskH = loadCurrentOther(daoSession.getTaskHDao(), cursor, offset);
|
||||
entity.setTaskH(taskH);
|
||||
offset += daoSession.getTaskHDao().getAllColumns().length;
|
||||
|
||||
Lookup lookup = loadCurrentOther(daoSession.getLookupDao(), cursor, offset);
|
||||
entity.setLookup(lookup);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public TaskD loadDeep(Long key) {
|
||||
assertSinglePk();
|
||||
if (key == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder(getSelectDeep());
|
||||
builder.append("WHERE ");
|
||||
SqlUtils.appendColumnsEqValue(builder, "T", getPkColumns());
|
||||
String sql = builder.toString();
|
||||
|
||||
String[] keyArray = new String[] { key.toString() };
|
||||
Cursor cursor = db.rawQuery(sql, keyArray);
|
||||
|
||||
try {
|
||||
boolean available = cursor.moveToFirst();
|
||||
if (!available) {
|
||||
return null;
|
||||
} else if (!cursor.isLast()) {
|
||||
throw new IllegalStateException("Expected unique result, but count was " + cursor.getCount());
|
||||
}
|
||||
return loadCurrentDeep(cursor, true);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
/** Reads all available rows from the given cursor and returns a list of new ImageTO objects. */
|
||||
public List<TaskD> loadAllDeepFromCursor(Cursor cursor) {
|
||||
int count = cursor.getCount();
|
||||
List<TaskD> list = new ArrayList<TaskD>(count);
|
||||
|
||||
if (cursor.moveToFirst()) {
|
||||
if (identityScope != null) {
|
||||
identityScope.lock();
|
||||
identityScope.reserveRoom(count);
|
||||
}
|
||||
try {
|
||||
do {
|
||||
list.add(loadCurrentDeep(cursor, false));
|
||||
} while (cursor.moveToNext());
|
||||
} finally {
|
||||
if (identityScope != null) {
|
||||
identityScope.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
protected List<TaskD> loadDeepAllAndCloseCursor(Cursor cursor) {
|
||||
try {
|
||||
return loadAllDeepFromCursor(cursor);
|
||||
} finally {
|
||||
cursor.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** A raw-style query where you can pass any WHERE clause and arguments. */
|
||||
public List<TaskD> queryDeep(String where, String... selectionArg) {
|
||||
Cursor cursor = db.rawQuery(getSelectDeep() + where, selectionArg);
|
||||
return loadDeepAllAndCloseCursor(cursor);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue