-
Notifications
You must be signed in to change notification settings - Fork 188
/
ModifyObjectResult.java
90 lines (74 loc) · 3.01 KB
/
ModifyObjectResult.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/*
* Copyright (c) 2010-2019 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.repo.api;
import com.evolveum.midpoint.prism.PrismObject;
import com.evolveum.midpoint.prism.delta.ItemDelta;
import com.evolveum.midpoint.repo.api.perf.OperationRecord;
import com.evolveum.midpoint.util.annotation.Experimental;
import com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectType;
import java.util.Collection;
/**
* Contains information about object modification result; primarily needed by repository caching algorithms.
* Because it is bound to the current (SQL) implementation of the repository, avoid using this information
* for any other purposes.
*
* Note that objectBefore and objectAfter might be null if the object XML representation was not changed.
* It is currently the case for lookup tables (when rows are modified) and certification campaigns (when cases are modified).
* In all other cases these are non-null.
*
* EXPERIMENTAL. We will probably drop objectBefore and modifications.
*/
@Experimental
public class ModifyObjectResult<T extends ObjectType> {
private final PrismObject<T> objectBefore;
private final PrismObject<T> objectAfter;
private final Collection<? extends ItemDelta> modifications;
/**
* Performance record for the current operation.
* Very experimental. Probably should be present also for other repository operation result objects.
*/
private OperationRecord performanceRecord;
public ModifyObjectResult(Collection<? extends ItemDelta> modifications) {
this(null, null, modifications);
}
public ModifyObjectResult(PrismObject<T> objectBefore, PrismObject<T> objectAfter,
Collection<? extends ItemDelta> modifications) {
this.objectBefore = objectBefore;
this.objectAfter = objectAfter;
this.modifications = modifications;
}
public PrismObject<T> getObjectBefore() {
return objectBefore;
}
public PrismObject<T> getObjectAfter() {
return objectAfter;
}
public Collection<? extends ItemDelta> getModifications() {
return modifications;
}
public OperationRecord getPerformanceRecord() {
return performanceRecord;
}
public void setPerformanceRecord(OperationRecord performanceRecord) {
this.performanceRecord = performanceRecord;
}
public int getRetries() {
return performanceRecord != null ? performanceRecord.getAttempts() - 1 : 0;
}
public long getWastedTime() {
return performanceRecord != null ? performanceRecord.getWastedTime() : 0;
}
@Override
public String toString() {
return "ModifyObjectResult{" +
"objectBefore=" + objectBefore +
", objectAfter=" + objectAfter +
", modifications=" + modifications +
", performanceRecord=" + performanceRecord +
'}';
}
}