use of org.forgerock.openam.sm.datalayer.impl.uma.UmaAuditEntry in project OpenAM by OpenRock.
the class AuditHistory method queryCollection.
@Override
public Promise<QueryResponse, ResourceException> queryCollection(Context context, QueryRequest request, QueryResourceHandler handler) {
AMIdentity identity = getIdentity(context);
Set<UmaAuditEntry> history;
try {
if (request.getQueryFilter().toString().equals("true")) {
history = auditLogger.getEntireHistory(identity);
} else {
history = auditLogger.getHistory(identity, request);
}
} catch (ServerException e) {
return new InternalServerErrorException(e).asPromise();
}
List<ResourceResponse> results = new ArrayList<>();
for (UmaAuditEntry entry : history) {
JsonValue result = entry.asJson();
results.add(newResourceResponse(entry.getId(), String.valueOf(result.hashCode()), result));
}
QueryResponsePresentation.enableDeprecatedRemainingQueryResponse(request);
return QueryResponsePresentation.perform(handler, request, results);
}
use of org.forgerock.openam.sm.datalayer.impl.uma.UmaAuditEntry in project OpenAM by OpenRock.
the class UmaAuditLogger method log.
public void log(String resourceSetId, String resourceSetName, AMIdentity resourceOwner, UmaAuditType message, String requestingPartyId) {
final UmaAuditEntry umaAuditEntry;
try {
umaAuditEntry = new UmaAuditEntry(resourceSetId, resourceSetName, resourceOwner.getUniversalId(), message.toString(), requestingPartyId);
delegate.create(umaAuditEntry);
} catch (ServerException e) {
logger.warning("Error writing to UMA audit log", e);
}
}
Aggregations