use of org.apache.ranger.view.VXAccessAudit in project ranger by apache.
the class SolrAccessAuditsService method populateViewBean.
/**
* @param doc
* @return
*/
private VXAccessAudit populateViewBean(SolrDocument doc) {
VXAccessAudit accessAudit = new VXAccessAudit();
Object value = null;
if (logger.isDebugEnabled()) {
logger.debug("doc=" + doc.toString());
}
value = doc.getFieldValue("id");
if (value != null) {
// TODO: Converting ID to hashcode for now
accessAudit.setId((long) value.hashCode());
}
value = doc.getFieldValue("cluster");
if (value != null) {
accessAudit.setClusterName(value.toString());
}
value = doc.getFieldValue("access");
if (value != null) {
accessAudit.setAccessType(value.toString());
}
value = doc.getFieldValue("enforcer");
if (value != null) {
accessAudit.setAclEnforcer(value.toString());
}
value = doc.getFieldValue("agent");
if (value != null) {
accessAudit.setAgentId(value.toString());
}
value = doc.getFieldValue("repo");
if (value != null) {
accessAudit.setRepoName(value.toString());
}
value = doc.getFieldValue("sess");
if (value != null) {
accessAudit.setSessionId(value.toString());
}
value = doc.getFieldValue("reqUser");
if (value != null) {
accessAudit.setRequestUser(value.toString());
}
value = doc.getFieldValue("reqData");
if (value != null) {
accessAudit.setRequestData(value.toString());
}
value = doc.getFieldValue("resource");
if (value != null) {
accessAudit.setResourcePath(value.toString());
}
value = doc.getFieldValue("cliIP");
if (value != null) {
accessAudit.setClientIP(value.toString());
}
value = doc.getFieldValue("logType");
// if (value != null) {
// TODO: Need to see what logType maps to in UI
// accessAudit.setAuditType(solrUtil.toInt(value));
// }
value = doc.getFieldValue("result");
if (value != null) {
accessAudit.setAccessResult(solrUtil.toInt(value));
}
value = doc.getFieldValue("policy");
if (value != null) {
accessAudit.setPolicyId(solrUtil.toLong(value));
}
value = doc.getFieldValue("repoType");
if (value != null) {
accessAudit.setRepoType(solrUtil.toInt(value));
XXServiceDef xServiceDef = daoManager.getXXServiceDef().getById((long) accessAudit.getRepoType());
if (xServiceDef != null) {
accessAudit.setServiceType(xServiceDef.getName());
}
}
value = doc.getFieldValue("resType");
if (value != null) {
accessAudit.setResourceType(value.toString());
}
value = doc.getFieldValue("reason");
if (value != null) {
accessAudit.setResultReason(value.toString());
}
value = doc.getFieldValue("action");
if (value != null) {
accessAudit.setAction(value.toString());
}
value = doc.getFieldValue("evtTime");
if (value != null) {
accessAudit.setEventTime(solrUtil.toDate(value));
}
value = doc.getFieldValue("seq_num");
if (value != null) {
accessAudit.setSequenceNumber(solrUtil.toLong(value));
}
value = doc.getFieldValue("event_count");
if (value != null) {
accessAudit.setEventCount(solrUtil.toLong(value));
}
value = doc.getFieldValue("event_dur_ms");
if (value != null) {
accessAudit.setEventDuration(solrUtil.toLong(value));
}
value = doc.getFieldValue("tags");
if (value != null) {
accessAudit.setTags(value.toString());
}
return accessAudit;
}
Aggregations