Skip to content

Commit

Permalink
Modified delta details page of Audit log viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
ardanu committed Oct 13, 2016
1 parent 3a90526 commit caca48d
Show file tree
Hide file tree
Showing 3 changed files with 289 additions and 9 deletions.
Expand Up @@ -18,7 +18,82 @@
<body>
<wicket:extend>

todo
<div wicket:id="eventPanel">

<div wicket:id="eventDetailsPanel" class="col-md-6">
<div class="box box-success">
<table class="table table-striped">
<tr>
<td><wicket:message key="PageAuditLogDetails.eventTimestamp" /></td>
<td><span wicket:id="timestamp"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventIdentifier" /></td>
<td><span wicket:id="eventIdentifier"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventType" /></td>
<td><span wicket:id="eventType" /></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventStage" /></td>
<td><span wicket:id="eventStage" /></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventInitiatorRef" /></td>
<td><span wicket:id="initiatorRef" /></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventTargetRef" /></td>
<td><span wicket:id="targetRef" /></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventTargetOwnerRef" /></td>
<td><span wicket:id="targetOwnerRef"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventResult" /></td>
<td><span wicket:id="result" /></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.eventOutcome" /></td>
<td><span wicket:id="outcome" /></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.sessionIdentifier" /></td>
<td><span wicket:id="sessionIdentifier"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.taskIdentifier" /></td>
<td><span wicket:id="taskIdentifier"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.taskOID" /></td>
<td><span wicket:id="taskOID"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.hostIdentifier" /></td>
<td><span wicket:id="hostIdentifier"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.channel" /></td>
<td><span wicket:id="channel"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.parameter" /></td>
<td><span wicket:id="parameter"/></td>
</tr>
<tr>
<td><wicket:message key="PageAuditLogDetails.message" /></td>
<td><span wicket:id="message"/></td>
</tr>
</table>
</div>
</div>
<div wicket:id="deltaPanel" class="col-md-6">

</div>
</div>

</wicket:extend>
</body>
Expand Down
@@ -1,14 +1,41 @@
package com.evolveum.midpoint.web.page.admin.reports;

import java.util.ArrayList;
import java.util.List;

import org.apache.wicket.RestartResponseException;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.AbstractPropertyModel;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;

import com.evolveum.midpoint.gui.api.model.LoadableModel;
import com.evolveum.midpoint.gui.api.page.PageBase;
import com.evolveum.midpoint.gui.api.util.WebModelServiceUtils;
import com.evolveum.midpoint.model.api.visualizer.Scene;
import com.evolveum.midpoint.prism.delta.ObjectDelta;
import com.evolveum.midpoint.schema.DeltaConvertor;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.security.api.AuthorizationConstants;
import com.evolveum.midpoint.util.exception.SchemaException;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.application.AuthorizationAction;
import com.evolveum.midpoint.web.application.PageDescriptor;
import com.evolveum.midpoint.web.component.input.TextPanel;
import com.evolveum.midpoint.web.component.prism.show.SceneDto;
import com.evolveum.midpoint.web.component.prism.show.ScenePanel;
import com.evolveum.midpoint.web.component.prism.show.WrapperScene;
import com.evolveum.midpoint.web.page.admin.configuration.PageAdminConfiguration;
import com.evolveum.midpoint.xml.ns._public.common.audit_3.AuditEventRecordType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectDeltaOperationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;
import com.evolveum.prism.xml.ns._public.types_3.ObjectDeltaType;


