Commit d23461b3 by Kazuyuki Hida

Merge branch 'contract/sato/1.0.300_dev' into contract/sato/1.0.300_hida

# Conflicts:
#	ABVJE_BL/src/jp/agentec/abook/abv/bl/acms/client/json/LockReportJSON.java
#	ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/LockReportLogic.java
#	ABVJE_BL/src/jp/agentec/abook/abv/bl/logic/UnlockReportLogic.java
#	ABVJE_UI_Android/src/jp/agentec/abook/abv/ui/common/activity/ABVContentViewActivity.java
parents 61be2a86 f381ab70
...@@ -6,11 +6,15 @@ import jp.agentec.abook.abv.bl.common.exception.AcmsException; ...@@ -6,11 +6,15 @@ import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.abook.abv.bl.common.exception.JSONValidationException; import jp.agentec.abook.abv.bl.common.exception.JSONValidationException;
import jp.agentec.abook.abv.bl.common.log.Logger; import jp.agentec.abook.abv.bl.common.log.Logger;
import jp.agentec.adf.core.CloneableObject; import jp.agentec.adf.core.CloneableObject;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
import org.json.adf.JSONException; import org.json.adf.JSONException;
import org.json.adf.JSONObject; import org.json.adf.JSONObject;
import java.util.Date;
public abstract class AcmsJSONParser extends CloneableObject { public abstract class AcmsJSONParser extends CloneableObject {
/** /**
* {@link AcmsJSONParser} クラスのインスタンスを初期化します。 * {@link AcmsJSONParser} クラスのインスタンスを初期化します。
...@@ -129,4 +133,27 @@ public abstract class AcmsJSONParser extends CloneableObject { ...@@ -129,4 +133,27 @@ public abstract class AcmsJSONParser extends CloneableObject {
} }
} }
protected int getIntOrDef(JSONObject json, String key, int def) {
if (json.has(key)) {
return json.getInt(key);
} else {
return def;
}
}
protected String getStringOrNull(JSONObject json, String key) {
if (json.has(key)) {
return json.getString(key);
} else {
return null;
}
}
protected Date getDateOrNull(JSONObject json, String key) {
if (json.has(key)) {
return DateTimeUtil.toDate(json.getString(key), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} else {
return null;
}
}
} }
...@@ -5,14 +5,13 @@ import org.json.adf.JSONObject; ...@@ -5,14 +5,13 @@ import org.json.adf.JSONObject;
import java.util.Date; import java.util.Date;
import jp.agentec.abook.abv.bl.common.exception.AcmsException; import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
/** /**
* checkapi/lockReport/のレスポンスを変換するクラス * checkapi/lockReport/のレスポンスを変換するクラス
*/ */
public class LockReportJSON extends AcmsCommonJSON { public class LockReportJSON extends AcmsCommonJSON {
public static final int BAD_STATE = 999;
private Date presentTimeUTC; private Date presentTimeUTC;
private int reportStatus; private int reportStatus;
private String reportLockUserId; private String reportLockUserId;
...@@ -25,63 +24,45 @@ public class LockReportJSON extends AcmsCommonJSON { ...@@ -25,63 +24,45 @@ public class LockReportJSON extends AcmsCommonJSON {
@Override @Override
protected void parse(JSONObject json) { protected void parse(JSONObject json) {
httpStatus = intOrDef(json, "httpStatus", 999); presentTimeUTC = getDateOrNull(json, "presentTimeUTC");
presentTimeUTC = dateOrNull(json, "presentTimeUTC"); reportStatus = getIntOrDef(json, "reportStatus", BAD_STATE);
reportStatus = intOrDef(json, "reportStatus", 999); reportLockUserId = getStringOrNull(json, "reportLockUserId");
reportLockUserId = stringOrNull(json, "reportLockUserId"); reportLockUserName = getStringOrNull(json, "reportLockUserName");
reportLockUserName = stringOrNull(json, "reportLockUserName"); reportLockTime = getDateOrNull(json, "reportLockTime");
reportLockTime = dateOrNull(json, "reportLockTime");
} }
@SuppressWarnings("unused")
int getHttpStatus() { int getHttpStatus() {
return httpStatus; return httpStatus;
} }
@SuppressWarnings("unused")
Date getPresentTime() { Date getPresentTime() {
return presentTime; return presentTime;
} }
@SuppressWarnings("unused")
public Date getPresentTimeUTC() { public Date getPresentTimeUTC() {
return presentTimeUTC; return presentTimeUTC;
} }
@SuppressWarnings("unused")
public int getReportStatus() { public int getReportStatus() {
return reportStatus; return reportStatus;
} }
@SuppressWarnings("unused")
public String getReportLockUserId() { public String getReportLockUserId() {
return reportLockUserId; return reportLockUserId;
} }
@SuppressWarnings("unused")
public String getReportLockUserName() { public String getReportLockUserName() {
return reportLockUserName; return reportLockUserName;
} }
@SuppressWarnings("unused")
public Date getReportLockTime() { public Date getReportLockTime() {
return reportLockTime; return reportLockTime;
} }
private int intOrDef(JSONObject json, String key, int def) {
if (json.has(key)) {
return json.getInt(key);
} else {
return def;
}
}
private String stringOrNull(JSONObject json, String key) {
if (json.has(key)) {
return json.getString(key);
} else {
return null;
}
}
private Date dateOrNull(JSONObject json, String key) {
if (json.has(key)) {
return DateTimeUtil.toDate(json.getString(key), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} else {
return null;
}
}
} }
...@@ -45,6 +45,8 @@ public class OperationDataJSON extends AcmsCommonJSON { ...@@ -45,6 +45,8 @@ public class OperationDataJSON extends AcmsCommonJSON {
public static final String SendBackUserName = "sendBackUserName"; // 差し戻しユーザ名 差し戻された場合のみ public static final String SendBackUserName = "sendBackUserName"; // 差し戻しユーザ名 差し戻された場合のみ
public static final String SendBackComment = "sendBackComment"; // 確認コメント 差し戻された場合のみ public static final String SendBackComment = "sendBackComment"; // 確認コメント 差し戻された場合のみ
public static final String ReportStatus = "reportStatus";
public List<TaskDto> taskDtoList; public List<TaskDto> taskDtoList;
public Date lastEditDate; public Date lastEditDate;
......
...@@ -5,10 +5,10 @@ import org.json.adf.JSONObject; ...@@ -5,10 +5,10 @@ import org.json.adf.JSONObject;
import java.util.Date; import java.util.Date;
import jp.agentec.abook.abv.bl.common.exception.AcmsException; import jp.agentec.abook.abv.bl.common.exception.AcmsException;
import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil;
public class UnlockReportJSON extends AcmsCommonJSON { public class UnlockReportJSON extends AcmsCommonJSON {
public static final int BAD_STATE = 999;
private Date presentTimeUTC; private Date presentTimeUTC;
private int reportStatus; private int reportStatus;
...@@ -18,37 +18,25 @@ public class UnlockReportJSON extends AcmsCommonJSON { ...@@ -18,37 +18,25 @@ public class UnlockReportJSON extends AcmsCommonJSON {
@Override @Override
protected void parse(JSONObject json) { protected void parse(JSONObject json) {
presentTimeUTC = dateOrNull(json, "presentTimeUTC"); presentTimeUTC = getDateOrNull(json, "presentTimeUTC");
reportStatus = intOrDef(json, "", 999); reportStatus = getIntOrDef(json, "", BAD_STATE);
} }
@SuppressWarnings("unused")
public int getHttpStatus() { public int getHttpStatus() {
return httpStatus; return httpStatus;
} }
@SuppressWarnings("unused")
public Date getPresentTime() { public Date getPresentTime() {
return presentTime; return presentTime;
} }
@SuppressWarnings("unused")
public Date getPresentTimeUTC() { public Date getPresentTimeUTC() {
return presentTimeUTC; return presentTimeUTC;
} }
@SuppressWarnings("unused")
public int getReportStatus() {return reportStatus; } public int getReportStatus() {return reportStatus; }
private int intOrDef(JSONObject json, String key, int def) {
if (json.has(key)) {
return json.getInt(key);
} else {
return def;
}
}
private Date dateOrNull(JSONObject json, String key) {
if (json.has(key)) {
return DateTimeUtil.toDate(json.getString(key), "UTC", DateTimeFormat.yyyyMMdd_hyphen);
} else {
return null;
}
}
} }
...@@ -14,6 +14,13 @@ import jp.agentec.adf.util.DateTimeFormat; ...@@ -14,6 +14,13 @@ import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
import static java.net.HttpURLConnection.HTTP_OK; import static java.net.HttpURLConnection.HTTP_OK;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportLockTime;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportLockUserId;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportLockUserName;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportStartDate;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportStatus;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.TaskReportId;
import static jp.agentec.abook.abv.bl.common.constant.ABookKeys.TASK_KEY;
public class LockReportLogic extends AbstractLogic { public class LockReportLogic extends AbstractLogic {
...@@ -78,6 +85,7 @@ public class LockReportLogic extends AbstractLogic { ...@@ -78,6 +85,7 @@ public class LockReportLogic extends AbstractLogic {
// コールバック用のパラメータ // コールバック用のパラメータ
public static class Result { public static class Result {
public static final int BAD_STATUS = 999;
int result; int result;
String message; String message;
ExtParam extParam; ExtParam extParam;
...@@ -101,7 +109,6 @@ public class LockReportLogic extends AbstractLogic { ...@@ -101,7 +109,6 @@ public class LockReportLogic extends AbstractLogic {
@SuppressWarnings("magic_number") @SuppressWarnings("magic_number")
static Result failure(Throwable e, Long taskReportId, Date reportStartDate) { static Result failure(Throwable e, Long taskReportId, Date reportStartDate) {
// 例外がでたとき // 例外がでたとき
final int BAD_STATUS = 999;
Result result = new Result(); Result result = new Result();
result.result = 1; result.result = 1;
result.message = e.getLocalizedMessage(); result.message = e.getLocalizedMessage();
...@@ -192,16 +199,16 @@ public class LockReportLogic extends AbstractLogic { ...@@ -192,16 +199,16 @@ public class LockReportLogic extends AbstractLogic {
@SuppressWarnings("unused") @SuppressWarnings("unused")
public String json() { public String json() {
JSONObject extParam = new JSONObject(); JSONObject extParam = new JSONObject();
extParam.put("reportStatus", String.valueOf(reportStatus)); extParam.put(ReportStatus, String.valueOf(reportStatus));
extParam.put("reportLockUserId", reportLockUserId); extParam.put(ReportLockUserId, reportLockUserId);
extParam.put("reportLockUserName", reportLockUserName); extParam.put(ReportLockUserName, reportLockUserName);
extParam.put("reportLockTime", reportLockTime); extParam.put(ReportLockTime, DateTimeUtil.formatDate(reportLockTime, DateTimeFormat.yyyyMMddHHmmssSSS_hyphen));
if (taskReportId != null && taskReportId != 0) { if (taskReportId != null && taskReportId != 0) {
extParam.put("taskReportId", taskReportId); extParam.put(TaskReportId, taskReportId);
} }
if (reportStartDate != null) { if (reportStartDate != null) {
extParam.put("reportStartDate", DateTimeUtil.toString(reportStartDate, DateTimeFormat.yyyyMMddHHmmss_hyphen)); extParam.put(ReportStartDate, DateTimeUtil.formatDate(reportStartDate, DateTimeFormat.yyyyMMddHHmmssSSS_hyphen));
} }
return extParam.toString(); return extParam.toString();
} }
......
...@@ -15,6 +15,10 @@ import jp.agentec.adf.util.DateTimeFormat; ...@@ -15,6 +15,10 @@ import jp.agentec.adf.util.DateTimeFormat;
import jp.agentec.adf.util.DateTimeUtil; import jp.agentec.adf.util.DateTimeUtil;
import static java.net.HttpURLConnection.HTTP_OK; import static java.net.HttpURLConnection.HTTP_OK;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportStartDate;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportStatus;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.TaskKey;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.TaskReportId;
public class UnlockReportLogic extends AbstractLogic { public class UnlockReportLogic extends AbstractLogic {
...@@ -79,6 +83,7 @@ public class UnlockReportLogic extends AbstractLogic { ...@@ -79,6 +83,7 @@ public class UnlockReportLogic extends AbstractLogic {
// コールバック用のパラメータ // コールバック用のパラメータ
public static class Result { public static class Result {
public static final int BAD_STATUS = 999;
int result; int result;
String message; String message;
ExtParam extParam; ExtParam extParam;
...@@ -94,7 +99,6 @@ public class UnlockReportLogic extends AbstractLogic { ...@@ -94,7 +99,6 @@ public class UnlockReportLogic extends AbstractLogic {
static Result failure(Throwable e, Long taskReportId, Date reportStartDate) { static Result failure(Throwable e, Long taskReportId, Date reportStartDate) {
// 例外がでたとき // 例外がでたとき
final int BAD_STATUS = 999;
Result result = new Result(); Result result = new Result();
result.result = 1; result.result = 1;
result.message = e.getLocalizedMessage(); result.message = e.getLocalizedMessage();
...@@ -141,12 +145,12 @@ public class UnlockReportLogic extends AbstractLogic { ...@@ -141,12 +145,12 @@ public class UnlockReportLogic extends AbstractLogic {
public String json() { public String json() {
JSONObject extParam = new JSONObject(); JSONObject extParam = new JSONObject();
extParam.put("reportStatus", String.valueOf(reportStatus)); extParam.put(ReportStatus, String.valueOf(reportStatus));
if (taskReportId != null && taskReportId != 0) { if (taskReportId != null && taskReportId != 0) {
extParam.put("taskReportId", taskReportId); extParam.put(TaskReportId, taskReportId);
} }
if (reportStartDate != null) { if (reportStartDate != null) {
extParam.put("reportStartDate", DateTimeUtil.formatDate(reportStartDate, DateTimeFormat.yyyyMMddHHmmssSSS_hyphen)); extParam.put(ReportStartDate, DateTimeUtil.formatDate(reportStartDate, DateTimeFormat.yyyyMMddHHmmssSSS_hyphen));
} }
return extParam.toString(); return extParam.toString();
} }
......
...@@ -87,6 +87,8 @@ import jp.agentec.adf.util.DateTimeUtil; ...@@ -87,6 +87,8 @@ import jp.agentec.adf.util.DateTimeUtil;
import jp.agentec.adf.util.FileUtil; import jp.agentec.adf.util.FileUtil;
import jp.agentec.adf.util.StringUtil; import jp.agentec.adf.util.StringUtil;
import static jp.agentec.abook.abv.bl.acms.client.json.OperationDataJSON.ReportStartDate;
public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity { public abstract class ABVContentViewActivity extends ABVAuthenticatedActivity {
private static final String TAG ="ABVContentViewActivity"; private static final String TAG ="ABVContentViewActivity";
......
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