http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/UserServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/UserServiceBase.java 
b/security-admin/src/main/java/com/xasecure/service/UserServiceBase.java
deleted file mode 100644
index d445b3c..0000000
--- a/security-admin/src/main/java/com/xasecure/service/UserServiceBase.java
+++ /dev/null
@@ -1,73 +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 UserServiceBase<T extends XXPortalUser, V extends 
VXPortalUser>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "User";
-
-       public UserServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXPortalUser mapViewToEntityBean(VXPortalUser vObj, 
XXPortalUser mObj, int OPERATION_CONTEXT) {
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXPortalUser mapEntityToViewBean(VXPortalUser vObj, 
XXPortalUser mObj) {
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXPortalUserList searchUsers(SearchCriteria searchCriteria) {
-               VXPortalUserList returnList = new VXPortalUserList();
-               List<VXPortalUser> userList = 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 gjUser : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXPortalUser vUser = populateViewBean((T)gjUser);
-                       userList.add(vUser);
-               }
-
-               returnList.setVXPortalUsers(userList);
-               return returnList;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XAccessAuditService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XAccessAuditService.java 
b/security-admin/src/main/java/com/xasecure/service/XAccessAuditService.java
deleted file mode 100644
index 08168d8..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XAccessAuditService.java
+++ /dev/null
@@ -1,265 +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.Collections;
-import java.util.List;
-
-import javax.persistence.Query;
-
-import com.xasecure.common.SearchCriteria;
-import com.xasecure.common.SearchField;
-import com.xasecure.common.SearchUtil;
-import com.xasecure.common.SortField;
-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.view.VList;
-import com.xasecure.view.*;
-import com.xasecure.db.XADaoManager;
-import com.xasecure.entity.*;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-@Service
-@Scope("singleton")
-public class XAccessAuditService extends 
XAccessAuditServiceBase<XXAccessAudit, VXAccessAudit>{
-       public static final String NAME = "XAccessAudit";
-       public List<SortField> sortFields = new ArrayList<SortField>();
-       public List<SearchField> searchFields = new ArrayList<SearchField>();
-
-       @Autowired
-       protected SearchUtil searchUtil;
-       
-       @Autowired
-       XADaoManager appDaoMgr;
-
-       protected String queryStr;
-       protected final String distinctCountQueryStr;
-       protected final String distinctQueryStr;
-       protected String countQueryStr;
-
-
-       public XAccessAuditService() {
-               countQueryStr = "SELECT COUNT(obj) FROM XXAccessAudit  obj ";
-               queryStr = "SELECT obj FROM XXAccessAudit obj ";
-               distinctCountQueryStr = "SELECT COUNT(distinct obj.id) FROM 
XXAccessAudit obj ";
-               distinctQueryStr = "SELECT distinct obj FROM XXAccessAudit obj 
";
-               
-               searchFields.add(new SearchField("accessType", "obj.accessType",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("aclEnforcer", 
"obj.aclEnforcer",
-                               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("repoName", "obj.repoName",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("sessionId", "obj.sessionId",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("requestUser", 
"obj.requestUser",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("requestData", 
"obj.requestData",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("resourcePath", 
"obj.resourcePath",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("clientIP", "obj.clientIP",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-
-               searchFields.add(new SearchField("auditType", "obj.auditType",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-               searchFields.add(new SearchField("accessResult", 
"obj.accessResult",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-               searchFields.add(new SearchField("assetId", "obj.assetId",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-               searchFields.add(new SearchField("policyId", "obj.policyId",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-               searchFields.add(new SearchField("repoType", "obj.repoType",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-
-               searchFields.add(new SearchField("startDate", "obj.eventTime", 
-                               DATA_TYPE.DATE, 
SEARCH_TYPE.GREATER_EQUAL_THAN));
-               searchFields.add(new SearchField("endDate", "obj.eventTime", 
-                               DATA_TYPE.DATE, SEARCH_TYPE.LESS_EQUAL_THAN));
-               sortFields.add(new SortField("eventTime", "obj.eventTime", 
true, SORT_ORDER.DESC));
-}
-
-       protected XXAccessAudit mapViewToEntityBean(VXAccessAudit vObj, 
XXAccessAudit mObj, int OPERATION_CONTEXT) {
-               mObj.setId(vObj.getId());
-               mObj.setAuditType( vObj.getAuditType());
-               mObj.setAccessResult( vObj.getAccessResult());
-               mObj.setAccessType( vObj.getAccessType());
-               mObj.setAclEnforcer( vObj.getAclEnforcer());
-               mObj.setAgentId( vObj.getAgentId());
-               mObj.setPolicyId( vObj.getPolicyId());
-               mObj.setRepoName( vObj.getRepoName());
-               mObj.setRepoType( vObj.getRepoType());
-               mObj.setResultReason( vObj.getResultReason());
-               mObj.setSessionId( vObj.getSessionId());
-               mObj.setEventTime( vObj.getEventTime());
-               mObj.setRequestUser( vObj.getRequestUser());
-               mObj.setRequestData( vObj.getRequestData());
-               mObj.setResourcePath( vObj.getResourcePath());
-               mObj.setResourceType(vObj.getResourceType());
-               mObj.setClientIP(vObj.getClientIP());
-               mObj.setClientType(vObj.getClientType());
-               return mObj;
-       }
-
-       protected VXAccessAudit mapEntityToViewBean(VXAccessAudit vObj, 
XXAccessAudit mObj) {
-               vObj.setAuditType( mObj.getAuditType());
-               vObj.setAccessResult( mObj.getAccessResult());
-               vObj.setAccessType( mObj.getAccessType());
-               vObj.setAclEnforcer( mObj.getAclEnforcer());
-               vObj.setAgentId( mObj.getAgentId());
-               vObj.setPolicyId( mObj.getPolicyId());
-               vObj.setRepoName( mObj.getRepoName());
-               vObj.setRepoType( mObj.getRepoType());
-               vObj.setResultReason( mObj.getResultReason());
-               vObj.setSessionId( mObj.getSessionId());
-               vObj.setEventTime( mObj.getEventTime());
-               vObj.setRequestUser( mObj.getRequestUser());
-               vObj.setRequestData( mObj.getRequestData());
-               vObj.setResourcePath( mObj.getResourcePath());
-               vObj.setResourceType( mObj.getResourceType());
-               vObj.setClientIP( mObj.getClientIP());
-               vObj.setClientType( mObj.getClientType());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXAccessAuditList searchXAccessAudits(SearchCriteria 
searchCriteria) {
-               VXAccessAuditList returnList = new VXAccessAuditList();
-               List<VXAccessAudit> xAccessAuditList = new 
ArrayList<VXAccessAudit>();
-
-               List<XXAccessAudit> resultList = 
(List<XXAccessAudit>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXAccessAudit gjXAccessAudit : resultList) {
-                       VXAccessAudit vXAccessAudit = 
populateViewBean(gjXAccessAudit);
-                       xAccessAuditList.add(vXAccessAudit);
-               }
-
-               returnList.setVXAccessAudits(xAccessAuditList);
-               return returnList;
-       }
-       
-       public VXAccessAudit populateViewBean(XXAccessAudit gjXAccessAudit) {
-               VXAccessAudit vXAccessAudit = new VXAccessAudit();
-               return mapEntityToViewBean(vXAccessAudit, gjXAccessAudit);
-       }
-    /*
-       protected List<XXAccessAudit> searchResources(SearchCriteria 
searchCriteria,
-                       List<SearchField> searchFieldList, List<SortField> 
sortFieldList,
-                       VList vList) {
-
-               // Get total count of the rows which meet the search criteria
-               long count = -1;
-               if (searchCriteria.isGetCount()) {
-                       count = getCountForSearchQuery(searchCriteria, 
searchFieldList);
-                       if (count == 0) {
-                               return Collections.emptyList();
-                       }
-               }
-               // construct the sort clause
-               String sortClause = 
searchUtil.constructSortClause(searchCriteria,
-                               sortFieldList);
-
-               String q=queryStr;
-               if(searchCriteria.isDistinct()){
-                       q=distinctQueryStr;
-               }
-               // construct the query object for retrieving the data
-               Query query = createQuery(q, sortClause, searchCriteria,
-                               searchFieldList, false);
-
-               List<XXAccessAudit> resultList = 
appDaoMgr.getXXAccessAudit().executeQueryInSecurityContext(
-                               XXAccessAudit.class, query);
-
-               if (vList != null) {
-                       // Set the meta values for the query result
-                       vList.setPageSize(query.getMaxResults());
-                       vList.setSortBy(searchCriteria.getSortBy());
-                       vList.setSortType(searchCriteria.getSortType());
-                       vList.setStartIndex(query.getFirstResult());
-                       vList.setTotalCount(count);
-                       vList.setResultSize(resultList.size());
-               }
-               return resultList;
-       }
-
-       public VXLong getSearchCount(SearchCriteria searchCriteria,
-                       List<SearchField> searchFieldList) {
-               long count = getCountForSearchQuery(searchCriteria, 
searchFieldList);
-
-               VXLong vXLong = new VXLong();
-               vXLong.setValue(count);
-               return vXLong;
-       }
-
-       protected long getCountForSearchQuery(SearchCriteria searchCriteria,
-                       List<SearchField> searchFieldList) {
-
-               String q = countQueryStr;
-               // Get total count of the rows which meet the search criteria
-               if( searchCriteria.isDistinct()) {
-                       q = distinctCountQueryStr;
-               }
-               
-               // Get total count of the rows which meet the search criteria
-               Query query = createQuery(q, null, searchCriteria,
-                               searchFieldList, true);
-
-               // Make the database call to get the total count
-               Long count = 
appDaoMgr.getXXAccessAudit().executeCountQueryInSecurityContext(XXAccessAudit.class,
-                               query);
-               if (count == null) {
-                       // If no data that meets the criteria, return 0
-                       return 0;
-               }
-               return count.longValue();
-       }
-
-//     protected Query createQuery(String searchString, String sortString,
-//                     SearchCriteria searchCriteria, List<SearchField> 
searchFieldList,
-//                     boolean isCountQuery) {
-//             Query query = 
searchUtil.createSearchQuery(appDaoMgr.getXXAccessAudit().getEntityManager(), 
searchString, sortString,
-//                             searchCriteria, searchFieldList, isCountQuery);
-//             return query;
-//     }
-*/
-       @Override
-       protected void validateForCreate(VXAccessAudit viewBaseBean) {
-               // TODO Auto-generated method stub
-               
-       }
-
-       @Override
-       protected void validateForUpdate(VXAccessAudit viewBaseBean, 
XXAccessAudit t) {
-               // TODO Auto-generated method stub
-               
-       }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XAccessAuditServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XAccessAuditServiceBase.java
 
b/security-admin/src/main/java/com/xasecure/service/XAccessAuditServiceBase.java
deleted file mode 100644
index 168ecb9..0000000
--- 
a/security-admin/src/main/java/com/xasecure/service/XAccessAuditServiceBase.java
+++ /dev/null
@@ -1,113 +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 XAccessAuditServiceBase<T extends XXAccessAudit, V 
extends VXAccessAudit>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "XAccessAudit";
-
-       public XAccessAuditServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXAccessAudit mapViewToEntityBean(VXAccessAudit vObj, 
XXAccessAudit mObj, int OPERATION_CONTEXT) {
-               mObj.setAuditType( vObj.getAuditType());
-               mObj.setAccessResult( vObj.getAccessResult());
-               mObj.setAccessType( vObj.getAccessType());
-               mObj.setAclEnforcer( vObj.getAclEnforcer());
-               mObj.setAgentId( vObj.getAgentId());
-               mObj.setClientIP( vObj.getClientIP());
-               mObj.setClientType( vObj.getClientType());
-               mObj.setPolicyId( vObj.getPolicyId());
-               mObj.setRepoName( vObj.getRepoName());
-               mObj.setRepoType( vObj.getRepoType());
-               mObj.setResultReason( vObj.getResultReason());
-               mObj.setSessionId( vObj.getSessionId());
-               mObj.setEventTime( vObj.getEventTime());
-               mObj.setRequestUser( vObj.getRequestUser());
-               mObj.setAction( vObj.getAction());
-               mObj.setRequestData( vObj.getRequestData());
-               mObj.setResourcePath( vObj.getResourcePath());
-               mObj.setResourceType( vObj.getResourceType());
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXAccessAudit mapEntityToViewBean(VXAccessAudit vObj, 
XXAccessAudit mObj) {
-               vObj.setAuditType( mObj.getAuditType());
-               vObj.setAccessResult( mObj.getAccessResult());
-               vObj.setAccessType( mObj.getAccessType());
-               vObj.setAclEnforcer( mObj.getAclEnforcer());
-               vObj.setAgentId( mObj.getAgentId());
-               vObj.setClientIP( mObj.getClientIP());
-               vObj.setClientType( mObj.getClientType());
-               vObj.setPolicyId( mObj.getPolicyId());
-               vObj.setRepoName( mObj.getRepoName());
-               vObj.setRepoType( mObj.getRepoType());
-               vObj.setResultReason( mObj.getResultReason());
-               vObj.setSessionId( mObj.getSessionId());
-               vObj.setEventTime( mObj.getEventTime());
-               vObj.setRequestUser( mObj.getRequestUser());
-               vObj.setAction( mObj.getAction());
-               vObj.setRequestData( mObj.getRequestData());
-               vObj.setResourcePath( mObj.getResourcePath());
-               vObj.setResourceType( mObj.getResourceType());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXAccessAuditList searchXAccessAudits(SearchCriteria 
searchCriteria) {
-               VXAccessAuditList returnList = new VXAccessAuditList();
-               List<VXAccessAudit> xAccessAuditList = new 
ArrayList<VXAccessAudit>();
-
-               @SuppressWarnings("unchecked")
-               List<XXAccessAudit> resultList = 
(List<XXAccessAudit>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXAccessAudit gjXAccessAudit : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXAccessAudit vXAccessAudit = 
populateViewBean((T)gjXAccessAudit);
-                       xAccessAuditList.add(vXAccessAudit);
-               }
-
-               returnList.setVXAccessAudits(xAccessAuditList);
-               return returnList;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XAgentService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XAgentService.java 
b/security-admin/src/main/java/com/xasecure/service/XAgentService.java
deleted file mode 100644
index 97e1e9e..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XAgentService.java
+++ /dev/null
@@ -1,144 +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.List;
-import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.TimeUnit;
-
-import com.xasecure.common.DateUtil;
-import com.xasecure.common.PropertiesUtil;
-import com.xasecure.common.SearchCriteria;
-import com.xasecure.common.StringUtil;
-
-import org.apache.log4j.Logger;
-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.TimedEventUtil;
-import com.xasecure.view.VXAuditRecord;
-import com.xasecure.view.VXAuditRecordList;
-
-@Service
-@Scope("singleton")
-public class XAgentService {
-
-       @Autowired
-       StringUtil stringUtil;
-
-       @Autowired
-       DateUtil dateUtil;
-       
-       private static Logger logger = Logger.getLogger(XAgentService.class);
-       
-       protected String defaultDBDateFormat="yyyy-MM-dd";
-       protected boolean auditSupported = false;
-       
-       public XAgentService() {
-               defaultDBDateFormat = PropertiesUtil.getProperty(
-                               "xa.db.defaultDateformat", defaultDBDateFormat);
-               auditSupported = 
PropertiesUtil.getBooleanProperty("xa.audit.supported", 
-                               false);
-       }
-       
-       private boolean isHDFSLog(String loggerName, int fieldCount) {
-               boolean ret = false ;
-               if (loggerName != null) {
-                       ret = loggerName.startsWith("org.") ;
-               }
-               else {
-                       ret = (fieldCount == 5) ;
-               }
-               return ret;
-       }
-       
-       private boolean isHiveLog(String loggerName, int fieldCount) {
-               boolean ret = false ;
-               if (loggerName != null) {
-                       ret = 
loggerName.startsWith("com.xasecure.authorization.hive")  || 
loggerName.startsWith("com.xasecure.pdp.hive.") ;
-               }
-               else {
-                       ret = (fieldCount == 11) ;
-               }
-               return ret;
-       }
-
-       private boolean isHBaseLog(String loggerName, int fieldCount) {
-               boolean ret = false ;
-               if (loggerName != null) {
-                       ret = 
loggerName.startsWith("com.xasecure.authorization.hbase") ;
-               }
-               else {
-                       ret = ((fieldCount != 5) && (fieldCount != 11)) ;
-               }
-               return ret;
-       }
-
-
-       // The resource type field in the message has "@" at the start
-       // remove and then compare
-       
-       private int getResourceType(String field) {
-               field = field.startsWith("@") ? field.substring(1) : field;
-               
-               int resourceType = AppConstants.RESOURCE_UNKNOWN;
-               if (field.equals("db")) {
-                       resourceType = AppConstants.RESOURCE_DB;
-               } else if (field.equals("table")) {
-                       resourceType = AppConstants.RESOURCE_TABLE;
-               } else if (field.equals("column")) {
-                       resourceType = AppConstants.RESOURCE_COLUMN;
-               }
-               
-               return resourceType;
-       }
-
-       private String bulidWhereClause(SearchCriteria searchCriteria) {
-               StringBuffer whereClause = new StringBuffer();
-               Date startDate = (Date) 
searchCriteria.getParamValue("startDate");
-               Date endDate = (Date) searchCriteria.getParamValue("endDate");
-
-               if (startDate == null) {
-                       startDate = new Date(0);
-               }
-
-               if (endDate == null) {
-                       endDate = DateUtil.getUTCDate();
-
-               }
-               String startDateString = DateUtil.dateToString(startDate, 
defaultDBDateFormat);
-               String endDateString = DateUtil.dateToString(endDate, 
defaultDBDateFormat);
-               
-               whereClause.append(" DATE(inserted_date)  BETWEEN  '" + 
startDateString
-                               + "' AND  '" + endDateString + "'");
-               
-               if (whereClause.length() != 0) {
-                       return "WHERE " + whereClause.toString();
-               }
-               
-               return "";
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XAssetService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XAssetService.java 
b/security-admin/src/main/java/com/xasecure/service/XAssetService.java
deleted file mode 100644
index 3b3d651..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XAssetService.java
+++ /dev/null
@@ -1,400 +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.io.IOException;
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import com.xasecure.common.JSONUtil;
-import com.xasecure.common.MessageEnums;
-import com.xasecure.common.PasswordUtils;
-import com.xasecure.common.PropertiesUtil;
-import com.xasecure.common.SearchField;
-import com.xasecure.common.SearchField.DATA_TYPE;
-import com.xasecure.common.SearchField.SEARCH_TYPE;
-import com.xasecure.common.StringUtil;
-import com.xasecure.entity.*;
-
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.type.TypeReference;
-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.util.XAEnumUtil;
-import com.xasecure.view.*;
-
-@Service
-@Scope("singleton")
-public class XAssetService extends XAssetServiceBase<XXAsset, VXAsset> {
-
-       @Autowired
-       JSONUtil jsonUtil;
-
-       @Autowired
-       XADaoManager appDaoMgr;
-       
-       @Autowired
-       StringUtil stringUtil;
-       
-       static HashMap<String, VTrxLogAttr> trxLogAttrs = new HashMap<String, 
VTrxLogAttr>();
-       static {
-               trxLogAttrs.put("name", new VTrxLogAttr("name", "Repository 
Name", false));
-               trxLogAttrs.put("description", new VTrxLogAttr("description", 
"Repository Description", false));
-               trxLogAttrs.put("activeStatus", new VTrxLogAttr("activeStatus", 
"Repository Status", true));
-               trxLogAttrs.put("config", new VTrxLogAttr("config", "Connection 
Configurations", false));
-       }
-
-       private String hiddenPasswordString;
-       
-       @Autowired
-       XAEnumUtil xaEnumUtil;
-       
-       public XAssetService(){
-               super();
-               hiddenPasswordString = 
PropertiesUtil.getProperty("xa.password.hidden", "*****");
-               searchFields.add(new SearchField("status", "obj.activeStatus",
-                               SearchField.DATA_TYPE.INT_LIST, 
SearchField.SEARCH_TYPE.FULL));
-               searchFields.add(new SearchField("name", "obj.name", 
DATA_TYPE.STRING,
-                               SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("type", "obj.assetType",
-                               DATA_TYPE.INTEGER, SEARCH_TYPE.FULL));
-       }
-
-       @Override
-       protected void validateForCreate(VXAsset vObj) {
-               XXAsset xxAsset = appDaoMgr.getXXAsset()
-                               .findByAssetName(vObj.getName());
-               if (xxAsset != null) {
-                       String errorMessage = "Repository Name already exists";
-                       throw restErrorUtil.createRESTException(errorMessage,
-                                       MessageEnums.INVALID_INPUT_DATA, null, 
null,
-                                       vObj.toString());
-               }
-               if(vObj.getName()==null || vObj.getName().trim().length()==0){
-                       String errorMessage = "Repository Name can't be empty";
-                       throw restErrorUtil.createRESTException(errorMessage,
-                                       MessageEnums.INVALID_INPUT_DATA, null, 
null,
-                                       vObj.toString());
-               }
-               
-               validateConfig(vObj);
-       }
-
-       @Override
-       protected void validateForUpdate(VXAsset vObj, XXAsset mObj) {
-               if (!vObj.getName().equalsIgnoreCase(mObj.getName())) {
-                       validateForCreate(vObj);
-               }else{          
-               validateConfig(vObj);
-               }
-       }
-
-       @Override
-       protected XXAsset mapViewToEntityBean(VXAsset vObj, XXAsset mObj,
-                       int OPERATION_CONTEXT) {
-               String oldConfig = (mObj != null) ? mObj.getConfig() : null;
-               super.mapViewToEntityBean(vObj, mObj, OPERATION_CONTEXT);
-               String config = vObj.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);
-                               }
-                       }
-               }
-               mObj.setConfig(config);
-               return mObj;
-       }
-
-       @Override
-       protected VXAsset mapEntityToViewBean(VXAsset vObj, XXAsset mObj) {
-               vObj = super.mapEntityToViewBean(vObj, mObj);
-               String config = vObj.getConfig();
-               if (config != null && !config.isEmpty()) {
-                       Map<String, String> configMap = 
jsonUtil.jsonToMap(config);
-                       Entry<String, String> passwordEntry = 
getPasswordEntry(configMap);
-                       if (passwordEntry != null) {
-                               configMap.put(passwordEntry.getKey(), 
hiddenPasswordString);
-                       }
-                       config = jsonUtil.readMapToString(configMap);
-               }
-               vObj.setConfig(config);
-               return vObj;
-       }
-       
-       private Entry<String, String> getPasswordEntry(Map<String, String> 
configMap) {
-               Entry<String, String> entry = null;
-               
-               for(Entry<String, String> e : configMap.entrySet()) {
-                       if(e.getKey().toLowerCase().contains("password")){
-                               entry = e;
-                               break;
-                       }
-               }
-               
-               return entry;
-       }
-       
-       private Entry<String, String> getIsEncryptedEntry(Map<String, String> 
configMap){
-               Entry<String, String> entry = null;             
-               for(Entry<String, String> e : configMap.entrySet()) {
-                       if(e.getKey().toLowerCase().contains("isencrypted")){
-                               entry = e;
-                               break;
-                       }
-               }
-               return entry;
-       }
-       
-       public void validateConfig(VXAsset vObj) {
-               HashMap<String, Object> configrationMap = null;
-               if (vObj.getAssetType() == AppConstants.ASSET_HDFS) {
-                       ObjectMapper objectMapper = new ObjectMapper();
-                       TypeReference<HashMap<String, Object>> typeRef = new 
TypeReference
-                                       <HashMap<String, Object>>() {};
-                       try {
-                               configrationMap = 
objectMapper.readValue(vObj.getConfig(),
-                                               typeRef);
-                       } catch (Exception e) {
-                               logger.error("Error in config json", e);
-                       }
-
-                       if (configrationMap != null) {
-                               String fs_default_name = 
configrationMap.get("fs.default.name")
-                                               .toString();
-
-                               if (fs_default_name.isEmpty()) {
-                                       throw restErrorUtil.createRESTException(
-                                                       
"serverMsg.fsDefaultNameEmptyError",
-                                                       
MessageEnums.INVALID_INPUT_DATA, null, "fs.default.name",
-                                                       vObj.toString());
-                               }
-                               /*String 
expression="^+(hdfs://)\\s*(.*?):[0-9]{1,5}";
-//                             String expression = 
"^+(hdfs://)[a-z,A-Z,0-9,.]*+:[0-9]{1,5}";
-                               Pattern pattern = Pattern.compile(expression,
-                                               Pattern.CASE_INSENSITIVE);
-                               // String inputStr = "hdfs://192.168.1.16:2";
-                               Matcher matcher = 
pattern.matcher(fs_default_name);
-                               if (!matcher.matches()) {                       
                
-                                       throw restErrorUtil.createRESTException(
-                                                       
"serverMsg.fsDefaultNameValidationError",
-                                                       
MessageEnums.INVALID_INPUT_DATA, null, "fs.default.name",
-                                                       vObj.toString());
-                               }*/
-                       }
-               }
-       }
-
-       public List<XXTrxLog> getTransactionLog(VXAsset vResource, String 
action){
-               return getTransactionLog(vResource, null, action);
-       }
-
-       public List<XXTrxLog> getTransactionLog(VXAsset vObj, XXAsset mObj, 
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("name");
-                       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[] mFields = 
mObj.getClass().getDeclaredFields();
-                                       for(Field mField : mFields){
-                                               mField.setAccessible(true);
-                                               String mFieldName = 
mField.getName();
-                                               
if(fieldName.equalsIgnoreCase(mFieldName)){
-                                                       if(isEnum){
-                                                               String enumName 
= XXAsset.getEnumName(mFieldName);
-                                                               int enumValue = 
mField.get(mObj) == null ? 0 : Integer.parseInt(""+mField.get(mObj));
-                                                               oldValue = 
xaEnumUtil.getLabel(enumName, enumValue);
-                                                       } else {
-                                                               oldValue = 
mField.get(mObj)+"";
-                                                       }
-                                                       break;
-                                               }
-                                       }
-                                       
if(fieldName.equalsIgnoreCase("config")){
-                                               Map<String, String> vConfig = 
jsonUtil.jsonToMap(value);
-                                               Map<String, String> xConfig = 
jsonUtil.jsonToMap(oldValue);
-                                               
-                                               Map<String, String> newConfig = 
new HashMap<String, String>();
-                                               Map<String, String> oldConfig = 
new HashMap<String, String>();
-                                               
-                                               for (Entry<String, String> 
entry: vConfig.entrySet()) {
-                                                       String key = 
entry.getKey();
-                                                   if 
(!xConfig.containsKey(key)) {
-                                                       newConfig.put(key, 
entry.getValue());
-                                                   } else 
if(!entry.getValue().equalsIgnoreCase(xConfig.get(key))){
-                                                       
if(key.equalsIgnoreCase("password") && entry
-                                                                       
.getValue().equalsIgnoreCase(hiddenPasswordString)){
-                                                               continue;
-                                                       }
-                                                       newConfig.put(key, 
entry.getValue());
-                                                       oldConfig.put(key, 
xConfig.get(key));
-                                                   }
-                                               }
-                                               
-                                               oldValue = 
jsonUtil.readMapToString(oldConfig);
-                                               value = 
jsonUtil.readMapToString(newConfig);
-                                       }
-                                       if(value.equalsIgnoreCase(oldValue)){
-                                               continue;
-                                       }
-                                       xTrxLog.setPreviousValue(oldValue);
-                                       xTrxLog.setNewValue(value);
-                               }
-                               
-                               xTrxLog.setAction(action);
-                               
xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_XA_ASSET);
-                               xTrxLog.setObjectId(vObj.getId());
-                               xTrxLog.setObjectName(objectName);
-                               trxLogList.add(xTrxLog);
-                               
-                       }
-               } catch (IllegalArgumentException e) {
-                       e.printStackTrace();
-               } catch (IllegalAccessException e) {
-                       e.printStackTrace();
-               } catch (NoSuchFieldException e) {
-                       e.printStackTrace();
-               } catch (SecurityException e) {
-                       e.printStackTrace();
-               }
-               
-               return trxLogList;
-       }
-       
-       public String getConfigWithEncryptedPassword(String config,boolean 
isForced){
-               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 (passwordEntry != null){
-                                       if(isEncryptedEntry==null || 
!isEncryptedEntry.getValue().equalsIgnoreCase("true")||isForced==true){
-                                               String 
password=passwordEntry.getValue();
-                                               String 
encryptPassword=PasswordUtils.encryptPassword(password);
-                                               String 
decryptPassword=PasswordUtils.decryptPassword(encryptPassword);
-                                               
if(decryptPassword.equalsIgnoreCase(password)){
-                                                       
configMap.put(passwordEntry.getKey(),
-                                                                       
encryptPassword);
-                                                       
configMap.put("isencrypted", "true");
-                                               }
-                                       }
-                               }
-                               config = jsonUtil.readMapToString(configMap);
-                       }                                                       
                        
-               } catch (IOException e) {
-                       String errorMessage = "Password encryption error";
-                       throw restErrorUtil.createRESTException(errorMessage,
-                                       MessageEnums.INVALID_INPUT_DATA, null, 
null,
-                                       e.getMessage());        
-               }
-               return config;
-       }
-       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())
-                                                       && 
isEncryptedEntry.getValue().equalsIgnoreCase(
-                                                                       
"true")) {
-                                               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;
-       }
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XAssetServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XAssetServiceBase.java 
b/security-admin/src/main/java/com/xasecure/service/XAssetServiceBase.java
deleted file mode 100644
index 71ec819..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XAssetServiceBase.java
+++ /dev/null
@@ -1,89 +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 XAssetServiceBase<T extends XXAsset, V extends VXAsset>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "XAsset";
-
-       public XAssetServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXAsset mapViewToEntityBean(VXAsset vObj, XXAsset mObj, int 
OPERATION_CONTEXT) {
-               mObj.setName( vObj.getName());
-               mObj.setDescription( vObj.getDescription());
-               mObj.setActiveStatus( vObj.getActiveStatus());
-               mObj.setAssetType( vObj.getAssetType());
-               mObj.setConfig( vObj.getConfig());
-               mObj.setSupportNative( vObj.isSupportNative());
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXAsset mapEntityToViewBean(VXAsset vObj, XXAsset mObj) {
-               vObj.setName( mObj.getName());
-               vObj.setDescription( mObj.getDescription());
-               vObj.setActiveStatus( mObj.getActiveStatus());
-               vObj.setAssetType( mObj.getAssetType());
-               vObj.setConfig( mObj.getConfig());
-               vObj.setSupportNative( mObj.isSupportNative());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXAssetList searchXAssets(SearchCriteria searchCriteria) {
-               VXAssetList returnList = new VXAssetList();
-               List<VXAsset> xAssetList = new ArrayList<VXAsset>();
-
-               @SuppressWarnings("unchecked")
-               List<XXAsset> resultList = 
(List<XXAsset>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXAsset gjXAsset : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXAsset vXAsset = populateViewBean((T)gjXAsset);
-                       xAssetList.add(vXAsset);
-               }
-
-               returnList.setVXAssets(xAssetList);
-               return returnList;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XAuditMapService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XAuditMapService.java 
b/security-admin/src/main/java/com/xasecure/service/XAuditMapService.java
deleted file mode 100644
index 137cf19..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XAuditMapService.java
+++ /dev/null
@@ -1,188 +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.SearchField;
-
-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 XAuditMapService extends
-               XAuditMapServiceBase<XXAuditMap, VXAuditMap> {
-
-       @Autowired
-       XAEnumUtil xaEnumUtil;
-
-       @Autowired
-       XADaoManager xADaoManager;
-
-       static HashMap<String, VTrxLogAttr> trxLogAttrs = new HashMap<String, 
VTrxLogAttr>();
-       static {
-//             trxLogAttrs.put("groupId", new VTrxLogAttr("groupId", "Group 
Audit", false));
-//             trxLogAttrs.put("userId", new VTrxLogAttr("userId", "User 
Audit", false));
-               trxLogAttrs.put("auditType", new VTrxLogAttr("auditType", 
"Audit Type", true));
-       }
-
-       public XAuditMapService() {
-               searchFields.add(new SearchField("resourceId", "obj.resourceId",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-       }
-
-       @Override
-       protected void validateForCreate(VXAuditMap vObj) {
-               // TODO Auto-generated method stub
-
-       }
-
-       @Override
-       protected void validateForUpdate(VXAuditMap vObj, XXAuditMap mObj) {
-               // TODO Auto-generated method stub
-
-       }
-
-       public List<XXTrxLog> getTransactionLog(VXAuditMap vXAuditMap, String 
action){
-               return getTransactionLog(vXAuditMap, null, action);
-       }
-
-       public List<XXTrxLog> getTransactionLog(VXAuditMap vObj, VXAuditMap 
mObj, String action){
-               if(vObj == null && (action == null || 
!action.equalsIgnoreCase("update"))){
-                       return null;
-               }
-               
-               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;
-                               }
-                               
-                               VTrxLogAttr vTrxLogAttr = 
trxLogAttrs.get(fieldName);
-                               
-                               XXTrxLog xTrxLog = new XXTrxLog();
-                               
xTrxLog.setAttributeName(vTrxLogAttr.getAttribUserFriendlyName());
-                       
-                               String value = null;
-                               boolean isEnum = vTrxLogAttr.isEnum();
-                               if(isEnum){
-                                       String enumName = 
XXAuditMap.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(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);
-                               }
-                               
-                               xTrxLog.setAction(action);
-                               
xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_XA_AUDIT_MAP);
-                               xTrxLog.setObjectId(vObj.getId());
-                               
xTrxLog.setParentObjectClassType(AppConstants.CLASS_TYPE_XA_RESOURCE);
-                               xTrxLog.setParentObjectId(vObj.getResourceId());
-//                             xTrxLog.setParentObjectName(vObj.get);
-//                             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 XXAuditMap mapViewToEntityBean(VXAuditMap vObj, XXAuditMap 
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 VXAuditMap mapEntityToViewBean(VXAuditMap vObj, XXAuditMap 
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/XAuditMapServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XAuditMapServiceBase.java 
b/security-admin/src/main/java/com/xasecure/service/XAuditMapServiceBase.java
deleted file mode 100644
index fca1ca5..0000000
--- 
a/security-admin/src/main/java/com/xasecure/service/XAuditMapServiceBase.java
+++ /dev/null
@@ -1,85 +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 XAuditMapServiceBase<T extends XXAuditMap, V extends 
VXAuditMap>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "XAuditMap";
-
-       public XAuditMapServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXAuditMap mapViewToEntityBean(VXAuditMap vObj, XXAuditMap 
mObj, int OPERATION_CONTEXT) {
-               mObj.setResourceId( vObj.getResourceId());
-               mObj.setGroupId( vObj.getGroupId());
-               mObj.setUserId( vObj.getUserId());
-               mObj.setAuditType( vObj.getAuditType());
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXAuditMap mapEntityToViewBean(VXAuditMap vObj, XXAuditMap 
mObj) {
-               vObj.setResourceId( mObj.getResourceId());
-               vObj.setGroupId( mObj.getGroupId());
-               vObj.setUserId( mObj.getUserId());
-               vObj.setAuditType( mObj.getAuditType());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXAuditMapList searchXAuditMaps(SearchCriteria searchCriteria) {
-               VXAuditMapList returnList = new VXAuditMapList();
-               List<VXAuditMap> xAuditMapList = new ArrayList<VXAuditMap>();
-
-               @SuppressWarnings("unchecked")
-               List<XXAuditMap> resultList = 
(List<XXAuditMap>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXAuditMap gjXAuditMap : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXAuditMap vXAuditMap = 
populateViewBean((T)gjXAuditMap);
-                       xAuditMapList.add(vXAuditMap);
-               }
-
-               returnList.setVXAuditMaps(xAuditMapList);
-               return returnList;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XCredentialStoreService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XCredentialStoreService.java
 
b/security-admin/src/main/java/com/xasecure/service/XCredentialStoreService.java
deleted file mode 100644
index da7db11..0000000
--- 
a/security-admin/src/main/java/com/xasecure/service/XCredentialStoreService.java
+++ /dev/null
@@ -1,49 +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.entity.*;
-import com.xasecure.view.*;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.xasecure.biz.*;
-import com.xasecure.entity.*;
-import com.xasecure.service.*;
-import com.xasecure.view.*;
-
-@Service
-@Scope("singleton")
-public class XCredentialStoreService extends 
XCredentialStoreServiceBase<XXCredentialStore, VXCredentialStore> {
-
-       @Override
-       protected void validateForCreate(VXCredentialStore vObj) {
-               // TODO Auto-generated method stub
-
-       }
-
-       @Override
-       protected void validateForUpdate(VXCredentialStore vObj, 
XXCredentialStore 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/XCredentialStoreServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XCredentialStoreServiceBase.java
 
b/security-admin/src/main/java/com/xasecure/service/XCredentialStoreServiceBase.java
deleted file mode 100644
index cb605c0..0000000
--- 
a/security-admin/src/main/java/com/xasecure/service/XCredentialStoreServiceBase.java
+++ /dev/null
@@ -1,81 +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 XCredentialStoreServiceBase<T extends XXCredentialStore, 
V extends VXCredentialStore>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "XCredentialStore";
-
-       public XCredentialStoreServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXCredentialStore mapViewToEntityBean(VXCredentialStore vObj, 
XXCredentialStore mObj, int OPERATION_CONTEXT) {
-               mObj.setName( vObj.getName());
-               mObj.setDescription( vObj.getDescription());
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXCredentialStore mapEntityToViewBean(VXCredentialStore vObj, 
XXCredentialStore mObj) {
-               vObj.setName( mObj.getName());
-               vObj.setDescription( mObj.getDescription());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXCredentialStoreList searchXCredentialStores(SearchCriteria 
searchCriteria) {
-               VXCredentialStoreList returnList = new VXCredentialStoreList();
-               List<VXCredentialStore> xCredentialStoreList = new 
ArrayList<VXCredentialStore>();
-
-               @SuppressWarnings("unchecked")
-               List<XXCredentialStore> resultList = 
(List<XXCredentialStore>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXCredentialStore gjXCredentialStore : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXCredentialStore vXCredentialStore = 
populateViewBean((T)gjXCredentialStore);
-                       xCredentialStoreList.add(vXCredentialStore);
-               }
-
-               returnList.setVXCredentialStores(xCredentialStoreList);
-               return returnList;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XGroupGroupService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XGroupGroupService.java 
b/security-admin/src/main/java/com/xasecure/service/XGroupGroupService.java
deleted file mode 100644
index 420880a..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XGroupGroupService.java
+++ /dev/null
@@ -1,49 +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.entity.*;
-import com.xasecure.view.*;
-
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.xasecure.biz.*;
-import com.xasecure.entity.*;
-import com.xasecure.service.*;
-import com.xasecure.view.*;
-
-@Service
-@Scope("singleton")
-public class XGroupGroupService extends XGroupGroupServiceBase<XXGroupGroup, 
VXGroupGroup> {
-
-       @Override
-       protected void validateForCreate(VXGroupGroup vObj) {
-               // TODO Auto-generated method stub
-
-       }
-
-       @Override
-       protected void validateForUpdate(VXGroupGroup vObj, XXGroupGroup 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/XGroupGroupServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XGroupGroupServiceBase.java 
b/security-admin/src/main/java/com/xasecure/service/XGroupGroupServiceBase.java
deleted file mode 100644
index fd8c9ea..0000000
--- 
a/security-admin/src/main/java/com/xasecure/service/XGroupGroupServiceBase.java
+++ /dev/null
@@ -1,83 +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 XGroupGroupServiceBase<T extends XXGroupGroup, V extends 
VXGroupGroup>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "XGroupGroup";
-
-       public XGroupGroupServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXGroupGroup mapViewToEntityBean(VXGroupGroup vObj, 
XXGroupGroup mObj, int OPERATION_CONTEXT) {
-               mObj.setName( vObj.getName());
-               mObj.setParentGroupId( vObj.getParentGroupId());
-               mObj.setGroupId( vObj.getGroupId());
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXGroupGroup mapEntityToViewBean(VXGroupGroup vObj, 
XXGroupGroup mObj) {
-               vObj.setName( mObj.getName());
-               vObj.setParentGroupId( mObj.getParentGroupId());
-               vObj.setGroupId( mObj.getGroupId());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXGroupGroupList searchXGroupGroups(SearchCriteria 
searchCriteria) {
-               VXGroupGroupList returnList = new VXGroupGroupList();
-               List<VXGroupGroup> xGroupGroupList = new 
ArrayList<VXGroupGroup>();
-
-               @SuppressWarnings("unchecked")
-               List<XXGroupGroup> resultList = 
(List<XXGroupGroup>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXGroupGroup gjXGroupGroup : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXGroupGroup vXGroupGroup = 
populateViewBean((T)gjXGroupGroup);
-                       xGroupGroupList.add(vXGroupGroup);
-               }
-
-               returnList.setVXGroupGroups(xGroupGroupList);
-               return returnList;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XGroupService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XGroupService.java 
b/security-admin/src/main/java/com/xasecure/service/XGroupService.java
deleted file mode 100644
index 73725dc..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XGroupService.java
+++ /dev/null
@@ -1,252 +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.XACommonEnums;
-import com.xasecure.common.MessageEnums;
-import com.xasecure.common.PropertiesUtil;
-import com.xasecure.common.SearchField;
-import com.xasecure.common.SortField;
-import com.xasecure.common.SortField.SORT_ORDER;
-import com.xasecure.common.StringUtil;
-import com.xasecure.entity.*;
-import com.xasecure.view.*;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Service;
-
-import com.xasecure.biz.*;
-import com.xasecure.common.AppConstants;
-import com.xasecure.common.view.VTrxLogAttr;
-import com.xasecure.db.XADaoManager;
-import com.xasecure.entity.*;
-import com.xasecure.service.*;
-import com.xasecure.util.XAEnumUtil;
-import com.xasecure.view.*;
-
-@Service
-@Scope("singleton")
-public class XGroupService extends XGroupServiceBase<XXGroup, VXGroup> {
-
-       public static Long createdByUserId = 1L;
-       
-       @Autowired
-       XADaoManager xADaoManager;
-       
-       @Autowired
-       XAEnumUtil xaEnumUtil;
-       
-       @Autowired
-       StringUtil stringUtil;
-       
-       static HashMap<String, VTrxLogAttr> trxLogAttrs = new HashMap<String, 
VTrxLogAttr>();
-       static {
-               trxLogAttrs.put("name", new VTrxLogAttr("name", "Group Name", 
false));
-               trxLogAttrs.put("description", new VTrxLogAttr("description", 
"Group Description", false));
-       }
-       
-       public XGroupService() {
-               searchFields.add(new SearchField("name", "obj.name",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.PARTIAL));
-               searchFields.add(new SearchField("groupSource", 
"obj.groupSource",
-                               SearchField.DATA_TYPE.STRING, 
SearchField.SEARCH_TYPE.FULL));
-                createdByUserId = new Long(PropertiesUtil.getIntProperty(
-                               "xa.xuser.createdByUserId", 1));                
 
-               
-                sortFields.add(new SortField("name", 
"obj.name",true,SortField.SORT_ORDER.ASC));
-       }
-
-       @Override
-       protected void validateForCreate(VXGroup vObj) {
-               XXGroup xxGroup = xADaoManager.getXXGroup().findByGroupName(
-                               vObj.getName());
-               if (xxGroup != null) {
-                       throw restErrorUtil.createRESTException("XGroup already 
exists",
-                                       MessageEnums.ERROR_DUPLICATE_OBJECT);
-               }
-
-       }
-
-       @Override
-       protected void validateForUpdate(VXGroup vObj, XXGroup mObj) {
-               if (!vObj.getName().equalsIgnoreCase(mObj.getName())) {
-                       validateForCreate(vObj);
-               }
-       }
-
-       public VXGroup getGroupByGroupName(String groupName) {
-               XXGroup xxGroup = 
xADaoManager.getXXGroup().findByGroupName(groupName);
-
-               if (xxGroup == null) {
-                       throw restErrorUtil.createRESTException(
-                                       groupName + " is Not Found", 
MessageEnums.DATA_NOT_FOUND);
-               }
-               return super.populateViewBean(xxGroup);
-       }
-       
-       public VXGroup createXGroupWithOutLogin(VXGroup vxGroup) {
-               XXGroup xxGroup = xADaoManager.getXXGroup().findByGroupName(
-                               vxGroup.getName());
-               boolean groupExists = true;
-
-               if (xxGroup == null) {
-                       xxGroup = new XXGroup();
-                       groupExists = false;
-               }
-
-               xxGroup = mapViewToEntityBean(vxGroup, xxGroup, 0);
-               XXPortalUser xXPortalUser = 
xADaoManager.getXXPortalUser().getById(createdByUserId);
-               if (xXPortalUser != null) {
-                       xxGroup.setAddedByUserId(createdByUserId);
-                       xxGroup.setUpdatedByUserId(createdByUserId);
-               }
-               if (groupExists) {
-                       xxGroup = getDao().update(xxGroup);
-               } else {
-                       xxGroup = getDao().create(xxGroup);
-               }
-               vxGroup = postCreate(xxGroup);
-               return vxGroup;
-       }
-
-       public VXGroup readResourceWithOutLogin(Long id) {
-               XXGroup resource = getDao().getById(id);
-               if (resource == null) {
-                       // Returns code 400 with DATA_NOT_FOUND as the error 
message
-                       throw 
restErrorUtil.createRESTException(getResourceName()
-                                       + " not found", 
MessageEnums.DATA_NOT_FOUND, id, null,
-                                       "preRead: " + id + " not found.");
-               }
-
-               VXGroup view = populateViewBean(resource);
-               if(view!=null){
-                       view.setGroupSource(resource.getGroupSource());
-               }
-               return view;
-       }
-
-       public List<XXTrxLog> getTransactionLog(VXGroup vResource, String 
action){
-               return getTransactionLog(vResource, null, action);
-       }
-
-       public List<XXTrxLog> getTransactionLog(VXGroup vObj, XXGroup mObj, 
String action){
-               if(vObj == null && (action == null || 
!action.equalsIgnoreCase("update"))){
-                       return null;
-               }
-               
-               List<XXTrxLog> trxLogList = new ArrayList<XXTrxLog>();
-               try {
-
-                       Field nameField = 
vObj.getClass().getDeclaredField("name");
-                       nameField.setAccessible(true);
-                       String objectName = ""+nameField.get(vObj);
-                       Field[] fields = vObj.getClass().getDeclaredFields();
-                       
-                       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 = 
XXGroup.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[] mFields = 
mObj.getClass().getDeclaredFields();
-                                       for(Field mField : mFields){
-                                               mField.setAccessible(true);
-                                               String mFieldName = 
mField.getName();
-                                               
if(fieldName.equalsIgnoreCase(mFieldName)){
-                                                       if(isEnum){
-                                                               String enumName 
= XXAsset.getEnumName(mFieldName);
-                                                               int enumValue = 
mField.get(mObj) == null ? 0 : Integer.parseInt(""+mField.get(mObj));
-                                                               oldValue = 
xaEnumUtil.getLabel(enumName, enumValue);
-                                                       } else {
-                                                               oldValue = 
mField.get(mObj)+"";
-                                                       }
-                                                       break;
-                                               }
-                                       }
-                                       if(value.equalsIgnoreCase(oldValue)){
-                                               continue;
-                                       }
-                                       xTrxLog.setPreviousValue(oldValue);
-                                       xTrxLog.setNewValue(value);
-                               }
-                               
-                               xTrxLog.setAction(action);
-                               
xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_XA_GROUP);
-                               xTrxLog.setObjectId(vObj.getId());
-                               xTrxLog.setObjectName(objectName);
-                               trxLogList.add(xTrxLog);
-                               
-                       }
-               } catch (IllegalArgumentException e) {
-                       e.printStackTrace();
-               } catch (IllegalAccessException e) {
-                       e.printStackTrace();
-               } catch (NoSuchFieldException e) {
-                       e.printStackTrace();
-               } catch (SecurityException e) {
-                       e.printStackTrace();
-               }
-               
-               return trxLogList;
-       }
-       
-       @Override
-       protected XXGroup mapViewToEntityBean(VXGroup vObj, XXGroup mObj, int 
OPERATION_CONTEXT) {
-               super.mapViewToEntityBean(vObj, mObj, OPERATION_CONTEXT);
-               return mObj;
-       }
-
-       @Override
-       protected VXGroup mapEntityToViewBean(VXGroup vObj, XXGroup mObj) {
-               super.mapEntityToViewBean(vObj, mObj);
-               return vObj;
-       }       
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XGroupServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XGroupServiceBase.java 
b/security-admin/src/main/java/com/xasecure/service/XGroupServiceBase.java
deleted file mode 100644
index fcd21d6..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XGroupServiceBase.java
+++ /dev/null
@@ -1,85 +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 XGroupServiceBase<T extends XXGroup, V extends VXGroup>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "XGroup";
-
-       public XGroupServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXGroup mapViewToEntityBean(VXGroup vObj, XXGroup mObj, int 
OPERATION_CONTEXT) {
-               mObj.setName( vObj.getName());
-               mObj.setDescription( vObj.getDescription());
-               mObj.setGroupType( vObj.getGroupType());
-               mObj.setCredStoreId( vObj.getCredStoreId());
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXGroup mapEntityToViewBean(VXGroup vObj, XXGroup mObj) {
-               vObj.setName( mObj.getName());
-               vObj.setDescription( mObj.getDescription());
-               vObj.setGroupType( mObj.getGroupType());
-               vObj.setCredStoreId( mObj.getCredStoreId());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXGroupList searchXGroups(SearchCriteria searchCriteria) {
-               VXGroupList returnList = new VXGroupList();
-               List<VXGroup> xGroupList = new ArrayList<VXGroup>();
-
-               @SuppressWarnings("unchecked")
-               List<XXGroup> resultList = 
(List<XXGroup>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXGroup gjXGroup : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXGroup vXGroup = populateViewBean((T)gjXGroup);
-                       xGroupList.add(vXGroup);
-               }
-
-               returnList.setVXGroups(xGroupList);
-               return returnList;
-       }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XGroupUserService.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XGroupUserService.java 
b/security-admin/src/main/java/com/xasecure/service/XGroupUserService.java
deleted file mode 100644
index 31e9f81..0000000
--- a/security-admin/src/main/java/com/xasecure/service/XGroupUserService.java
+++ /dev/null
@@ -1,194 +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.XACommonEnums;
-import com.xasecure.common.MessageEnums;
-import com.xasecure.common.PropertiesUtil;
-import com.xasecure.common.SearchField;
-import com.xasecure.entity.XXPortalUser;
-import com.xasecure.entity.XXGroup;
-
-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 XGroupUserService extends
-               XGroupUserServiceBase<XXGroupUser, VXGroupUser> {
-
-       public static Long createdByUserId = 1L;
-       
-       @Autowired
-       XADaoManager xADaoManager;
-
-       @Autowired
-       XAEnumUtil xaEnumUtil;
-       
-       static HashMap<String, VTrxLogAttr> trxLogAttrs = new HashMap<String, 
VTrxLogAttr>();
-       static {
-               trxLogAttrs.put("parentGroupId", new 
VTrxLogAttr("parentGroupId", "Group Name", false));
-       }
-
-
-       public XGroupUserService() {
-               searchFields.add(new SearchField("xUserId", "obj.userId",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-               searchFields.add(new SearchField("xGroupId", 
"obj.parentGroupId",
-                               SearchField.DATA_TYPE.INTEGER, 
SearchField.SEARCH_TYPE.FULL));
-               createdByUserId = new Long(PropertiesUtil.getIntProperty(
-                               "xa.xuser.createdByUserId", 1));
-               
-       }
-
-       @Override
-       protected void validateForCreate(VXGroupUser vObj) {
-               // TODO Auto-generated method stub
-
-       }
-
-       @Override
-       protected void validateForUpdate(VXGroupUser vObj, XXGroupUser mObj) {
-               // TODO Auto-generated method stub
-
-       }
-       
-       public VXGroupUser createXGroupUserWithOutLogin(VXGroupUser 
vxGroupUser) {
-               XXGroupUser xxGroupUser = new XXGroupUser();
-               XXGroup xGroup = 
daoManager.getXXGroup().findByGroupName(vxGroupUser.getName());
-               vxGroupUser.setParentGroupId(xGroup.getId());
-               xxGroupUser = mapViewToEntityBean(vxGroupUser, xxGroupUser, 0);
-               XXPortalUser xXPortalUser = 
xADaoManager.getXXPortalUser().getById(createdByUserId);
-               if (xXPortalUser != null) {
-                       xxGroupUser.setAddedByUserId(createdByUserId);
-                       xxGroupUser.setUpdatedByUserId(createdByUserId);
-               }
-               xxGroupUser = getDao().create(xxGroupUser);
-               vxGroupUser = postCreate(xxGroupUser);
-               return vxGroupUser;
-       }
-
-       public VXGroupUser readResourceWithOutLogin(Long id) {
-               XXGroupUser resource = getDao().getById(id);
-               if (resource == null) {
-                       // Returns code 400 with DATA_NOT_FOUND as the error 
message
-                       throw 
restErrorUtil.createRESTException(getResourceName()
-                                       + " not found", 
MessageEnums.DATA_NOT_FOUND, id, null,
-                                       "preRead: " + id + " not found.");
-               }
-
-               VXGroupUser view = populateViewBean(resource);
-               return view;
-       }
-       
-       public List<XXTrxLog> getTransactionLog(VXGroupUser vXGroupUser, String 
action){
-               return getTransactionLog(vXGroupUser, null, action);
-       }
-
-       public List<XXTrxLog> getTransactionLog(VXGroupUser vObj, XXGroupUser 
mObj, String action){
-//             if(vObj == null && (action == null || 
!action.equalsIgnoreCase("update"))){
-//                     return null;
-//             }
-               
-               Long groupId = vObj.getParentGroupId();
-               XXGroup xGroup = xADaoManager.getXXGroup().getById(groupId);
-               String groupName = xGroup.getName();
-
-               Long userId = vObj.getUserId();
-               XXUser xUser = xADaoManager.getXXUser().getById(userId);
-               String 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;
-                               }
-                               
-                               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);
-                                       XXGroup xXGroup = 
xADaoManager.getXXGroup().getById(Long.parseLong(value));
-                                       value = xXGroup.getName();
-                               }
-                               
-                               if(action.equalsIgnoreCase("create")){
-                                       xTrxLog.setNewValue(value);
-                               } else if(action.equalsIgnoreCase("delete")){
-                                       xTrxLog.setPreviousValue(value);
-                               } else if(action.equalsIgnoreCase("update")){
-                                       // No Change.
-                                       xTrxLog.setNewValue(value);
-                                       xTrxLog.setPreviousValue(value);
-                               }
-                               
-                               xTrxLog.setAction(action);
-                               
-                               
xTrxLog.setObjectClassType(AppConstants.CLASS_TYPE_XA_GROUP_USER);
-                               xTrxLog.setObjectId(vObj.getId());
-                               xTrxLog.setObjectName(userName);
-                               
-                               
xTrxLog.setParentObjectClassType(AppConstants.CLASS_TYPE_XA_GROUP);
-                               xTrxLog.setParentObjectId(groupId);
-                               xTrxLog.setParentObjectName(groupName);
-                               
-                               trxLogList.add(xTrxLog);
-                               
-                       }
-               } catch (IllegalArgumentException e) {
-                       e.printStackTrace();
-               } catch (IllegalAccessException e) {
-                       e.printStackTrace();
-               } catch (SecurityException e) {
-                       e.printStackTrace();
-               }
-               
-               return trxLogList;
-       }
-
-       
-}

http://git-wip-us.apache.org/repos/asf/incubator-ranger/blob/413fcb68/security-admin/src/main/java/com/xasecure/service/XGroupUserServiceBase.java
----------------------------------------------------------------------
diff --git 
a/security-admin/src/main/java/com/xasecure/service/XGroupUserServiceBase.java 
b/security-admin/src/main/java/com/xasecure/service/XGroupUserServiceBase.java
deleted file mode 100644
index 76ffa82..0000000
--- 
a/security-admin/src/main/java/com/xasecure/service/XGroupUserServiceBase.java
+++ /dev/null
@@ -1,83 +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 XGroupUserServiceBase<T extends XXGroupUser, V extends 
VXGroupUser>
-               extends AbstractBaseResourceService<T, V> {
-       public static final String NAME = "XGroupUser";
-
-       public XGroupUserServiceBase() {
-
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected XXGroupUser mapViewToEntityBean(VXGroupUser vObj, XXGroupUser 
mObj, int OPERATION_CONTEXT) {
-               mObj.setName( vObj.getName());
-               mObj.setParentGroupId( vObj.getParentGroupId());
-               mObj.setUserId( vObj.getUserId());
-               return mObj;
-       }
-
-       @SuppressWarnings("unchecked")
-       @Override
-       protected VXGroupUser mapEntityToViewBean(VXGroupUser vObj, XXGroupUser 
mObj) {
-               vObj.setName( mObj.getName());
-               vObj.setParentGroupId( mObj.getParentGroupId());
-               vObj.setUserId( mObj.getUserId());
-               return vObj;
-       }
-
-       /**
-        * @param searchCriteria
-        * @return
-        */
-       public VXGroupUserList searchXGroupUsers(SearchCriteria searchCriteria) 
{
-               VXGroupUserList returnList = new VXGroupUserList();
-               List<VXGroupUser> xGroupUserList = new ArrayList<VXGroupUser>();
-
-               @SuppressWarnings("unchecked")
-               List<XXGroupUser> resultList = 
(List<XXGroupUser>)searchResources(searchCriteria,
-                               searchFields, sortFields, returnList);
-
-               // Iterate over the result list and create the return list
-               for (XXGroupUser gjXGroupUser : resultList) {
-                       @SuppressWarnings("unchecked")
-                       VXGroupUser vXGroupUser = 
populateViewBean((T)gjXGroupUser);
-                       xGroupUserList.add(vXGroupUser);
-               }
-
-               returnList.setVXGroupUsers(xGroupUserList);
-               return returnList;
-       }
-
-}

Reply via email to