Skip to content

Commit

Permalink
Fixed wrong task operation statistics. Fixed NPE when creating new ta…
Browse files Browse the repository at this point in the history
…sk. Fixed certification sample.
  • Loading branch information
mederly committed Feb 15, 2016
1 parent ecb0f1b commit 7e04157
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
Expand Up @@ -66,17 +66,17 @@ public EnvironmentalPerformanceInformationType getStartValue() {
}

public synchronized EnvironmentalPerformanceInformationType getDeltaValue() {
EnvironmentalPerformanceInformationType rv = toOperationalInformationType();
EnvironmentalPerformanceInformationType rv = toEnvironmentalPerformanceInformationType();
return rv;
}

public synchronized EnvironmentalPerformanceInformationType getAggregatedValue() {
EnvironmentalPerformanceInformationType delta = toOperationalInformationType();
EnvironmentalPerformanceInformationType delta = toEnvironmentalPerformanceInformationType();
EnvironmentalPerformanceInformationType rv = aggregate(startValue, delta);
return rv;
}

private EnvironmentalPerformanceInformationType toOperationalInformationType() {
private EnvironmentalPerformanceInformationType toEnvironmentalPerformanceInformationType() {
EnvironmentalPerformanceInformationType rv = new EnvironmentalPerformanceInformationType();
rv.setProvisioningStatistics(toProvisioningStatisticsType());
rv.setMappingsStatistics(toMappingsStatisticsType());
Expand Down Expand Up @@ -284,7 +284,7 @@ private static void addNotificationsTo(EnvironmentalPerformanceInformationType r
return;
}
if (rv.getNotificationsStatistics() == null) {
rv.setNotificationsStatistics(delta);
rv.setNotificationsStatistics(delta.clone());
return;
}

Expand Down Expand Up @@ -326,7 +326,7 @@ private static void addMappingsTo(EnvironmentalPerformanceInformationType rv, Ma
return;
}
if (rv.getMappingsStatistics() == null) {
rv.setMappingsStatistics(delta);
rv.setMappingsStatistics(delta.clone());
return;
}

Expand Down Expand Up @@ -365,7 +365,7 @@ private static void addProvisioningTo(EnvironmentalPerformanceInformationType rv
return;
}
if (rv.getProvisioningStatistics() == null) {
rv.setProvisioningStatistics(delta);
rv.setProvisioningStatistics(delta.clone());
return;
}

Expand Down
Expand Up @@ -193,7 +193,7 @@ public void refreshStatus(Task task) {

@Override
public String getCategoryName(Task task) {
if (task.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_CLEANUP_POLICIES) != null) {
if (task != null && task.getExtensionPropertyRealValue(SchemaConstants.MODEL_EXTENSION_CLEANUP_POLICIES) != null) {
return TaskCategory.UTIL; // this is run on-demand just like other utility tasks (e.g. delete task handler)
} else {
return TaskCategory.SYSTEM; // this is the default instance, always running
Expand Down
Expand Up @@ -1217,8 +1217,10 @@ public List<String> getAllTaskCategories() {
public String getHandlerUriForCategory(String category) {
for (Map.Entry<String,TaskHandler> h : handlers.entrySet()) {
List<String> cats = h.getValue().getCategoryNames();
if (cats != null && cats.contains(category)) {
return h.getKey();
if (cats != null) {
if (cats.contains(category)) {
return h.getKey();
}
} else {
String cat = h.getValue().getCategoryName(null);
if (category.equals(cat)) {
Expand Down
8 changes: 5 additions & 3 deletions samples/certification/def-all-user-assignments.xml
Expand Up @@ -17,11 +17,13 @@

<accessCertificationDefinition
xmlns='http://midpoint.evolveum.com/xml/ns/public/common/common-3'
xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>All user assignments</name>
<description>Certifies all users' assignments. Everything is certified by the administrator.</description>
<handlerUri>http://midpoint.evolveum.com/xml/ns/public/certification/handlers-3#direct-assignment</handlerUri>
<scopeDefinition xsi:type="AccessCertificationAssignmentReviewScopeType">
<objectType>UserType</objectType>
</scopeDefinition>
<ownerRef oid="00000000-0000-0000-0000-000000000002" type="UserType"><!-- administrator --></ownerRef>
<remediationDefinition>
<style>automated</style>
Expand All @@ -30,8 +32,8 @@
<number>1</number>
<name>Administrator's review</name>
<description>In this stage, the administrator has to review all the assignments of all users.</description>
<duration>P14D</duration> <!-- days -->
<notifyBeforeDeadline>PT48H</notifyBeforeDeadline> <!-- hours -->
<duration>P14D</duration> <!-- 14 days -->
<notifyBeforeDeadline>PT48H</notifyBeforeDeadline> <!-- 48 hours -->
<notifyBeforeDeadline>PT12H</notifyBeforeDeadline>
<notifyOnlyWhenNoDecision>true</notifyOnlyWhenNoDecision> <!-- this is the default -->
<reviewerSpecification>
Expand Down

0 comments on commit 7e04157

Please sign in to comment.