Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
abook_check
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abook_android
abook_check
Commits
3329f676
Commit
3329f676
authored
Aug 29, 2019
by
Lee Jaebin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
一括同期処理(レビュー後修正)
parent
3e2de8d8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
101 additions
and
39 deletions
+101
-39
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/OperationDao.java
+10
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVActivity.java
+1
-1
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVAuthenticatedActivity.java
+1
-20
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/view/ABVBatchSyncView.java
+87
-18
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
+0
-0
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/OperationGroupMasterListHelper.java
+2
-0
No files found.
ABVJE_BL/src/jp/agentec/abook/abv/bl/data/dao/OperationDao.java
View file @
3329f676
...
@@ -401,6 +401,16 @@ public class OperationDao extends AbstractDao {
...
@@ -401,6 +401,16 @@ public class OperationDao extends AbstractDao {
}
}
/**
/**
* 作業グループに紐づく同期可能な作業リストが存在するかチェック
* @param operationGroupMasterId
* @return
*/
public
boolean
hasNeedSyncOperationByGroupMasterId
(
Integer
operationGroupMasterId
)
{
List
<
OperationDto
>
operationDtoList
=
getNeedSyncOperationByGroupMasterId
(
operationGroupMasterId
);
return
operationDtoList
!=
null
&&
operationDtoList
.
size
()
>
0
;
}
/**
* 定期点検で同期が必要な作業を取得
* 定期点検で同期が必要な作業を取得
* @return
* @return
*/
*/
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVActivity.java
View file @
3329f676
...
@@ -800,7 +800,7 @@ public abstract class ABVActivity extends Activity {
...
@@ -800,7 +800,7 @@ public abstract class ABVActivity extends Activity {
showSimpleAlertDialog
(
getString
(
titleResId
),
getString
(
bodyResId
));
showSimpleAlertDialog
(
getString
(
titleResId
),
getString
(
bodyResId
));
}
}
p
rotected
void
showSimpleAlertDialog
(
final
String
title
,
final
String
body
)
{
p
ublic
void
showSimpleAlertDialog
(
final
String
title
,
final
String
body
)
{
handler
.
postDelayed
(
new
Runnable
()
{
handler
.
postDelayed
(
new
Runnable
()
{
@Override
@Override
public
void
run
()
{
public
void
run
()
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVAuthenticatedActivity.java
View file @
3329f676
...
@@ -659,26 +659,7 @@ public abstract class ABVAuthenticatedActivity extends ABVActivity implements Co
...
@@ -659,26 +659,7 @@ 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
);
return
false
;
}
}
else
{
return
contentDownload
(
contentDto
.
contentId
,
false
,
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
{
...
...
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/view/ABVBatchSyncView.java
View file @
3329f676
...
@@ -6,25 +6,42 @@ import android.graphics.PixelFormat;
...
@@ -6,25 +6,42 @@ import android.graphics.PixelFormat;
import
java.util.Stack
;
import
java.util.Stack
;
import
jp.agentec.abook.abv.bl.common.ABVEnvironment
;
import
jp.agentec.abook.abv.bl.common.Callback
;
import
jp.agentec.abook.abv.bl.common.CommonExecutor
;
import
jp.agentec.abook.abv.bl.common.log.Logger
;
import
jp.agentec.abook.abv.bl.data.dao.AbstractDao
;
import
jp.agentec.abook.abv.bl.data.dao.ContentDao
;
import
jp.agentec.abook.abv.bl.dto.ContentDto
;
import
jp.agentec.abook.abv.bl.dto.OperationDto
;
import
jp.agentec.abook.abv.bl.dto.OperationDto
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.launcher.android.R
;
import
jp.agentec.abook.abv.ui.home.activity.OperationListActivity
;
/**
/**
* Created by leej on 2019/08/26.
* Created by leej on 2019/08/26.
*/
*/
public
class
ABVBatchSyncView
extends
ProgressDialog
{
public
class
ABVBatchSyncView
extends
ProgressDialog
{
private
static
final
String
TAG
=
"ABVBatchSyncView"
;
private
Stack
<
OperationDto
>
mBatchSyncOperationStack
=
new
Stack
<>();
private
Stack
<
OperationDto
>
mBatchSyncOperationStack
=
new
Stack
<>();
private
ContentDao
contentDao
=
AbstractDao
.
getDao
(
ContentDao
.
class
);
private
OperationListActivity
mOperationListActivity
;
// Activityが破棄された場合、処理を中止するフラグ
private
boolean
isDestroy
=
false
;
public
ABVBatchSyncView
(
Context
context
)
{
public
ABVBatchSyncView
(
Context
context
)
{
super
(
context
);
super
(
context
);
mOperationListActivity
=
(
OperationListActivity
)
context
;
init
();
init
();
isDestroy
=
false
;
}
}
// 初期化
// 初期化
private
void
init
()
{
private
void
init
()
{
if
(
getWindow
()
!=
null
)
{
if
(
getWindow
()
!=
null
)
{
setIndeterminate
(
false
);
setIndeterminate
(
false
);
// キャンセルできないように設定・ナビゲーションバーのバックボタンも無効してくれる
setCancelable
(
false
);
setCancelable
(
false
);
setProgressStyle
(
ProgressDialog
.
STYLE_HORIZONTAL
);
//プログレスバー表示
setProgressStyle
(
ProgressDialog
.
STYLE_HORIZONTAL
);
//プログレスバー表示
getWindow
().
setFormat
(
PixelFormat
.
TRANSPARENT
);
getWindow
().
setFormat
(
PixelFormat
.
TRANSPARENT
);
...
@@ -42,39 +59,91 @@ public class ABVBatchSyncView extends ProgressDialog {
...
@@ -42,39 +59,91 @@ public class ABVBatchSyncView extends ProgressDialog {
}
}
/**
/**
* 参照のみ、stackには保存状態
* 閉じる処理
* @return
*/
*/
public
OperationDto
getOperationStackPeek
()
{
public
void
closeProgressDialog
()
{
return
mBatchSyncOperationStack
.
peek
();
// プログレス値を0に初期化
setProgress
(
0
);
dismiss
();
}
}
/**
/**
*
stackからOperationDtoを取り出す
*
スタック中の空チェック
* @return
* @return
*/
*/
public
OperationDto
getOperationStackPop
()
{
public
boolean
isStackEmpty
()
{
return
mBatchSyncOperationStack
.
pop
();
return
mBatchSyncOperationStack
.
empty
();
}
}
public
boolean
checkMaxProgress
()
{
/**
return
getMax
()
==
getProgress
()
+
1
;
* 一括同期処理(stackの中を全て同期する)
* ベース資料ダウンロードチェックして、未ダウンロードであればダウンロードして同期
*/
public
void
batchOperationSyncForCheckDonwload
()
{
if
(
isDestroy
||
isStackEmpty
())
{
// Activity破棄フラグがtrue、またはスタックが存在しなければ、全て完了と見做す
closeProgressDialog
();
Logger
.
d
(
TAG
,
"---batchSync is end"
);
return
;
}
// ベース資料のダウンロードチェック
OperationDto
peekOperationDto
=
mBatchSyncOperationStack
.
peek
();
ContentDto
contentDto
=
contentDao
.
getContent
(
peekOperationDto
.
contentId
);
if
(
contentDto
==
null
)
{
Logger
.
e
(
TAG
,
"contentDto is null !"
);
closeProgressDialog
();
return
;
}
if
(!
contentDto
.
downloadedFlg
||
contentDto
.
updatedFlg
)
{
if
(!
mOperationListActivity
.
operationContentDownload
(
contentDto
))
{
// error
showBatchSyncErrorAlert
(
peekOperationDto
,
mOperationListActivity
.
getString
(
R
.
string
.
msg_batch_sync_content_download_fail
));
}
return
;
}
// 同期処理
batchOperationSync
();
}
}
/**
/**
*
閉じる処理
*
一括同期処理(ベース資料はダウンロード済み)
*/
*/
public
void
closeProgressDialog
()
{
public
void
batchOperationSync
()
{
// プログレス値を0に初期化
final
OperationDto
operationDto
=
mBatchSyncOperationStack
.
pop
();
setProgress
(
0
);
String
errorMessage
=
mOperationListActivity
.
syncOperation
(
operationDto
.
operationId
,
operationDto
.
reportType
,
false
);
dismiss
();
if
(
errorMessage
!=
null
)
{
showBatchSyncErrorAlert
(
operationDto
,
errorMessage
);
}
else
{
// 正常
// 次のスタックがなければ、カウントしない
if
(!
isStackEmpty
())
{
setProgress
(
getProgress
()
+
1
);
}
// 次の作業を同期処理
batchOperationSyncForCheckDonwload
();
}
}
// Activityが破棄された場合呼ばれる
public
void
setActivityDestroy
()
{
isDestroy
=
true
;
}
}
/**
/**
* スタック中の空チェック
* 一括同期処理時、エラーアラート表示
* @return
* 一括同期中のプログレスバーは非表示にする
* @param operationDto
* @param errorMessage
*/
*/
public
boolean
isStackEmpty
()
{
public
void
showBatchSyncErrorAlert
(
OperationDto
operationDto
,
String
errorMessage
)
{
return
mBatchSyncOperationStack
.
empty
();
// 異常
closeProgressDialog
();
if
(
ABVEnvironment
.
getInstance
().
networkAdapter
.
isNetworkConnected
())
{
String
convertErrorMsg
=
String
.
format
(
mOperationListActivity
.
getString
(
R
.
string
.
msg_batch_sync_error
),
operationDto
.
operationName
)
+
errorMessage
;
mOperationListActivity
.
showSimpleAlertDialog
(
mOperationListActivity
.
getString
(
R
.
string
.
app_name
),
convertErrorMsg
);
}
else
{
// ネットワーク通信エラー
mOperationListActivity
.
showSimpleAlertDialog
(
mOperationListActivity
.
getString
(
R
.
string
.
app_name
),
mOperationListActivity
.
getString
(
R
.
string
.
msg_batch_sync_disconnect_network
));
}
}
}
}
}
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/activity/OperationListActivity.java
View file @
3329f676
This diff is collapsed.
Click to expand it.
ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/home/helper/OperationGroupMasterListHelper.java
View file @
3329f676
...
@@ -74,6 +74,8 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
...
@@ -74,6 +74,8 @@ public class OperationGroupMasterListHelper extends HierarchyOperationListHelper
mAppActivity
.
closeOperationGroupMasterDialog
();
mAppActivity
.
closeOperationGroupMasterDialog
();
}
}
OperationGroupMasterDto
peekOperationGroupMasterDto
=
stack
.
peek
();
OperationGroupMasterDto
peekOperationGroupMasterDto
=
stack
.
peek
();
mAppActivity
.
checkBatchNeedSyncButton
(
peekOperationGroupMasterDto
.
operationGroupMasterId
);
// 作業種別IDで紐づく作業リストを取得
// 作業種別IDで紐づく作業リストを取得
return
mOperationGroupMasterLogic
.
getOperationByOperationGroupMasterId
(
peekOperationGroupMasterDto
.
operationGroupMasterId
);
return
mOperationGroupMasterLogic
.
getOperationByOperationGroupMasterId
(
peekOperationGroupMasterDto
.
operationGroupMasterId
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment