/
PullActions.java
194 lines (181 loc) · 7.94 KB
/
PullActions.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 org.apache.syncope.core.provisioning.api.pushpull;
import org.apache.syncope.common.lib.patch.AnyPatch;
import org.apache.syncope.common.lib.to.EntityTO;
import org.identityconnectors.framework.common.objects.SyncDelta;
import org.quartz.JobExecutionException;
/**
* Interface for actions to be performed during pull.
* All methods can throw {@link IgnoreProvisionException} to make the current any object ignored by the pull
* process.
*/
public interface PullActions extends ProvisioningActions {
/**
* Pre-process the pull information received by the underlying connector, before any internal activity occurs.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @return pull information, possibly altered.
*/
SyncDelta preprocess(ProvisioningProfile<?, ?> profile, SyncDelta delta);
/**
* Action to be executed before to create a pulled entity locally.
* The entity is created locally upon pull in case of the un-matching rule
* {@link org.apache.syncope.common.lib.types.UnmatchingRule#PROVISION} (default un-matching rule) is applied.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @throws JobExecutionException in case of generic failure
*/
void beforeProvision(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity) throws JobExecutionException;
/**
* Action to be executed before creating (and linking to the resource) a pulled entity locally.
* The entity is created locally and linked to the pulled resource upon pull in case of the
* un-matching rule {@link org.apache.syncope.common.lib.types.UnmatchingRule#ASSIGN} is applied.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @throws JobExecutionException in case of generic failure
*/
void beforeAssign(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity) throws JobExecutionException;
/**
* Action to be executed before unlinking resource from the pulled entity and de-provisioning.
* The entity is unlinked and de-provisioned from the pulled resource upon pull in case of the
* matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#UNASSIGN} is applied.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @throws JobExecutionException in case of generic failure
*/
void beforeUnassign(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity) throws JobExecutionException;
/**
* Action to be executed before de-provisioning action only.
* The entity is de-provisioned (without unlinking) from the pulled resource upon pull in case of
* the matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#DEPROVISION} is applied.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @throws JobExecutionException in case of generic failure
*/
void beforeDeprovision(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity) throws JobExecutionException;
/**
* Action to be executed before unlinking resource from the pulled entity.
* The entity is unlinked (without de-provisioning) from the pulled resource upon pull in case of
* the matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#UNLINK} is applied.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @throws JobExecutionException in case of generic failure
*/
void beforeUnlink(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity) throws JobExecutionException;
/**
* Action to be executed before linking resource to the pulled entity.
* The entity is linked (without updating) to the pulled resource upon pull in case of
* the matching rule {@link org.apache.syncope.common.lib.types.MatchingRule#LINK} is applied.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @throws JobExecutionException in case of generic failure
*/
void beforeLink(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity) throws JobExecutionException;
/**
* Action to be executed before to update a pulled entity locally.
* The entity is updated upon pull in case of the matching rule
* {@link org.apache.syncope.common.lib.types.MatchingRule#UPDATE} (default matching rule) is applied.
*
* @param <P> any object modifications
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @param anyPatch modification
* @throws JobExecutionException in case of generic failure.
*/
<P extends AnyPatch> void beforeUpdate(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity,
P anyPatch)
throws JobExecutionException;
/**
* Action to be executed before to delete a pulled entity locally.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information
* @param entity entity
* @throws JobExecutionException in case of generic failure
*/
void beforeDelete(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity) throws JobExecutionException;
/**
* Action to be executed after each local entity pull.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information (may be modified by beforeProvision / beforeUpdate /
* beforeDelete)
* @param entity entity
* @param result global pull results at the current pull step
* @throws JobExecutionException in case of generic failure
*/
void after(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
EntityTO entity,
ProvisioningReport result) throws JobExecutionException;
/**
* Action to be executed in case an exception is thrown during pull.
*
* @param profile profile of the pull being executed.
* @param delta retrieved pull information (may be modified by beforeProvision / beforeUpdate /
* beforeDelete)
* @param e the exception thrown
* @return an instance of the given exception type is that is to be thrown; {@code NULL} otherwise
* @throws JobExecutionException in case of generic failure
*/
IgnoreProvisionException onError(
ProvisioningProfile<?, ?> profile,
SyncDelta delta,
Exception e) throws JobExecutionException;
}