@Test public void test5GetConfigWithDecryptedPassword() { xAssetService.getConfigWithDecryptedPassword("testConfig"); }
public String getConfigWithDecryptedPassword(String config){ try { if (config != null && !config.isEmpty()) { Map<String, String> configMap = jsonUtil.jsonToMap(config); Entry<String, String> passwordEntry = getPasswordEntry(configMap); Entry<String, String> isEncryptedEntry = getIsEncryptedEntry(configMap); if (isEncryptedEntry!=null && passwordEntry != null){ if (!stringUtil.isEmpty(isEncryptedEntry.getValue()) && "true".equalsIgnoreCase(isEncryptedEntry.getValue())) { String encryptPassword = passwordEntry.getValue(); String decryptPassword = PasswordUtils .decryptPassword(encryptPassword); configMap.put(passwordEntry.getKey(), decryptPassword); } } config = jsonUtil.readMapToString(configMap); } } catch (IOException e) { String errorMessage = "Password decryption error"; throw restErrorUtil.createRESTException(errorMessage, MessageEnums.INVALID_INPUT_DATA, null, null, e.getMessage()); } return config; }
XAssetService extends XAssetServiceBase<XXAsset, VXAsset> { public String getConfigWithDecryptedPassword(String config){ try { if (config != null && !config.isEmpty()) { Map<String, String> configMap = jsonUtil.jsonToMap(config); Entry<String, String> passwordEntry = getPasswordEntry(configMap); Entry<String, String> isEncryptedEntry = getIsEncryptedEntry(configMap); if (isEncryptedEntry!=null && passwordEntry != null){ if (!stringUtil.isEmpty(isEncryptedEntry.getValue()) && "true".equalsIgnoreCase(isEncryptedEntry.getValue())) { String encryptPassword = passwordEntry.getValue(); String decryptPassword = PasswordUtils .decryptPassword(encryptPassword); configMap.put(passwordEntry.getKey(), decryptPassword); } } config = jsonUtil.readMapToString(configMap); } } catch (IOException e) { String errorMessage = "Password decryption error"; throw restErrorUtil.createRESTException(errorMessage, MessageEnums.INVALID_INPUT_DATA, null, null, e.getMessage()); } return config; } }
XAssetService extends XAssetServiceBase<XXAsset, VXAsset> { public String getConfigWithDecryptedPassword(String config){ try { if (config != null && !config.isEmpty()) { Map<String, String> configMap = jsonUtil.jsonToMap(config); Entry<String, String> passwordEntry = getPasswordEntry(configMap); Entry<String, String> isEncryptedEntry = getIsEncryptedEntry(configMap); if (isEncryptedEntry!=null && passwordEntry != null){ if (!stringUtil.isEmpty(isEncryptedEntry.getValue()) && "true".equalsIgnoreCase(isEncryptedEntry.getValue())) { String encryptPassword = passwordEntry.getValue(); String decryptPassword = PasswordUtils .decryptPassword(encryptPassword); configMap.put(passwordEntry.getKey(), decryptPassword); } } config = jsonUtil.readMapToString(configMap); } } catch (IOException e) { String errorMessage = "Password decryption error"; throw restErrorUtil.createRESTException(errorMessage, MessageEnums.INVALID_INPUT_DATA, null, null, e.getMessage()); } return config; } XAssetService(); }
XAssetService extends XAssetServiceBase<XXAsset, VXAsset> { public String getConfigWithDecryptedPassword(String config){ try { if (config != null && !config.isEmpty()) { Map<String, String> configMap = jsonUtil.jsonToMap(config); Entry<String, String> passwordEntry = getPasswordEntry(configMap); Entry<String, String> isEncryptedEntry = getIsEncryptedEntry(configMap); if (isEncryptedEntry!=null && passwordEntry != null){ if (!stringUtil.isEmpty(isEncryptedEntry.getValue()) && "true".equalsIgnoreCase(isEncryptedEntry.getValue())) { String encryptPassword = passwordEntry.getValue(); String decryptPassword = PasswordUtils .decryptPassword(encryptPassword); configMap.put(passwordEntry.getKey(), decryptPassword); } } config = jsonUtil.readMapToString(configMap); } } catch (IOException e) { String errorMessage = "Password decryption error"; throw restErrorUtil.createRESTException(errorMessage, MessageEnums.INVALID_INPUT_DATA, null, null, e.getMessage()); } return config; } XAssetService(); void validateConfig(VXAsset vObj); List<XXTrxLog> getTransactionLog(VXAsset vResource, String action); List<XXTrxLog> getTransactionLog(VXAsset vObj, XXAsset mObj, String action); String getConfigWithEncryptedPassword(String config,boolean isForced); String getConfigWithDecryptedPassword(String config); }
XAssetService extends XAssetServiceBase<XXAsset, VXAsset> { public String getConfigWithDecryptedPassword(String config){ try { if (config != null && !config.isEmpty()) { Map<String, String> configMap = jsonUtil.jsonToMap(config); Entry<String, String> passwordEntry = getPasswordEntry(configMap); Entry<String, String> isEncryptedEntry = getIsEncryptedEntry(configMap); if (isEncryptedEntry!=null && passwordEntry != null){ if (!stringUtil.isEmpty(isEncryptedEntry.getValue()) && "true".equalsIgnoreCase(isEncryptedEntry.getValue())) { String encryptPassword = passwordEntry.getValue(); String decryptPassword = PasswordUtils .decryptPassword(encryptPassword); configMap.put(passwordEntry.getKey(), decryptPassword); } } config = jsonUtil.readMapToString(configMap); } } catch (IOException e) { String errorMessage = "Password decryption error"; throw restErrorUtil.createRESTException(errorMessage, MessageEnums.INVALID_INPUT_DATA, null, null, e.getMessage()); } return config; } XAssetService(); void validateConfig(VXAsset vObj); List<XXTrxLog> getTransactionLog(VXAsset vResource, String action); List<XXTrxLog> getTransactionLog(VXAsset vObj, XXAsset mObj, String action); String getConfigWithEncryptedPassword(String config,boolean isForced); String getConfigWithDecryptedPassword(String config);  }