Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/master'
- Loading branch information
Showing
91 changed files
with
2,147 additions
and
1,067 deletions.
There are no files selected for viewing
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
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
92 changes: 92 additions & 0 deletions
92
...java/com/evolveum/midpoint/web/component/progress/ProvisioningStatisticsOperationDto.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,92 @@ | ||
/* | ||
* Copyright (c) 2021 Evolveum and contributors | ||
* | ||
* This work is dual-licensed under the Apache License 2.0 | ||
* and European Union Public License. See LICENSE file for details. | ||
*/ | ||
|
||
package com.evolveum.midpoint.web.component.progress; | ||
|
||
import com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultStatusType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsEntryType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsOperationEntryType; | ||
import com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningStatisticsType; | ||
|
||
import org.apache.commons.collections4.CollectionUtils; | ||
import org.apache.wicket.model.StringResourceModel; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class ProvisioningStatisticsOperationDto implements Serializable { | ||
|
||
public static final String F_AVG_TIME = "avgTime"; | ||
|
||
private Long avgTime; | ||
|
||
private ProvisioningStatisticsOperationEntryType entry; | ||
|
||
|
||
ProvisioningStatisticsOperationDto(ProvisioningStatisticsOperationEntryType entry) { | ||
this.entry = entry; | ||
computeAvg(); | ||
} | ||
|
||
public static List<ProvisioningStatisticsOperationDto> extractFromOperationalInformation(List<ProvisioningStatisticsOperationEntryType> entries) { | ||
List<ProvisioningStatisticsOperationDto> retval = new ArrayList<>(); | ||
if (CollectionUtils.isEmpty(entries)) { | ||
return retval; | ||
} | ||
for (ProvisioningStatisticsOperationEntryType entry : entries) { | ||
retval.add(new ProvisioningStatisticsOperationDto(entry)); | ||
} | ||
return retval; | ||
} | ||
|
||
private void computeAvg() { | ||
Integer count = entry.getCount(); | ||
if (count == null || count == 0) { | ||
return; | ||
} | ||
|
||
Long totalTime = entry.getTotalTime(); | ||
if (totalTime == null) { | ||
return; | ||
} | ||
|
||
avgTime = totalTime / count; | ||
} | ||
|
||
public String getCount() { | ||
return getString(entry.getCount()); | ||
} | ||
|
||
public String getMaxTime() { | ||
return getString(entry.getMaxTime()); | ||
} | ||
|
||
public String getMinTime() { | ||
return getString(entry.getMinTime()); | ||
} | ||
|
||
public String getTotalTime() { | ||
return getString(entry.getTotalTime()); | ||
} | ||
|
||
public String getAvgTime() { | ||
return getString(avgTime); | ||
} | ||
|
||
public OperationResultStatusType getStatus() { | ||
return entry.getStatus(); | ||
} | ||
|
||
public String getOperation() { | ||
return entry.getOperation(); | ||
} | ||
|
||
private String getString(Object numberToFormat) { | ||
return new StringResourceModel("StatisticsPanel.provisioningStatistics.averageTime.formatted").setParameters(numberToFormat).getString(); | ||
} | ||
} |
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.