Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First attempt at showing current state + performance info, shown from…
… GUI.
- Loading branch information
Showing
37 changed files
with
1,877 additions
and
151 deletions.
There are no files selected for viewing
118 changes: 118 additions & 0 deletions
118
...admin-gui/src/main/java/com/evolveum/midpoint/web/component/progress/MappingsLineDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
/* | ||
* Copyright (c) 2010-2015 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
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 org.apache.commons.lang.StringUtils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author Pavol Mederly | ||
*/ | ||
public class MappingsLineDto { | ||
|
||
public static final String F_OBJECT = "object"; | ||
public static final String F_COUNT = "count"; | ||
public static final String F_AVERAGE_TIME = "averageTime"; | ||
public static final String F_MIN_TIME = "minTime"; | ||
public static final String F_MAX_TIME = "maxTime"; | ||
public static final String F_TOTAL_TIME = "totalTime"; | ||
|
||
private String object; | ||
private int count; | ||
private Integer minTime; | ||
private Integer maxTime; | ||
private int totalTime; | ||
|
||
public MappingsLineDto(String object) { | ||
this.object = object; | ||
} | ||
|
||
public String getObject() { | ||
return object; | ||
} | ||
|
||
public int getCount() { | ||
return count; | ||
} | ||
|
||
public int getAverageTime() { | ||
if (count > 0) { | ||
return totalTime / count; | ||
} else { | ||
return 0; | ||
} | ||
} | ||
|
||
public int getMinTime() { | ||
return minTime != null ? minTime : 0; | ||
} | ||
|
||
public int getMaxTime() { | ||
return maxTime != null ? maxTime : 0; | ||
} | ||
|
||
public int getTotalTime() { | ||
return totalTime; | ||
} | ||
|
||
public static List<MappingsLineDto> extractFromOperationalInformation(OperationalInformation operationalInformation) { | ||
List<MappingsLineDto> retval = new ArrayList<>(); | ||
Map<MappingsStatisticsKey, GenericStatisticsData> dataMap = operationalInformation.getMappingsData(); | ||
if (dataMap == null) { | ||
return retval; | ||
} | ||
// this is much more generic that needs to be - but useful for future, maybe | ||
for (Map.Entry<MappingsStatisticsKey, GenericStatisticsData> entry : dataMap.entrySet()) { | ||
MappingsStatisticsKey key = entry.getKey(); | ||
String object = key.getObjectName() != null ? key.getObjectName() : key.getObjectOid(); | ||
MappingsLineDto lineDto = findLineDto(retval, object); | ||
if (lineDto == null) { | ||
lineDto = new MappingsLineDto(object); | ||
retval.add(lineDto); | ||
} | ||
lineDto.setValue(entry.getValue().getCount(), entry.getValue().getMinDuration(), | ||
entry.getValue().getMaxDuration(), entry.getValue().getTotalDuration()); | ||
} | ||
return retval; | ||
} | ||
|
||
private static MappingsLineDto findLineDto(List<MappingsLineDto> list, String object) { | ||
for (MappingsLineDto lineDto : list) { | ||
if (StringUtils.equals(lineDto.getObject(), object)) { | ||
return lineDto; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private void setValue(int count, int min, int max, long totalDuration) { | ||
this.count += count; | ||
if (minTime == null || min < minTime) { | ||
minTime = min; | ||
} | ||
if (maxTime == null || max > maxTime) { | ||
maxTime = max; | ||
} | ||
totalTime += totalDuration; | ||
} | ||
} |
128 changes: 128 additions & 0 deletions
128
...-gui/src/main/java/com/evolveum/midpoint/web/component/progress/NotificationsLineDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
/* | ||
* Copyright (c) 2010-2015 Evolveum | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
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 org.apache.commons.lang.StringUtils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import java.util.Map; | ||
|
||
/** | ||
* @author Pavol Mederly | ||
*/ | ||
public class NotificationsLineDto { | ||
|
||
public static final String F_TRANSPORT = "transport"; | ||
public static final String F_COUNT_SUCCESS = "countSuccess"; | ||
public static final String F_COUNT_FAILURE = "countFailure"; | ||
public static final String F_AVERAGE_TIME = "averageTime"; | ||
public static final String F_MIN_TIME = "minTime"; | ||
public static final String F_MAX_TIME = "maxTime"; | ||
public static final String F_TOTAL_TIME = "totalTime"; | ||
|
||
private String transport; | ||
private int countSuccess; | ||
private int countFailure; | ||
private Integer minTime; | ||
private Integer maxTime; | ||
private int totalTime; | ||
|
||
public NotificationsLineDto(String transport) { | ||
this.transport = transport; | ||
} | ||
|
||
public String getTransport() { | ||
return transport; | ||
} | ||
|
||
public int getCountSuccess() { | ||
return countSuccess; | ||
} | ||
|
||
public int getCountFailure() { | ||
return countFailure; | ||
} | ||
|
||
public int getAverageTime() { | ||
int count = countSuccess + countFailure; | ||
if (count > 0) { | ||
return totalTime / count; | ||
} else { | ||
return 0; | ||
} | ||
} | ||
|
||
public int getMinTime() { | ||
return minTime != null ? minTime : 0; | ||
} | ||
|
||
public int getMaxTime() { | ||
return maxTime != null ? maxTime : 0; | ||
} | ||
|
||
public int getTotalTime() { | ||
return totalTime; | ||
} | ||
|
||
public static List<NotificationsLineDto> extractFromOperationalInformation(OperationalInformation operationalInformation) { | ||
List<NotificationsLineDto> retval = new ArrayList<>(); | ||
Map<NotificationsStatisticsKey, GenericStatisticsData> dataMap = operationalInformation.getNotificationsData(); | ||
if (dataMap == null) { | ||
return retval; | ||
} | ||
for (Map.Entry<NotificationsStatisticsKey, GenericStatisticsData> entry : dataMap.entrySet()) { | ||
NotificationsStatisticsKey key = entry.getKey(); | ||
String transport = key.getTransport(); | ||
NotificationsLineDto lineDto = findLineDto(retval, transport); | ||
if (lineDto == null) { | ||
lineDto = new NotificationsLineDto(transport); | ||
retval.add(lineDto); | ||
} | ||
lineDto.setValue(key.isSuccess(), entry.getValue().getCount(), entry.getValue().getMinDuration(), | ||
entry.getValue().getMaxDuration(), entry.getValue().getTotalDuration()); | ||
} | ||
return retval; | ||
} | ||
|
||
private static NotificationsLineDto findLineDto(List<NotificationsLineDto> list, String transport) { | ||
for (NotificationsLineDto lineDto : list) { | ||
if (StringUtils.equals(lineDto.getTransport(), transport)) { | ||
return lineDto; | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
private void setValue(boolean success, int count, int min, int max, long totalDuration) { | ||
if (success) { | ||
this.countSuccess += count; | ||
} else { | ||
this.countFailure += count; | ||
} | ||
if (minTime == null || min < minTime) { | ||
minTime = min; | ||
} | ||
if (maxTime == null || max > maxTime) { | ||
maxTime = max; | ||
} | ||
totalTime += totalDuration; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.