Commit 10e245df by Kang Donghun

#73190 更新チェック用API(Android)コード整理

parent 4945c7ab
...@@ -12,8 +12,6 @@ public class ShopSyncWatermarkJSON extends AcmsCommonJSON { ...@@ -12,8 +12,6 @@ public class ShopSyncWatermarkJSON extends AcmsCommonJSON {
public static final String NeedsFullSync = "needsFullSync"; public static final String NeedsFullSync = "needsFullSync";
public static final String LastChangedAt = "lastChangedAt"; public static final String LastChangedAt = "lastChangedAt";
// 0: false, 1: true
public int needsFullSyncValue;
public boolean needsFullSync; public boolean needsFullSync;
public String lastChangedAt; public String lastChangedAt;
...@@ -25,24 +23,19 @@ public class ShopSyncWatermarkJSON extends AcmsCommonJSON { ...@@ -25,24 +23,19 @@ public class ShopSyncWatermarkJSON extends AcmsCommonJSON {
protected void parse(JSONObject json) throws JSONValidationException { protected void parse(JSONObject json) throws JSONValidationException {
super.parse(json); super.parse(json);
// default: fail-safe true (field may be absent) // default: fail-safe true (field may be absent)
needsFullSyncValue = 1;
needsFullSync = true; needsFullSync = true;
Object rawNeedsFullSync = null;
if (json.has(NeedsFullSync)) { if (json.has(NeedsFullSync)) {
Object value = json.get(NeedsFullSync); Object value = json.get(NeedsFullSync);
rawNeedsFullSync = value;
if (value != null) { if (value != null) {
// org.json.adf 환경에서 타입이 섞여 들어오므로 문자열 기준으로 0/1 정규화
String lowerValue = String.valueOf(value).trim().toLowerCase(); String lowerValue = String.valueOf(value).trim().toLowerCase();
if ("true".equals(lowerValue) || "1".equals(lowerValue)) { if ("true".equals(lowerValue) || "1".equals(lowerValue)) {
needsFullSyncValue = 1; needsFullSync = true;
} else if ("false".equals(lowerValue) || "0".equals(lowerValue)) { } else if ("false".equals(lowerValue) || "0".equals(lowerValue)) {
needsFullSyncValue = 0; needsFullSync = false;
} }
} }
} }
needsFullSync = needsFullSyncValue == 1;
lastChangedAt = getStringOrNull(json, LastChangedAt); lastChangedAt = getStringOrNull(json, LastChangedAt);
} }
} }
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