public void saveDBForPadInfo(PadInfoEntity padInfoEntityParam) { PadInfoEntity padInfoEntity = DaoHolder.getInstance().getPadInfoDao().uniqueOne(); if (null == padInfoEntity) { // insert DaoHolder.getInstance().getPadInfoDao().add(padInfoEntityParam); } else { // update padInfoEntityParam.setGuid(padInfoEntity.getGuid()); DaoHolder.getInstance().getPadInfoDao().update(padInfoEntityParam); } }
public PadInfoEntity createPadInfoEntity(JSONObject jsonPadInfo) throws JSONException { PadInfoEntity padInfoEntity = new PadInfoEntity(); JSONObject jsonData = jsonPadInfo.getJSONObject("jsonData"); JSONObject jsonXmPadDevice = jsonData.getJSONObject("xmPadDevice"); String assetCode = jsonXmPadDevice.getString("xmpdCode"); String androidId = jsonXmPadDevice.getString("xmpdDeviceId"); padInfoEntity.setAndroidId(androidId); padInfoEntity.setAssetCode(assetCode); padInfoEntity.setJsonData(jsonXmPadDevice.toString()); return padInfoEntity; }