Commit f5c78aa8 by Lee Jaebin

#34866 一括同期

parent af2b9d92
...@@ -380,4 +380,23 @@ public class OperationDao extends AbstractDao { ...@@ -380,4 +380,23 @@ public class OperationDao extends AbstractDao {
updateNeedSyncFlg(operationDto.operationId, true); updateNeedSyncFlg(operationDto.operationId, true);
} }
} }
/**
* 作業グループに紐づく同期可能な作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getNeedSyncOperationByGroupMasterId(Integer operationGroupMasterId) {
StringBuffer sql = new StringBuffer();
sql.append(" SELECT * ");
sql.append(" FROM t_operation AS top ");
sql.append(" INNER JOIN r_operation_content AS rop ");
sql.append(" ON top.operation_id = rop.operation_id ");
sql.append(" AND rop.operation_content_flg = 1 ");
sql.append(" INNER JOIN r_operation_group_master_relation AS rogm ");
sql.append(" ON top.operation_id = rogm.operation_id ");
sql.append(" WHERE top.need_sync_flg = 1");
sql.append(" AND rogm.operation_group_master_id = ?");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + operationGroupMasterId }, OperationDto.class);
}
} }
\ No newline at end of file
...@@ -121,6 +121,10 @@ public class ContentDownloader { ...@@ -121,6 +121,10 @@ public class ContentDownloader {
public void addContentDownloadListener(ContentDownloadListener contentDownloadListener) { public void addContentDownloadListener(ContentDownloadListener contentDownloadListener) {
// ダウンロードリスナーが既にセットされてる場合、何もしない
if (contentDownloadListenerSet.contains(contentDownloadListener)) {
return;
}
contentDownloadListenerSet.add(contentDownloadListener); contentDownloadListenerSet.add(contentDownloadListener);
} }
...@@ -834,7 +838,9 @@ public class ContentDownloader { ...@@ -834,7 +838,9 @@ public class ContentDownloader {
private void onDownloadingContentZip(HttpDownloadNotification notification, DownloadStatusType downloadStatus) { private void onDownloadingContentZip(HttpDownloadNotification notification, DownloadStatusType downloadStatus) {
ContentZipDownloadNotification dlNotification = new ContentZipDownloadNotification(notification, downloadStatus); ContentZipDownloadNotification dlNotification = new ContentZipDownloadNotification(notification, downloadStatus);
Logger.i(TAG, "--------------- dlNotification");
for (ContentDownloadListener listener : contentDownloadListenerSet) { for (ContentDownloadListener listener : contentDownloadListenerSet) {
Logger.i("---------------" + listener.getClass().toString());
listener.onDownloadingContentZip(dlNotification); listener.onDownloadingContentZip(dlNotification);
} }
} }
......
...@@ -30,6 +30,7 @@ import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic; ...@@ -30,6 +30,7 @@ import jp.agentec.abook.abv.bl.logic.ContentReadingLogLogic;
import jp.agentec.abook.abv.bl.logic.ContractLogic; import jp.agentec.abook.abv.bl.logic.ContractLogic;
import jp.agentec.abook.abv.bl.logic.EnqueteLogic; import jp.agentec.abook.abv.bl.logic.EnqueteLogic;
import jp.agentec.abook.abv.bl.logic.GroupLogic; import jp.agentec.abook.abv.bl.logic.GroupLogic;
import jp.agentec.abook.abv.bl.logic.OperationGroupMasterLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic; import jp.agentec.abook.abv.bl.logic.OperationLogic;
import jp.agentec.adf.util.CollectionUtil; import jp.agentec.adf.util.CollectionUtil;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
...@@ -67,6 +68,7 @@ public class ContentRefresher { ...@@ -67,6 +68,7 @@ public class ContentRefresher {
// masterDataを取得するため登録 // masterDataを取得するため登録
private ApertureMasterDataLogic apertureMasterDataLogic = AbstractLogic.getLogic(ApertureMasterDataLogic.class); private ApertureMasterDataLogic apertureMasterDataLogic = AbstractLogic.getLogic(ApertureMasterDataLogic.class);
private OperationGroupMasterLogic operationGroupMasterLogic = AbstractLogic.getLogic(OperationGroupMasterLogic.class);
public static ContentRefresher getInstance() { public static ContentRefresher getInstance() {
...@@ -167,6 +169,9 @@ public class ContentRefresher { ...@@ -167,6 +169,9 @@ public class ContentRefresher {
// CMSでメンテナンスされる絞り検索マスタデータをアプリから取得できるようにJSONファイルを生成する。 // CMSでメンテナンスされる絞り検索マスタデータをアプリから取得できるようにJSONファイルを生成する。
apertureMasterDataLogic.initializeApertureMasterData(); apertureMasterDataLogic.initializeApertureMasterData();
// 作業種別情報を取得
operationGroupMasterLogic.setOperationGroupMaster();
if (interrupt) { // この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別)) if (interrupt) { // この時点で停止要求が来た場合先には進まない。(ServiceOption/Group/Categoryの更新は1セットで行う(トランザクションはそれぞれ別))
Logger.d(TAG, "stop refresh worker before content update."); Logger.d(TAG, "stop refresh worker before content update.");
setFail(); setFail();
......
...@@ -96,8 +96,6 @@ public class OperationLogic extends AbstractLogic { ...@@ -96,8 +96,6 @@ public class OperationLogic extends AbstractLogic {
public void initializeOperations() throws AcmsException, NetworkDisconnectedException { public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
// 作業グループリスト取得 // 作業グループリスト取得
setWorkingGroupList(); setWorkingGroupList();
// 作業種別・作業種別に紐づいた作業IDを取得
mOperationGroupMasterLogic.setOperationGroupMaster();
// 作業一覧取得し、登録・更新・削除する // 作業一覧取得し、登録・更新・削除する
retrieveServerOperation(); retrieveServerOperation();
} }
...@@ -1261,7 +1259,9 @@ public class OperationLogic extends AbstractLogic { ...@@ -1261,7 +1259,9 @@ public class OperationLogic extends AbstractLogic {
operationDto.reportType, operationDto.reportType,
taskReportSendDto.hotspotChangeFlg taskReportSendDto.hotspotChangeFlg
); );
if (progressCallback != null) {
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
}
removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId); removeTaskReportSendIds.add(taskReportSendDto.taskReportSendId);
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId)); FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportSendDirFilePath(operationId, taskReportSendDto.taskKey, taskReportSendDto.taskReportSendId));
...@@ -1642,4 +1642,13 @@ public class OperationLogic extends AbstractLogic { ...@@ -1642,4 +1642,13 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.insert(taskDto); mTaskDao.insert(taskDto);
} }
} }
/**
* 作業グループに紐づく同期可能な作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getNeedSyncOperationByGroupMasterId(Integer operationGroupMasterId) {
return mOperationDao.getNeedSyncOperationByGroupMasterId(operationGroupMasterId);
}
} }
...@@ -523,6 +523,17 @@ ...@@ -523,6 +523,17 @@
<string name="operation_category">カテゴリ</string> <string name="operation_category">カテゴリ</string>
<string name="type_all">全て</string> <string name="type_all">全て</string>
<!-- 1.2.0 -->
<string name="msg_operation_enable_meeting_room_connected">会議室入室中の為、このボタンは利用できません。\n共通資料画面から資料を選択してください。</string>
<string name="batch_sync">一括同期</string>
<string name="batch_syncing">一括同期中...</string>
<string name="msg_confirm_batch_sync">表示中の全作業を一括同期しますか?</string>
<string name="msg_batch_sync_disconnect_network">インターネットに接続されていない為、同期処理を中止します。</string>
<string name="msg_batch_sync_content_download_fail">作業ベース資料のダウンロードに失敗しました。</string>
<string name="msg_batch_sync_new_content_updating">新着更新処理中の為、一括同期できません。</string>
<string name="msg_batch_sync_error">「%1$s」の同期に失敗しました。同期処理を中止します。</string>
<string name="msg_batch_sync_move_operation_view">一括同期中には点検作業報告画面へ遷移できません。</string>
<!-- 1.0.1 Resource Pattern 1 --> <!-- 1.0.1 Resource Pattern 1 -->
<!-- 1.9.0.0--> <!-- 1.9.0.0-->
<string name="meetingroom_setting_1">会議室設定(1)</string> <string name="meetingroom_setting_1">会議室設定(1)</string>
......
...@@ -77,6 +77,15 @@ ...@@ -77,6 +77,15 @@
android:textStyle="bold" /> android:textStyle="bold" />
</RadioGroup> </RadioGroup>
<ImageButton
android:id="@+id/btc_batch_sync"
style="@style/ToolBarIcon"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/segment_group"
android:src="@drawable/ic_batch_sync"
android:visibility="gone"/>
<LinearLayout <LinearLayout
android:id="@+id/search_result" android:id="@+id/search_result"
android:layout_width="wrap_content" android:layout_width="wrap_content"
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<RadioButton <RadioButton
android:id="@+id/operation_location_type_all" android:id="@+id/operation_location_type_all"
android:layout_width="80dp" android:layout_width="60dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background" android:background="@drawable/operation_location_segment_background"
android:button="@null" android:button="@null"
...@@ -52,15 +52,17 @@ ...@@ -52,15 +52,17 @@
android:onClick="onClickOperationLocationType" android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color" android:textColor="@drawable/operation_location_text_color"
android:text="@string/type_all" android:text="@string/type_all"
android:textSize="10sp"
android:textStyle="bold" /> android:textStyle="bold" />
<RadioButton <RadioButton
android:id="@+id/operation_location_type_group" android:id="@+id/operation_location_type_group"
android:layout_width="80dp" android:layout_width="60dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/operation_location_segment_background" android:background="@drawable/operation_location_segment_background"
android:button="@null" android:button="@null"
android:gravity="center" android:gravity="center"
android:textSize="10sp"
android:onClick="onClickOperationLocationType" android:onClick="onClickOperationLocationType"
android:textColor="@drawable/operation_location_text_color" android:textColor="@drawable/operation_location_text_color"
android:text="@string/operation_category" android:text="@string/operation_category"
...@@ -68,6 +70,14 @@ ...@@ -68,6 +70,14 @@
</RadioGroup> </RadioGroup>
<ImageButton <ImageButton
android:id="@+id/btc_batch_sync"
style="@style/ToolBarIcon"
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/segment_group"
android:src="@drawable/ic_batch_sync" />
<ImageButton
android:id="@+id/btn_common_content" android:id="@+id/btn_common_content"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
......
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="50dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:paddingRight="6dip"
android:textColor="@color/text_select"
android:text="@string/dummy_str"
/>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="center_vertical"
android:checkMark="?android:attr/listChoiceIndicatorSingle"
android:padding="6dp"
/>
...@@ -321,8 +321,8 @@ public abstract class ABVActivity extends Activity { ...@@ -321,8 +321,8 @@ public abstract class ABVActivity extends Activity {
} }
} }
protected void startActivity(Intent intend, NaviConsts ABVNavi) { protected void startActivity(Intent intent, NaviConsts ABVNavi) {
super.startActivity(intend); super.startActivity(intent);
ActivityHandlingHelper.transitionNavi(this, ABVNavi); ActivityHandlingHelper.transitionNavi(this, ABVNavi);
} }
......
...@@ -207,7 +207,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -207,7 +207,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
contentDownloader.removeContentDownloadListener(this); // contentDownloader.removeContentDownloadListener(this);
} }
@Override @Override
...@@ -648,6 +648,26 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -648,6 +648,26 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
return result; return result;
} }
/**
* 作業用コンテンツダウンロード時、ダウンロードかダウンロード再開か判定して行う。
* @param contentDto
* @return
*/
public boolean operationContentDownload(final ContentDto contentDto) {
if (contentDto.isDownloadPaused()) {
// ダウンロード途中で通信が切れた場合、一時停止のステータスに変更になるため、再開させる
try {
contentDownloader.resume(contentDto.contentId);
contentDownloader.addContentDownloadListener(this);
} catch (Exception e) {
Logger.e(TAG, "downloadContent failed. contentId=" + contentDto.contentId, e);
}
} else {
return contentDownload(contentDto.contentId, false);
}
return true;
}
// Wifi非接続時のアラート表示 // Wifi非接続時のアラート表示
public void showWifiDisconnectAlert(final int messageId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException { public void showWifiDisconnectAlert(final int messageId, final DialogInterface.OnClickListener positive, final DialogInterface.OnClickListener negative) throws NetworkDisconnectedException {
showWifiDisconnectAlert(messageId, R.string.download, positive, negative); showWifiDisconnectAlert(messageId, R.string.download, positive, negative);
......
package jp.agentec.abook.abv.ui.common.view;
import android.app.ProgressDialog;
import android.content.Context;
import android.graphics.PixelFormat;
import java.util.Stack;
import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.launcher.android.R;
/**
* Created by leej on 2019/08/26.
*/
public class ABVBatchSyncView extends ProgressDialog {
private Context mContext;
private Stack<OperationDto> mBatchSyncOperationStack = new Stack<>();
public ABVBatchSyncView(Context context) {
super(context);
mContext = context;
init();
}
private void init() {
if (getWindow() != null) {
setIndeterminate(false);
setCancelable(false);
setProgressStyle(ProgressDialog.STYLE_HORIZONTAL); //プログレスバー表示
getWindow().setFormat(PixelFormat.TRANSPARENT);
setMessage(getContext().getResources().getString(R.string.batch_syncing));
}
}
public void setStack(Stack<OperationDto> operationDtoStack) {
setMax(operationDtoStack.size());
mBatchSyncOperationStack = operationDtoStack;
}
public OperationDto getOperationDtoByStack() {
return mBatchSyncOperationStack.peek();
}
public boolean checkMaxProgress() {
return getMax() == getProgress() + 1;
}
public void closeProgressDialog() {
setProgress(0);
dismiss();
}
public Stack<OperationDto> getBatchSyncOperationStack() {
return mBatchSyncOperationStack;
}
public boolean empty() {
return mBatchSyncOperationStack.empty();
}
}
...@@ -52,11 +52,10 @@ import java.util.Date; ...@@ -52,11 +52,10 @@ import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Stack;
import jp.agentec.abook.abv.bl.acms.client.AcmsClient; import jp.agentec.abook.abv.bl.acms.client.AcmsClient;
import jp.agentec.abook.abv.bl.acms.client.json.ApertureMasterDataJSON;
import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON; import jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetApertureMasterDataParameters;
import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters; import jp.agentec.abook.abv.bl.acms.client.parameters.GetOperationDataParameters;
import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType; import jp.agentec.abook.abv.bl.acms.type.DownloadStatusType;
import jp.agentec.abook.abv.bl.acms.type.OperationType; import jp.agentec.abook.abv.bl.acms.type.OperationType;
...@@ -107,6 +106,7 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil; ...@@ -107,6 +106,7 @@ import jp.agentec.abook.abv.ui.common.util.ABVToastUtil;
import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil; import jp.agentec.abook.abv.ui.common.util.AlertDialogUtil;
import jp.agentec.abook.abv.ui.common.util.KeyboardUtils; import jp.agentec.abook.abv.ui.common.util.KeyboardUtils;
import jp.agentec.abook.abv.ui.common.util.PatternStringUtil; import jp.agentec.abook.abv.ui.common.util.PatternStringUtil;
import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.common.view.ABVListDialog; import jp.agentec.abook.abv.ui.common.view.ABVListDialog;
import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow; import jp.agentec.abook.abv.ui.common.view.ABVPopupListWindow;
import jp.agentec.abook.abv.ui.home.adapter.FixPushMessageAdapter; import jp.agentec.abook.abv.ui.home.adapter.FixPushMessageAdapter;
...@@ -133,11 +133,12 @@ import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref; ...@@ -133,11 +133,12 @@ import static jp.agentec.abook.abv.cl.util.PreferenceUtil.getUserPref;
public class OperationListActivity extends ABVUIActivity { public class OperationListActivity extends ABVUIActivity {
private static final String TAG = "OperationListActivity"; private static final String TAG = "OperationListActivity";
private ImageButton mViewModeButton; private ImageButton mViewModeButton; // リスト・パンネル切り替えボタン
private ImageButton mSearchButton; private ImageButton mSearchButton; // 検索ボタン
private ImageButton mFilterButton; private ImageButton mFilterButton; // フィルタボタン
private ImageButton mCommunicationButton; private ImageButton mCommunicationButton; // コミュニケーションボタン
private ImageButton mCommonContentButton; private ImageButton mCommonContentButton; // 共通資料ボタン
private ImageButton mOperationBatchSyncButton; // 一括同期ボタン
public String mSearchWord; public String mSearchWord;
public String mStartDateStr; public String mStartDateStr;
...@@ -156,7 +157,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -156,7 +157,6 @@ public class OperationListActivity extends ABVUIActivity {
private Dialog mSearchDialog; private Dialog mSearchDialog;
private Date mOperationLastEditDate; private Date mOperationLastEditDate;
private boolean isSyncGetTaskFileError;
private Dialog mPanoEntryDialog; private Dialog mPanoEntryDialog;
...@@ -207,6 +207,10 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -207,6 +207,10 @@ public class OperationListActivity extends ABVUIActivity {
// 絞り検索マスタLogic // 絞り検索マスタLogic
private ApertureMasterDataLogic mApertureMasterDataLogic = AbstractLogic.getLogic(ApertureMasterDataLogic.class); private ApertureMasterDataLogic mApertureMasterDataLogic = AbstractLogic.getLogic(ApertureMasterDataLogic.class);
// 一括同期ビュー(コントロール)
private ABVBatchSyncView mBatchSyncView;
// ビューの作成 // ビューの作成
private class ReloadHandler implements Runnable { private class ReloadHandler implements Runnable {
@Override @Override
...@@ -245,6 +249,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -245,6 +249,7 @@ public class OperationListActivity extends ABVUIActivity {
mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu); mCommunicationButton = (ImageButton) findViewById(R.id.btn_communication_menu);
mCommonContentButton = (ImageButton) findViewById(R.id.btn_common_content); mCommonContentButton = (ImageButton) findViewById(R.id.btn_common_content);
mLocationTypeRadioGroup = (RadioGroup) findViewById(R.id.segment_group); mLocationTypeRadioGroup = (RadioGroup) findViewById(R.id.segment_group);
mOperationBatchSyncButton = (ImageButton) findViewById(R.id.btc_batch_sync);
// ビュー変更ボタンのタッチイベント // ビュー変更ボタンのタッチイベント
mViewModeButton.setOnClickListener(new View.OnClickListener() { mViewModeButton.setOnClickListener(new View.OnClickListener() {
...@@ -299,6 +304,32 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -299,6 +304,32 @@ public class OperationListActivity extends ABVUIActivity {
} }
}); });
// 一括同期ボタン
mOperationBatchSyncButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showSimpleAlertDialog(getString(R.string.app_name), getString(R.string.request_network_connection));
return;
}
// 新着更新チェック
if (contentRefresher.isRefreshing()) {
showSimpleAlertDialog(getString(R.string.app_name), getString(R.string.msg_batch_sync_new_content_updating));
return;
}
// 会議室接続中
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(OperationListActivity.this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
showBatchSyncDialog();
}
});
if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.PushMessageKey.operationId))) { if (!StringUtil.isNullOrEmpty(getIntent().getStringExtra(AppDefType.PushMessageKey.operationId))) {
final long operationId = Long.parseLong(getIntent().getStringExtra(AppDefType.PushMessageKey.operationId)); final long operationId = Long.parseLong(getIntent().getStringExtra(AppDefType.PushMessageKey.operationId));
String message = getIntent().getStringExtra(AppDefType.PushMessageKey.message); String message = getIntent().getStringExtra(AppDefType.PushMessageKey.message);
...@@ -353,6 +384,8 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -353,6 +384,8 @@ public class OperationListActivity extends ABVUIActivity {
alertDialog.show(); alertDialog.show();
} }
} }
// 一括同期を設定
mBatchSyncView = new ABVBatchSyncView(this);
mAllOperationReportTypes = getOperationReportTypeList(true); mAllOperationReportTypes = getOperationReportTypeList(true);
// リスト更新 // リスト更新
setOperationListView(); setOperationListView();
...@@ -410,9 +443,13 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -410,9 +443,13 @@ public class OperationListActivity extends ABVUIActivity {
// 検索ボタンを無効にする // 検索ボタンを無効にする
mSearchButton.setImageDrawable(getRDrawable(R.drawable.ic_operation_search)); mSearchButton.setImageDrawable(getRDrawable(R.drawable.ic_operation_search));
setEnabledImageButton(mSearchButton); setEnabledImageButton(mSearchButton);
// 一括同期ボタン表示
mOperationBatchSyncButton.setVisibility(View.VISIBLE);
} else { } else {
// 全て // 全て
cancelToolbarEnabledIcon(); cancelToolbarEnabledIcon();
// 一括同期ボタン非表示
mOperationBatchSyncButton.setVisibility(View.GONE);
} }
// 全て・作業種別のセグメントチェック設定 // 全て・作業種別のセグメントチェック設定
checkOperationGroupType(getABVUIDataCache().getOperationGroupMasterMode()); checkOperationGroupType(getABVUIDataCache().getOperationGroupMasterMode());
...@@ -509,6 +546,10 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -509,6 +546,10 @@ public class OperationListActivity extends ABVUIActivity {
public void onResume() { public void onResume() {
Logger.i(TAG, "onResume:start"); Logger.i(TAG, "onResume:start");
super.onResume(); super.onResume();
if (isShowingBatchSync()) {
// 一括同期中の場合何もしない
return;
}
refreshOperationList(); refreshOperationList();
// 作業指示・報告からプロジェクト一覧へ戻った時の同期処理 // 作業指示・報告からプロジェクト一覧へ戻った時の同期処理
final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L); final long operationId = getUserPref(AppDefType.UserPrefKey.SYNC_TARGET_OPERATION_ID, -1L);
...@@ -771,24 +812,56 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -771,24 +812,56 @@ public class OperationListActivity extends ABVUIActivity {
public void onDownloadingContentZip(final ContentZipDownloadNotification notification) { public void onDownloadingContentZip(final ContentZipDownloadNotification notification) {
super.onDownloadingContentZip(notification); super.onDownloadingContentZip(notification);
OperationContentDto operationContentDto = mOperationContentDao.getOperationContentForContentId(notification.getContentId()); OperationContentDto operationContentDto = mOperationContentDao.getOperationContentForContentId(notification.getContentId());
Logger.i(TAG, "----------------------onDownloadingContentZip ");
if (operationContentDto != null) { if (operationContentDto != null) {
if (notification.downloadStatus == DownloadStatusType.Succeeded) { if (notification.downloadStatus == DownloadStatusType.Succeeded) {
if (isShowingBatchSync()) {
// 一括同期からの同期処理
batchOperationSync(true);
Logger.i(TAG, "----------------------onDownloadingContentZip mBatchSyncFlg");
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationContentDto.operationId); OperationDto operationDto = mOperationLogic.getOperation(operationContentDto.operationId);
syncOperation(operationContentDto.operationId, operationDto.reportType, true); syncOperation(operationContentDto.operationId, operationDto.reportType, true);
}
} else if (notification.downloadStatus == DownloadStatusType.Failed || notification.downloadStatus == DownloadStatusType.Canceled || notification.downloadStatus == DownloadStatusType.Paused) { } else if (notification.downloadStatus == DownloadStatusType.Failed || notification.downloadStatus == DownloadStatusType.Canceled || notification.downloadStatus == DownloadStatusType.Paused) {
Logger.i(TAG, "syncOperation update is failed downloadStatus : " + notification.downloadStatus); Logger.i(TAG, "syncOperation update is failed downloadStatus : " + notification.downloadStatus);
if (isShowingBatchSync()) {
// 一括同期からのダウンロード失敗時、プログレスバーを閉じる
mBatchSyncView.closeProgressDialog();
}
closeProgressPopup(); closeProgressPopup();
} }
} }
} }
// 作業の自動同期処理(onresumeで呼ばれる同期処理)
public void syncOperation(final long operationId, int operationReportType) {
syncOperation(operationId, operationReportType, false);
}
/** /**
* プロジェクト同期処理 * 作業同期処理
* @param operationId * @param operationId
* @param operationReportType * @param operationReportType
*/ */
public void syncOperation(final long operationId, int operationReportType) { public void syncOperation(final long operationId, int operationReportType, boolean buttonEventFlg) {
syncOperation(operationId, operationReportType, false); syncOperation(operationId, operationReportType, buttonEventFlg, new Callback() {
@Override
public Object callback(Object ret) {
final String errorMessage = (String) ret;
runOnUiThread(new Runnable() {
@Override
public void run() {
if (errorMessage != null) {
// エラーメッセージ表示
showSimpleAlertDialog(getString(R.string.app_name), errorMessage);
closeProgressPopup();
}
}
});
return null;
}
});
} }
/** /**
...@@ -796,13 +869,18 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -796,13 +869,18 @@ public class OperationListActivity extends ABVUIActivity {
* @param operationId * @param operationId
* @param reportType * @param reportType
* @param buttonEventFlag * @param buttonEventFlag
* @return result true 正常 false 異常
*/ */
public void syncOperation(final long operationId, int reportType, boolean buttonEventFlag) { public void syncOperation(final long operationId, int reportType, boolean buttonEventFlag, final Callback errorCallback) {
final StringBuilder errorMsg = new StringBuilder();
Logger.i(TAG, "---sync start"); Logger.i(TAG, "---sync start");
// ネットワーク通信チェック // ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) { if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
ABVToastUtil.showMakeText(OperationListActivity.this, R.string.request_network_connection, Toast.LENGTH_SHORT); if (isShowingBatchSync()) {
closeProgressPopup(); errorCallback.callback(getString(R.string.msg_batch_sync_disconnect_network));
} else {
errorCallback.callback(getString(R.string.request_network_connection));
}
return; return;
} }
// 新着更新チェック // 新着更新チェック
...@@ -811,6 +889,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -811,6 +889,7 @@ public class OperationListActivity extends ABVUIActivity {
closeProgressPopup(); closeProgressPopup();
return; return;
} }
try { try {
//コンテンツダウンロード関連プログレスバー値設定 //コンテンツダウンロード関連プログレスバー値設定
progressDialogHorizontal.setProgress(20); progressDialogHorizontal.setProgress(20);
...@@ -833,9 +912,9 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -833,9 +912,9 @@ public class OperationListActivity extends ABVUIActivity {
progressDialogHorizontal.setProgress(60); progressDialogHorizontal.setProgress(60);
// 報告受信 // 報告受信
mOperationLastEditDate = receptionTaskData(operationId, progressCallback, buttonEventFlag); mOperationLastEditDate = receptionTaskData(operationId, progressCallback, errorMsg);
// mOperationLastEditDateがnullの場合、エラーと見做す
if (reportType == ReportType.RoutineTask) { if (mOperationLastEditDate != null && reportType == ReportType.RoutineTask) {
if (buttonEventFlag) { if (buttonEventFlag) {
String dialogMsg = null; String dialogMsg = null;
// 定期点検プロジェクトの利用可能日付を取得 // 定期点検プロジェクトの利用可能日付を取得
...@@ -853,7 +932,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -853,7 +932,7 @@ public class OperationListActivity extends ABVUIActivity {
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)); getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0));
} }
if (!StringUtil.isNullOrEmpty(dialogMsg)) { if (!StringUtil.isNullOrEmpty(dialogMsg)) {
showSimpleAlertDialog(getString(R.string.app_name), dialogMsg); errorMsg.append(dialogMsg);
} }
} }
putUserPref(String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationId), DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none)); putUserPref(String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationId), DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none));
...@@ -863,24 +942,20 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -863,24 +942,20 @@ public class OperationListActivity extends ABVUIActivity {
switch (e.getCode()) { switch (e.getCode()) {
case P_E_ACMS_P003: case P_E_ACMS_P003:
// リソースパターンを適用 // リソースパターンを適用
showSimpleAlertDialog(R.string.app_name, PatternStringUtil.patternToInt(getApplicationContext(), errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P003, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
R.string.P003,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
break; break;
case P_E_ACMS_P004: case P_E_ACMS_P004:
showSimpleAlertDialog(R.string.app_name, PatternStringUtil.patternToInt(getApplicationContext(), errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P004, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
R.string.P004,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
break; break;
case P_E_ACMS_P005: case P_E_ACMS_P005:
showSimpleAlertDialog(R.string.app_name, R.string.P005); errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P005, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break; break;
case P_E_ACMS_P006: case P_E_ACMS_P006:
showSimpleAlertDialog(R.string.app_name, R.string.P006); errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.P006, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
break; break;
default: default:
Logger.e(TAG, "syncOperation", e); Logger.e(TAG, "syncOperation", e);
handleErrorMessageToast(ErrorMessage.getErrorCode(e)); errorMsg.append(ErrorMessage.getErrorMessage(this, ErrorMessage.getErrorCode(e)));
break; break;
} }
} catch (Exception e) { } catch (Exception e) {
...@@ -888,7 +963,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -888,7 +963,7 @@ public class OperationListActivity extends ABVUIActivity {
handler.post(new Runnable() { handler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
handleErrorMessageToast(ABVExceptionCode.S_E_ACMS_0001); handleErrorMessageToast(ABVExceptionCode.C_E_SYSTEM_0001);
closeProgressPopup(); closeProgressPopup();
} }
}); });
...@@ -896,8 +971,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -896,8 +971,6 @@ public class OperationListActivity extends ABVUIActivity {
handler.post(new Runnable() { handler.post(new Runnable() {
@Override @Override
public void run() { public void run() {
// データの受信時、エラーキャッチのための変数を初期化
isSyncGetTaskFileError = false;
if (mOperationLastEditDate != null) { if (mOperationLastEditDate != null) {
mOperationLogic.finishedSyncOperation(operationId, mOperationLastEditDate); mOperationLogic.finishedSyncOperation(operationId, mOperationLastEditDate);
progressDialogHorizontal.setProgress(100); progressDialogHorizontal.setProgress(100);
...@@ -905,6 +978,8 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -905,6 +978,8 @@ public class OperationListActivity extends ABVUIActivity {
mOperationLastEditDate = null; mOperationLastEditDate = null;
refreshOperationList(); refreshOperationList();
closeProgressPopup(); closeProgressPopup();
// コールバック
errorCallback.callback(errorMsg.length() > 0 ? errorMsg.toString() : null);
} }
}); });
Logger.i(TAG, "---sync end"); Logger.i(TAG, "---sync end");
...@@ -930,6 +1005,11 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -930,6 +1005,11 @@ public class OperationListActivity extends ABVUIActivity {
* @param operationDto * @param operationDto
*/ */
public void startPanoEdit(OperationDto operationDto) { public void startPanoEdit(OperationDto operationDto) {
// 会議室接続中
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
if (operationDto.contentId != null && operationDto.contentId != 0) { if (operationDto.contentId != null && operationDto.contentId != 0) {
showProgressPopup(); showProgressPopup();
try { try {
...@@ -963,7 +1043,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -963,7 +1043,7 @@ public class OperationListActivity extends ABVUIActivity {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* @throws ZipException * @throws ZipException
*/ */
public Date receptionTaskData(long operationId, Callback progressCallback, boolean buttonEventFlag) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException { public Date receptionTaskData(long operationId, Callback progressCallback, StringBuilder errorMsg) throws NetworkDisconnectedException, ABVException, IOException, InterruptedException, NoSuchAlgorithmException, ZipException {
GetOperationDataParameters param = new GetOperationDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId); GetOperationDataParameters param = new GetOperationDataParameters(ABVDataCache.getInstance().getMemberInfo().sid, operationId);
OperationDto operationDto = mOperationLogic.getOperation(operationId); OperationDto operationDto = mOperationLogic.getOperation(operationId);
OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId); OperationContentDto operationContentDto = mOperationContentDao.getOperationMainContent(operationId);
...@@ -1036,8 +1116,12 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1036,8 +1116,12 @@ public class OperationListActivity extends ABVUIActivity {
serverTaskReportDto.taskKey = serverTaskDto.taskKey; serverTaskReportDto.taskKey = serverTaskDto.taskKey;
// 添付ファイルが存在する場合、取得して解凍する。 // 添付ファイルが存在する場合、取得して解凍する。
try {
refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.taskReportInfoId, serverTaskReportDto.reportStartDate, attachedFileName); refreshRoutineTaskFile(operationId, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.taskReportId, serverTaskReportDto.taskReportInfoId, serverTaskReportDto.reportStartDate, attachedFileName);
if (isSyncGetTaskFileError) { } catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
return null; return null;
} }
if (localTaskReportDto != null) { if (localTaskReportDto != null) {
...@@ -1052,6 +1136,9 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1052,6 +1136,9 @@ public class OperationListActivity extends ABVUIActivity {
try { try {
refreshTaskFile(operationId, serverTaskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.attachedFileName); refreshTaskFile(operationId, serverTaskReportDto.taskReportLevel, operationContentDto.contentId, serverTaskDto.taskId, serverTaskDto.taskKey, serverTaskReportDto.attachedFileName);
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
errorMsg.append(getString(PatternStringUtil.patternToInt(getApplicationContext(), R.string.msg_error_task_report_receiving_failed, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))));
return null; return null;
} }
if (!serverTaskReportDto.jsonData.isEmpty()) { if (!serverTaskReportDto.jsonData.isEmpty()) {
...@@ -1074,16 +1161,19 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1074,16 +1161,19 @@ public class OperationListActivity extends ABVUIActivity {
} }
} }
} }
if (progressCallback != null) {
progressCallback.callback(new Integer(progress)); progressCallback.callback(new Integer(progress));
} }
}
// サーバーから取得した作業情報がローカルに存在しないので削除する // サーバーから取得した作業情報がローカルに存在しないので削除する
for (TaskDto taskDto : localTaskList) { for (TaskDto taskDto : localTaskList) {
mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey, TaskReportLevel.ReportType); mOperationLogic.deleteTaskFileData(operationId, operationContentDto.contentId, taskDto.taskKey, TaskReportLevel.ReportType);
mTaskDao.delete(taskDto); mTaskDao.delete(taskDto);
} }
lastEditDate = json.lastEditDate; lastEditDate = json.lastEditDate;
if (progressCallback != null) {
progressCallback.callback(new Integer(40)); progressCallback.callback(new Integer(40));
}
return lastEditDate; return lastEditDate;
} }
...@@ -1108,21 +1198,12 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1108,21 +1198,12 @@ public class OperationListActivity extends ABVUIActivity {
String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey, taskReportLevel); String reportLocalAttachedFileName = mTaskReportDao.getTaskReportAttachedFileName(taskKey, taskReportLevel);
if (attachedFileName != null && !attachedFileName.equals(reportLocalAttachedFileName)) { if (attachedFileName != null && !attachedFileName.equals(reportLocalAttachedFileName)) {
try {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, attachedFileName); Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, attachedFileName);
// #32926 start // #32926 start
FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel)); FileUtil.delete(ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel));
// #32926 end // #32926 end
String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, attachedFileName, taskReportLevel); String outputFilePath = mOperationLogic.getTaskFile(operationId, taskKey, taskId, attachedFileName, taskReportLevel);
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel),null, true); ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, ABVEnvironment.getInstance().getOperationTaskReportLevelDirPath(operationId, taskKey, taskReportLevel),null, true);
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
ABVToastUtil.showMakeText(getApplicationContext(), PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_error_task_report_receiving_failed,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_LONG);
throw e;
}
} }
} }
...@@ -1141,7 +1222,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1141,7 +1222,7 @@ public class OperationListActivity extends ABVUIActivity {
* @throws NoSuchAlgorithmException * @throws NoSuchAlgorithmException
* @throws IOException * @throws IOException
*/ */
public void refreshRoutineTaskFile(final long operationId, final long contentId, final long taskId, final String taskKey, final int taskReportId, final int taskReportInfoId, final Date reportStartDate, final String reportAttachedFileName) throws ABVException, InterruptedException, ZipException, NoSuchAlgorithmException, IOException { public void refreshRoutineTaskFile(final long operationId, final long contentId, final long taskId, final String taskKey, final int taskReportId, final int taskReportInfoId, final Date reportStartDate, final String reportAttachedFileName) throws Exception {
String reportStartDateHypn = DateTimeUtil.toString(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen); String reportStartDateHypn = DateTimeUtil.toString(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen);
final String reportStartDateNone = DateTimeUtil.toString_yyyyMMddHHmmss_none(reportStartDate); final String reportStartDateNone = DateTimeUtil.toString_yyyyMMddHHmmss_none(reportStartDate);
// 既存の添付ディレクトリ削除 // 既存の添付ディレクトリ削除
...@@ -1151,7 +1232,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1151,7 +1232,6 @@ public class OperationListActivity extends ABVUIActivity {
boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName); boolean getReportFileFlg = !StringUtil.isNullOrEmpty(reportAttachedFileName) && !reportAttachedFileName.equals(reportLocalAttachedFileName);
if (getReportFileFlg) { if (getReportFileFlg) {
try {
Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName); Logger.i(TAG, "[Get Task Report Files] operationId=%s, taskKey=%s, taskId=%s, attachedFileName=%s", operationId, taskKey, taskId, reportAttachedFileName);
// #32926 start // #32926 start
int taskReportLevel = 0; int taskReportLevel = 0;
...@@ -1162,14 +1242,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1162,14 +1242,6 @@ public class OperationListActivity extends ABVUIActivity {
ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath, ContentFileExtractor.getInstance().extractZipFile(contentId, outputFilePath,
ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone), null, true); ABVEnvironment.getInstance().getRoutineTaskReportDirFilePath(operationId, taskKey, taskReportId, reportStartDateNone), null, true);
// #32926 end // #32926 end
} catch (Exception e) {
Logger.e(TAG, e);
// リソースパターンの適用
ABVToastUtil.showMakeText(getApplicationContext(), PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_error_task_report_receiving_failed,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)), Toast.LENGTH_LONG);
isSyncGetTaskFileError = true;
}
} }
} }
...@@ -1778,6 +1850,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1778,6 +1850,7 @@ public class OperationListActivity extends ABVUIActivity {
*/ */
public void openReportView(OperationDto operationDto) { public void openReportView(OperationDto operationDto) {
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) { if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return; return;
} }
// 新着更新を止める // 新着更新を止める
...@@ -1799,6 +1872,13 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1799,6 +1872,13 @@ public class OperationListActivity extends ABVUIActivity {
if (contentRefresher.isRefreshing()) { if (contentRefresher.isRefreshing()) {
return; return;
} }
// 会議室接続中
if (ActivityHandlingHelper.getInstance().isMeetingConnected()) {
ABVToastUtil.showMakeText(this, R.string.msg_operation_enable_meeting_room_connected, Toast.LENGTH_SHORT);
return;
}
// リソースパターンの適用 // リソースパターンの適用
showProgressView(PatternStringUtil.patternToString(getApplicationContext(), showProgressView(PatternStringUtil.patternToString(getApplicationContext(),
R.string.synchronizing, R.string.synchronizing,
...@@ -1809,8 +1889,12 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1809,8 +1889,12 @@ public class OperationListActivity extends ABVUIActivity {
Logger.i(TAG, "[syncOperation] operationId=%s, contentId=%s", operationDto.operationId, operationDto.contentId); Logger.i(TAG, "[syncOperation] operationId=%s, contentId=%s", operationDto.operationId, operationDto.contentId);
// コンテンツダウンロード // コンテンツダウンロード
ContentDto contentDto = contentDao.getContent(operationDto.contentId); ContentDto contentDto = contentDao.getContent(operationDto.contentId);
if (contentDto == null || !contentDto.downloadedFlg || contentDto.updatedFlg) { if (contentDto == null) {
contentDownload(operationDto.contentId, false); Logger.e(TAG, "contentDto is null !");
return;
}
if (!contentDto.downloadedFlg || contentDto.updatedFlg) {
operationContentDownload(contentDto);
} else { } else {
syncOperation(operationDto.operationId, operationDto.reportType, true); syncOperation(operationDto.operationId, operationDto.reportType, true);
} }
...@@ -2020,7 +2104,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2020,7 +2104,7 @@ public class OperationListActivity extends ABVUIActivity {
* @param autoClose 直下階層が存在しない場合、ダイアログを自動で閉じる * @param autoClose 直下階層が存在しない場合、ダイアログを自動で閉じる
*/ */
public void showOperationGroupMasterDialog(boolean isInit, boolean autoClose) { public void showOperationGroupMasterDialog(boolean isInit, boolean autoClose) {
if (isInit) { if (isInit || operationCountMap == null) {
// 最後の階層レベルを取得 // 最後の階層レベルを取得
Integer lastLevel = mOperationGroupMasterLogic.getLastGroupLevel(); Integer lastLevel = mOperationGroupMasterLogic.getLastGroupLevel();
operationCountMap = new HashMap<Integer, Integer>(); operationCountMap = new HashMap<Integer, Integer>();
...@@ -2052,7 +2136,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2052,7 +2136,7 @@ public class OperationListActivity extends ABVUIActivity {
}); });
// autoCloseがtrueの場合、下位階層が存在しなければreturnで以下の処理は行わない // autoCloseがtrueの場合、下位階層が存在しなければreturnで以下の処理は行わない
if (autoClose && operationGroupMasterDtoList.size() < 1) { if (autoClose && (operationGroupMasterDtoList == null || operationGroupMasterDtoList.size() < 1)) {
return; return;
} }
...@@ -2198,4 +2282,124 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2198,4 +2282,124 @@ public class OperationListActivity extends ABVUIActivity {
private void setApertureMasterDataFetchDate() { private void setApertureMasterDataFetchDate() {
putUserPref(AppDefType.UserPrefKey.APERTURE_MASTER_DATA_FETCH_DATE, ABVDataCache.getInstance().getTempApertureMasterDataFetchDate()); putUserPref(AppDefType.UserPrefKey.APERTURE_MASTER_DATA_FETCH_DATE, ABVDataCache.getInstance().getTempApertureMasterDataFetchDate());
} }
/**
* カテゴリの一括同期ダイアログ表示
*/
private void showBatchSyncDialog() {
ABookAlertDialog dialog = AlertDialogUtil.createABookAlertDialog(this);
dialog.setTitle(getString(R.string.batch_sync));
dialog.setMessage(getString(R.string.msg_confirm_batch_sync));
dialog.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// 一括同期開始
categoryBatchSync();
dialog.dismiss();
}
});
dialog.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
});
if (mAlertDialog != null && this.mAlertDialog.isShowing()) {
mAlertDialog.dismiss();
}
this.mAlertDialog = dialog;
mAlertDialog.show();
}
/**
* カテゴリの一括同期ボタン
*/
public void categoryBatchSync() {
Logger.i(TAG, "---category batch sync start");
// 作業種別に関連する作業リストを取得
List<OperationDto> operationList = mOperationLogic.getNeedSyncOperationByGroupMasterId(getABVUIDataCache().getOperationGroupMasterId());
// 一覧に作業が存在しない場合
if (operationList == null || operationList.isEmpty()) {
return;
}
// 作業リストをスタックにセット
Stack<OperationDto> operationDtoStack = new Stack<OperationDto>();
for (OperationDto operationDto : operationList) {
operationDtoStack.push(operationDto);
}
mBatchSyncView.setStack(operationDtoStack);
mBatchSyncView.show();
batchOperationSync(false);
}
/**
* 一括同期処理(stackの中を全て同期する)
* @param downloadedFlg
*/
private void batchOperationSync(final boolean downloadedFlg) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
if (mBatchSyncView.empty()) {
mBatchSyncView.closeProgressDialog();
return;
}
Stack<OperationDto> batchSyncStack = mBatchSyncView.getBatchSyncOperationStack();
if (!downloadedFlg) {
Logger.d(TAG, "batchOperation sync -- base file not downloaded");
// ベースファイルのダウンロードチェック
OperationDto peekOperationDto = batchSyncStack.peek();
ContentDto contentDto = contentDao.getContent(peekOperationDto.contentId);
if (contentDto == null) {
Logger.e(TAG, "contentDto is null !");
return;
}
if (!contentDto.downloadedFlg || contentDto.updatedFlg) {
operationContentDownload(contentDto);
return;
}
}
final OperationDto operationDto = batchSyncStack.pop();
syncOperation(operationDto.operationId, operationDto.reportType, false, new Callback() {
@Override
public Object callback(Object ret) {
final String errorMessage = (String)ret;
runOnUiThread(new Runnable() {
@Override
public void run() {
if (errorMessage != null) {
String errorStr = String.format(getString(R.string.msg_batch_sync_error), operationDto.operationName) + "\n" + errorMessage;
showSimpleAlertDialog(getString(R.string.app_name), errorStr);
// error
mBatchSyncView.closeProgressDialog();
} else {
if (mBatchSyncView.checkMaxProgress()) {
// 最後の処理が完了したと見做す
mBatchSyncView.closeProgressDialog();
} else {
// プログレスバーに作業1つ完了をセット
mBatchSyncView.setProgress(mBatchSyncView.getProgress() + 1);
// 次の作業を同期処理
batchOperationSync(false);
}
}
}
});
return null;
}
});
}
});
}
public boolean isShowingBatchSync() {
return mBatchSyncView != null && mBatchSyncView.isShowing();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment