Skip to content

Commit

Permalink
Merge branch 'master' of github.com:Evolveum/midpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Oct 21, 2015
2 parents 6059b2c + 7f30f46 commit fcb3763
Show file tree
Hide file tree
Showing 32 changed files with 408 additions and 444 deletions.
Expand Up @@ -16,17 +16,13 @@

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.statistics.GenericStatisticsData;
import com.evolveum.midpoint.schema.statistics.MappingsStatisticsKey;
import com.evolveum.midpoint.schema.statistics.OperationalInformation;
import com.evolveum.midpoint.schema.statistics.EnvironmentalPerformanceInformation;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsEntryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.MappingsStatisticsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import org.apache.commons.lang.StringUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType;

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

/**
* @author Pavol Mederly
Expand Down Expand Up @@ -86,9 +82,9 @@ public long getTotalTime() {
return totalTime;
}

public static List<MappingsLineDto> extractFromOperationalInformation(OperationalInformation operationalInformation) {
OperationalInformationType operationalInformationType = operationalInformation.getAggregatedValue();
MappingsStatisticsType mappingsStatisticsType = operationalInformationType.getMappingsStatistics();
public static List<MappingsLineDto> extractFromOperationalInformation(EnvironmentalPerformanceInformation environmentalPerformanceInformation) {
EnvironmentalPerformanceInformationType environmentalPerformanceInformationType = environmentalPerformanceInformation.getAggregatedValue();
MappingsStatisticsType mappingsStatisticsType = environmentalPerformanceInformationType.getMappingsStatistics();
return extractFromOperationalInformation(mappingsStatisticsType);
}

Expand Down
Expand Up @@ -16,17 +16,13 @@

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.statistics.GenericStatisticsData;
import com.evolveum.midpoint.schema.statistics.NotificationsStatisticsKey;
import com.evolveum.midpoint.schema.statistics.OperationalInformation;
import com.evolveum.midpoint.schema.statistics.EnvironmentalPerformanceInformation;
import com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsEntryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.NotificationsStatisticsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import org.apache.commons.lang.StringUtils;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType;

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

/**
* @author Pavol Mederly
Expand Down Expand Up @@ -94,9 +90,9 @@ public long getTotalTime() {
return totalTime;
}

public static List<NotificationsLineDto> extractFromOperationalInformation(OperationalInformation operationalInformation) {
OperationalInformationType operationalInformationType = operationalInformation.getAggregatedValue();
NotificationsStatisticsType notificationsStatisticsType = operationalInformationType.getNotificationsStatistics();
public static List<NotificationsLineDto> extractFromOperationalInformation(EnvironmentalPerformanceInformation environmentalPerformanceInformation) {
EnvironmentalPerformanceInformationType environmentalPerformanceInformationType = environmentalPerformanceInformation.getAggregatedValue();
NotificationsStatisticsType notificationsStatisticsType = environmentalPerformanceInformationType.getNotificationsStatistics();
return extractFromOperationalInformation(notificationsStatisticsType);
}

Expand Down
Expand Up @@ -16,20 +16,14 @@

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.statistics.OperationalInformation;
import com.evolveum.midpoint.schema.statistics.ProvisioningOperation;
import com.evolveum.midpoint.schema.statistics.ProvisioningStatisticsData;
import com.evolveum.midpoint.schema.statistics.ProvisioningStatisticsKey;
import com.evolveum.midpoint.schema.statistics.ProvisioningStatusType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import com.evolveum.midpoint.schema.statistics.EnvironmentalPerformanceInformation;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsType;
import org.apache.commons.lang.StringUtils;

import javax.xml.namespace.QName;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* @author Pavol Mederly
Expand Down Expand Up @@ -212,9 +206,9 @@ public long getTotalTime() {
return totalTime;
}

public static List<ProvisioningStatisticsLineDto> extractFromOperationalInformation(OperationalInformation operationalInformation) {
OperationalInformationType operationalInformationType = operationalInformation.getAggregatedValue();
ProvisioningStatisticsType provisioningStatisticsType = operationalInformationType.getProvisioningStatistics();
public static List<ProvisioningStatisticsLineDto> extractFromOperationalInformation(EnvironmentalPerformanceInformation environmentalPerformanceInformation) {
EnvironmentalPerformanceInformationType environmentalPerformanceInformationType = environmentalPerformanceInformation.getAggregatedValue();
ProvisioningStatisticsType provisioningStatisticsType = environmentalPerformanceInformationType.getProvisioningStatistics();
return extractFromOperationalInformation(provisioningStatisticsType);
}

Expand Down
Expand Up @@ -17,12 +17,11 @@
package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.prism.xml.XmlTypeConverter;
import com.evolveum.midpoint.schema.statistics.OperationalInformation;
import com.evolveum.midpoint.schema.statistics.EnvironmentalPerformanceInformation;
import com.evolveum.midpoint.schema.statistics.StatusMessage;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

Expand All @@ -36,7 +35,7 @@ public class StatisticsDto implements Serializable {
public static final String F_NOTIFICATIONS_LINES = "notificationsLines";
public static final String F_LAST_MESSAGE = "lastMessage";

private OperationalInformationType operationalInformationType;
private EnvironmentalPerformanceInformationType environmentalPerformanceInformationType;
private List<ProvisioningStatisticsLineDto> provisioningLines;
private List<MappingsLineDto> mappingsLines;
private List<NotificationsLineDto> notificationsLines;
Expand All @@ -45,24 +44,24 @@ public class StatisticsDto implements Serializable {
public StatisticsDto() {
}

public StatisticsDto(OperationalInformationType operationalInformationType) {
this.operationalInformationType = operationalInformationType;
provisioningLines = ProvisioningStatisticsLineDto.extractFromOperationalInformation(operationalInformationType.getProvisioningStatistics());
mappingsLines = MappingsLineDto.extractFromOperationalInformation(operationalInformationType.getMappingsStatistics());
notificationsLines = NotificationsLineDto.extractFromOperationalInformation(operationalInformationType.getNotificationsStatistics());
lastMessage = extractLastMessageFromOperationalInformation(operationalInformationType);
public StatisticsDto(EnvironmentalPerformanceInformationType environmentalPerformanceInformationType) {
this.environmentalPerformanceInformationType = environmentalPerformanceInformationType;
provisioningLines = ProvisioningStatisticsLineDto.extractFromOperationalInformation(environmentalPerformanceInformationType.getProvisioningStatistics());
mappingsLines = MappingsLineDto.extractFromOperationalInformation(environmentalPerformanceInformationType.getMappingsStatistics());
notificationsLines = NotificationsLineDto.extractFromOperationalInformation(environmentalPerformanceInformationType.getNotificationsStatistics());
lastMessage = extractLastMessageFromOperationalInformation(environmentalPerformanceInformationType);
}

private String extractLastMessageFromOperationalInformation(OperationalInformationType operationalInformationType) {
if (operationalInformationType.getLastMessageTimestamp() == null) {
private String extractLastMessageFromOperationalInformation(EnvironmentalPerformanceInformationType environmentalPerformanceInformationType) {
if (environmentalPerformanceInformationType.getLastMessageTimestamp() == null) {
return null;
}
Date timestamp = XmlTypeConverter.toDate(operationalInformationType.getLastMessageTimestamp());
return timestamp + ": " + operationalInformationType.getLastMessage();
Date timestamp = XmlTypeConverter.toDate(environmentalPerformanceInformationType.getLastMessageTimestamp());
return timestamp + ": " + environmentalPerformanceInformationType.getLastMessage();
}

private String extractLastMessageFromOperationalInformation(OperationalInformation operationalInformation) {
StatusMessage lastStatusMessage = operationalInformation.getLastMessage();
private String extractLastMessageFromOperationalInformation(EnvironmentalPerformanceInformation environmentalPerformanceInformation) {
StatusMessage lastStatusMessage = environmentalPerformanceInformation.getLastMessage();
if (lastStatusMessage == null) {
return null;
}
Expand Down Expand Up @@ -101,7 +100,7 @@ public void setLastMessage(String lastMessage) {
this.lastMessage = lastMessage;
}

public OperationalInformationType getOperationalInformationType() {
return operationalInformationType;
public EnvironmentalPerformanceInformationType getEnvironmentalPerformanceInformationType() {
return environmentalPerformanceInformationType;
}
}
Expand Up @@ -16,13 +16,12 @@

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.prism.path.ItemPath;
import com.evolveum.midpoint.schema.constants.SchemaConstants;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.util.logging.Trace;
import com.evolveum.midpoint.util.logging.TraceManager;
import com.evolveum.midpoint.web.page.admin.server.dto.TaskDto;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationStatsType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;
import org.apache.wicket.model.AbstractReadOnlyModel;
import org.apache.wicket.model.IModel;
Expand Down Expand Up @@ -74,25 +73,33 @@ public StatisticsDto getObjectInternal() {
}

protected StatisticsDto getStatisticsFromTask(Task task) {
OperationalInformationType operationalInformation = task.getAggregateOperationalInformation();
if (operationalInformation == null) {

OperationStatsType operationStats = task.getAggregatedLiveOperationStats();
if (operationStats == null) {
LOGGER.warn("No operational information in task");
return null;
}
operationalInformation.setFromMemory(true);
StatisticsDto dto = new StatisticsDto(operationalInformation);
EnvironmentalPerformanceInformationType envInfo = operationStats.getEnvironmentalPerformanceInformation();
if (envInfo == null) {
LOGGER.warn("No environmental performance information in task");
return null;
}
StatisticsDto dto = new StatisticsDto(envInfo);
return dto;
}

protected StatisticsDto getStatisticsFromTaskType(TaskType task) {
OperationalInformationType infoPropertyValue = (OperationalInformationType) task.asPrismObject().getPropertyRealValue(
new ItemPath(TaskType.F_EXTENSION, SchemaConstants.MODEL_EXTENSION_OPERATIONAL_INFORMATION_PROPERTY_NAME),
OperationalInformationType.class);
if (infoPropertyValue == null) {
LOGGER.trace("No operational information in task extension.");
OperationStatsType operationStats = task.getOperationStats();
if (operationStats == null) {
LOGGER.warn("No operational information in task");
return null;
}
EnvironmentalPerformanceInformationType envInfo = operationStats.getEnvironmentalPerformanceInformation();
if (envInfo == null) {
LOGGER.warn("No environmental performance information in task");
return null;
}
StatisticsDto dto = new StatisticsDto(infoPropertyValue);
StatisticsDto dto = new StatisticsDto(envInfo);
return dto;
}

Expand Down
Expand Up @@ -115,7 +115,7 @@ <h3><wicket:message key="Title.NotificationsStatistics"/></h3>
<h3><wicket:message key="Title.CurrentStatus"/></h3>
<span wicket:id="lastMessage" style="font-size: smaller"/>
<p/>
<p style="font-size: smaller"><wicket:message key="Title.Source"/> <span wicket:id="source"/></p>
<!--<p style="font-size: smaller"><wicket:message key="Title.Source"/> <span wicket:id="source"/></p>-->
</div>
</wicket:panel>
</body>
Expand Down
Expand Up @@ -16,14 +16,9 @@

package com.evolveum.midpoint.web.component.progress;

import com.evolveum.midpoint.schema.statistics.StatusMessage;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.web.component.util.SimplePanel;
import com.evolveum.midpoint.web.page.admin.server.currentState.TaskCurrentStateDto;
import com.evolveum.midpoint.web.util.WebMiscUtil;
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationalInformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.SynchronizationInformationType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType;
import com.evolveum.midpoint.xml.ns._public.common.common_3.EnvironmentalPerformanceInformationType;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.list.ListItem;
Expand All @@ -32,7 +27,6 @@
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.PropertyModel;

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

/**
Expand Down Expand Up @@ -159,27 +153,27 @@ protected void populateItem(final ListItem<NotificationsLineDto> item) {
Label lastMessage = new Label(ID_LAST_MESSAGE, new PropertyModel<>(getModel(), StatisticsDto.F_LAST_MESSAGE));
contentsPanel.add(lastMessage);

Label source = new Label(ID_SOURCE, new AbstractReadOnlyModel<String>() {
@Override
public String getObject() {
StatisticsDto dto = getModelObject();
if (dto == null) {
return null;
}
OperationalInformationType info = dto.getOperationalInformationType();
if (info == null) {
return null;
}
if (Boolean.TRUE.equals(info.isFromMemory())) {
return getString("Message.SourceMemory",
WebMiscUtil.formatDate(info.getTimestamp()));
} else {
return getString("Message.SourceRepository",
WebMiscUtil.formatDate(info.getTimestamp()));
}
}
});
contentsPanel.add(source);
// Label source = new Label(ID_SOURCE, new AbstractReadOnlyModel<String>() {
// @Override
// public String getObject() {
// StatisticsDto dto = getModelObject();
// if (dto == null) {
// return null;
// }
// EnvironmentalPerformanceInformationType info = dto.getEnvironmentalPerformanceInformationType();
// if (info == null) {
// return null;
// }
// if (Boolean.TRUE.equals(info.isFromMemory())) {
// return getString("Message.SourceMemory",
// WebMiscUtil.formatDate(info.getTimestamp()));
// } else {
// return getString("Message.SourceRepository",
// WebMiscUtil.formatDate(info.getTimestamp()));
// }
// }
// });
// contentsPanel.add(source);
}

// Note: do not setVisible(false) on the progress panel itself - it will disable AJAX refresh functionality attached to it.
Expand Down
Expand Up @@ -20,7 +20,7 @@
<h3><wicket:message key="ActionsExecutedInformationPanel.title"/></h3>

<span wicket:id="showResultingActionsOnlyLabel"/>
<a wicket:id="showResultingActionsOnlyLink" ><wicket:message key="ActionsExecutedInformationPanel.changeShowingActions"/></a>
<i><a wicket:id="showResultingActionsOnlyLink" ><wicket:message key="ActionsExecutedInformationPanel.changeShowingActions"/></a></i>

<table class="table table-striped table-condensed" style="width: auto;">
<thead>
Expand Down

0 comments on commit fcb3763

Please sign in to comment.