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.util.Collection;
22  import java.util.List;
23  import java.util.Map;
24  import java.util.Set;
25  import org.apache.commons.lang3.tuple.Pair;
26  import org.apache.syncope.core.persistence.api.entity.Any;
27  import org.apache.syncope.core.persistence.api.entity.AnyType;
28  import org.apache.syncope.core.persistence.api.entity.ExternalResource;
29  import org.apache.syncope.core.persistence.api.entity.Relationship;
30  import org.apache.syncope.core.persistence.api.entity.anyobject.AMembership;
31  import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject;
32  import org.apache.syncope.core.persistence.api.entity.group.Group;
33  
34  public interface AnyObjectDAO extends AnyDAO<AnyObject> {
35  
36      String findKey(String type, String name);
37  
38      AnyObject findByName(String type, String name);
39  
40      List<AnyObject> findByName(String name);
41  
42      /**
43       * Checks if the calling user is authorized to access the Any Object matching the provided key, under the given
44       * realm.
45       *
46       * @param authRealms realms for which the calling user owns entitlement(s) to check
47       * @param key Any Object key
48       * @param realm Any Object's realm full path
49       * @param groups group the Any Object is member of
50       */
51      void securityChecks(Set<String> authRealms, String key, String realm, Collection<String> groups);
52  
53      /**
54       * Counts the number of instances for each type.
55       * The returned map is expected to be sorted on values.
56       *
57       * @return the number of instances for each type
58       */
59      Map<AnyType, Integer> countByType();
60  
61      Map<String, Integer> countByRealm(AnyType anyType);
62  
63      AMembership findMembership(String key);
64  
65      List<Group> findDynGroups(String key);
66  
67      List<Relationship<Any<?>, AnyObject>> findAllRelationships(AnyObject anyObject);
68  
69      Collection<Group> findAllGroups(AnyObject anyObject);
70  
71      Collection<String> findAllGroupKeys(AnyObject anyObject);
72  
73      Collection<ExternalResource> findAllResources(AnyObject anyObject);
74  
75      Pair<Set<String>, Set<String>> saveAndGetDynGroupMembs(AnyObject anyObject);
76  }