private SearchVO convertPhoneEntityToTableData(PhoneEntity phoneEntity) { SearchVO tableData = new SearchVO(); tableData.setKey(phoneEntity.getKey()); tableData.setPhones(phoneEntity.getKey()); tableData.setAppId(phoneEntity.getAppid()); if (phoneEntity.getDevices() != null) { tableData.setDevices(phoneEntity.getDevices()); } if (phoneEntity.getAccounts() != null) { tableData.setAccounts(phoneEntity.getAccounts()); } tableData.setUid("--"); return tableData; }
public boolean updateData(String data) { String[] waitChange = data.split(";"); for (int i = 0; i < waitChange.length; i++) { String[] keyValue = waitChange[i].split("&&"); Map<String, String> records = convertKeyValue(keyValue); String accounts = records.get("accounts"); String phones = records.get("phones"); String devices = records.get("devices"); String appId = records.get("appId"); String key = records.get("key"); String uid = records.get("uid"); Date date = new Date(); if (appId == null || appId.equals("")) { return false; } String policyIds = getCurrentPolicy(appId); // change account data if (key != null && key.equalsIgnoreCase(accounts)) { if (policyIds.indexOf("10") > -1) { AccountEntity oldAccountEntity = accountBL.getAccount4One(key, appId); if (oldAccountEntity != null) { oldAccountEntity.setPhones(phones); oldAccountEntity.setDevices(devices); oldAccountEntity.setTimestamp(date); accountBL.updateAccount4One(oldAccountEntity); } } if (policyIds.indexOf("20") > -1) { AccountEntity oldAccountEntity = accountBL.getAccount4Two(key, appId); if (oldAccountEntity != null) { oldAccountEntity.setPhones(phones); oldAccountEntity.setDevices(devices); oldAccountEntity.setTimestamp(date); accountBL.updateAccount4Two(oldAccountEntity); } } } // change phone data if (key != null && key.equalsIgnoreCase(phones)) { if (policyIds.indexOf("10") > -1) { PhoneEntity oldPhoneEntity = phoneBL.getPhone4One(key, appId); if (oldPhoneEntity != null) { oldPhoneEntity.setAccounts(accounts); oldPhoneEntity.setDevices(devices); oldPhoneEntity.setTimestamp(date); phoneBL.updatePhone4Two(oldPhoneEntity); } } if (policyIds.indexOf("20") > -1) { PhoneEntity oldPhoneEntity = phoneBL.getPhone4Two(key, appId); if (oldPhoneEntity != null) { oldPhoneEntity.setAccounts(accounts); oldPhoneEntity.setDevices(devices); oldPhoneEntity.setTimestamp(date); phoneBL.updatePhone4Two(oldPhoneEntity); } } } // change device data if (key != null && key.equalsIgnoreCase(devices)) { if (policyIds.indexOf("10") > -1) { DeviceEntity oldDeviceEntity = deviceBL.getDevice4One(key, appId); if (oldDeviceEntity != null) { oldDeviceEntity.setAccounts(accounts); oldDeviceEntity.setPhones(phones); oldDeviceEntity.setTimestamp(date); deviceBL.updateDevice4One(oldDeviceEntity); } } if (policyIds.indexOf("20") > -1) { DeviceEntity oldDeviceEntity = deviceBL.getDevice4Two(key, appId); if (oldDeviceEntity != null) { oldDeviceEntity.setAccounts(accounts); oldDeviceEntity.setPhones(phones); oldDeviceEntity.setTimestamp(date); deviceBL.updateDevice4Two(oldDeviceEntity); } } } } return true; }