You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ranger.apache.org by ma...@apache.org on 2014/12/12 02:29:58 UTC

[15/51] [partial] incubator-ranger git commit: RANGER-194: Rename packages from xasecure to apache ranger

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPermMapService.java b/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
deleted file mode 100644
index 94f458e..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XPermMapService.java
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package com.xasecure.service;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import com.xasecure.common.SearchCriteria;
-import com.xasecure.common.SearchField;
-
-import org.apache.commons.lang.ArrayUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.xasecure.common.AppConstants;
-import com.xasecure.common.view.VTrxLogAttr;
-import com.xasecure.db.XADaoManager;
-import com.xasecure.entity.*;
-import com.xasecure.util.XAEnumUtil;
-import com.xasecure.view.*;
-
-@Service
-@Scope("singleton")
-public class XPermMapService extends XPermMapServiceBase<XXPermMap, VXPermMap> {
-
-	@Autowired
-	XGroupService xGroupService;
-	
-	@Autowired
-	XUserService xUserService;
-	
-	@Autowired
-	XAEnumUtil xaEnumUtil;
-
-	@Autowired
-	XADaoManager xADaoManager;
-
-	static HashMap<String, VTrxLogAttr> trxLogAttrs = new HashMap<String, VTrxLogAttr>();
-	static {
-//		trxLogAttrs.put("groupId", new VTrxLogAttr("groupId", "Group Permission", false));
-//		trxLogAttrs.put("userId", new VTrxLogAttr("userId", "User Permission", false));
-		trxLogAttrs.put("permType", new VTrxLogAttr("permType", "Permission Type", true));
-		trxLogAttrs.put("ipAddress", new VTrxLogAttr("ipAddress", "IP Address", false));
-	}
-
-	
-	public XPermMapService() {
-		searchFields.add(new SearchField("resourceId", "obj.resourceId",
-				SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
-		searchFields.add(new SearchField("permType", "obj.permType",
-				SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
-		searchFields.add(new SearchField("permFor", "obj.permFor",
-				SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
-		searchFields.add(new SearchField("userId", "obj.userId",
-				SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
-		searchFields.add(new SearchField("groupId", "obj.groupId",
-				SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
-	}
-
-	@Override
-	protected void validateForCreate(VXPermMap vObj) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	protected void validateForUpdate(VXPermMap vObj, XXPermMap mObj) {
-		// TODO Auto-generated method stub
-
-	}
-	
-	@Override
-	public VXPermMap populateViewBean(XXPermMap xXPermMap){
-		VXPermMap map = super.populateViewBean(xXPermMap);		
-		if(map.getPermFor() == AppConstants.XA_PERM_FOR_GROUP) {
-			String groupName = getGroupName(map.getGroupId());
-			if(groupName != null){
-				map.setGroupName(groupName);
-			}
-		} else if(map.getPermFor() == AppConstants.XA_PERM_FOR_USER) {
-			String username = getUserName(map.getUserId());
-			if(username != null){
-				map.setUserName(username);
-			}
-		}
-		return map;
-	}
-	
-	@Override
-	public VXPermMapList searchXPermMaps(SearchCriteria searchCriteria) {
-		VXPermMapList vXPermMapList = super.searchXPermMaps(searchCriteria);
-		if(vXPermMapList != null && vXPermMapList.getResultSize() != 0){
-			for(VXPermMap vXPermMap : vXPermMapList.getVXPermMaps()){
-				if(vXPermMap.getPermFor() == AppConstants.XA_PERM_FOR_GROUP) {
-					String groupName = getGroupName(vXPermMap.getGroupId());
-					vXPermMap.setGroupName(groupName);
-				} else if(vXPermMap.getPermFor() == AppConstants.XA_PERM_FOR_USER) {
-					String username = getUserName(vXPermMap.getUserId());
-					vXPermMap.setUserName(username);
-				}
-			}
-		}
-		return vXPermMapList;
-	}
-	
-	public String getGroupName(Long groupId){
-		if(groupId!=null && groupId!=0){
-		VXGroup vXGroup = xGroupService.readResource(groupId);
-			return vXGroup.getName();
-		}
-		else
-			return null;
-	}
-	
-	public String getUserName(Long userId){
-		if(userId!=null && userId!=0){
-		VXUser vXUser = xUserService.readResource(userId);
-			return vXUser.getName();
-		}
-		else
-			return null;
-	}
-
-	public List<XXTrxLog> getTransactionLog(VXPermMap vXPermMap, String action){
-		return getTransactionLog(vXPermMap, null, action);
-	}
-	
-	public List<XXTrxLog> getTransactionLog(VXPermMap vObj, VXPermMap mObj, String action){
-		if(vObj == null && (action == null || !action.equalsIgnoreCase("update"))){
-			return null;
-		}
-		
-		boolean isGroupPolicy = true;
-		if(vObj.getGroupId() == null){
-			isGroupPolicy = false;
-		}
-		
-		Long groupId = null;
-		Long userId = null;
-		String groupName = null;
-		String userName = null;
-		
-		if(isGroupPolicy){
-			groupId = vObj.getGroupId();
-			XXGroup xGroup = xADaoManager.getXXGroup().getById(groupId);
-			groupName = xGroup.getName();
-		} else {
-			userId = vObj.getUserId();
-			XXUser xUser = xADaoManager.getXXUser().getById(userId);
-			userName = xUser.getName();
-		}
-
-		List<XXTrxLog> trxLogList = new ArrayList<XXTrxLog>();
-		Field[] fields = vObj.getClass().getDeclaredFields();
-		
-		try {
-			for(Field field : fields){
-				field.setAccessible(true);
-				String fieldName = field.getName();
-				if(!trxLogAttrs.containsKey(fieldName)){
-					continue;
-//				int policyType = vObj.getIpAddress();
-				/*if(policyType == AppConstants.ASSET_HDFS){
-					String[] ignoredAttribs = {"ipAddress"};
-					if(ArrayUtils.contains(ignoredAttribs, fieldName)){
-						continue;
-					}
-				}*/	
-//				} else {
-//					if(isGroupPolicy){
-//						if(fieldName.equalsIgnoreCase("userId")){
-//							continue;
-//						}
-//					} else {
-//						if (fieldName.equalsIgnoreCase("groupId")){
-//							continue;
-//						}
-//					}
-				}
-				Long assetId = xADaoManager.getXXResource().getById(vObj.getResourceId()).getAssetId();
-				int policyType = xADaoManager.getXXAsset().getById(assetId).getAssetType();
-				if(policyType != AppConstants.ASSET_KNOX){
-					if(fieldName.equals("ipAddress"))
-						continue;
-				} 
-				
-				VTrxLogAttr vTrxLogAttr = trxLogAttrs.get(fieldName);
-				
-				XXTrxLog xTrxLog = new XXTrxLog();
-				xTrxLog.setAttributeName(vTrxLogAttr.getAttribUserFriendlyName());
-			
-				String value = null,prevValue = "";
-				boolean isEnum = vTrxLogAttr.isEnum();
-				if(isEnum){
-					String enumName = XXPermMap.getEnumName(fieldName);
-					int enumValue = field.get(vObj) == null ? 0 : Integer.parseInt(""+field.get(vObj));
-					value = xaEnumUtil.getLabel(enumName, enumValue);
-				} else {
-					value = ""+field.get(vObj);
-//					XXUser xUser = xADaoManager.getXXUser().getById(Long.parseLong(value));
-//					value = xUser.getName();
-					if(fieldName.equals("ipAddress") && action.equalsIgnoreCase("update")){
-						prevValue = ""+field.get(mObj);
-						value = value.equalsIgnoreCase("null") ? "" : value; 
-					}
-					else if(value == null || value.equalsIgnoreCase("null") || stringUtil.isEmpty(value)){
-						continue;
-					}
-				}
-				
-				if(action.equalsIgnoreCase("create")){
-					xTrxLog.setNewValue(value);
-				} else if(action.equalsIgnoreCase("delete")){
-					xTrxLog.setPreviousValue(value);
-				} else if(action.equalsIgnoreCase("update")){
-					// Not Changed.
-					xTrxLog.setNewValue(value);
-					xTrxLog.setPreviousValue(value);
-					if(fieldName.equals("ipAddress")){
-						xTrxLog.setPreviousValue(prevValue);
-					}
-				}
-				
-				xTrxLog.setAction(action);
-				xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_XA_PERM_MAP);
-				xTrxLog.setObjectId(vObj.getId());
-				if(isGroupPolicy){
-					xTrxLog.setParentObjectClassType(AppConstants.CLASS_TYPE_XA_GROUP);
-					xTrxLog.setParentObjectId(groupId);
-					xTrxLog.setParentObjectName(groupName);
-				} else {
-					xTrxLog.setParentObjectClassType(AppConstants.CLASS_TYPE_XA_USER);
-					xTrxLog.setParentObjectId(userId);
-					xTrxLog.setParentObjectName(userName);
-				}
-//				xTrxLog.setObjectName(objectName);
-				trxLogList.add(xTrxLog);
-				
-			}
-		} catch (IllegalArgumentException e) {
-			e.printStackTrace();
-		} catch (IllegalAccessException e) {
-			e.printStackTrace();
-		} catch (SecurityException e) {
-			e.printStackTrace();
-		}
-		
-		return trxLogList;
-	}
-	
-	@Override
-	protected XXPermMap mapViewToEntityBean(VXPermMap vObj, XXPermMap mObj, int OPERATION_CONTEXT) {
-		super.mapViewToEntityBean(vObj, mObj, OPERATION_CONTEXT);
-		if(vObj!=null && mObj!=null){
-			XXPortalUser xXPortalUser=null;
-			if(mObj.getAddedByUserId()==null || mObj.getAddedByUserId()==0){
-				if(!stringUtil.isEmpty(vObj.getOwner())){
-					xXPortalUser=xADaoManager.getXXPortalUser().findByLoginId(vObj.getOwner());	
-					if(xXPortalUser!=null){
-						mObj.setAddedByUserId(xXPortalUser.getId());
-					}
-				}
-			}
-			if(mObj.getUpdatedByUserId()==null || mObj.getUpdatedByUserId()==0){
-				if(!stringUtil.isEmpty(vObj.getUpdatedBy())){
-					xXPortalUser= xADaoManager.getXXPortalUser().findByLoginId(vObj.getUpdatedBy());			
-					if(xXPortalUser!=null){
-						mObj.setUpdatedByUserId(xXPortalUser.getId());
-					}		
-				}
-			}
-		}
-		return mObj;
-	}
-
-	@Override
-	protected VXPermMap mapEntityToViewBean(VXPermMap vObj, XXPermMap mObj) {
-		super.mapEntityToViewBean(vObj, mObj);
-		if(mObj!=null && vObj!=null){
-			XXPortalUser xXPortalUser=null;
-			if(stringUtil.isEmpty(vObj.getOwner())){
-				xXPortalUser= xADaoManager.getXXPortalUser().getById(mObj.getAddedByUserId());	
-				if(xXPortalUser!=null){
-					vObj.setOwner(xXPortalUser.getLoginId());
-				}
-			}
-			if(stringUtil.isEmpty(vObj.getUpdatedBy())){
-				xXPortalUser= xADaoManager.getXXPortalUser().getById(mObj.getUpdatedByUserId());		
-				if(xXPortalUser!=null){
-					vObj.setUpdatedBy(xXPortalUser.getLoginId());
-				}
-			}
-		}
-		return vObj;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XPermMapServiceBase.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPermMapServiceBase.java b/security-admin/src/main/java/com/xasecure/service/XPermMapServiceBase.java
deleted file mode 100644
index eb1eb30..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XPermMapServiceBase.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package com.xasecure.service;
-
-/**
- * 
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.xasecure.common.*;
-import com.xasecure.entity.*;
-import com.xasecure.view.*;
-import com.xasecure.service.*;
-
-public abstract class XPermMapServiceBase<T extends XXPermMap, V extends VXPermMap>
-		extends AbstractBaseResourceService<T, V> {
-	public static final String NAME = "XPermMap";
-
-	public XPermMapServiceBase() {
-
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected XXPermMap mapViewToEntityBean(VXPermMap vObj, XXPermMap mObj, int OPERATION_CONTEXT) {
-		mObj.setPermGroup( vObj.getPermGroup());
-		mObj.setResourceId( vObj.getResourceId());
-		mObj.setGroupId( vObj.getGroupId());
-		mObj.setUserId( vObj.getUserId());
-		mObj.setPermFor( vObj.getPermFor());
-		mObj.setPermType( vObj.getPermType());
-		mObj.setIsRecursive( vObj.getIsRecursive());
-		mObj.setIsWildCard( vObj.isIsWildCard());
-		mObj.setGrantOrRevoke( vObj.isGrantOrRevoke());
-		mObj.setIpAddress( vObj.getIpAddress());
-		return mObj;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected VXPermMap mapEntityToViewBean(VXPermMap vObj, XXPermMap mObj) {
-		vObj.setPermGroup( mObj.getPermGroup());
-		vObj.setResourceId( mObj.getResourceId());
-		vObj.setGroupId( mObj.getGroupId());
-		vObj.setUserId( mObj.getUserId());
-		vObj.setPermFor( mObj.getPermFor());
-		vObj.setPermType( mObj.getPermType());
-		vObj.setIsRecursive( mObj.getIsRecursive());
-		vObj.setIsWildCard( mObj.isIsWildCard());
-		vObj.setGrantOrRevoke( mObj.isGrantOrRevoke());
-		vObj.setIpAddress( mObj.getIpAddress());
-		return vObj;
-	}
-
-	/**
-	 * @param searchCriteria
-	 * @return
-	 */
-	public VXPermMapList searchXPermMaps(SearchCriteria searchCriteria) {
-		VXPermMapList returnList = new VXPermMapList();
-		List<VXPermMap> xPermMapList = new ArrayList<VXPermMap>();
-
-		@SuppressWarnings("unchecked")
-		List<XXPermMap> resultList = (List<XXPermMap>)searchResources(searchCriteria,
-				searchFields, sortFields, returnList);
-
-		// Iterate over the result list and create the return list
-		for (XXPermMap gjXPermMap : resultList) {
-			@SuppressWarnings("unchecked")
-			VXPermMap vXPermMap = populateViewBean((T)gjXPermMap);
-			xPermMapList.add(vXPermMap);
-		}
-
-		returnList.setVXPermMaps(xPermMapList);
-		return returnList;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditService.java b/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditService.java
deleted file mode 100644
index bd66b28..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditService.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package com.xasecure.service;
-
-import com.xasecure.common.SearchField;
-import com.xasecure.common.SearchField.DATA_TYPE;
-import com.xasecure.common.SearchField.SEARCH_TYPE;
-import com.xasecure.common.SortField.SORT_ORDER;
-import com.xasecure.common.SortField;
-
-import com.xasecure.view.*;
-import com.xasecure.entity.*;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-@Service
-@Scope("singleton")
-public class XPolicyExportAuditService extends XPolicyExportAuditServiceBase<XXPolicyExportAudit, VXPolicyExportAudit> {
-
-	public XPolicyExportAuditService(){
-		searchFields.add(new SearchField("httpRetCode", "obj.httpRetCode",
-				SearchField.DATA_TYPE.INTEGER, SearchField.SEARCH_TYPE.FULL));
-		searchFields.add(new SearchField("clientIP", "obj.clientIP",
-				SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.PARTIAL));
-		searchFields.add(new SearchField("agentId", "obj.agentId",
-				SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.PARTIAL));
-		searchFields.add(new SearchField("repositoryName", "obj.repositoryName",
-				SearchField.DATA_TYPE.STRING, SearchField.SEARCH_TYPE.PARTIAL));
-		searchFields.add(new SearchField("startDate", "obj.createTime", 
-				DATA_TYPE.DATE, SEARCH_TYPE.GREATER_EQUAL_THAN));
-		searchFields.add(new SearchField("endDate", "obj.createTime", 
-				DATA_TYPE.DATE, SEARCH_TYPE.LESS_EQUAL_THAN));
-		
-		sortFields.add(new SortField("createDate", "obj.createTime", true, SORT_ORDER.DESC));
-	}
-	
-	@Override
-	protected void validateForCreate(VXPolicyExportAudit vObj) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	protected void validateForUpdate(VXPolicyExportAudit vObj, XXPolicyExportAudit mObj) {
-		// TODO Auto-generated method stub
-
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditServiceBase.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditServiceBase.java b/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditServiceBase.java
deleted file mode 100644
index 0293c49..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XPolicyExportAuditServiceBase.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package com.xasecure.service;
-
-/**
- * 
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.xasecure.common.*;
-import com.xasecure.entity.*;
-import com.xasecure.view.*;
-import com.xasecure.service.*;
-
-public abstract class XPolicyExportAuditServiceBase<T extends XXPolicyExportAudit, V extends VXPolicyExportAudit>
-		extends AbstractBaseResourceService<T, V> {
-	public static final String NAME = "XPolicyExportAudit";
-
-	public XPolicyExportAuditServiceBase() {
-
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected XXPolicyExportAudit mapViewToEntityBean(VXPolicyExportAudit vObj, XXPolicyExportAudit mObj, int OPERATION_CONTEXT) {
-		mObj.setClientIP( vObj.getClientIP());
-		mObj.setAgentId( vObj.getAgentId());
-		mObj.setRequestedEpoch( vObj.getRequestedEpoch());
-		mObj.setLastUpdated( vObj.getLastUpdated());
-		mObj.setRepositoryName( vObj.getRepositoryName());
-		mObj.setExportedJson( vObj.getExportedJson());
-		mObj.setHttpRetCode( vObj.getHttpRetCode());
-		return mObj;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected VXPolicyExportAudit mapEntityToViewBean(VXPolicyExportAudit vObj, XXPolicyExportAudit mObj) {
-		vObj.setClientIP( mObj.getClientIP());
-		vObj.setAgentId( mObj.getAgentId());
-		vObj.setRequestedEpoch( mObj.getRequestedEpoch());
-		vObj.setLastUpdated( mObj.getLastUpdated());
-		vObj.setRepositoryName( mObj.getRepositoryName());
-		vObj.setExportedJson( mObj.getExportedJson());
-		vObj.setHttpRetCode( mObj.getHttpRetCode());
-		return vObj;
-	}
-
-	/**
-	 * @param searchCriteria
-	 * @return
-	 */
-	public VXPolicyExportAuditList searchXPolicyExportAudits(SearchCriteria searchCriteria) {
-		VXPolicyExportAuditList returnList = new VXPolicyExportAuditList();
-		List<VXPolicyExportAudit> xPolicyExportAuditList = new ArrayList<VXPolicyExportAudit>();
-
-		@SuppressWarnings("unchecked")
-		List<XXPolicyExportAudit> resultList = (List<XXPolicyExportAudit>)searchResources(searchCriteria,
-				searchFields, sortFields, returnList);
-
-		// Iterate over the result list and create the return list
-		for (XXPolicyExportAudit gjXPolicyExportAudit : resultList) {
-			@SuppressWarnings("unchecked")
-			VXPolicyExportAudit vXPolicyExportAudit = populateViewBean((T)gjXPolicyExportAudit);
-			xPolicyExportAuditList.add(vXPolicyExportAudit);
-		}
-
-		returnList.setVXPolicyExportAudits(xPolicyExportAuditList);
-		return returnList;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPolicyService.java b/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
deleted file mode 100644
index 9e2addc..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XPolicyService.java
+++ /dev/null
@@ -1,754 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.xasecure.service;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.xasecure.common.AppConstants;
-import com.xasecure.common.DateUtil;
-import com.xasecure.common.MessageEnums;
-import com.xasecure.common.PropertiesUtil;
-import com.xasecure.common.RESTErrorUtil;
-import com.xasecure.common.SearchCriteria;
-import com.xasecure.common.StringUtil;
-import com.xasecure.db.XADaoManager;
-import com.xasecure.entity.XXAsset;
-import com.xasecure.entity.XXGroup;
-import com.xasecure.entity.XXPermMap;
-import com.xasecure.entity.XXResource;
-import com.xasecure.entity.XXUser;
-import com.xasecure.view.VXAuditMap;
-import com.xasecure.view.VXAuditMapList;
-import com.xasecure.view.VXDataObject;
-import com.xasecure.view.VXPermMap;
-import com.xasecure.view.VXPermMapList;
-import com.xasecure.view.VXPermObj;
-import com.xasecure.view.VXPolicy;
-import com.xasecure.view.VXPolicyList;
-import com.xasecure.view.VXResource;
-import com.xasecure.view.VXResourceList;
-
-@Service
-public class XPolicyService extends PublicAPIServiceBase<VXResource, VXPolicy> {
-	Logger logger = Logger.getLogger(XPolicyService.class);
-
-	@Autowired
-	RESTErrorUtil restErrorUtil;
-
-	@Autowired
-	StringUtil stringUtil;
-
-	@Autowired
-	XADaoManager xaDaoMgr;
-
-	@Autowired
-	XPermMapService xPermMapService;
-
-	@Autowired
-	XAuditMapService xAuditMapService;
-
-	@Autowired
-	XResourceService xResourceService;
-
-	String version;
-	
-	private static String uniqueKeySeparator = "_";
-
-	public XPolicyService() {
-		version = PropertiesUtil.getProperty("maven.project.version", "");
-	}
-
-	public VXPolicy mapXAToPublicObject(VXResource vXResource) {
-
-		VXPolicy vXPolicy = new VXPolicy();
-		vXPolicy = super.mapBaseAttributesToPublicObject(vXResource, vXPolicy);
-
-		vXPolicy.setPolicyName(vXResource.getPolicyName());
-		vXPolicy.setResourceName(vXResource.getName());
-		vXPolicy.setDescription(vXResource.getDescription());
-		vXPolicy.setRepositoryName(vXResource.getAssetName());
-		vXPolicy.setRepositoryType(AppConstants
-				.getLabelFor_AssetType(vXResource.getAssetType()));
-		
-		
-		List<VXPermObj> permObjList = mapPermMapToPermObj(vXResource
-				.getPermMapList());
-		if (!stringUtil.isEmpty(permObjList)) {
-			vXPolicy.setPermMapList(permObjList);
-		}
-		vXPolicy.setTables(vXResource.getTables());
-		vXPolicy.setColumnFamilies(vXResource.getColumnFamilies());
-		vXPolicy.setColumns(vXResource.getColumns());
-		vXPolicy.setDatabases(vXResource.getDatabases());
-		vXPolicy.setUdfs(vXResource.getUdfs());
-		
-		vXPolicy.setTopologies(vXResource.getTopologies());
-		vXPolicy.setServices(vXResource.getServices());
-
-		boolean enable = true;
-		if (vXResource.getResourceStatus() == AppConstants.STATUS_DISABLED
-				|| vXResource.getResourceStatus() == AppConstants.STATUS_DELETED) {
-			enable = false;
-		}
-		vXPolicy.setIsEnabled(enable);
-
-		boolean auditEnable = true;
-		if (stringUtil.isEmpty(vXResource.getAuditList())) {
-			auditEnable = false;
-		}
-		vXPolicy.setIsAuditEnabled(auditEnable);
-		vXPolicy.setVersion(version);
-		
-		/*
-		 * TODO : These parameters are specific for some components. Need to
-		 * take care while adding new component
-		 */
-		if (vXResource.getAssetType() == AppConstants.ASSET_HIVE) {
-			vXPolicy.setTableType(AppConstants
-					.getLabelFor_PolicyType(vXResource.getTableType()));
-			vXPolicy.setColumnType(AppConstants
-					.getLabelFor_PolicyType(vXResource.getColumnType()));
-		}
-		if (vXResource.getAssetType() == AppConstants.ASSET_HDFS) {
-			vXPolicy.setIsRecursive(AppConstants
-					.getBooleanFor_BooleanValue(vXResource.getIsRecursive()));
-		} else {
-			vXPolicy.setIsRecursive(null);
-		}
-
-		return vXPolicy;
-	}
-
-	public VXResource mapPublicToXAObject(VXPolicy vXPolicy,
-			int operationContext) {
-		VXResource vXResource = new VXResource();
-		vXResource = super.mapBaseAttributesToXAObject(vXPolicy, vXResource);
-
-		vXResource.setName(vXPolicy.getResourceName());
-		vXResource.setPolicyName(vXPolicy.getPolicyName());
-		vXResource.setDescription(vXPolicy.getDescription());
-		vXResource.setResourceType(getResourceType(vXPolicy));
-
-		XXAsset xAsset = xaDaoMgr.getXXAsset().findByAssetName(
-				vXPolicy.getRepositoryName());
-		if (xAsset == null) {
-			throw restErrorUtil.createRESTException("The repository for which "
-					+ "you're updating policy, doesn't exist.",
-					MessageEnums.INVALID_INPUT_DATA);
-		}
-		vXResource.setAssetId(xAsset.getId());
-
-		if (operationContext == AbstractBaseResourceService.OPERATION_UPDATE_CONTEXT) {
-			XXResource xxResource = xaDaoMgr.getXXResource().getById(
-					vXPolicy.getId());
-			if (xxResource == null) {
-				logger.error("No policy found with given Id : "
-						+ vXPolicy.getId());
-				throw restErrorUtil
-						.createRESTException("No Policy found with given Id : "
-								+ vXResource.getId(),
-								MessageEnums.DATA_NOT_FOUND);
-			}
-			/*
-			 * While updating public object we wont have createDate/updateDate,
-			 * so create time, addedById, updatedById, etc. we ll have to take
-			 * from existing object
-			 */
-
-			xxResource.setUpdateTime(DateUtil.getUTCDate());
-			xResourceService
-					.mapBaseAttributesToViewBean(xxResource, vXResource);
-
-			SearchCriteria scAuditMap = new SearchCriteria();
-			scAuditMap.addParam("resourceId", xxResource.getId());
-			VXAuditMapList vXAuditMapList = xAuditMapService
-					.searchXAuditMaps(scAuditMap);
-
-			List<VXAuditMap> auditList = new ArrayList<VXAuditMap>();
-
-			if (vXAuditMapList.getListSize() > 0
-					&& vXPolicy.getIsAuditEnabled()) {
-				auditList.addAll(vXAuditMapList.getVXAuditMaps());
-			} else if (vXAuditMapList.getListSize() == 0
-					&& vXPolicy.getIsAuditEnabled()) {
-				VXAuditMap vXAuditMap = new VXAuditMap();
-				vXAuditMap.setAuditType(AppConstants.XA_AUDIT_TYPE_ALL);
-				auditList.add(vXAuditMap);
-
-			}
-
-			List<VXPermMap> permMapList = mapPermObjToPermList(
-					vXPolicy.getPermMapList(), vXPolicy);
-
-			vXResource.setAuditList(auditList);
-			vXResource.setPermMapList(permMapList);
-
-		} else if (operationContext == AbstractBaseResourceService.OPERATION_CREATE_CONTEXT) {
-			if (vXPolicy.getIsAuditEnabled()) {
-				VXAuditMap vXAuditMap = new VXAuditMap();
-				vXAuditMap.setAuditType(AppConstants.XA_AUDIT_TYPE_ALL);
-				List<VXAuditMap> auditList = new ArrayList<VXAuditMap>();
-				auditList.add(vXAuditMap);
-
-				vXResource.setAuditList(auditList);
-			}
-			if (!stringUtil.isEmpty(vXPolicy.getPermMapList())) {
-				List<VXPermMap> permMapList = mapPermObjToPermList(vXPolicy
-						.getPermMapList());
-				vXResource.setPermMapList(permMapList);
-			}
-		}
-
-		vXResource.setDatabases(vXPolicy.getDatabases());
-		vXResource.setTables(vXPolicy.getTables());
-		vXResource.setColumnFamilies(vXPolicy.getColumnFamilies());
-		vXResource.setColumns(vXPolicy.getColumns());
-		vXResource.setUdfs(vXPolicy.getUdfs());
-		vXResource.setAssetName(vXPolicy.getRepositoryName());
-		
-		int assetType = AppConstants.getEnumFor_AssetType(vXPolicy
-				.getRepositoryType());
-		if (assetType == 0 || assetType == AppConstants.ASSET_UNKNOWN) {
-			assetType = xAsset.getAssetType();
-			vXPolicy.setRepositoryType(AppConstants.getLabelFor_AssetType(assetType));
-		}
-		vXResource.setAssetType(assetType);
-
-		int resourceStatus = AppConstants.STATUS_ENABLED;
-		if (!vXPolicy.getIsEnabled()) {
-			resourceStatus = AppConstants.STATUS_DISABLED;
-		}
-		vXResource.setResourceStatus(resourceStatus);
-		// Allowing to create policy without checking parent permission
-		vXResource.setCheckParentPermission(AppConstants.BOOL_FALSE);
-		vXResource.setTopologies(vXPolicy.getTopologies());
-		vXResource.setServices(vXPolicy.getServices());
-		
-		/*
-		 * TODO : These parameters are specific for some components. Need to
-		 * take care while adding new component
-		 */
-		if (vXPolicy.getRepositoryType().equalsIgnoreCase(
-				AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HIVE))) {
-			vXResource.setTableType(AppConstants.getEnumFor_PolicyType(vXPolicy
-					.getTableType()));
-			vXResource.setColumnType(AppConstants
-					.getEnumFor_PolicyType(vXPolicy.getColumnType()));
-		}
-		if (vXPolicy.getRepositoryType().equalsIgnoreCase(
-				AppConstants.getLabelFor_AssetType(AppConstants.ASSET_HDFS))) {
-			vXResource.setIsRecursive(AppConstants
-					.getEnumFor_BooleanValue(vXPolicy.getIsRecursive()));
-		}
-
-		return vXResource;
-	}
-
-	private List<VXPermMap> mapPermObjToPermList(List<VXPermObj> permObjList,
-			VXPolicy vXPolicy) {
-
-		Long resId = vXPolicy.getId();
-		List<VXPermMap> permMapList = new ArrayList<VXPermMap>();
-		List<VXPermMap> updPermMapList = new ArrayList<VXPermMap>();
-		Map<String, VXPermMap> newPermMap = new LinkedHashMap<String, VXPermMap>();
-		Random rand = new Random();
-
-		Map<String, XXPermMap> prevPermMap = getPrevPermMap(resId);
-
-		if (permObjList == null) {
-			permObjList = new ArrayList<VXPermObj>();
-		}
-		for (VXPermObj permObj : permObjList) {
-			String permGrp = new Date() + " : " + rand.nextInt(9999);
-			String ipAddress = permObj.getIpAddress();
-
-			if (!stringUtil.isEmpty(permObj.getUserList())) {
-				int permFor = AppConstants.XA_PERM_FOR_USER;
-
-				for (String user : permObj.getUserList()) {
-
-					XXUser xxUser = xaDaoMgr.getXXUser().findByUserName(user);
-					if (xxUser == null) {
-						logger.error("No User found with this name : " + user);
-						throw restErrorUtil.createRESTException(
-								"No User found with name : " + user,
-								MessageEnums.DATA_NOT_FOUND);
-					}
-					Long userId = xxUser.getId();
-					for (String permission : permObj.getPermList()) {
-
-						int permType = AppConstants
-								.getEnumFor_XAPermType(permission);
-						VXPermMap vXPermMap = new VXPermMap();
-						vXPermMap.setPermFor(AppConstants.XA_PERM_FOR_USER);
-						vXPermMap.setPermGroup(permGrp);
-						vXPermMap.setPermType(permType);
-						vXPermMap.setUserId(xxUser.getId());
-						vXPermMap.setResourceId(resId);
-						vXPermMap.setIpAddress(ipAddress);
-						permMapList.add(vXPermMap);
-
-						StringBuilder uniqueKey = new StringBuilder();
-						uniqueKey.append(resId + uniqueKeySeparator);
-						uniqueKey.append(permFor + uniqueKeySeparator);
-						uniqueKey.append(userId + uniqueKeySeparator);
-						uniqueKey.append(permType);
-						newPermMap.put(uniqueKey.toString(), vXPermMap);
-					}
-				}
-			}
-			if (!stringUtil.isEmpty(permObj.getGroupList())) {
-				int permFor = AppConstants.XA_PERM_FOR_GROUP;
-
-				for (String group : permObj.getGroupList()) {
-
-					XXGroup xxGroup = xaDaoMgr.getXXGroup().findByGroupName(
-							group);
-					if (xxGroup == null) {
-						logger.error("No UserGroup found with this name : "
-								+ group);
-						throw restErrorUtil.createRESTException(
-								"No Group found with name : " + group,
-								MessageEnums.DATA_NOT_FOUND);
-					}
-					Long grpId = xxGroup.getId();
-					for (String permission : permObj.getPermList()) {
-
-						int permType = AppConstants
-								.getEnumFor_XAPermType(permission);
-						VXPermMap vXPermMap = new VXPermMap();
-						vXPermMap.setPermFor(AppConstants.XA_PERM_FOR_GROUP);
-						vXPermMap.setPermGroup(permGrp);
-						vXPermMap.setPermType(permType);
-						vXPermMap.setGroupId(xxGroup.getId());
-						vXPermMap.setResourceId(resId);
-						vXPermMap.setIpAddress(ipAddress);
-						permMapList.add(vXPermMap);
-
-						StringBuilder uniqueKey = new StringBuilder();
-						uniqueKey.append(resId + uniqueKeySeparator);
-						uniqueKey.append(permFor + uniqueKeySeparator);
-						uniqueKey.append(grpId + uniqueKeySeparator);
-						uniqueKey.append(permType);
-						newPermMap.put(uniqueKey.toString(), vXPermMap);
-					}
-				}
-			}
-		}
-
-		// Create Newly added permissions and Remove deleted permissions from DB
-		if (prevPermMap.size() == 0) {
-			updPermMapList.addAll(permMapList);
-		} else {
-			for (Entry<String, VXPermMap> entry : newPermMap.entrySet()) {
-				if (!prevPermMap.containsKey(entry.getKey())) {
-					updPermMapList.add(entry.getValue());
-				} else {
-					VXPermMap vPMap = xPermMapService
-							.populateViewBean(prevPermMap.get(entry.getKey()));
-					VXPermMap vPMapNew = entry.getValue();
-					vPMap.setIpAddress(vPMapNew.getIpAddress());
-					updPermMapList.add(vPMap);
-				}
-			}
-		}
-		return updPermMapList;
-	}
-
-	private Map<String, XXPermMap> getPrevPermMap(Long resId) {
-		List<XXPermMap> xxPermMapList = xaDaoMgr.getXXPermMap()
-				.findByResourceId(resId);
-
-		Map<String, XXPermMap> prevPermMap = new LinkedHashMap<String, XXPermMap>();
-
-		for (XXPermMap xxPermMap : xxPermMapList) {
-			int permFor = xxPermMap.getPermFor();
-			Long userId = xxPermMap.getUserId();
-			Long grpId = xxPermMap.getGroupId();
-			int permType = xxPermMap.getPermType();
-
-			StringBuilder uniqueKey = new StringBuilder();
-			uniqueKey.append(resId + uniqueKeySeparator);
-			uniqueKey.append(permFor + uniqueKeySeparator);
-
-			if (userId != null) {
-				uniqueKey.append(userId + uniqueKeySeparator);
-			} else if (grpId != null) {
-				uniqueKey.append(grpId + uniqueKeySeparator);
-			}
-			uniqueKey.append(permType);
-			prevPermMap.put(uniqueKey.toString(), xxPermMap);
-		}
-
-		return prevPermMap;
-	}
-
-	public List<VXPermObj> mapPermMapToPermObj(List<VXPermMap> permMapList) {
-
-		List<VXPermObj> permObjList = new ArrayList<VXPermObj>();
-		HashMap<String, List<VXPermMap>> sortedPemMap = new HashMap<String, List<VXPermMap>>();
-
-		if (permMapList != null) {
-			for (VXPermMap vXPermMap : permMapList) {
-
-				String permGrp = vXPermMap.getPermGroup();
-				List<VXPermMap> sortedList = sortedPemMap.get(permGrp);
-				if (sortedList == null) {
-					sortedList = new ArrayList<VXPermMap>();
-					sortedPemMap.put(permGrp, sortedList);
-				}
-				sortedList.add(vXPermMap);
-			}
-		}
-
-		for (Entry<String, List<VXPermMap>> entry : sortedPemMap.entrySet()) {
-			VXPermObj vXPermObj = new VXPermObj();
-			List<String> userList = new ArrayList<String>();
-			List<String> groupList = new ArrayList<String>();
-			List<String> permList = new ArrayList<String>();
-			String ipAddress = "";
-
-			List<VXPermMap> permListForGrp = entry.getValue();
-
-			for (VXPermMap permMap : permListForGrp) {
-				if (permMap.getPermFor() == AppConstants.XA_PERM_FOR_USER) {
-					if (!userList.contains(permMap.getUserName())) {
-						userList.add(permMap.getUserName());
-					}
-				} else if (permMap.getPermFor() == AppConstants.XA_PERM_FOR_GROUP) {
-					if (!groupList.contains(permMap.getGroupName())) {
-						groupList.add(permMap.getGroupName());
-					}					
-				} 
-				String perm = AppConstants.getLabelFor_XAPermType(permMap
-						.getPermType());
-				if (!permList.contains(perm)) {
-					permList.add(perm);
-				}
-				ipAddress = permMap.getIpAddress();
-			}
-			if (!userList.isEmpty()) {
-				vXPermObj.setUserList(userList);
-			}
-			if (!groupList.isEmpty()) {
-				vXPermObj.setGroupList(groupList);
-			}
-			vXPermObj.setPermList(permList);
-			vXPermObj.setIpAddress(ipAddress);
-
-			permObjList.add(vXPermObj);
-		}
-		return permObjList;
-	}
-
-	public VXPolicyList mapToVXPolicyList(VXResourceList vXResourceList) {
-
-		List<VXPolicy> policyList = new ArrayList<VXPolicy>();
-		for (VXResource vXAsset : vXResourceList.getVXResources()) {
-			VXPolicy vXRepo = mapXAToPublicObject(vXAsset);
-			policyList.add(vXRepo);
-		}
-		VXPolicyList vXPolicyList = new VXPolicyList(policyList);
-		return vXPolicyList;
-	}
-
-	private List<VXPermMap> mapPermObjToPermList(List<VXPermObj> permObjList) {
-
-		List<VXPermMap> permMapList = new ArrayList<VXPermMap>();
-		Random rand = new Random();
-
-		for (VXPermObj permObj : permObjList) {
-			
-			String ipAddress = permObj.getIpAddress();
-
-			if (!stringUtil.isEmpty(permObj.getUserList())) {
-				String permGrp = new Date() + " : " + rand.nextInt(9999);
-				for (String user : permObj.getUserList()) {
-
-					XXUser xxUser = xaDaoMgr.getXXUser().findByUserName(user);
-					if (xxUser == null) {
-						logger.error("No User found with this name : " + user);
-						throw restErrorUtil.createRESTException(
-								"No User found with name : " + user,
-								MessageEnums.DATA_NOT_FOUND);
-					}
-					for (String permission : permObj.getPermList()) {
-
-						VXPermMap vXPermMap = new VXPermMap();
-						int permType = AppConstants
-								.getEnumFor_XAPermType(permission);
-						vXPermMap.setPermFor(AppConstants.XA_PERM_FOR_USER);
-						vXPermMap.setPermGroup(permGrp);
-						vXPermMap.setPermType(permType);
-						vXPermMap.setUserId(xxUser.getId());
-						vXPermMap.setIpAddress(ipAddress);
-
-						permMapList.add(vXPermMap);
-					}
-				}
-			}
-			if (!stringUtil.isEmpty(permObj.getGroupList())) {
-				String permGrp = new Date() + " : " + rand.nextInt(9999);
-				for (String group : permObj.getGroupList()) {
-
-					XXGroup xxGroup = xaDaoMgr.getXXGroup().findByGroupName(
-							group);
-					if (xxGroup == null) {
-						logger.error("No UserGroup found with this name : "
-								+ group);
-						throw restErrorUtil.createRESTException(
-								"No User found with name : " + group,
-								MessageEnums.DATA_NOT_FOUND);
-					}
-
-					for (String permission : permObj.getPermList()) {
-
-						VXPermMap vXPermMap = new VXPermMap();
-						int permType = AppConstants
-								.getEnumFor_XAPermType(permission);
-						vXPermMap.setPermFor(AppConstants.XA_PERM_FOR_GROUP);
-						vXPermMap.setPermGroup(permGrp);
-						vXPermMap.setPermType(permType);
-						vXPermMap.setGroupId(xxGroup.getId());
-						vXPermMap.setIpAddress(ipAddress);
-
-						permMapList.add(vXPermMap);
-					}
-				}
-			}
-		}
-		return permMapList;
-	}
-
-	public List<VXPermMap> updatePermGroup(VXResource vXResource) {
-
-		XXResource xxResource = xaDaoMgr.getXXResource().getById(
-				vXResource.getId());
-		if (xxResource == null) {
-			logger.info("Resource : " + vXResource.getPolicyName()
-					+ " Not Found, while updating PermGroup");
-			throw restErrorUtil.createRESTException(
-					"Resource Not found to update PermGroup",
-					MessageEnums.DATA_NOT_FOUND);
-		}
-		Long resId = vXResource.getId();
-		List<VXPermMap> updatedPermMapList = new ArrayList<VXPermMap>();
-
-		SearchCriteria searchCriteria = new SearchCriteria();
-		searchCriteria.addParam("resourceId", resId);
-		VXPermMapList currentPermMaps = xPermMapService
-				.searchXPermMaps(searchCriteria);
-
-		List<VXPermMap> currentPermMapList = currentPermMaps.getVXPermMaps();
-		HashMap<String, List<String>> userPermMap = new HashMap<String, List<String>>();
-
-		for (VXPermMap currentPermMap : currentPermMapList) {
-			Long userId = currentPermMap.getUserId();
-			Long groupId = currentPermMap.getGroupId();
-			int permFor = currentPermMap.getPermFor();
-			int permType = currentPermMap.getPermType();
-			String ipAddress = currentPermMap.getIpAddress();
-			
-			String uniKey = resId + uniqueKeySeparator + permFor;
-			if (permFor == AppConstants.XA_PERM_FOR_GROUP) {
-				uniKey = uniKey + uniqueKeySeparator + groupId;
-			} else if (permFor == AppConstants.XA_PERM_FOR_USER) {
-				uniKey = uniKey + uniqueKeySeparator + userId;
-			}
-
-			List<String> permList = userPermMap.get(uniKey);
-			if (permList == null) {
-				permList = new ArrayList<String>();
-				userPermMap.put(uniKey, permList);
-			}
-			permList.add(""+permType);
-			
-			if (stringUtil.isEmpty(ipAddress)) {
-				permList.add(ipAddress);
-			}
-			
-		}
-
-		List<List<String>> masterKeyList = new ArrayList<List<String>>();
-		List<String> proceedKeyList = new ArrayList<String>();
-		for (Entry<String, List<String>> upMap : userPermMap.entrySet()) {
-
-			if (proceedKeyList.contains(upMap.getKey())) {
-				continue;
-			}
-
-			List<String> keyList = new ArrayList<String>();
-			keyList.add(upMap.getKey());
-			proceedKeyList.add(upMap.getKey());
-
-			for (Entry<String, List<String>> entry : userPermMap.entrySet()) {
-
-				if (proceedKeyList.contains(entry.getKey())) {
-					continue;
-				}
-
-				boolean result = compareTwoListElements(upMap.getValue(),
-						entry.getValue());
-				if (result) {
-					keyList.add(entry.getKey());
-					proceedKeyList.add(entry.getKey());
-				}
-			}
-			masterKeyList.add(keyList);
-		}
-
-		for (List<String> keyList : masterKeyList) {
-			Random rand = new Random();
-			String permGrp = new Date() + " : " + rand.nextInt(9999);
-			for (String key : keyList) {
-
-				SearchCriteria scPermMap = new SearchCriteria();
-				String[] keyEle = StringUtils.split(key, uniqueKeySeparator);
-				if (keyEle != null && keyEle.length == 3) {
-
-					int permFor = Integer.parseInt(keyEle[1]);
-					int ugId = Integer.parseInt(keyEle[2]);
-					scPermMap.addParam("resourceId", resId);
-					scPermMap.addParam("permFor", permFor);
-
-					if (permFor == AppConstants.XA_PERM_FOR_GROUP) {
-						scPermMap.addParam("groupId", ugId);
-					} else if (permFor == AppConstants.XA_PERM_FOR_USER) {
-						scPermMap.addParam("userId", ugId);
-					}
-
-					VXPermMapList permList = xPermMapService
-							.searchXPermMaps(scPermMap);
-					for (VXPermMap vXPerm : permList.getVXPermMaps()) {
-						vXPerm.setPermGroup(permGrp);
-						xPermMapService.updateResource(vXPerm);
-						updatedPermMapList.add(vXPerm);
-					}
-				} else {
-					logger.info("variable : keyEle, should fulfill the checked"
-							+ " condition, but its not fulfilling required "
-							+ "condition. Ignoring appropriate permMap from"
-							+ " updating permGroup. Key : " + key
-							+ "Resource Id : " + resId);
-				}
-			}
-		}
-		return updatedPermMapList;
-	}
-
-	private boolean compareTwoListElements(List<?> list1, List<?> list2) {
-		if (list1 == null || list2 == null) {
-			return false;
-		}
-		if (list1.size() != list2.size()) {
-			return false;
-		}
-		int listSize = list1.size();
-		for (int i = 0; i < listSize; i++) {
-			Object obj1 = list1.get(i);
-			if (!list2.contains(obj1)) {
-				return false;
-			}
-		}
-		return true;
-	}
-
-	public int getResourceType(VXDataObject vObj) {
-		int resourceType = AppConstants.RESOURCE_PATH;
-		if (vObj == null) {
-			return resourceType;
-		}
-
-		VXPolicy vXPolicy = null;
-		VXResource vXResource = null;
-		if (vObj instanceof VXPolicy) {
-			vXPolicy = (VXPolicy) vObj;
-		} else if (vObj instanceof VXResource) {
-			vXResource = (VXResource) vObj;
-		} else {
-			return resourceType;
-		}
-
-		String databases = null;
-		String tables = null;
-		String columns = null;
-		String udfs = null;
-		String columnFamilies = null;
-		String topologies = null;
-		String services = null;
-
-		if (vXPolicy != null) {
-			databases = vXPolicy.getDatabases();
-			tables = vXPolicy.getTables();
-			columns = vXPolicy.getColumns();
-			udfs = vXPolicy.getUdfs();
-			columnFamilies = vXPolicy.getColumnFamilies();
-			topologies = vXPolicy.getTopologies();
-			services = vXPolicy.getServices();
-		} else if (vXResource != null) {
-			databases = vXResource.getDatabases();
-			tables = vXResource.getTables();
-			columns = vXResource.getColumns();
-			udfs = vXResource.getUdfs();
-			columnFamilies = vXResource.getColumnFamilies();
-			topologies = vXResource.getTopologies();
-			services = vXResource.getServices();
-		}
-
-		if (!stringUtil.isEmpty(databases)) {
-			resourceType = AppConstants.RESOURCE_DB;
-			if (!stringUtil.isEmptyOrWildcardAsterisk(tables)) {
-				resourceType = AppConstants.RESOURCE_TABLE;
-			}
-			if (!stringUtil.isEmptyOrWildcardAsterisk(columns)) {
-				resourceType = AppConstants.RESOURCE_COLUMN;
-			}
-			if (!stringUtil.isEmpty(udfs)) {
-				resourceType = AppConstants.RESOURCE_UDF;
-			}
-		} else if (!stringUtil.isEmpty(tables)) {
-			resourceType = AppConstants.RESOURCE_TABLE;
-			if (!stringUtil.isEmptyOrWildcardAsterisk(columnFamilies)) {
-				resourceType = AppConstants.RESOURCE_COL_FAM;
-			}
-			if (!stringUtil.isEmptyOrWildcardAsterisk(columns)) {
-				resourceType = AppConstants.RESOURCE_COLUMN;
-			}
-		} else if (!stringUtil.isEmpty(topologies)) {
-			resourceType = AppConstants.RESOURCE_TOPOLOGY;
-			if (!stringUtil.isEmptyOrWildcardAsterisk(services)) {
-				resourceType = AppConstants.RESOURCE_SERVICE_NAME;
-			}
-		}
-		return resourceType;
-	}
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XPortalUserService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPortalUserService.java b/security-admin/src/main/java/com/xasecure/service/XPortalUserService.java
deleted file mode 100644
index 3641b31..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XPortalUserService.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package com.xasecure.service;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import com.xasecure.common.AppConstants;
-import com.xasecure.common.StringUtil;
-import com.xasecure.common.view.VTrxLogAttr;
-import com.xasecure.entity.*;
-import com.xasecure.util.XAEnumUtil;
-import com.xasecure.view.*;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-@Service
-@Scope("singleton")
-public class XPortalUserService extends
-		XPortalUserServiceBase<XXPortalUser, VXPortalUser> {
-
-	@Autowired
-	XAEnumUtil xaEnumUtil;
-
-	@Autowired
-	StringUtil stringUtil;
-
-	static HashMap<String, VTrxLogAttr> trxLogAttrs = new HashMap<String, VTrxLogAttr>();
-	static {
-		trxLogAttrs.put("loginId",
-				new VTrxLogAttr("loginId", "Login ID", false));
-		trxLogAttrs.put("status", new VTrxLogAttr("status",
-				"Activation Status", false));
-		trxLogAttrs.put("firstName", new VTrxLogAttr("firstName", "First Name",
-				false));
-		trxLogAttrs.put("lastName", new VTrxLogAttr("lastName", "Last Name",
-				false));
-		trxLogAttrs.put("emailAddress", new VTrxLogAttr("emailAddress",
-				"Email Address", false));
-		trxLogAttrs.put("publicScreenName", new VTrxLogAttr("publicScreenName",
-				"Public Screen Name", false));
-	}
-
-	@Override
-	protected void validateForCreate(VXPortalUser vObj) {
-		// TODO Auto-generated method stub
-
-	}
-
-	@Override
-	protected void validateForUpdate(VXPortalUser vObj, XXPortalUser mObj) {
-		// TODO Auto-generated method stub
-
-	}
-
-	public List<XXTrxLog> getTransactionLog(VXPortalUser vUser, String action) {
-		return getTransactionLog(vUser, null, action);
-	}
-
-	public List<XXTrxLog> getTransactionLog(VXPortalUser vObj,
-			XXPortalUser xObj, String action) {
-		if (vObj == null
-				&& (action == null || !action.equalsIgnoreCase("update"))) {
-			return null;
-		}
-
-		List<XXTrxLog> trxLogList = new ArrayList<XXTrxLog>();
-		Field[] fields = vObj.getClass().getDeclaredFields();
-
-		try {
-			Field nameField = vObj.getClass().getDeclaredField("loginId");
-			nameField.setAccessible(true);
-			String objectName = "" + nameField.get(vObj);
-
-			for (Field field : fields) {
-				field.setAccessible(true);
-				String fieldName = field.getName();
-				if (!trxLogAttrs.containsKey(fieldName)) {
-					continue;
-				}
-
-				VTrxLogAttr vTrxLogAttr = trxLogAttrs.get(fieldName);
-
-				XXTrxLog xTrxLog = new XXTrxLog();
-				xTrxLog.setAttributeName(vTrxLogAttr
-						.getAttribUserFriendlyName());
-
-				String value = null;
-				boolean isEnum = vTrxLogAttr.isEnum();
-				if (isEnum) {
-					String enumName = XXAsset.getEnumName(fieldName);
-					int enumValue = field.get(vObj) == null ? 0 : Integer
-							.parseInt("" + field.get(vObj));
-					value = xaEnumUtil.getLabel(enumName, enumValue);
-				} else {
-					value = "" + field.get(vObj);
-				}
-
-				if (action.equalsIgnoreCase("create")) {
-					if (stringUtil.isEmpty(value)) {
-						continue;
-					}
-					xTrxLog.setNewValue(value);
-				} else if (action.equalsIgnoreCase("delete")) {
-					xTrxLog.setPreviousValue(value);
-				} else if (action.equalsIgnoreCase("update")) {
-					String oldValue = null;
-					Field[] xFields = xObj.getClass().getDeclaredFields();
-
-					for (Field xField : xFields) {
-						xField.setAccessible(true);
-						String xFieldName = xField.getName();
-
-						if (fieldName.equalsIgnoreCase(xFieldName)) {
-							if (isEnum) {
-								String enumName = XXAsset
-										.getEnumName(xFieldName);
-								int enumValue = xField.get(xObj) == null ? 0
-										: Integer.parseInt(""
-												+ xField.get(xObj));
-								oldValue = xaEnumUtil.getLabel(enumName,
-										enumValue);
-							} else {
-								oldValue = xField.get(xObj) + "";
-							}
-							break;
-						}
-					}
-					if (fieldName.equalsIgnoreCase("emailAddress")) {
-						if (!stringUtil.validateEmail(oldValue)) {
-							oldValue = "";
-						}
-						if (!stringUtil.validateEmail(value)) {
-							value = "";
-						}
-					}
-					if (value.equalsIgnoreCase(oldValue)) {
-						continue;
-					}
-					xTrxLog.setPreviousValue(oldValue);
-					xTrxLog.setNewValue(value);
-				}
-
-				xTrxLog.setAction(action);
-				xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_USER_PROFILE);
-				xTrxLog.setObjectId(vObj.getId());
-				xTrxLog.setObjectName(objectName);
-				trxLogList.add(xTrxLog);
-			}
-		} catch (IllegalArgumentException e) {
-			logger.info(
-					"Caught IllegalArgumentException while"
-							+ " getting Transaction log for user : "
-							+ vObj.getLoginId(), e);
-		} catch (NoSuchFieldException e) {
-			logger.info(
-					"Caught NoSuchFieldException while"
-							+ " getting Transaction log for user : "
-							+ vObj.getLoginId(), e);
-		} catch (SecurityException e) {
-			logger.info(
-					"Caught SecurityException while"
-							+ " getting Transaction log for user : "
-							+ vObj.getLoginId(), e);
-		} catch (IllegalAccessException e) {
-			logger.info(
-					"Caught IllegalAccessException while"
-							+ " getting Transaction log for user : "
-							+ vObj.getLoginId(), e);
-		}
-		return trxLogList;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XPortalUserServiceBase.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XPortalUserServiceBase.java b/security-admin/src/main/java/com/xasecure/service/XPortalUserServiceBase.java
deleted file mode 100644
index 8d78975..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XPortalUserServiceBase.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- package com.xasecure.service;
-
-/**
- * 
- */
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.xasecure.common.*;
-import com.xasecure.entity.*;
-import com.xasecure.view.*;
-import com.xasecure.service.*;
-
-public abstract class XPortalUserServiceBase<T extends XXPortalUser, V extends VXPortalUser>
-		extends AbstractBaseResourceService<T, V> {
-	public static final String NAME = "XPortalUser";
-
-	public XPortalUserServiceBase() {
-
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected XXPortalUser mapViewToEntityBean(VXPortalUser vObj, XXPortalUser mObj, int OPERATION_CONTEXT) {
-		mObj.setFirstName( vObj.getFirstName());
-		mObj.setLastName( vObj.getLastName());
-		mObj.setPublicScreenName( vObj.getPublicScreenName());
-		mObj.setLoginId( vObj.getLoginId());
-		mObj.setPassword( vObj.getPassword());
-		mObj.setEmailAddress( vObj.getEmailAddress());
-		mObj.setStatus( vObj.getStatus());
-		mObj.setUserSource( vObj.getUserSource());
-		mObj.setNotes( vObj.getNotes());
-		return mObj;
-	}
-
-	@SuppressWarnings("unchecked")
-	@Override
-	protected VXPortalUser mapEntityToViewBean(VXPortalUser vObj, XXPortalUser mObj) {
-		vObj.setFirstName( mObj.getFirstName());
-		vObj.setLastName( mObj.getLastName());
-		vObj.setPublicScreenName( mObj.getPublicScreenName());
-		vObj.setLoginId( mObj.getLoginId());
-		vObj.setPassword( mObj.getPassword());
-		vObj.setEmailAddress( mObj.getEmailAddress());
-		vObj.setStatus( mObj.getStatus());
-		vObj.setUserSource( mObj.getUserSource());
-		vObj.setNotes( mObj.getNotes());
-		return vObj;
-	}
-
-	/**
-	 * @param searchCriteria
-	 * @return
-	 */
-	public VXPortalUserList searchXPortalUsers(SearchCriteria searchCriteria) {
-		VXPortalUserList returnList = new VXPortalUserList();
-		List<VXPortalUser> xPortalUserList = new ArrayList<VXPortalUser>();
-
-		@SuppressWarnings("unchecked")
-		List<XXPortalUser> resultList = (List<XXPortalUser>)searchResources(searchCriteria,
-				searchFields, sortFields, returnList);
-
-		// Iterate over the result list and create the return list
-		for (XXPortalUser gjXPortalUser : resultList) {
-			@SuppressWarnings("unchecked")
-			VXPortalUser vXPortalUser = populateViewBean((T)gjXPortalUser);
-			xPortalUserList.add(vXPortalUser);
-		}
-
-		returnList.setVXPortalUsers(xPortalUserList);
-		return returnList;
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XRepositoryService.java
----------------------------------------------------------------------
diff --git a/security-admin/src/main/java/com/xasecure/service/XRepositoryService.java b/security-admin/src/main/java/com/xasecure/service/XRepositoryService.java
deleted file mode 100644
index ade952a..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XRepositoryService.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package com.xasecure.service;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import com.xasecure.common.AppConstants;
-import com.xasecure.common.MessageEnums;
-import com.xasecure.common.PropertiesUtil;
-import com.xasecure.common.RESTErrorUtil;
-import com.xasecure.common.SearchCriteria;
-import com.xasecure.common.XACommonEnums;
-import com.xasecure.view.VXAsset;
-import com.xasecure.view.VXAssetList;
-import com.xasecure.view.VXRepository;
-import com.xasecure.view.VXRepositoryList;
-
-@Service
-public class XRepositoryService extends
-		PublicAPIServiceBase<VXAsset, VXRepository> {
-
-	@Autowired
-	RESTErrorUtil restErrorUtil;
-
-	String version;
-
-	public XRepositoryService() {
-		version = PropertiesUtil.getProperty("maven.project.version", "");
-	}
-
-	public VXRepository mapXAToPublicObject(VXAsset vXAsset) {
-		VXRepository vRepo = new VXRepository();
-		vRepo = super.mapBaseAttributesToPublicObject(vXAsset, vRepo);
-
-		vRepo.setName(vXAsset.getName());
-		vRepo.setDescription(vXAsset.getDescription());
-		vRepo.setRepositoryType(AppConstants.getLabelFor_AssetType(vXAsset
-				.getAssetType()));
-		vRepo.setConfig(vXAsset.getConfig());
-		
-		int actStatus = vXAsset.getActiveStatus();
-		boolean isAct = (actStatus == XACommonEnums.STATUS_DISABLED) ? false
-				: true;
-
-		vRepo.setIsActive(isAct);
-		vRepo.setVersion(version);
-
-		return vRepo;
-	}
-
-	public VXAsset mapPublicToXAObject(VXRepository vXRepo) {
-
-		VXAsset vXAsset = new VXAsset();
-		vXAsset = super.mapBaseAttributesToXAObject(vXRepo, vXAsset);
-
-		vXAsset.setName(vXRepo.getName());
-		vXAsset.setDescription(vXRepo.getDescription());
-		vXAsset.setAssetType(AppConstants.getEnumFor_AssetType(vXRepo
-				.getRepositoryType()));
-		vXAsset.setConfig(vXRepo.getConfig());
-		
-		int actStatus = (!vXRepo.getIsActive()) ? XACommonEnums.STATUS_DISABLED
-				: XACommonEnums.STATUS_ENABLED;
-
-		vXAsset.setActiveStatus(actStatus);
-
-		return vXAsset;
-	}
-
-	public SearchCriteria getMappedSearchParams(HttpServletRequest request,
-			SearchCriteria searchCriteria) {
-
-		Object typeObj = searchCriteria.getParamValue("type");
-		Object statusObj = searchCriteria.getParamValue("status");
-
-		ArrayList<Integer> statusList = new ArrayList<Integer>();
-		if (statusObj == null) {
-			statusList.add(XACommonEnums.STATUS_DISABLED);
-			statusList.add(XACommonEnums.STATUS_ENABLED);
-		} else {
-			boolean status = restErrorUtil.parseBoolean(
-					request.getParameter("status"), "Invalid value for "
-							+ "status", MessageEnums.INVALID_INPUT_DATA, null,
-					"status");
-			int statusEnum = (status == false) ? AppConstants.STATUS_DISABLED
-					: AppConstants.STATUS_ENABLED;
-			statusList.add(statusEnum);
-		}
-		searchCriteria.addParam("status", statusList);
-
-		if (typeObj != null) {
-			String type = typeObj.toString();
-			int typeEnum = AppConstants.getEnumFor_AssetType(type);
-			searchCriteria.addParam("type", typeEnum);
-		}
-		return searchCriteria;
-	}
-
-	public VXRepositoryList mapToVXRepositoryList(VXAssetList vXAssetList) {
-
-		List<VXRepository> repoList = new ArrayList<VXRepository>();
-		for (VXAsset vXAsset : vXAssetList.getVXAssets()) {
-			VXRepository vXRepo = mapXAToPublicObject(vXAsset);
-			repoList.add(vXRepo);
-		}
-		VXRepositoryList vXRepositoryList = new VXRepositoryList(repoList);
-		return vXRepositoryList;
-	}
-
-}