private RangerAccessRequestImpl createBaseRequest(
     String userName, Set<String> userGroups, String ip, Date eventTime) {
   RangerAccessRequestImpl rangerRequest = new RangerAccessRequestImpl();
   if (userName != null && !userName.isEmpty()) {
     rangerRequest.setUser(userName);
   }
   if (userGroups != null && userGroups.size() > 0) {
     rangerRequest.setUserGroups(userGroups);
   }
   if (ip != null && !ip.isEmpty()) {
     rangerRequest.setClientIPAddress(ip);
   }
   rangerRequest.setAccessTime(eventTime);
   return rangerRequest;
 }
  /**
   * @param userName
   * @param userGroups
   * @param ip
   * @param eventTime
   * @param context
   * @param collectionRequest
   * @param requestData
   * @return
   */
  private List<RangerAccessRequestImpl> createRequests(
      String userName,
      Set<String> userGroups,
      String ip,
      Date eventTime,
      AuthorizationContext context,
      CollectionRequest collectionRequest,
      String requestData) {

    List<RangerAccessRequestImpl> requests = new ArrayList<RangerAccessRequestImpl>();
    String accessType = mapToRangerAccessType(context);
    String action = accessType;

    if (collectionRequest.collectionName != null) {
      RangerAccessRequestImpl rangerRequest =
          createBaseRequest(userName, userGroups, ip, eventTime);
      RangerAccessResourceImpl rangerResource = new RangerAccessResourceImpl();
      rangerResource.setValue(KEY_COLLECTION, collectionRequest.collectionName);
      rangerRequest.setResource(rangerResource);
      rangerRequest.setAccessType(accessType);
      rangerRequest.setAction(action);

      requests.add(rangerRequest);
    } else {
      logger.fatal(
          "Can't create RangerRequest oject. userName="******", accessType="
              + accessType
              + ", ip="
              + ip
              + ", collectionRequest="
              + collectionRequest);
    }

    return requests;
  }