Skip to content

Commit

Permalink
Showing sync states before and after operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Apr 1, 2016
1 parent da5cac9 commit 4d1f64a
Show file tree
Hide file tree
Showing 17 changed files with 183 additions and 75 deletions.
Expand Up @@ -19,7 +19,8 @@
xmlns:wicket="http://wicket.apache.org">
<body>
<wicket:panel>
<div wicket:id="synchronizationInformationPanel"/>
<div wicket:id="synchronizationInformationPanelBefore"/>
<div wicket:id="synchronizationInformationPanelAfter"/>
<div wicket:id="actionsExecutedInformationPanel"/>
</wicket:panel>
</body>
Expand Down
Expand Up @@ -34,7 +34,8 @@
public class TaskStatesAndActionsTabPanel extends AbstractObjectTabPanel<TaskType> {
private static final long serialVersionUID = 1L;

private static final String ID_SYNCHRONIZATION_INFORMATION_PANEL = "synchronizationInformationPanel";
private static final String ID_SYNCHRONIZATION_INFORMATION_PANEL_BEFORE = "synchronizationInformationPanelBefore";
private static final String ID_SYNCHRONIZATION_INFORMATION_PANEL_AFTER = "synchronizationInformationPanelAfter";
private static final String ID_ACTIONS_EXECUTED_INFORMATION_PANEL = "actionsExecutedInformationPanel";

private static final Trace LOGGER = TraceManager.getTrace(TaskStatesAndActionsTabPanel.class);
Expand All @@ -46,18 +47,28 @@ public TaskStatesAndActionsTabPanel(String id, Form mainForm,
initLayout(taskDtoModel, pageBase);
}

private void initLayout(LoadableModel<TaskDto> taskDtoModel, PageBase pageBase) {
private void initLayout(final LoadableModel<TaskDto> taskDtoModel, PageBase pageBase) {
final TaskCurrentStateDtoModel model = new TaskCurrentStateDtoModel(taskDtoModel);
SynchronizationInformationPanel synchronizationInformationPanel = new SynchronizationInformationPanel(ID_SYNCHRONIZATION_INFORMATION_PANEL,
new PropertyModel<SynchronizationInformationDto>(model, TaskCurrentStateDto.F_SYNCHRONIZATION_INFORMATION_DTO));
synchronizationInformationPanel.add(new VisibleEnableBehaviour() {
SynchronizationInformationPanel synchronizationInformationPanelBefore = new SynchronizationInformationPanel(ID_SYNCHRONIZATION_INFORMATION_PANEL_BEFORE,
new PropertyModel<SynchronizationInformationDto>(model, TaskCurrentStateDto.F_SYNCHRONIZATION_INFORMATION_DTO), false);
synchronizationInformationPanelBefore.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return model.getObject().getSynchronizationInformationType() != null;
}
});
add(synchronizationInformationPanel);
add(synchronizationInformationPanelBefore);

SynchronizationInformationPanel synchronizationInformationPanelAfter = new SynchronizationInformationPanel(ID_SYNCHRONIZATION_INFORMATION_PANEL_AFTER,
new PropertyModel<SynchronizationInformationDto>(model, TaskCurrentStateDto.F_SYNCHRONIZATION_INFORMATION_AFTER_DTO), true);
synchronizationInformationPanelAfter.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return model.getObject().getSynchronizationInformationType() != null && !taskDtoModel.getObject().isDryRun();
}
});
add(synchronizationInformationPanelAfter);

