use of org.apache.ranger.entity.XXAsset in project ranger by apache.
the class TestXAssetService method createXXAssetObject.
public XXAsset createXXAssetObject() {
XXAsset xXAsset = new XXAsset();
xXAsset.setId(1L);
xXAsset.setAssetType(1);
xXAsset.setName("testName");
xXAsset.setConfig("testconfig");
xXAsset.setActiveStatus(1);
xXAsset.setAddedByUserId(1L);
xXAsset.setSupportNative(true);
xXAsset.setUpdatedByUserId(1L);
Date date = new Date();
xXAsset.setCreateTime(date);
xXAsset.setUpdateTime(date);
xXAsset.setDescription("this is test description");
return xXAsset;
}
use of org.apache.ranger.entity.XXAsset in project ranger by apache.
the class TestXAssetService method test3GetTransactionLog.
@Test
public void test3GetTransactionLog() {
VXAsset vXAsset = new VXAsset();
XXAsset xXAsset = createXXAssetObject();
xAssetService.getTransactionLog(vXAsset, xXAsset, "delete");
}
use of org.apache.ranger.entity.XXAsset in project ranger by apache.
the class XAssetService method mapViewToEntityBean.
@Override
protected XXAsset mapViewToEntityBean(VXAsset vObj, XXAsset mObj, int OPERATION_CONTEXT) {
XXAsset ret = null;
if (vObj != null && mObj != null) {
String oldConfig = mObj.getConfig();
ret = super.mapViewToEntityBean(vObj, mObj, OPERATION_CONTEXT);
String config = ret.getConfig();
if (config != null && !config.isEmpty()) {
Map<String, String> configMap = jsonUtil.jsonToMap(config);
Entry<String, String> passwordEntry = getPasswordEntry(configMap);
if (passwordEntry != null) {
// If "*****" then get password from db and update
String password = passwordEntry.getValue();
if (password != null) {
if (password.equals(hiddenPasswordString)) {
if (oldConfig != null && !oldConfig.isEmpty()) {
Map<String, String> oldConfigMap = jsonUtil.jsonToMap(oldConfig);
Entry<String, String> oldPasswordEntry = getPasswordEntry(oldConfigMap);
if (oldPasswordEntry != null) {
configMap.put(oldPasswordEntry.getKey(), oldPasswordEntry.getValue());
}
}
}
config = jsonUtil.readMapToString(configMap);
}
}
}
ret.setConfig(config);
}
return ret;
}
Aggregations