Commit 30e88f86 by NGUYEN HOANG SON

save, load processList, warningReportList json

parent 287788d3
......@@ -65,6 +65,9 @@ public class OperationListJSON extends AcmsCommonJSON {
public static final String PermitCodeRequiredFlg = "permitCodeRequiredFlg";
public static final String DisplayPermissionFlg = "displayPermissionFlg";
public static final String ProcessList = "processList";
public static final String WarningReportList = "warningReportList";
public List<OperationDto> operationList;
public OperationListJSON(String jsonString) throws AcmsException {
......@@ -180,6 +183,13 @@ public class OperationListJSON extends AcmsCommonJSON {
dto.operationGroupMasterRelationDtoList.add(operationGroupMasterRelationDto);
}
}
// check pickup tab
if (operationJson.has(ProcessList)) {
dto.processJsonArray = operationJson.getJSONArray(ProcessList);
}
if (operationJson.has(WarningReportList)) {
dto.warningReportJsonArray = operationJson.getJSONArray(WarningReportList);
}
operationList.add(dto);
}
}
......
......@@ -52,6 +52,9 @@ public class ABookKeys {
public static final String OPERATION_PUSHMESSAGE = "pushMessage";
public static final String OPERATION_READINGFLG = "readingFlg";
public static final String OPERATION_PROCESS_LIST = "processList";
public static final String OPERATION_WARNING_REPORT_LIST = "warningReportList";
// ABOOKCHECK SCHEME
public static final String ABOOK_CHECK_API = "abookcheck-api";
public static final String CMD_MOVE_HOT_SPOT = "moveHotspot";
......
package jp.agentec.abook.abv.bl.dto;
import org.json.adf.JSONArray;
import java.util.Date;
import java.util.List;
......@@ -42,6 +44,9 @@ public class OperationDto extends AbstractDto {
// 作業担当グループリスト
public List<TaskWorkerGroupDto> taskWorkerGroupDtoList;
public JSONArray processJsonArray;
public JSONArray warningReportJsonArray;
public boolean equalsLastEdit(OperationDto dto) {
if (dto != null) {
if (operationId.equals(dto.operationId) && lastEditDate.equals(dto.lastEditDate)) {
......
......@@ -110,7 +110,7 @@ public class OperationLogic extends AbstractLogic {
* @throws AcmsException
* @throws NetworkDisconnectedException
*/
public void initializeOperations() throws AcmsException, NetworkDisconnectedException {
public void initializeOperations() throws AcmsException, NetworkDisconnectedException, IOException {
// 作業グループリスト取得
setWorkingGroupList();
// 作業一覧取得し、登録・更新・削除する
......@@ -131,7 +131,7 @@ public class OperationLogic extends AbstractLogic {
* @throws AcmsException
* @throws NetworkDisconnectedException
*/
private void retrieveServerOperation() throws AcmsException, NetworkDisconnectedException {
private void retrieveServerOperation() throws AcmsException, NetworkDisconnectedException, IOException {
List<OperationDto> localOperations = mOperationDao.getAllOperation();
AcmsParameters param = new AcmsParameters(cache.getMemberInfo().sid);
OperationListJSON json = AcmsClient.getInstance(cache.getUrlPath(), networkAdapter).getOperationList(param);
......@@ -256,6 +256,19 @@ public class OperationLogic extends AbstractLogic {
for (PushMessageDto dto : serverOperationDto.pushMessageList) {
mPushMessageDao.insert(dto);
}
//save processList, warningReport json file
String processListJsonPath = ABVEnvironment.getInstance().getOperationDirFile(serverOperationDto.operationId) + "/processList.json";
FileUtil.delete(processListJsonPath);
if (serverOperationDto.processJsonArray != null && serverOperationDto.processJsonArray.length() > 0) {
FileUtil.createFile(processListJsonPath, serverOperationDto.processJsonArray.toString());
}
String warningReportJsonPath = ABVEnvironment.getInstance().getOperationDirFile(serverOperationDto.operationId) + "/warningReportList.json";
FileUtil.delete(warningReportJsonPath);
if (serverOperationDto.warningReportJsonArray != null && serverOperationDto.warningReportJsonArray.length() > 0) {
FileUtil.createFile(warningReportJsonPath, serverOperationDto.warningReportJsonArray.toString());
}
}
List<OperationDto> deleteListDtoArray = new ArrayList<OperationDto>();
......@@ -2294,6 +2307,18 @@ public class OperationLogic extends AbstractLogic {
operationJson.put(ABookKeys.OPERATION_OPEN_DATE, DateTimeUtil.toString(operationList.get(i).operationOpenDate, DateTimeFormat.yyyyMMddHHmmss_hyphen));
operationJson.put(ABookKeys.DISPLAY_PERMISSION_FLG, operationList.get(i).displayPermissionFlg);
operationJson.put(ABookKeys.CONTENT_ID, operationList.get(i).contentId);
//load processList and warning json file
String processListJsonPath = ABVEnvironment.getInstance().getOperationDirFile(operationList.get(i).operationId) + "/processList.json";
String processListString = FileUtil.readTextFile(processListJsonPath);
if (!StringUtil.isNullOrEmpty(processListString)) {
operationJson.put("processList", new JSONArray(processListString));
}
String warningReportJsonPath = ABVEnvironment.getInstance().getOperationDirFile(operationList.get(i).operationId) + "/warningReportList.json";
String warningReportString = FileUtil.readTextFile(warningReportJsonPath);
if (!StringUtil.isNullOrEmpty(warningReportString)) {
operationJson.put("warningReportList", new JSONArray(warningReportString));
}
operationJsonArray.put(operationJson);
}
operationListJsonObject.put(ABookKeys.OPERATION_LIST, operationJsonArray);
......
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