View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.syncope.core.provisioning.api.propagation;
20  
21  import java.util.Optional;
22  import java.util.Set;
23  import org.apache.syncope.common.lib.to.OrgUnit;
24  import org.apache.syncope.common.lib.to.Provision;
25  import org.apache.syncope.core.persistence.api.entity.task.PropagationTask;
26  import org.apache.syncope.core.persistence.api.entity.task.TaskExec;
27  import org.identityconnectors.framework.common.objects.ConnectorObject;
28  
29  public interface PropagationActions {
30  
31      /**
32       * Return additional attributes to include in the result from the underlying connector.
33       *
34       * @param taskInfo propagation task
35       * @param orgUnit Realm provisioning information
36       * @return additional attributes to include in the result from the underlying connector
37       */
38      default Set<String> moreAttrsToGet(Optional<PropagationTaskInfo> taskInfo, OrgUnit orgUnit) {
39          return Set.of();
40      }
41  
42      /**
43       * Return additional attributes to include in the result from the underlying connector.
44       *
45       * @param taskInfo propagation task
46       * @param provision Any provisioning information
47       * @return additional attributes to include in the result from the underlying connector
48       */
49      default Set<String> moreAttrsToGet(Optional<PropagationTaskInfo> taskInfo, Provision provision) {
50          return Set.of();
51      }
52  
53      /**
54       * Executes logic before actual propagation.
55       *
56       * @param taskInfo propagation task
57       */
58      default void before(PropagationTaskInfo taskInfo) {
59          // do nothing
60      }
61  
62      /**
63       * Executes logic in case of propagation error.
64       * This method can throw {@link org.apache.syncope.core.provisioning.api.pushpull.IgnoreProvisionException} to
65       * ignore the reported error and continue.
66       *
67       * @param taskInfo propagation task
68       * @param execution execution result
69       * @param error propagation error
70       */
71      default void onError(PropagationTaskInfo taskInfo, TaskExec<PropagationTask> execution, Exception error) {
72          // do nothing
73      }
74  
75      /**
76       * Executes logic after actual propagation.
77       *
78       * @param taskInfo propagation task
79       * @param execution execution result
80       * @param afterObj connector object read after propagation
81       */
82      default void after(PropagationTaskInfo taskInfo, TaskExec<PropagationTask> execution, ConnectorObject afterObj) {
83          // do nothing
84      }
85  }