Search in sources :

Example 16 with XXAsset

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;
}
Also used : XXAsset(org.apache.ranger.entity.XXAsset) Date(java.util.Date)

Example 17 with 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");
}
Also used : VXAsset(org.apache.ranger.view.VXAsset) XXAsset(org.apache.ranger.entity.XXAsset) Test(org.junit.Test)

Example 18 with XXAsset

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;
}
Also used : XXAsset(org.apache.ranger.entity.XXAsset)

Aggregations

XXAsset (org.apache.ranger.entity.XXAsset)18 Test (org.junit.Test)7 XXResource (org.apache.ranger.entity.XXResource)4 ArrayList (java.util.ArrayList)3 BaseDao (org.apache.ranger.common.db.BaseDao)2 XXDBBase (org.apache.ranger.entity.XXDBBase)2 RangerService (org.apache.ranger.plugin.model.RangerService)2 VXAsset (org.apache.ranger.view.VXAsset)2 VXResource (org.apache.ranger.view.VXResource)2 VXResponse (org.apache.ranger.view.VXResponse)2 Field (java.lang.reflect.Field)1 Date (java.util.Date)1 List (java.util.List)1 SearchCriteria (org.apache.ranger.common.SearchCriteria)1 SearchField (org.apache.ranger.common.SearchField)1 SortField (org.apache.ranger.common.SortField)1 VTrxLogAttr (org.apache.ranger.common.view.VTrxLogAttr)1 XXAssetDao (org.apache.ranger.db.XXAssetDao)1 XXPortalUserDao (org.apache.ranger.db.XXPortalUserDao)1 XXResourceDao (org.apache.ranger.db.XXResourceDao)1