ActionsExecutedInformationPanel actionsExecutedInformationPanel = new ActionsExecutedInformationPanel(ID_ACTIONS_EXECUTED_INFORMATION_PANEL,
new PropertyModel<ActionsExecutedInformationDto>(model, TaskCurrentStateDto.F_ACTIONS_EXECUTED_INFORMATION_DTO));
actionsExecutedInformationPanel.add(new VisibleEnableBehaviour() {
Expand Down
Expand Up @@ -34,44 +34,46 @@ public class SynchronizationInformationDto {
public static final String F_COUNT_UNMATCHED = "countUnmatched";

private SynchronizationInformationType synchronizationInformationType;
private boolean useAfter;

public SynchronizationInformationDto(SynchronizationInformationType synchronizationInformationType) {
public SynchronizationInformationDto(SynchronizationInformationType synchronizationInformationType, boolean useAfter) {
this.synchronizationInformationType = synchronizationInformationType;
this.useAfter = useAfter;
}

public int getCountProtected() {
return synchronizationInformationType.getCountProtected();
return useAfter ? synchronizationInformationType.getCountProtectedAfter() : synchronizationInformationType.getCountProtected();
}

public int getCountNoSynchronizationPolicy() {
return synchronizationInformationType.getCountNoSynchronizationPolicy();
return useAfter ? synchronizationInformationType.getCountNoSynchronizationPolicyAfter() : synchronizationInformationType.getCountNoSynchronizationPolicy();
}

public int getCountSynchronizationDisabled() {
return synchronizationInformationType.getCountSynchronizationDisabled();
return useAfter ? synchronizationInformationType.getCountSynchronizationDisabledAfter() : synchronizationInformationType.getCountSynchronizationDisabled();
}

public int getCountNotApplicableForTask() {
return synchronizationInformationType.getCountNotApplicableForTask();
return useAfter ? synchronizationInformationType.getCountNotApplicableForTaskAfter() : synchronizationInformationType.getCountNotApplicableForTask();
}

public int getCountDeleted() {
return synchronizationInformationType.getCountDeleted();
return useAfter ? synchronizationInformationType.getCountDeletedAfter() : synchronizationInformationType.getCountDeleted();
}

public int getCountDisputed() {
return synchronizationInformationType.getCountDisputed();
return useAfter ? synchronizationInformationType.getCountDisputedAfter() : synchronizationInformationType.getCountDisputed();
}

public int getCountLinked() {
return synchronizationInformationType.getCountLinked();
return useAfter ? synchronizationInformationType.getCountLinkedAfter() : synchronizationInformationType.getCountLinked();
}

public int getCountUnlinked() {
return synchronizationInformationType.getCountUnlinked();
return useAfter ? synchronizationInformationType.getCountUnlinkedAfter() : synchronizationInformationType.getCountUnlinked();
}

public int getCountUnmatched() {
return synchronizationInformationType.getCountUnmatched();
return useAfter ? synchronizationInformationType.getCountUnmatchedAfter() : synchronizationInformationType.getCountUnmatched();
}
}
Expand Up @@ -17,7 +17,8 @@
<!DOCTYPE html>
<html xmlns:wicket="http://wicket.apache.org">
<wicket:panel>
<h3><wicket:message key="SynchronizationInformationPanel.title"/></h3>
<h3 wicket:id="titleBefore"><wicket:message key="SynchronizationInformationPanel.title"/></h3>
<h3 wicket:id="titleAfter"><wicket:message key="SynchronizationInformationPanel.titleAfter"/></h3>
<p style="font-size: smaller"><wicket:message key="SynchronizationInformationPanel.discoveryWarning"/></p>
<table class="table table-striped table-condensed" style="width: auto;">
<thead>
Expand Down
Expand Up @@ -16,20 +16,25 @@

package com.evolveum.midpoint.web.page.admin.server.currentState;

import com.evolveum.midpoint.gui.api.component.BasePanel;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

/**
* @author mederly
*/
public class SynchronizationInformationPanel extends SimplePanel<SynchronizationInformationDto> {
public class SynchronizationInformationPanel extends BasePanel<SynchronizationInformationDto> {

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

private static final String ID_TITLE_BEFORE = "titleBefore";
private static final String ID_TITLE_AFTER = "titleAfter";
private static final String ID_PROTECTED = "protected";
private static final String ID_NO_SYNCHRONIZATION_POLICY = "noSynchronizationPolicy";
private static final String ID_SYNCHRONIZATION_DISABLED = "synchronizationDisabled";
Expand All @@ -40,12 +45,30 @@ public class SynchronizationInformationPanel extends SimplePanel<Synchronization
private static final String ID_UNLINKED = "unlinked";
private static final String ID_UNMATCHED = "unmatched";

public SynchronizationInformationPanel(String id, IModel<SynchronizationInformationDto> model) {
public SynchronizationInformationPanel(String id, IModel<SynchronizationInformationDto> model, boolean useAfter) {
super(id, model);
initLayout(useAfter);
}

@Override
protected void initLayout() {
protected void initLayout(final boolean useAfter) {

WebMarkupContainer titleBefore = new WebMarkupContainer(ID_TITLE_BEFORE);
titleBefore.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !useAfter;
}
});
add(titleBefore);

WebMarkupContainer titleAfter = new WebMarkupContainer(ID_TITLE_AFTER);
titleAfter.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return useAfter;
}
});
add(titleAfter);

Label aProtected = new Label(ID_PROTECTED, new PropertyModel<>(getModel(), SynchronizationInformationDto.F_COUNT_PROTECTED));
add(aProtected);
Expand Down
Expand Up @@ -32,6 +32,7 @@ public class TaskCurrentStateDto {

public static final String F_ACTIONS_EXECUTED_INFORMATION_DTO = "actionsExecutedInformationDto";
public static final String F_SYNCHRONIZATION_INFORMATION_DTO = "synchronizationInformationDto";
public static final String F_SYNCHRONIZATION_INFORMATION_AFTER_DTO = "synchronizationInformationAfterDto";

private TaskDto taskDto;

Expand Down Expand Up @@ -59,10 +60,14 @@ public SynchronizationInformationType getSynchronizationInformationType() {
}

public SynchronizationInformationDto getSynchronizationInformationDto() {
return getSynchronizationInformationType() != null ? new SynchronizationInformationDto(getSynchronizationInformationType()) : null;
return getSynchronizationInformationType() != null ? new SynchronizationInformationDto(getSynchronizationInformationType(), false) : null;
}

public IterativeTaskInformationType getIterativeTaskInformationType() {
public SynchronizationInformationDto getSynchronizationInformationAfterDto() {
return getSynchronizationInformationType() != null ? new SynchronizationInformationDto(getSynchronizationInformationType(), true) : null;
}

public IterativeTaskInformationType getIterativeTaskInformationType() {
OperationStatsType stats = getOperationStatsType();
if (stats == null) {
return null;
Expand Down
Expand Up @@ -453,9 +453,9 @@ public SynchronizationInformationDto getObject() {
if (dto.getSynchronizationInformationType() == null) {
return null;
}
return new SynchronizationInformationDto(dto.getSynchronizationInformationType());
return new SynchronizationInformationDto(dto.getSynchronizationInformationType(), false);
}
});
}, false);
synchronizationInformationPanel.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
Expand Down
Expand Up @@ -2636,7 +2636,8 @@ SynchronizationInformationPanel.notApplicableForTask=Not applicable for task
SynchronizationInformationPanel.protected=Protected
SynchronizationInformationPanel.state=State
SynchronizationInformationPanel.synchronizationDisabled=Sync disabled
SynchronizationInformationPanel.title=States of processed objects
SynchronizationInformationPanel.title=States of processed objects (before operation)
SynchronizationInformationPanel.titleAfter=States of processed objects (after operation)
SynchronizationInformationPanel.discoveryWarning=(The following numbers may include processing triggered by the discovery mechanism.)
SynchronizationInformationPanel.unlinked=Unlinked
SynchronizationInformationPanel.unmatched=Unmatched
Expand Down
Expand Up @@ -2452,7 +2452,7 @@ SynchronizationInformationPanel.notApplicableForTask=Není použitelné pro úl
SynchronizationInformationPanel.protected=Chráněno
SynchronizationInformationPanel.state=Stav
SynchronizationInformationPanel.synchronizationDisabled=Synchronizace zakázána
SynchronizationInformationPanel.title=Stavy zpracovaných objektů
SynchronizationInformationPanel.title=Stavy zpracovaných objektů (před operací)
# SynchronizationInformationPanel.discoveryWarning=(The following numbers may include processing triggered by the discovery mechanism.)
SynchronizationInformationPanel.unlinked=Odpojený
SynchronizationInformationPanel.unmatched=Nenalezený
Expand Down
Expand Up @@ -2540,7 +2540,7 @@ SynchronizationInformationPanel.notApplicableForTask=Not applicable for task
SynchronizationInformationPanel.protected=Protected
SynchronizationInformationPanel.state=State
SynchronizationInformationPanel.synchronizationDisabled=Sync disabled
SynchronizationInformationPanel.title=States of processed objects
SynchronizationInformationPanel.title=States of processed objects (before operation)
SynchronizationInformationPanel.discoveryWarning=(The following numbers may include processing triggered by the discovery mechanism.)
SynchronizationInformationPanel.unlinked=Unlinked
SynchronizationInformationPanel.unmatched=Unmatched
Expand Down
Expand Up @@ -2452,7 +2452,7 @@ SynchronizationInformationPanel.notApplicableForTask=Neaplikovateľné pre úloh
SynchronizationInformationPanel.protected=Chránený
SynchronizationInformationPanel.state=Stav
SynchronizationInformationPanel.synchronizationDisabled=Synch. zakázaná
SynchronizationInformationPanel.title=Stavy spracovaných objektov
SynchronizationInformationPanel.title=Stavy spracovaných objektov (pred operáciou)
# SynchronizationInformationPanel.discoveryWarning=(The following numbers may include processing triggered by the discovery mechanism.)
SynchronizationInformationPanel.unlinked=Odpojený
SynchronizationInformationPanel.unmatched=Bez zhody
Expand Down
Expand Up @@ -76,7 +76,8 @@ public interface StatisticsCollector {

void recordSynchronizationOperationStart(String objectName, String objectDisplayName, QName objectType, String objectOid);

void recordSynchronizationOperationEnd(String objectName, String objectDisplayName, QName objectType, String objectOid, long started, Throwable exception, SynchronizationInformation.Record increment);
void recordSynchronizationOperationEnd(String objectName, String objectDisplayName, QName objectType, String objectOid, long started,
Throwable exception, SynchronizationInformation.Record originalStateIncrement, SynchronizationInformation.Record newStateIncrement);

/**
* Records information about repository (focal) events.
Expand Down

0 comments on commit 4d1f64a

Please sign in to comment.