001/*
002 *  Licensed to the Apache Software Foundation (ASF) under one
003 *  or more contributor license agreements.  See the NOTICE file
004 *  distributed with this work for additional information
005 *  regarding copyright ownership.  The ASF licenses this file
006 *  to you under the Apache License, Version 2.0 (the
007 *  "License"); you may not use this file except in compliance
008 *  with the License.  You may obtain a copy of the License at
009 *
010 *        http://www.apache.org/licenses/LICENSE-2.0
011 *
012 *  Unless required by applicable law or agreed to in writing,
013 *  software distributed under the License is distributed on an
014 *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015 *  KIND, either express or implied.  See the License for the
016 *  specific language governing permissions and limitations
017 *  under the License.
018 */
019
020package org.apache.isis.core.metamodel.spec.feature;
021
022import java.util.List;
023
024import org.apache.isis.applib.filter.Filter;
025import org.apache.isis.applib.filter.Filters;
026import org.apache.isis.core.metamodel.spec.ObjectSpecificationException;
027
028public interface ObjectAssociationContainer {
029
030    /**
031     * Get the field object representing the field with the specified field
032     * identifier.
033     * 
034     * Throw a {@link ObjectSpecificationException} if no such association
035     * exists.
036     */
037    ObjectAssociation getAssociation(String id);
038
039    /**
040     * Return all the fields that exist in an object of this specification,
041     * although they need not all be accessible or visible.
042     */
043    List<ObjectAssociation> getAssociations(Contributed contributed);
044
045    /**
046     * Returns all {@link ObjectAssociation} ({@link Contributed#INCLUDED including contributed actions})
047     * that match the supplied filter.
048     */
049    @Deprecated
050    List<ObjectAssociation> getAssociations(Filter<ObjectAssociation> filter);
051
052    /**
053     * Return all {@link ObjectAssociation}s matching the supplied filter.
054     * 
055     * To get the statically visible fields (where any invisible and
056     * unauthorised fields have been removed) use
057     * <tt>ObjectAssociationFilters#staticallyVisible(...)</tt>
058     * 
059     * @see Filters
060     */
061    List<ObjectAssociation> getAssociations(Contributed contributed, Filter<ObjectAssociation> filter);
062
063    /**
064     * All {@link ObjectAssociation association}s that represent
065     * {@link OneToOneAssociation properties}.
066     */
067    List<OneToOneAssociation> getProperties(Contributed contributed);
068
069    /**
070     * All {@link ObjectAssociation association}s that represents
071     * {@link OneToManyAssociation collections}.
072     * 
073     * @return
074     */
075    List<OneToManyAssociation> getCollections(Contributed contributed);
076
077}