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.persistence.api.dao;
20  
21  import java.time.OffsetDateTime;
22  import java.util.List;
23  import java.util.Optional;
24  import org.apache.syncope.common.lib.to.PropagationTaskTO;
25  import org.apache.syncope.common.lib.types.AnyTypeKind;
26  import org.apache.syncope.common.lib.types.ExecStatus;
27  import org.apache.syncope.common.lib.types.TaskType;
28  import org.apache.syncope.core.persistence.api.dao.search.OrderByClause;
29  import org.apache.syncope.core.persistence.api.entity.ExternalResource;
30  import org.apache.syncope.core.persistence.api.entity.Implementation;
31  import org.apache.syncope.core.persistence.api.entity.Notification;
32  import org.apache.syncope.core.persistence.api.entity.Realm;
33  import org.apache.syncope.core.persistence.api.entity.task.MacroTask;
34  import org.apache.syncope.core.persistence.api.entity.task.PullTask;
35  import org.apache.syncope.core.persistence.api.entity.task.PushTask;
36  import org.apache.syncope.core.persistence.api.entity.task.SchedTask;
37  import org.apache.syncope.core.persistence.api.entity.task.Task;
38  
39  public interface TaskDAO extends DAO<Task<?>> {
40  
41      boolean exists(TaskType type, String key);
42  
43      <T extends Task<T>> T find(TaskType type, String key);
44  
45      <T extends SchedTask> Optional<T> findByName(TaskType type, String name);
46  
47      Optional<Task<?>> find(String key);
48  
49      List<SchedTask> findByDelegate(Implementation delegate);
50  
51      List<PullTask> findByReconFilterBuilder(Implementation reconFilterBuilder);
52  
53      List<PullTask> findByPullActions(Implementation pullActions);
54  
55      List<PushTask> findByPushActions(Implementation pushActions);
56  
57      List<MacroTask> findByCommand(Implementation delegate);
58  
59      List<MacroTask> findByRealm(Realm realm);
60  
61      <T extends Task<T>> List<T> findToExec(TaskType type);
62  
63      <T extends Task<T>> List<T> findAll(TaskType type);
64  
65      <T extends Task<T>> List<T> findAll(
66              TaskType type,
67              ExternalResource resource,
68              Notification notification,
69              AnyTypeKind anyTypeKind,
70              String entityKey,
71              int page,
72              int itemsPerPage,
73              List<OrderByClause> orderByClauses);
74  
75      int count(
76              TaskType type,
77              ExternalResource resource,
78              Notification notification,
79              AnyTypeKind anyTypeKind,
80              String entityKey);
81  
82      <T extends Task<T>> T save(T task);
83  
84      void delete(TaskType type, String key);
85  
86      void delete(Task<?> task);
87  
88      void deleteAll(ExternalResource resource, TaskType type);
89  
90      List<PropagationTaskTO> purgePropagations(
91              OffsetDateTime since,
92              List<ExecStatus> statuses,
93              List<ExternalResource> externalResources);
94  }