use of org.apache.ranger.common.DateUtil in project ranger by apache.
the class AssetMgr method getAccessLogs.
public VXAccessAuditList getAccessLogs(SearchCriteria searchCriteria) {
if (searchCriteria == null) {
searchCriteria = new SearchCriteria();
}
if (searchCriteria.getParamList() != null && !searchCriteria.getParamList().isEmpty()) {
int clientTimeOffsetInMinute = RestUtil.getClientTimeOffset();
Date temp = null;
DateUtil dateUtil = new DateUtil();
if (searchCriteria.getParamList().containsKey("startDate")) {
temp = (Date) searchCriteria.getParamList().get("startDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 0, 0, 0);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("startDate", temp);
}
if (searchCriteria.getParamList().containsKey("endDate")) {
temp = (Date) searchCriteria.getParamList().get("endDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 23, 59, 59);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("endDate", temp);
}
}
if (searchCriteria.getSortType() == null) {
searchCriteria.setSortType("desc");
} else if (!"asc".equalsIgnoreCase(searchCriteria.getSortType()) && !"desc".equalsIgnoreCase(searchCriteria.getSortType())) {
searchCriteria.setSortType("desc");
}
if (RangerBizUtil.AUDIT_STORE_SOLR.equalsIgnoreCase(xaBizUtil.getAuditDBType())) {
return solrAccessAuditsService.searchXAccessAudits(searchCriteria);
} else {
return xAccessAuditService.searchXAccessAudits(searchCriteria);
}
}
use of org.apache.ranger.common.DateUtil in project ranger by apache.
the class SessionMgr method searchAuthSessions.
/**
* @param searchCriteria
* @return
*/
public VXAuthSessionList searchAuthSessions(SearchCriteria searchCriteria) {
if (searchCriteria == null) {
searchCriteria = new SearchCriteria();
}
if (searchCriteria.getParamList() != null && !searchCriteria.getParamList().isEmpty()) {
int clientTimeOffsetInMinute = RestUtil.getClientTimeOffset();
java.util.Date temp = null;
DateUtil dateUtil = new DateUtil();
if (searchCriteria.getParamList().containsKey("startDate")) {
temp = (java.util.Date) searchCriteria.getParamList().get("startDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 0, 0, 0);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("startDate", temp);
}
if (searchCriteria.getParamList().containsKey("endDate")) {
temp = (java.util.Date) searchCriteria.getParamList().get("endDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 23, 59, 59);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("endDate", temp);
}
}
return authSessionService.search(searchCriteria);
}
use of org.apache.ranger.common.DateUtil in project ranger by apache.
the class AssetMgr method getUgsyncAudits.
public VXUgsyncAuditInfoList getUgsyncAudits(SearchCriteria searchCriteria) {
if (searchCriteria == null) {
searchCriteria = new SearchCriteria();
}
if (searchCriteria.getParamList() != null && !searchCriteria.getParamList().isEmpty()) {
int clientTimeOffsetInMinute = RestUtil.getClientTimeOffset();
Date temp = null;
DateUtil dateUtil = new DateUtil();
if (searchCriteria.getParamList().containsKey("startDate")) {
temp = (Date) searchCriteria.getParamList().get("startDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 0, 0, 0);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("startDate", temp);
}
if (searchCriteria.getParamList().containsKey("endDate")) {
temp = (Date) searchCriteria.getParamList().get("endDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 23, 59, 59);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("endDate", temp);
}
}
if (searchCriteria.getSortType() == null) {
searchCriteria.setSortType("desc");
} else if (!"asc".equalsIgnoreCase(searchCriteria.getSortType()) && !"desc".equalsIgnoreCase(searchCriteria.getSortType())) {
searchCriteria.setSortType("desc");
}
return xUgsyncAuditInfoService.searchXUgsyncAuditInfoList(searchCriteria);
}
use of org.apache.ranger.common.DateUtil in project ranger by apache.
the class AssetMgr method searchXPolicyExportAudits.
/*
* (non-Javadoc)
*
* @see
* org.apache.ranger.biz.AssetMgrBase#searchXPolicyExportAudits(org.apache.ranger.
* common.SearchCriteria)
*/
@Override
public VXPolicyExportAuditList searchXPolicyExportAudits(SearchCriteria searchCriteria) {
if (searchCriteria == null) {
searchCriteria = new SearchCriteria();
}
if (searchCriteria.getParamList() != null && !searchCriteria.getParamList().isEmpty()) {
int clientTimeOffsetInMinute = RestUtil.getClientTimeOffset();
Date temp = null;
DateUtil dateUtil = new DateUtil();
if (searchCriteria.getParamList().containsKey("startDate")) {
temp = (Date) searchCriteria.getParamList().get("startDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 0, 0, 0);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("startDate", temp);
}
if (searchCriteria.getParamList().containsKey("endDate")) {
temp = (Date) searchCriteria.getParamList().get("endDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 23, 59, 59);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("endDate", temp);
}
}
return xPolicyExportAuditService.searchXPolicyExportAudits(searchCriteria);
}
use of org.apache.ranger.common.DateUtil in project ranger by apache.
the class AssetMgr method getReportLogs.
public VXTrxLogList getReportLogs(SearchCriteria searchCriteria) {
if (xaBizUtil.isAdmin() || xaBizUtil.isKeyAdmin() || xaBizUtil.isAuditAdmin() || xaBizUtil.isAuditKeyAdmin()) {
if (searchCriteria == null) {
searchCriteria = new SearchCriteria();
}
if (searchCriteria.getParamList() != null && !searchCriteria.getParamList().isEmpty()) {
int clientTimeOffsetInMinute = RestUtil.getClientTimeOffset();
Date temp = null;
DateUtil dateUtil = new DateUtil();
if (searchCriteria.getParamList().containsKey("startDate")) {
temp = (Date) searchCriteria.getParamList().get("startDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 0, 0, 0);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("startDate", temp);
}
if (searchCriteria.getParamList().containsKey("endDate")) {
temp = (Date) searchCriteria.getParamList().get("endDate");
temp = dateUtil.getDateFromGivenDate(temp, 0, 23, 59, 59);
temp = dateUtil.addTimeOffset(temp, clientTimeOffsetInMinute);
searchCriteria.getParamList().put("endDate", temp);
}
if (searchCriteria.getParamList().containsKey("owner")) {
XXPortalUser xXPortalUser = rangerDaoManager.getXXPortalUser().findByLoginId((searchCriteria.getParamList().get("owner").toString()));
if (xXPortalUser != null) {
searchCriteria.getParamList().put("owner", xXPortalUser.getId());
} else {
searchCriteria.getParamList().put("owner", 0);
}
}
}
VXTrxLogList vXTrxLogList = xTrxLogService.searchXTrxLogs(searchCriteria);
Long count = xTrxLogService.searchXTrxLogsCount(searchCriteria);
vXTrxLogList.setTotalCount(count);
List<VXTrxLog> newList = validateXXTrxLogList(vXTrxLogList.getVXTrxLogs());
vXTrxLogList.setVXTrxLogs(newList);
return vXTrxLogList;
} else {
throw restErrorUtil.create403RESTException("Permission Denied !");
}
}
Aggregations