XAccessAuditService extends XAccessAuditServiceBase<XXAccessAudit, VXAccessAudit> { 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); final boolean hiveQueryVisibility = PropertiesUtil.getBooleanProperty("ranger.audit.hive.query.visibility", true); for (XXAccessAudit gjXAccessAudit : resultList) { VXAccessAudit vXAccessAudit = populateViewBean(gjXAccessAudit); if(vXAccessAudit != null) { if(StringUtils.equalsIgnoreCase(vXAccessAudit.getAclEnforcer(), RangerHadoopConstants.DEFAULT_XASECURE_MODULE_ACL_NAME)) { vXAccessAudit.setAclEnforcer(RangerHadoopConstants.DEFAULT_RANGER_MODULE_ACL_NAME); } if (!hiveQueryVisibility && "hive".equalsIgnoreCase(vXAccessAudit.getServiceType())) { vXAccessAudit.setRequestData(null); } else if("hive".equalsIgnoreCase(vXAccessAudit.getServiceType()) && ("grant".equalsIgnoreCase(vXAccessAudit.getAccessType()) || "revoke".equalsIgnoreCase(vXAccessAudit.getAccessType()))){ try { vXAccessAudit.setRequestData(java.net.URLDecoder.decode(vXAccessAudit.getRequestData(), "UTF-8")); } catch (UnsupportedEncodingException e) { logger.warn("Error while encoding request data"); } } xAccessAuditList.add(vXAccessAudit); } } returnList.setVXAccessAudits(xAccessAuditList); return returnList; } XAccessAuditService(); VXAccessAuditList searchXAccessAudits(SearchCriteria searchCriteria); VXAccessAudit populateViewBean(XXAccessAudit gjXAccessAudit); static final String NAME; }
@Test public void test1SearchXAccessAudits() { SearchCriteria testSearchCriteria = createsearchCriteria(); xAccessAuditService.searchXAccessAudits(testSearchCriteria); }