Commit 53f9fea7 by Lee Jaebin

#34866 一括同期

parent f5c78aa8
...@@ -399,4 +399,30 @@ public class OperationDao extends AbstractDao { ...@@ -399,4 +399,30 @@ public class OperationDao extends AbstractDao {
sql.append(" AND rogm.operation_group_master_id = ?"); sql.append(" AND rogm.operation_group_master_id = ?");
return rawQueryGetDtoList(sql.toString(), new String[] { "" + operationGroupMasterId }, OperationDto.class); return rawQueryGetDtoList(sql.toString(), new String[] { "" + operationGroupMasterId }, OperationDto.class);
} }
/**
* 定期点検で同期が必要な作業を取得
* @return
*/
public List<OperationDto> getDeactivatedRoutineOperation() {
String curDate = DateTimeUtil.toStringInTimeZone(new Date(), DateTimeFormat.yyyyMMddHHmmss_hyphen, "UTC");
StringBuffer sql = new StringBuffer();
sql.append(" SELECT top.*, ");
sql.append(" CASE ");
sql.append(" WHEN report_type = 1 THEN ( ");
sql.append(" SELECT strftime('%Y/%m/%d %H:%M', datetime(ttr.report_start_date, 'localtime')) || ' ~ ' || strftime('%Y/%m/%d %H:%M', datetime(ttr.report_end_date, 'localtime')) ");
sql.append(" FROM t_task tt ");
sql.append(" INNER JOIN t_task_report ttr ");
sql.append(" ON tt.task_key = ttr.task_key ");
sql.append(" AND tt.del_flg = 0 ");
sql.append(" AND datetime(ttr.report_end_date) >= datetime('" + curDate + "') ");
sql.append(" WHERE tt.operation_id = top.operation_id ");
sql.append(" ORDER BY ttr.report_start_date ASC LIMIT 1 ) ");
sql.append(" ELSE '' ");
sql.append(" END AS report_period ");
sql.append(" FROM t_operation AS top");
sql.append(" WHERE top.need_sync_flg = 0");
sql.append(" AND top.report_type = 1");
return rawQueryGetDtoList(sql.toString(), null, OperationDto.class);
}
} }
\ No newline at end of file
...@@ -470,8 +470,9 @@ public class ContentDownloader { ...@@ -470,8 +470,9 @@ public class ContentDownloader {
* @throws NetworkDisconnectedException * @throws NetworkDisconnectedException
* @throws AcmsException * @throws AcmsException
* @since 1.0.0 * @since 1.0.0
* @return true : 正常 false : 異常
*/ */
public void resume(long contentId) throws NetworkDisconnectedException, AcmsException { public boolean resume(long contentId) throws NetworkDisconnectedException, AcmsException {
if (!networkAdapter.isNetworkConnected()) { if (!networkAdapter.isNetworkConnected()) {
throw new NetworkDisconnectedException(); throw new NetworkDisconnectedException();
} }
...@@ -479,12 +480,12 @@ public class ContentDownloader { ...@@ -479,12 +480,12 @@ public class ContentDownloader {
ContentDto contentDto = getOperableContent(contentId, DownloadStatusType.Downloading); ContentDto contentDto = getOperableContent(contentId, DownloadStatusType.Downloading);
if (contentDto == null) { if (contentDto == null) {
Logger.w(TAG, "resume called but already another thread is processing the contentId(%s).", contentId); Logger.w(TAG, "resume called but already another thread is processing the contentId(%s).", contentId);
return; return false;
} }
synchronized (contentDto) { synchronized (contentDto) {
if (contentDto.isDownloading()) { if (contentDto.isDownloading()) {
Logger.w(TAG, "resume called but already another thread is processing the contentId(%s).", contentId); Logger.w(TAG, "resume called but already another thread is processing the contentId(%s).", contentId);
return; return false;
} }
if (contentDto.downloader != null && !isFullActive()) { if (contentDto.downloader != null && !isFullActive()) {
contentDto.status = DownloadStatusType.Downloading.type(); contentDto.status = DownloadStatusType.Downloading.type();
...@@ -496,6 +497,7 @@ public class ContentDownloader { ...@@ -496,6 +497,7 @@ public class ContentDownloader {
kickTask(); kickTask();
} }
} }
return true;
} }
public void autoDownload() { public void autoDownload() {
......
...@@ -1642,13 +1642,4 @@ public class OperationLogic extends AbstractLogic { ...@@ -1642,13 +1642,4 @@ public class OperationLogic extends AbstractLogic {
mTaskDao.insert(taskDto); mTaskDao.insert(taskDto);
} }
} }
/**
* 作業グループに紐づく同期可能な作業リストを取得
* @param operationGroupMasterId
* @return
*/
public List<OperationDto> getNeedSyncOperationByGroupMasterId(Integer operationGroupMasterId) {
return mOperationDao.getNeedSyncOperationByGroupMasterId(operationGroupMasterId);
}
} }
...@@ -472,8 +472,8 @@ ...@@ -472,8 +472,8 @@
<string name="date_label_routineTask">作業期間</string> <string name="date_label_routineTask">作業期間</string>
<string name="msg_no_report_data">作業データがありません。</string> <string name="msg_no_report_data">作業データがありません。</string>
<string name="msg_permission_dialog_mic">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。</string> <string name="msg_permission_dialog_mic">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。</string>
<string name="msg_routineTask_report_disable_not_list">情報更新中には点検作業報告画面へ遷移できません。</string> <string name="msg_routineTask_report_disable_refreshing">情報更新中には点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_refreshing">作業一覧画面以外では点検作業報告画面へ遷移できません。</string> <string name="msg_routineTask_report_disable_not_list">作業一覧画面以外では点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_meeting_room">作業一覧画面以外では点検作業報告画面へ遷移できません。</string> <string name="msg_routineTask_report_disable_meeting_room">作業一覧画面以外では点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_not_updated">情報更新されてませんので点検作業報告画面へ遷移できません。</string> <string name="msg_routineTask_report_disable_not_updated">情報更新されてませんので点検作業報告画面へ遷移できません。</string>
<string name="msg_routineTask_report_disable_no_operation">作業が存在しないので点検作業報告画面へ遷移できません。</string> <string name="msg_routineTask_report_disable_no_operation">作業が存在しないので点検作業報告画面へ遷移できません。</string>
...@@ -531,7 +531,7 @@ ...@@ -531,7 +531,7 @@
<string name="msg_batch_sync_disconnect_network">インターネットに接続されていない為、同期処理を中止します。</string> <string name="msg_batch_sync_disconnect_network">インターネットに接続されていない為、同期処理を中止します。</string>
<string name="msg_batch_sync_content_download_fail">作業ベース資料のダウンロードに失敗しました。</string> <string name="msg_batch_sync_content_download_fail">作業ベース資料のダウンロードに失敗しました。</string>
<string name="msg_batch_sync_new_content_updating">新着更新処理中の為、一括同期できません。</string> <string name="msg_batch_sync_new_content_updating">新着更新処理中の為、一括同期できません。</string>
<string name="msg_batch_sync_error">「%1$s」の同期に失敗しました。同期処理を中止します。</string> <string name="msg_batch_sync_error">「%1$s」の同期に失敗しました。同期処理を中止します。\n</string>
<string name="msg_batch_sync_move_operation_view">一括同期中には点検作業報告画面へ遷移できません。</string> <string name="msg_batch_sync_move_operation_view">一括同期中には点検作業報告画面へ遷移できません。</string>
<!-- 1.0.1 Resource Pattern 1 --> <!-- 1.0.1 Resource Pattern 1 -->
...@@ -689,8 +689,8 @@ ...@@ -689,8 +689,8 @@
<string name="date_label_routineTask_1">作業期間(1)</string> <string name="date_label_routineTask_1">作業期間(1)</string>
<string name="msg_no_report_data_1">作業データがありません。(1)</string> <string name="msg_no_report_data_1">作業データがありません。(1)</string>
<string name="msg_permission_dialog_mic_1">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(1)</string> <string name="msg_permission_dialog_mic_1">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(1)</string>
<string name="msg_routineTask_report_disable_not_list_1">情報更新中には点検作業報告画面へ遷移できません。(1)</string> <string name="msg_routineTask_report_disable_refreshing_1">情報更新中には点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_refreshing_1">作業一覧画面以外では点検作業報告画面へ遷移できません。(1)</string> <string name="msg_routineTask_report_disable_not_list_1">作業一覧画面以外では点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_meeting_room_1">作業一覧画面以外では点検作業報告画面へ遷移できません。(1)</string> <string name="msg_routineTask_report_disable_meeting_room_1">作業一覧画面以外では点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_not_updated_1">情報更新されてませんので点検作業報告画面へ遷移できません。(1)</string> <string name="msg_routineTask_report_disable_not_updated_1">情報更新されてませんので点検作業報告画面へ遷移できません。(1)</string>
<string name="msg_routineTask_report_disable_no_operation_1">作業が存在しないので点検作業報告画面へ遷移できません。(1)</string> <string name="msg_routineTask_report_disable_no_operation_1">作業が存在しないので点検作業報告画面へ遷移できません。(1)</string>
...@@ -865,8 +865,8 @@ ...@@ -865,8 +865,8 @@
<string name="date_label_routineTask_2">作業期間(2)</string> <string name="date_label_routineTask_2">作業期間(2)</string>
<string name="msg_no_report_data_2">作業データがありません。(2)</string> <string name="msg_no_report_data_2">作業データがありません。(2)</string>
<string name="msg_permission_dialog_mic_2">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(2)</string> <string name="msg_permission_dialog_mic_2">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(2)</string>
<string name="msg_routineTask_report_disable_not_list_2">情報更新中には点検作業報告画面へ遷移できません。(2)</string> <string name="msg_routineTask_report_disable_refreshing_2">情報更新中には点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_refreshing_2">作業一覧画面以外では点検作業報告画面へ遷移できません。(2)</string> <string name="msg_routineTask_report_disable_not_list_2">作業一覧画面以外では点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_meeting_room_2">作業一覧画面以外では点検作業報告画面へ遷移できません。(2)</string> <string name="msg_routineTask_report_disable_meeting_room_2">作業一覧画面以外では点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_not_updated_2">情報更新されてませんので点検作業報告画面へ遷移できません。(2)</string> <string name="msg_routineTask_report_disable_not_updated_2">情報更新されてませんので点検作業報告画面へ遷移できません。(2)</string>
<string name="msg_routineTask_report_disable_no_operation_2">作業が存在しないので点検作業報告画面へ遷移できません。(2)</string> <string name="msg_routineTask_report_disable_no_operation_2">作業が存在しないので点検作業報告画面へ遷移できません。(2)</string>
...@@ -1041,8 +1041,8 @@ ...@@ -1041,8 +1041,8 @@
<string name="date_label_routineTask_3">作業期間(3)</string> <string name="date_label_routineTask_3">作業期間(3)</string>
<string name="msg_no_report_data_3">作業データがありません。(3)</string> <string name="msg_no_report_data_3">作業データがありません。(3)</string>
<string name="msg_permission_dialog_mic_3">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(3)</string> <string name="msg_permission_dialog_mic_3">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(3)</string>
<string name="msg_routineTask_report_disable_not_list_3">情報更新中には点検作業報告画面へ遷移できません。(3)</string> <string name="msg_routineTask_report_disable_refreshing_3">情報更新中には点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_refreshing_3">作業一覧画面以外では点検作業報告画面へ遷移できません。(3)</string> <string name="msg_routineTask_report_disable_not_list_3">作業一覧画面以外では点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_meeting_room_3">作業一覧画面以外では点検作業報告画面へ遷移できません。(3)</string> <string name="msg_routineTask_report_disable_meeting_room_3">作業一覧画面以外では点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_not_updated_3">情報更新されてませんので点検作業報告画面へ遷移できません。(3)</string> <string name="msg_routineTask_report_disable_not_updated_3">情報更新されてませんので点検作業報告画面へ遷移できません。(3)</string>
<string name="msg_routineTask_report_disable_no_operation_3">作業が存在しないので点検作業報告画面へ遷移できません。(3)</string> <string name="msg_routineTask_report_disable_no_operation_3">作業が存在しないので点検作業報告画面へ遷移できません。(3)</string>
...@@ -1217,8 +1217,8 @@ ...@@ -1217,8 +1217,8 @@
<string name="date_label_routineTask_4">作業期間(4)</string> <string name="date_label_routineTask_4">作業期間(4)</string>
<string name="msg_no_report_data_4">作業データがありません。(4)</string> <string name="msg_no_report_data_4">作業データがありません。(4)</string>
<string name="msg_permission_dialog_mic_4">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(4)</string> <string name="msg_permission_dialog_mic_4">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(4)</string>
<string name="msg_routineTask_report_disable_not_list_4">情報更新中には点検作業報告画面へ遷移できません。(4)</string> <string name="msg_routineTask_report_disable_refreshing_4">情報更新中には点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_refreshing_4">作業一覧画面以外では点検作業報告画面へ遷移できません。(4)</string> <string name="msg_routineTask_report_disable_not_list_4">作業一覧画面以外では点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_meeting_room_4">作業一覧画面以外では点検作業報告画面へ遷移できません。(4)</string> <string name="msg_routineTask_report_disable_meeting_room_4">作業一覧画面以外では点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_not_updated_4">情報更新されてませんので点検作業報告画面へ遷移できません。(4)</string> <string name="msg_routineTask_report_disable_not_updated_4">情報更新されてませんので点検作業報告画面へ遷移できません。(4)</string>
<string name="msg_routineTask_report_disable_no_operation_4">作業が存在しないので点検作業報告画面へ遷移できません。(4)</string> <string name="msg_routineTask_report_disable_no_operation_4">作業が存在しないので点検作業報告画面へ遷移できません。(4)</string>
...@@ -1393,8 +1393,8 @@ ...@@ -1393,8 +1393,8 @@
<string name="date_label_routineTask_5">作業期間(5)</string> <string name="date_label_routineTask_5">作業期間(5)</string>
<string name="msg_no_report_data_5">作業データがありません。(5)</string> <string name="msg_no_report_data_5">作業データがありません。(5)</string>
<string name="msg_permission_dialog_mic_5">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(5)</string> <string name="msg_permission_dialog_mic_5">マイク利用権限が必要です。\nアプリ設定画面へ遷移します。(5)</string>
<string name="msg_routineTask_report_disable_not_list_5">情報更新中には点検作業報告画面へ遷移できません。(5)</string> <string name="msg_routineTask_report_disable_refreshing_5">情報更新中には点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_refreshing_5">作業一覧画面以外では点検作業報告画面へ遷移できません。(5)</string> <string name="msg_routineTask_report_disable_not_list_5">作業一覧画面以外では点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_meeting_room_5">作業一覧画面以外では点検作業報告画面へ遷移できません。(5)</string> <string name="msg_routineTask_report_disable_meeting_room_5">作業一覧画面以外では点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_not_updated_5">情報更新されてませんので点検作業報告画面へ遷移できません。(5)</string> <string name="msg_routineTask_report_disable_not_updated_5">情報更新されてませんので点検作業報告画面へ遷移できません。(5)</string>
<string name="msg_routineTask_report_disable_no_operation_5">作業が存在しないので点検作業報告画面へ遷移できません。(5)</string> <string name="msg_routineTask_report_disable_no_operation_5">作業が存在しないので点検作業報告画面へ遷移できません。(5)</string>
......
...@@ -525,6 +525,17 @@ ...@@ -525,6 +525,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」정보갱신에 실패하였습니다. 동기처리을 중지합니다.\n</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>
......
...@@ -529,6 +529,16 @@ ...@@ -529,6 +529,16 @@
<string name="operation_category">Category</string> <string name="operation_category">Category</string>
<string name="type_all">All</string> <string name="type_all">All</string>
<string name="msg_operation_enable_meeting_room_connected">Because you are in a conference room, this button is not available right now. \n Please select the document from common document</string>
<string name="batch_sync">batch sync</string>
<string name="batch_syncing">batch syncing...</string>
<string name="msg_confirm_batch_sync">Do you want to synchronize all the displayed operation?</string>
<string name="msg_batch_sync_disconnect_network">There are not connected to the internet, we will stop the synchronization process.</string>
<string name="msg_batch_sync_content_download_fail">Failed to download operation base content.</string>
<string name="msg_batch_sync_new_content_updating">Batch synchronization can not be performed because new data is being updated.</string>
<string name="msg_batch_sync_error">「%1$s」 failed. Cancel synchronization processing.\n</string>
<string name="msg_batch_sync_move_operation_view">You can not transition to the inspection work report screen because you are in a batch synchronization.</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">Meeting room setting(1)</string> <string name="meetingroom_setting_1">Meeting room setting(1)</string>
......
...@@ -49,7 +49,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService { ...@@ -49,7 +49,7 @@ public class ABVFcmListenerService extends FirebaseMessagingService {
public void onMessageReceived(RemoteMessage remoteMessage) { public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> msg = remoteMessage.getData(); Map<String, String> msg = remoteMessage.getData();
Log.d(TAG,"onMessageReceived(): msg :"+ msg); Logger.d(TAG,"onMessageReceived(): msg :"+ msg);
try { try {
UserAuthenticateLogic logic = AbstractLogic.getLogic(UserAuthenticateLogic.class); UserAuthenticateLogic logic = AbstractLogic.getLogic(UserAuthenticateLogic.class);
MemberInfoDto memberInfo = logic.getMemberInfo(); MemberInfoDto memberInfo = logic.getMemberInfo();
......
...@@ -98,9 +98,11 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog; ...@@ -98,9 +98,11 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
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.DisplayUtil; import jp.agentec.abook.abv.ui.common.util.DisplayUtil;
import jp.agentec.abook.abv.ui.common.util.Initializer; import jp.agentec.abook.abv.ui.common.util.Initializer;
import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.common.vo.Size; import jp.agentec.abook.abv.ui.common.vo.Size;
import jp.agentec.abook.abv.ui.home.activity.HelpActivity; import jp.agentec.abook.abv.ui.home.activity.HelpActivity;
import jp.agentec.abook.abv.ui.home.activity.LoginActivity; import jp.agentec.abook.abv.ui.home.activity.LoginActivity;
import jp.agentec.abook.abv.ui.home.activity.OperationListActivity;
import jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity; import jp.agentec.abook.abv.ui.home.activity.SplashScreenActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper; import jp.agentec.abook.abv.ui.home.helper.ContentViewHelper;
...@@ -122,10 +124,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -122,10 +124,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
private ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用 private ExecutorService initilizeExecutor = Executors.newFixedThreadPool(2); // DL後の初期化専用
protected ImageButton btnDownload;
protected ActivityHandlingHelper activityHandlingHelper; protected ActivityHandlingHelper activityHandlingHelper;
protected Size mDisplaySize; protected Size mDisplaySize;
// 一括同期ビュー(コントロール)
protected ABVBatchSyncView batchSyncView;
/** /**
* メッセージ表示タイプ * メッセージ表示タイプ
*/ */
...@@ -207,7 +212,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -207,7 +212,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override @Override
protected void onPause() { protected void onPause() {
super.onPause(); super.onPause();
// contentDownloader.removeContentDownloadListener(this); if (!(this instanceof OperationListActivity)) {
// 作業一覧ではない場合、ダウンロードリスナーを削除する
contentDownloader.removeContentDownloadListener(this);
}
} }
@Override @Override
...@@ -218,6 +226,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -218,6 +226,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
@Override @Override
protected void onApplicationBroughtFromBackground() { protected void onApplicationBroughtFromBackground() {
if (isShowingBatchSync()) {
// 一括同期中は以下の処理を行わないようにする
return;
}
new Handler().post(new Runnable() { new Handler().post(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -583,11 +595,23 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -583,11 +595,23 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
contentLogic.deleteContent(dto, deletePhysical); contentLogic.deleteContent(dto, deletePhysical);
} }
/**
* ダウンロード処理(wifiチェック/トーストメッセージ表示)
* @param contentId
* @return
*/
protected boolean contentDownload(long contentId) { protected boolean contentDownload(long contentId) {
return contentDownload(contentId, true); return contentDownload(contentId, true, true);
} }
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag) { /**
* ダウンロード処理
* @param contentId
* @param needCheckWifiFlag
* @param isShowToast
* @return
*/
protected boolean contentDownload(final long contentId, boolean needCheckWifiFlag, final boolean isShowToast) {
boolean result = true; boolean result = true;
try { try {
if (needCheckWifiFlag) { if (needCheckWifiFlag) {
...@@ -595,7 +619,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -595,7 +619,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
showWifiDisconnectAlert(R.string.C_E_SYSTEM_0005, new DialogInterface.OnClickListener() { showWifiDisconnectAlert(R.string.C_E_SYSTEM_0005, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
contentDownload(contentId, false); contentDownload(contentId, false, isShowToast);
} }
}, new DialogInterface.OnClickListener() { }, new DialogInterface.OnClickListener() {
@Override @Override
...@@ -609,42 +633,29 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -609,42 +633,29 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} else { } else {
// 空き容量が少ない場合警告を表示 // 空き容量が少ない場合警告を表示
if (!StorageUtil.isFreeSpaceEnough(this)) { if (!StorageUtil.isFreeSpaceEnough(this)) {
Logger.w(TAG, "[storage free space enough]");
if (isShowToast) {
handleErrorMessageToast(ErrorCode.STORAGE_WARNING); handleErrorMessageToast(ErrorCode.STORAGE_WARNING);
} }
}
contentDownloader.download(contentId); contentDownloader.download(contentId);
} }
} catch (NetworkDisconnectedException e) { } catch (NetworkDisconnectedException e) {
Logger.e(TAG, "NetworkDisconnectedException" + e); Logger.e(TAG, "NetworkDisconnectedException" + e);
if (isShowToast) {
handleErrorMessageToast(ErrorCode.NETWORK); handleErrorMessageToast(ErrorCode.NETWORK);
}
result = false; result = false;
} catch (ABVException e) { } catch (ABVException e) {
if (btnDownload != null) {
btnDownload.setVisibility(View.INVISIBLE);
}
Logger.e("ABVException", e.toString()); Logger.e("ABVException", e.toString());
result = false; result = false;
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG, "Exception " + e); Logger.e(TAG, "Exception " + e);
if (isShowToast) {
handleErrorMessageToast(ErrorCode.E107); handleErrorMessageToast(ErrorCode.E107);
result = false;
} finally {
try {
List<ContentDto> contentList = contentDao.getUnfinishedDownloadAll();
if (contentList != null && contentList.size() > 0) {
if (btnDownload != null) {
btnDownload.setVisibility(View.VISIBLE);
}
} else {
if (btnDownload != null) {
btnDownload.setVisibility(View.INVISIBLE);
}
} }
} catch (Exception e) {
Logger.e(TAG, "Exception " + e);
handleErrorMessageToast(ErrorCode.E107);
result = false; result = false;
} }
}
return result; return result;
} }
...@@ -661,9 +672,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -661,9 +672,10 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
contentDownloader.addContentDownloadListener(this); contentDownloader.addContentDownloadListener(this);
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG, "downloadContent failed. contentId=" + contentDto.contentId, e); Logger.e(TAG, "downloadContent failed. contentId=" + contentDto.contentId, e);
return false;
} }
} else { } else {
return contentDownload(contentDto.contentId, false); return contentDownload(contentDto.contentId, false, false);
} }
return true; return true;
} }
...@@ -717,8 +729,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -717,8 +729,6 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
} }
} }
public abstract boolean contentValidCheckAndDownload(long contentId);
public void startContentViewActivity(long contentId) { public void startContentViewActivity(long contentId) {
startContentViewActivity(contentId, 0); startContentViewActivity(contentId, 0);
} }
...@@ -765,6 +775,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co ...@@ -765,6 +775,13 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
intent.putExtra(ABookKeys.HELP_VIEW_TYPE, helpViewType); intent.putExtra(ABookKeys.HELP_VIEW_TYPE, helpViewType);
intent.setClassName(getApplicationContext().getPackageName(), className); intent.setClassName(getApplicationContext().getPackageName(), className);
startActivity(intent); startActivity(intent);
}
/**
* 一括同期処理中であるか確認
* @return
*/
public boolean isShowingBatchSync() {
return batchSyncView != null && batchSyncView.isShowing();
} }
} }
...@@ -551,11 +551,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { ...@@ -551,11 +551,6 @@ public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
} }
} }
@Override
public boolean contentValidCheckAndDownload(long contentId) {
return false; // dummy
}
protected void setMeetingParticipantCount(boolean isVisible, View toolBar) { protected void setMeetingParticipantCount(boolean isVisible, View toolBar) {
final TextView textView = (TextView)toolBar.findViewById(R.id.txt_meeting_participant); final TextView textView = (TextView)toolBar.findViewById(R.id.txt_meeting_participant);
if (textView == null) { if (textView == null) {
......
...@@ -24,6 +24,7 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog; ...@@ -24,6 +24,7 @@ import jp.agentec.abook.abv.ui.common.dialog.ABookAlertDialog;
import jp.agentec.abook.abv.ui.common.util.ABVToastUtil; 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.LogUtil; import jp.agentec.abook.abv.ui.common.util.LogUtil;
import jp.agentec.abook.abv.ui.common.view.ABVBatchSyncView;
import jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity; import jp.agentec.abook.abv.ui.home.activity.ABookSettingActivity;
import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
...@@ -52,7 +53,6 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity { ...@@ -52,7 +53,6 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
// 新着更新処理の終了後、プルダウンを完了させるためのビュー // 新着更新処理の終了後、プルダウンを完了させるためのビュー
protected PullToRefreshBase refreshBaseView; protected PullToRefreshBase refreshBaseView;
protected String urlPassword; // Reader用
//Gettisの場合:プッシュ―メッセージを経由してコンテンツダウンロード場合対応 //Gettisの場合:プッシュ―メッセージを経由してコンテンツダウンロード場合対応
private String mPushMessage = ""; //コンテンツ追加の機能をの引数が増えないようにこの変数を追加 private String mPushMessage = ""; //コンテンツ追加の機能をの引数が増えないようにこの変数を追加
...@@ -262,31 +262,14 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity { ...@@ -262,31 +262,14 @@ public abstract class ABVUIActivity extends ABVAuthenticatedActivity {
* @param contentId 対象コンテンツID * @param contentId 対象コンテンツID
* @return boolean チェックの成功可否 * @return boolean チェックの成功可否
*/ */
@Override public boolean contentValidCheckAndDownload(long contentId) {
public boolean contentValidCheckAndDownload(final long contentId) {
CommonExecutor.execute(new Runnable() {
@Override
public void run() {
contentValidCheckAndDownload(contentId, true);
}
});
return true;
}
/**
* コンテンツの有効性チェックとダウンロードを行う
* @param contentId 対象コンテンツID
* @param refreshFlag 画面のリフレッシュさせるかのフラグ
* @return boolean チェックの成功可否
*/
public boolean contentValidCheckAndDownload(long contentId, boolean refreshFlag) {
boolean checkResult = false; boolean checkResult = false;
int status = contentValidCheckAndShowMessage(contentId, MessageType.TYPE_SHOW_TOAST); int status = contentValidCheckAndShowMessage(contentId, MessageType.TYPE_SHOW_TOAST);
if (status == ContentCheckResultType.SUCCESS) { if (status == ContentCheckResultType.SUCCESS) {
checkResult = contentDownload(contentId); checkResult = contentDownload(contentId);
} }
if (status == ContentCheckResultType.NO_AUTH_DELETE && refreshFlag) { if (status == ContentCheckResultType.NO_AUTH_DELETE) {
// コンテンツのチェック結果が権限喪失の場合はリフレッシュ // コンテンツのチェック結果が権限喪失の場合はリフレッシュ
handler.post(new Runnable() { handler.post(new Runnable() {
@Override @Override
......
...@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.ui.common.activity; ...@@ -3,6 +3,7 @@ package jp.agentec.abook.abv.ui.common.activity;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.os.Bundle; import android.os.Bundle;
import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.dto.OperationDto; import jp.agentec.abook.abv.bl.dto.OperationDto;
import jp.agentec.abook.abv.bl.logic.AbstractLogic; import jp.agentec.abook.abv.bl.logic.AbstractLogic;
import jp.agentec.abook.abv.bl.logic.OperationLogic; import jp.agentec.abook.abv.bl.logic.OperationLogic;
...@@ -18,15 +19,19 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper; ...@@ -18,15 +19,19 @@ import jp.agentec.abook.abv.ui.home.helper.ActivityHandlingHelper;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
public class ShowPushMessageDailogActivity extends ABVUIActivity { public class ShowPushMessageDailogActivity extends ABVUIActivity {
private static final String TAG = "ShowPushMessageDailogActivity";
OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class);
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
String data = getIntent().getExtras().getString(PushMessageKey.data); String data = getIntent().getExtras() != null ? getIntent().getExtras().getString(PushMessageKey.data) : null;
if (StringUtil.isNullOrEmpty(data)) { if (StringUtil.isNullOrEmpty(data)) {
final long operationId = StringUtil.isNullOrEmpty(getIntent().getExtras().getString(PushMessageKey.operationId)) ? 0 : Long.parseLong(getIntent().getExtras().getString(PushMessageKey.operationId)); final long operationId = StringUtil.isNullOrEmpty(getIntent().getExtras().getString(PushMessageKey.operationId)) ? 0 : Long.parseLong(getIntent().getExtras().getString(PushMessageKey.operationId));
if (operationId > 0) { if (operationId > 0) {
Logger.d(TAG, "operationId : " + operationId);
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ShowPushMessageDailogActivity.this, getRString(R.string.app_name), getIntent().getExtras().getString(PushMessageKey.message)); final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(ShowPushMessageDailogActivity.this, getRString(R.string.app_name), getIntent().getExtras().getString(PushMessageKey.message));
// リソースパターンの適用 // リソースパターンの適用
...@@ -47,25 +52,31 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity { ...@@ -47,25 +52,31 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
R.string.msg_routineTask_report_disable_meeting_room, R.string.msg_routineTask_report_disable_meeting_room,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))); getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else { } else {
OperationLogic mOperationLogic = AbstractLogic.getLogic(OperationLogic.class); OperationListActivity operationListActivity = ActivityHandlingHelper.getInstance().getPreviousOperationListActivity();
if (operationListActivity != null && operationListActivity.isShowingBatchSync()) {
Logger.d(TAG, "is showing Batch Sync");
// 一括同期中は移動しない
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, getString(R.string.msg_batch_sync_move_operation_view));
} else {
OperationDto operationDto = mOperationLogic.getOperation(operationId); OperationDto operationDto = mOperationLogic.getOperation(operationId);
if (operationDto == null) { if (operationDto == null) {
Logger.d(TAG, "operationDto is null");
// リソースパターンの適用 // リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(), ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_no_operation, R.string.msg_routineTask_report_disable_no_operation,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))); getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else if (operationDto.needSyncFlg) { } else if (operationDto.needSyncFlg) {
Logger.d(TAG, "needSyncFlg is true");
// リソースパターンの適用 // リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(), ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_not_updated, R.string.msg_routineTask_report_disable_not_updated,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))); getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else { } else {
OperationListActivity operationListActivity = ActivityHandlingHelper.getInstance().getPreviousOperationListActivity();
if (operationListActivity != null) { if (operationListActivity != null) {
Logger.d(TAG, "startTaskDirectionOrReportView");
operationListActivity.startTaskDirectionOrReportView(operationDto); operationListActivity.startTaskDirectionOrReportView(operationDto);
} else { } else {
Logger.d(TAG, "operationListActivity is null");
// リソースパターンの適用 // リソースパターンの適用
ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(), ErrorMessage.showErrorMessageToast(ShowPushMessageDailogActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_not_list, R.string.msg_routineTask_report_disable_not_list,
...@@ -73,6 +84,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity { ...@@ -73,6 +84,7 @@ public class ShowPushMessageDailogActivity extends ABVUIActivity {
} }
} }
} }
}
dialog.dismiss(); dialog.dismiss();
} }
}); });
......
...@@ -75,6 +75,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger; ...@@ -75,6 +75,7 @@ import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.abook.abv.bl.data.ABVDataCache; import jp.agentec.abook.abv.bl.data.ABVDataCache;
import jp.agentec.abook.abv.bl.data.dao.AbstractDao; import jp.agentec.abook.abv.bl.data.dao.AbstractDao;
import jp.agentec.abook.abv.bl.data.dao.OperationContentDao; import jp.agentec.abook.abv.bl.data.dao.OperationContentDao;
import jp.agentec.abook.abv.bl.data.dao.OperationDao;
import jp.agentec.abook.abv.bl.data.dao.TaskDao; import jp.agentec.abook.abv.bl.data.dao.TaskDao;
import jp.agentec.abook.abv.bl.data.dao.TaskReportDao; import jp.agentec.abook.abv.bl.data.dao.TaskReportDao;
import jp.agentec.abook.abv.bl.download.ContentFileExtractor; import jp.agentec.abook.abv.bl.download.ContentFileExtractor;
...@@ -160,6 +161,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -160,6 +161,7 @@ public class OperationListActivity extends ABVUIActivity {
private Dialog mPanoEntryDialog; private Dialog mPanoEntryDialog;
private OperationDao mOperationDao = AbstractDao.getDao(OperationDao.class);
private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class); private OperationContentDao mOperationContentDao = AbstractDao.getDao(OperationContentDao.class);
private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class); private TaskReportDao mTaskReportDao = AbstractDao.getDao(TaskReportDao.class);
...@@ -207,9 +209,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -207,9 +209,6 @@ 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 {
...@@ -251,6 +250,9 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -251,6 +250,9 @@ public class OperationListActivity extends ABVUIActivity {
mLocationTypeRadioGroup = (RadioGroup) findViewById(R.id.segment_group); mLocationTypeRadioGroup = (RadioGroup) findViewById(R.id.segment_group);
mOperationBatchSyncButton = (ImageButton) findViewById(R.id.btc_batch_sync); mOperationBatchSyncButton = (ImageButton) findViewById(R.id.btc_batch_sync);
// 定期点検で同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合、needSyncFlgをtrueに更新
updateNeedSyncRoutineOperation();
// ビュー変更ボタンのタッチイベント // ビュー変更ボタンのタッチイベント
mViewModeButton.setOnClickListener(new View.OnClickListener() { mViewModeButton.setOnClickListener(new View.OnClickListener() {
@Override @Override
...@@ -336,9 +338,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -336,9 +338,7 @@ public class OperationListActivity extends ABVUIActivity {
if (operationId > 0) { if (operationId > 0) {
final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(this, getRString(R.string.app_name), message); final ABookAlertDialog alertDialog = AlertDialogUtil.createAlertDialog(this, getRString(R.string.app_name), message);
// リソースパターンの適用 // リソースパターンの適用
alertDialog.setPositiveButton(PatternStringUtil.patternToInt(getApplicationContext(), alertDialog.setPositiveButton(PatternStringUtil.patternToInt(getApplicationContext(), R.string.work_report, getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)),
R.string.work_report,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)),
new DialogInterface.OnClickListener() { new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int whichButton) { public void onClick(DialogInterface dialog, int whichButton) {
...@@ -352,6 +352,9 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -352,6 +352,9 @@ public class OperationListActivity extends ABVUIActivity {
ErrorMessage.showErrorMessageToast(OperationListActivity.this, PatternStringUtil.patternToInt(getApplicationContext(), ErrorMessage.showErrorMessageToast(OperationListActivity.this, PatternStringUtil.patternToInt(getApplicationContext(),
R.string.msg_routineTask_report_disable_meeting_room, R.string.msg_routineTask_report_disable_meeting_room,
getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0))); getUserPref(AppDefType.UserPrefKey.RESOURCE_PATTERN_TYPE, 0)));
} else if (isShowingBatchSync()) {
// 一括同期中は移動しない
ErrorMessage.showErrorMessageToast(OperationListActivity.this, getString(R.string.msg_batch_sync_move_operation_view));
} else { } else {
OperationDto operationDto = mOperationLogic.getOperation(operationId); OperationDto operationDto = mOperationLogic.getOperation(operationId);
...@@ -385,7 +388,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -385,7 +388,7 @@ public class OperationListActivity extends ABVUIActivity {
} }
} }
// 一括同期を設定 // 一括同期を設定
mBatchSyncView = new ABVBatchSyncView(this); batchSyncView = new ABVBatchSyncView(this);
mAllOperationReportTypes = getOperationReportTypeList(true); mAllOperationReportTypes = getOperationReportTypeList(true);
// リスト更新 // リスト更新
setOperationListView(); setOperationListView();
...@@ -810,24 +813,24 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -810,24 +813,24 @@ public class OperationListActivity extends ABVUIActivity {
@Override @Override
public void onDownloadingContentZip(final ContentZipDownloadNotification notification) { public void onDownloadingContentZip(final ContentZipDownloadNotification notification) {
Logger.d(TAG, "[onDownloadingContentZip]");
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()) { if (isShowingBatchSync()) {
// 一括同期からの同期処理 // 一括同期からの同期処理
Logger.d(TAG, "[onDownloadingContentZip] batchOperationSync start");
batchOperationSync(true); batchOperationSync(true);
Logger.i(TAG, "----------------------onDownloadingContentZip mBatchSyncFlg");
} else { } 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.d(TAG, "syncOperation update is failed downloadStatus : " + notification.downloadStatus);
if (isShowingBatchSync()) { if (isShowingBatchSync()) {
// 一括同期からのダウンロード失敗時、プログレスバーを閉じる // 一括同期からのダウンロード失敗時、エラーメッセージ表示
mBatchSyncView.closeProgressDialog(); showBatchSyncErrorAlert(getString(R.string.msg_batch_sync_content_download_fail));
} }
closeProgressPopup(); closeProgressPopup();
} }
...@@ -845,6 +848,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -845,6 +848,7 @@ public class OperationListActivity extends ABVUIActivity {
* @param operationReportType * @param operationReportType
*/ */
public void syncOperation(final long operationId, int operationReportType, boolean buttonEventFlg) { public void syncOperation(final long operationId, int operationReportType, boolean buttonEventFlg) {
// TODO callback or return errorMsg どっちを使用すればいいか検討
syncOperation(operationId, operationReportType, buttonEventFlg, new Callback() { syncOperation(operationId, operationReportType, buttonEventFlg, new Callback() {
@Override @Override
public Object callback(Object ret) { public Object callback(Object ret) {
...@@ -874,21 +878,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -874,21 +878,6 @@ public class OperationListActivity extends ABVUIActivity {
public void syncOperation(final long operationId, int reportType, boolean buttonEventFlag, final Callback errorCallback) { public void syncOperation(final long operationId, int reportType, boolean buttonEventFlag, final Callback errorCallback) {
final StringBuilder errorMsg = new StringBuilder(); final StringBuilder errorMsg = new StringBuilder();
Logger.i(TAG, "---sync start"); Logger.i(TAG, "---sync start");
// ネットワーク通信チェック
if (!ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
if (isShowingBatchSync()) {
errorCallback.callback(getString(R.string.msg_batch_sync_disconnect_network));
} else {
errorCallback.callback(getString(R.string.request_network_connection));
}
return;
}
// 新着更新チェック
if (contentRefresher.isRefreshing()) {
// ignore
closeProgressPopup();
return;
}
try { try {
//コンテンツダウンロード関連プログレスバー値設定 //コンテンツダウンロード関連プログレスバー値設定
...@@ -960,13 +949,7 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -960,13 +949,7 @@ public class OperationListActivity extends ABVUIActivity {
} }
} catch (Exception e) { } catch (Exception e) {
Logger.e(TAG, e); Logger.e(TAG, e);
handler.post(new Runnable() { errorMsg.append(ErrorMessage.getErrorMessage(this, ABVExceptionCode.C_E_SYSTEM_0001));
@Override
public void run() {
handleErrorMessageToast(ABVExceptionCode.C_E_SYSTEM_0001);
closeProgressPopup();
}
});
} finally { } finally {
handler.post(new Runnable() { handler.post(new Runnable() {
@Override @Override
...@@ -1077,7 +1060,6 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1077,7 +1060,6 @@ public class OperationListActivity extends ABVUIActivity {
mTaskReportDao.delete(localTaskReportDto); mTaskReportDao.delete(localTaskReportDto);
} }
} }
localTaskReportList.remove(localTaskReportDto);
} }
} }
...@@ -1894,7 +1876,10 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -1894,7 +1876,10 @@ public class OperationListActivity extends ABVUIActivity {
return; return;
} }
if (!contentDto.downloadedFlg || contentDto.updatedFlg) { if (!contentDto.downloadedFlg || contentDto.updatedFlg) {
operationContentDownload(contentDto); if (!operationContentDownload(contentDto)) {
Logger.e("operation sync baseFile download fail");
closeProgressPopup();
}
} else { } else {
syncOperation(operationDto.operationId, operationDto.reportType, true); syncOperation(operationDto.operationId, operationDto.reportType, true);
} }
...@@ -2318,9 +2303,8 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2318,9 +2303,8 @@ public class OperationListActivity extends ABVUIActivity {
public void categoryBatchSync() { public void categoryBatchSync() {
Logger.i(TAG, "---category batch sync start"); Logger.i(TAG, "---category batch sync start");
// 作業種別に関連する作業リストを取得 // 作業種別に関連する作業リストを取得
List<OperationDto> operationList = mOperationLogic.getNeedSyncOperationByGroupMasterId(getABVUIDataCache().getOperationGroupMasterId()); List<OperationDto> operationList = mOperationDao.getNeedSyncOperationByGroupMasterId(getABVUIDataCache().getOperationGroupMasterId());
// 一覧に作業が存在しない場合 // 一覧に作業が存在しない場合
if (operationList == null || operationList.isEmpty()) { if (operationList == null || operationList.isEmpty()) {
return; return;
...@@ -2332,8 +2316,8 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2332,8 +2316,8 @@ public class OperationListActivity extends ABVUIActivity {
operationDtoStack.push(operationDto); operationDtoStack.push(operationDto);
} }
mBatchSyncView.setStack(operationDtoStack); batchSyncView.setStack(operationDtoStack);
mBatchSyncView.show(); batchSyncView.show();
batchOperationSync(false); batchOperationSync(false);
} }
...@@ -2345,11 +2329,11 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2345,11 +2329,11 @@ public class OperationListActivity extends ABVUIActivity {
CommonExecutor.execute(new Runnable() { CommonExecutor.execute(new Runnable() {
@Override @Override
public void run() { public void run() {
if (mBatchSyncView.empty()) { if (batchSyncView.empty()) {
mBatchSyncView.closeProgressDialog(); batchSyncView.closeProgressDialog();
return; return;
} }
Stack<OperationDto> batchSyncStack = mBatchSyncView.getBatchSyncOperationStack(); Stack<OperationDto> batchSyncStack = batchSyncView.getBatchSyncOperationStack();
if (!downloadedFlg) { if (!downloadedFlg) {
Logger.d(TAG, "batchOperation sync -- base file not downloaded"); Logger.d(TAG, "batchOperation sync -- base file not downloaded");
...@@ -2361,12 +2345,16 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2361,12 +2345,16 @@ public class OperationListActivity extends ABVUIActivity {
return; return;
} }
if (!contentDto.downloadedFlg || contentDto.updatedFlg) { if (!contentDto.downloadedFlg || contentDto.updatedFlg) {
operationContentDownload(contentDto); if (!operationContentDownload(contentDto)) {
// error
showBatchSyncErrorAlert(getString(R.string.msg_batch_sync_content_download_fail));
}
return; return;
} }
} }
final OperationDto operationDto = batchSyncStack.pop(); final OperationDto operationDto = batchSyncStack.pop();
// TODO callback or return errorMsg どっちを使用すればいいか検討
syncOperation(operationDto.operationId, operationDto.reportType, false, new Callback() { syncOperation(operationDto.operationId, operationDto.reportType, false, new Callback() {
@Override @Override
public Object callback(Object ret) { public Object callback(Object ret) {
...@@ -2375,17 +2363,20 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2375,17 +2363,20 @@ public class OperationListActivity extends ABVUIActivity {
@Override @Override
public void run() { public void run() {
if (errorMessage != null) { 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 // error
mBatchSyncView.closeProgressDialog(); if (ABVEnvironment.getInstance().networkAdapter.isNetworkConnected()) {
showBatchSyncErrorAlert(String.format(getString(R.string.msg_batch_sync_error), operationDto.operationName) + errorMessage);
} else {
// ネットワーク通信エラー
showBatchSyncErrorAlert(getString(R.string.msg_batch_sync_disconnect_network));
}
} else { } else {
if (mBatchSyncView.checkMaxProgress()) { if (batchSyncView.checkMaxProgress()) {
// 最後の処理が完了したと見做す // 最後の処理が完了したと見做す
mBatchSyncView.closeProgressDialog(); batchSyncView.closeProgressDialog();
} else { } else {
// プログレスバーに作業1つ完了をセット // プログレスバーに作業1つ完了をセット
mBatchSyncView.setProgress(mBatchSyncView.getProgress() + 1); batchSyncView.setProgress(batchSyncView.getProgress() + 1);
// 次の作業を同期処理 // 次の作業を同期処理
batchOperationSync(false); batchOperationSync(false);
} }
...@@ -2399,7 +2390,32 @@ public class OperationListActivity extends ABVUIActivity { ...@@ -2399,7 +2390,32 @@ public class OperationListActivity extends ABVUIActivity {
}); });
} }
public boolean isShowingBatchSync() { /**
return mBatchSyncView != null && mBatchSyncView.isShowing(); * 一括同期処理時、エラーアラート表示
* 一括同期中のプログレスバーは非表示にする
* @param msg
*/
private void showBatchSyncErrorAlert(String msg) {
showSimpleAlertDialog(getString(R.string.app_name), msg);
batchSyncView.closeProgressDialog();
}
/**
* 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
* needSyncFlgをtrueに更新する
*/
private void updateNeedSyncRoutineOperation() {
// サービスオプションチェック
if (ABVDataCache.getInstance().serviceOption.isRoutineTaskReport()) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合needSyncFlgをtrueに更新する
List<OperationDto> deactivatedRoutineOperationList = mOperationDao.getDeactivatedRoutineOperation();
for (OperationDto routineOperationDto : deactivatedRoutineOperationList) {
String syncedDate = getUserPref(String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, routineOperationDto.operationId), "");
if (StringUtil.isNullOrEmpty(routineOperationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
mOperationLogic.updateSyncOperation(routineOperationDto.operationId, true);
}
}
}
} }
} }
...@@ -211,7 +211,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity { ...@@ -211,7 +211,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
mOperationRelatedContentSectionAdapter.setAdapterListener(new OperationRelatedContentSectionAdapter.OperationRelatedContentSectionListener() { mOperationRelatedContentSectionAdapter.setAdapterListener(new OperationRelatedContentSectionAdapter.OperationRelatedContentSectionListener() {
@Override @Override
public boolean onContentDownload(long contentId) { public boolean onContentDownload(long contentId) {
return contentValidCheckAndDownload(contentId, true); return contentValidCheckAndDownload(contentId);
} }
@Override @Override
...@@ -324,7 +324,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity { ...@@ -324,7 +324,7 @@ public class OperationRelatedContentActivity extends ABVUIActivity {
protected Void doInBackground(Void... params) { protected Void doInBackground(Void... params) {
for (ContentDto contentDto : downloadList) { for (ContentDto contentDto : downloadList) {
Logger.i(TAG, "downloading content=" + contentDto.contentName); Logger.i(TAG, "downloading content=" + contentDto.contentName);
contentValidCheckAndDownload(contentDto.contentId, true); contentValidCheckAndDownload(contentDto.contentId);
} }
return null; return null;
} }
......
...@@ -118,29 +118,11 @@ public class OperationListAdapter extends AbstractOperationAdapter { ...@@ -118,29 +118,11 @@ public class OperationListAdapter extends AbstractOperationAdapter {
// 同期ボタン表示・非表示 // 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) { if (operationDto.contentId != null && operationDto.contentId != 0) {
if ((operationDto.needSyncFlg)) { holder.ivSync.setVisibility(operationDto.needSyncFlg ? View.VISIBLE : View.INVISIBLE);
holder.ivSync.setVisibility(View.VISIBLE);
} else { } else {
// needSyncFlgがfalseの場合 // 作業のコンテンツが存在しない場合は、同期ボタンを非活性化する
if (operationDto.reportType == ReportType.RoutineTask) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
holder.ivSync.setVisibility(View.VISIBLE);
} else {
holder.ivSync.setVisibility(View.INVISIBLE);
}
} else {
// 定期点検プロジェクトではない場合、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE); holder.ivSync.setVisibility(View.INVISIBLE);
} }
}
} else {
// プロジェクトのコンテンツが存在しない場合は、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE);
}
if(operationDto.operationType == OperationType.PANO) { if(operationDto.operationType == OperationType.PANO) {
if (operationDto.enableReportEdit == Constant.EnableReportEdit.NO) { if (operationDto.enableReportEdit == Constant.EnableReportEdit.NO) {
......
...@@ -145,26 +145,9 @@ public class OperationPanelAdapter extends AbstractOperationAdapter { ...@@ -145,26 +145,9 @@ public class OperationPanelAdapter extends AbstractOperationAdapter {
// 同期ボタン表示・非表示 // 同期ボタン表示・非表示
if (operationDto.contentId != null && operationDto.contentId != 0) { if (operationDto.contentId != null && operationDto.contentId != 0) {
if ((operationDto.needSyncFlg)) { holder.ivSync.setVisibility(operationDto.needSyncFlg ? View.VISIBLE : View.INVISIBLE);
holder.ivSync.setVisibility(View.VISIBLE);
} else { } else {
// needSyncFlgがfalseの場合 // 作業のコンテンツが存在しない場合は、同期ボタンを非活性化する
if (operationDto.reportType == ReportType.RoutineTask) {
// 定期点検プロジェクトの場合のみ、以下の処理を行う
String syncedDate = getUserPref(mContext, String.format(AppDefType.UserPrefKey.SYNCED_OPERATION_ID, operationDto.operationId), "");
if (StringUtil.isNullOrEmpty(operationDto.reportPeriod) && !syncedDate.equals(DateTimeUtil.toString(DateTimeUtil.getCurrentSqlDate(), DateTimeFormat.yyyyMMdd_none))) {
// 同期ボタンタップの日付と現在の日付が異なる且つ、作業するデータが存在しない場合
holder.ivSync.setVisibility(View.VISIBLE);
} else {
holder.ivSync.setVisibility(View.INVISIBLE);
}
} else {
// 定期点検プロジェクトではない場合、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE);
}
}
} else {
// プロジェクトのコンテンツが存在しない場合は、同期ボタンを非活性化する
holder.ivSync.setVisibility(View.INVISIBLE); holder.ivSync.setVisibility(View.INVISIBLE);
} }
......
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