Commit 4945c7ab by Kang Donghun

#73190 更新チェック用API(Android)

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