@PageDescriptor(url = "/admin/auditLogDetails", action = {
Expand All @@ -19,26 +46,186 @@
label = "PageAuditLogViewer.auth.auditLogViewer.label",
description = "PageAuditLogViewer.auth.auditLogViewer.description")})
public class PageAuditLogDetails extends PageBase{

private static final Trace LOGGER = TraceManager.getTrace(PageNewReport.class);

private static final long serialVersionUID = 1L;

private static final String ID_EVENT_PANEL = "eventPanel";
private static final String ID_DELTA_PANEL = "deltaPanel";
private static final String ID_EVENT_DETAILS_PANEL = "eventDetailsPanel";
private static final String ID_PARAMETERS_TIMESTAMP = "timestamp";
private static final String ID_PARAMETERS_EVENT_IDENTIFIER = "eventIdentifier";
private static final String ID_PARAMETERS_SESSION_IDENTIFIER = "sessionIdentifier";
private static final String ID_PARAMETERS_TASK_IDENTIFIER = "taskIdentifier";
private static final String ID_PARAMETERS_TASK_OID = "taskOID";
private static final String ID_PARAMETERS_HOST_IDENTIFIER = "hostIdentifier";
private static final String ID_PARAMETERS_EVENT_INITIATOR = "initiatorRef";
private static final String ID_PARAMETERS_EVENT_TARGET = "targetRef";
private static final String ID_PARAMETERS_EVENT_TARGET_OWNER = "targetOwnerRef";
private static final String ID_PARAMETERS_EVENT_TYPE = "eventType";
private static final String ID_PARAMETERS_EVENT_STAGE = "eventStage";
private static final String ID_PARAMETERS_CHANNEL = "channel";
private static final String ID_PARAMETERS_EVENT_OUTCOME = "outcome";
private static final String ID_PARAMETERS_EVENT_RESULT = "result";
private static final String ID_PARAMETERS_PARAMETER = "parameter";
private static final String ID_PARAMETERS_MESSAGE = "message";

private static final String ID_PARAMETERS_DELTA = "delta";
private static final String ID_PARAMETERS_EXECUTION_RESULT ="executionResult";
private static final String ID_PARAMETERS_OBJECT_NAME ="objectName";
private static final String ID_PARAMETERS_RESOURCE_OID ="resourceOid";
private static final String ID_PARAMETERS_RESOURCE_NAME ="resourceName";
private static final String ID_PARAMETERS_DELTA_KEY ="deltaKey";
private static final String ID_PARAMETERS_DELTA_PARAMETERS ="deltaParams";
private List <ObjectDeltaOperationType> deltas = null;








private IModel<AuditEventRecordType> recordModel;

// private IModel<SceneDto> deltaModel;

public PageAuditLogDetails(final AuditEventRecordType recordType) {

recordModel = new LoadableModel<AuditEventRecordType>(false) {

@Override
protected AuditEventRecordType load() {
return recordType;
}
};




initLayout();
}

private void initLayout(){
//TODO

initEventPanel();
initDeltasPanel();
}

WebMarkupContainer eventPanel = new WebMarkupContainer(ID_EVENT_PANEL);


private void initEventPanel(){

eventPanel.setOutputMarkupId(true);
add(eventPanel);
WebMarkupContainer eventDetailsPanel = new WebMarkupContainer(ID_EVENT_DETAILS_PANEL);
eventDetailsPanel.setOutputMarkupId(true);
eventPanel.add(eventDetailsPanel);

final Label identifier = new Label(ID_PARAMETERS_EVENT_IDENTIFIER , new PropertyModel(recordModel,ID_PARAMETERS_EVENT_IDENTIFIER));
identifier.setOutputMarkupId(true);
eventDetailsPanel.add(identifier);

final Label timestamp = new Label(ID_PARAMETERS_TIMESTAMP , new PropertyModel(recordModel,ID_PARAMETERS_TIMESTAMP));
timestamp.setOutputMarkupId(true);
eventDetailsPanel.add(timestamp);

final Label sessionIdentifier = new Label(ID_PARAMETERS_SESSION_IDENTIFIER , new PropertyModel(recordModel,ID_PARAMETERS_SESSION_IDENTIFIER));
sessionIdentifier.setOutputMarkupId(true);
eventDetailsPanel.add(sessionIdentifier);

final Label taskIdentifier = new Label(ID_PARAMETERS_TASK_IDENTIFIER , new PropertyModel(recordModel,ID_PARAMETERS_TASK_IDENTIFIER));
taskIdentifier.setOutputMarkupId(true);
eventDetailsPanel.add(taskIdentifier);

final Label taskOID = new Label(ID_PARAMETERS_TASK_OID , new PropertyModel(recordModel,ID_PARAMETERS_TASK_OID));
taskOID.setOutputMarkupId(true);
eventDetailsPanel.add(taskOID);

final Label hostIdentifier = new Label(ID_PARAMETERS_HOST_IDENTIFIER , new PropertyModel(recordModel,ID_PARAMETERS_HOST_IDENTIFIER));
hostIdentifier.setOutputMarkupId(true);
eventDetailsPanel.add(hostIdentifier);

final Label initiatorRef = new Label(ID_PARAMETERS_EVENT_INITIATOR,
new Model(WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getInitiatorRef(), this,
createSimpleTask(ID_PARAMETERS_EVENT_INITIATOR),
new OperationResult(ID_PARAMETERS_EVENT_INITIATOR))));
initiatorRef.setOutputMarkupId(true);
eventDetailsPanel.add(initiatorRef);

final Label targetRef = new Label(ID_PARAMETERS_EVENT_TARGET,
new Model(WebModelServiceUtils.resolveReferenceName(recordModel.getObject().getTargetRef(), this,
createSimpleTask(ID_PARAMETERS_EVENT_TARGET),
new OperationResult(ID_PARAMETERS_EVENT_TARGET))));
targetRef.setOutputMarkupId(true);
eventDetailsPanel.add(targetRef);

final Label targetOwnerRef = new Label(ID_PARAMETERS_EVENT_TARGET_OWNER , new PropertyModel(recordModel,ID_PARAMETERS_EVENT_TARGET_OWNER));
targetOwnerRef.setOutputMarkupId(true);
eventDetailsPanel.add(targetOwnerRef);

final Label eventType = new Label(ID_PARAMETERS_EVENT_TYPE , new PropertyModel(recordModel,ID_PARAMETERS_EVENT_TYPE));
eventType.setOutputMarkupId(true);
eventDetailsPanel.add(eventType);

final Label eventStage = new Label(ID_PARAMETERS_EVENT_STAGE , new PropertyModel(recordModel,ID_PARAMETERS_EVENT_STAGE));
eventStage.setOutputMarkupId(true);
eventDetailsPanel.add(eventStage);

final Label channel = new Label(ID_PARAMETERS_CHANNEL , new PropertyModel(recordModel,ID_PARAMETERS_CHANNEL));
channel.setOutputMarkupId(true);
eventDetailsPanel.add(channel);

final Label eventOutcome = new Label(ID_PARAMETERS_EVENT_OUTCOME , new PropertyModel(recordModel,ID_PARAMETERS_EVENT_OUTCOME));
eventOutcome.setOutputMarkupId(true);
eventDetailsPanel.add(eventOutcome);

final Label eventResult = new Label(ID_PARAMETERS_EVENT_RESULT , new PropertyModel(recordModel,ID_PARAMETERS_EVENT_RESULT));
eventResult.setOutputMarkupId(true);
eventDetailsPanel.add(eventResult);

final Label parameter = new Label(ID_PARAMETERS_PARAMETER , new PropertyModel(recordModel,ID_PARAMETERS_PARAMETER));
parameter.setOutputMarkupId(true);
eventDetailsPanel.add(parameter);

final Label message = new Label(ID_PARAMETERS_MESSAGE , new PropertyModel(recordModel,ID_PARAMETERS_MESSAGE));
message.setOutputMarkupId(true);
eventDetailsPanel.add(message);
}
private void initDeltasPanel(){
List <ObjectDeltaOperationType> deltas = recordModel.getObject().getDelta();
List<Scene> scenes= new ArrayList<Scene> (deltas.size());
for(ObjectDeltaOperationType deltaOp :deltas){

ObjectDeltaType od = deltaOp.getObjectDelta();
ObjectDelta<? extends ObjectType> delta;
try {
delta = DeltaConvertor.createObjectDelta(od, getPrismContext());
Scene scene = getModelInteractionService().visualizeDelta( delta, createSimpleTask(ID_PARAMETERS_DELTA), new OperationResult(ID_PARAMETERS_DELTA));
scenes.add(scene);
} catch (SchemaException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
LOGGER.error("error when converitng to DeltaObject.");
throw new RestartResponseException(this);
}
}

WrapperScene ws = new WrapperScene(scenes, createStringResource("PageAuditLogDetails.deltaKey").getObject(), ID_PARAMETERS_DELTA_PARAMETERS);
final SceneDto deltaSceneDto = new SceneDto(ws);
deltaSceneDto.setMinimized(true);

IModel<SceneDto> deltaModel = new AbstractReadOnlyModel<SceneDto>(){
public SceneDto getObject() {
return deltaSceneDto;
}

};

ScenePanel deltaPanel = new ScenePanel(ID_DELTA_PANEL, deltaModel);
deltaPanel.setOutputMarkupId(true);
eventPanel.add(deltaPanel);


}

}
Expand Up @@ -3348,4 +3348,22 @@ PageAuditLogViewer.column.time=Time
PageAuditLogViewer.column.initiatorRef=Initiator
PageAuditLogViewer.column.taskIdentifier=Task Identifier
PageAuditLogViewer.column.channel=Channel
PageAuditLogViewer.column.delta=Delta
PageAuditLogViewer.column.delta=Delta
PageAuditLogDetails.title=Audit Log Details
PageAuditLogDetails.eventTimestamp=Timestamp
PageAuditLogDetails.eventIdentifier=Event Identifier
PageAuditLogDetails.eventType=Event Type
PageAuditLogDetails.eventStage=Event Stage
PageAuditLogDetails.eventInitiatorRef=Initiator
PageAuditLogDetails.eventTargetRef=Target ref.
PageAuditLogDetails.eventTargetOwnerRef= Target Owner ref.
PageAuditLogDetails.eventResult=Result
PageAuditLogDetails.eventOutcome=Outcome
PageAuditLogDetails.sessionIdentifier=Session Identifier
PageAuditLogDetails.taskIdentifier=Task Identifier
PageAuditLogDetails.taskOID=Task oid
PageAuditLogDetails.hostIdentifier=Host Indentifier
PageAuditLogDetails.channel=Channel
PageAuditLogDetails.parameter=Parameter
PageAuditLogDetails.message=Message
PageAuditLogDetails.deltaKey=Delta List

0 comments on commit caca48d

Please sign in to comment.