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.entity; 20 21 import java.util.Collection; 22 import java.util.List; 23 import java.util.Optional; 24 25 public interface GroupableRelatable< 26 L extends Any<P>, 27 M extends Membership<L>, 28 P extends GroupablePlainAttr<L, M>, 29 R extends Any<?>, 30 REL extends Relationship<L, R>> extends Any<P> { 31 32 /** 33 * Returns the plain attribute for this instance, the given schema name and the given membership - 34 * if found, {@code NULL} otherwise. 35 * 36 * @param plainSchema plain schema name 37 * @param membership membership 38 * @return plain attribute for this instance, the given schema name and the given membership 39 */ 40 Optional<? extends P> getPlainAttr(String plainSchema, Membership<?> membership); 41 42 /** 43 * Returns the list of plain attributes for this instance and the given schema name (including membeship attributes, 44 * as opposite to {@link Any#getPlainAttr(java.lang.String)}). 45 * 46 * @param plainSchema plain schema name 47 * @return list of plain attributes for this instance and the given schema name (including membeship attributes) 48 */ 49 Collection<? extends P> getPlainAttrs(String plainSchema); 50 51 /** 52 * Returns the list of plain attributes for this instance and the given membership. 53 * 54 * @param membership membership 55 * @return list of plain attributes for this instance and the given membership 56 */ 57 Collection<? extends P> getPlainAttrs(Membership<?> membership); 58 59 boolean add(M membership); 60 61 boolean remove(M membership); 62 63 Optional<? extends M> getMembership(String groupKey); 64 65 List<? extends M> getMemberships(); 66 67 boolean add(REL relationship); 68 69 Optional<? extends REL> getRelationship(RelationshipType relationshipType, String otherEndKey); 70 71 Collection<? extends REL> getRelationships(String otherEndKey); 72 73 Collection<? extends REL> getRelationships(RelationshipType relationshipType); 74 75 List<? extends REL> getRelationships(); 76 }