1 /** 2 * Copyright 2005-2016 The Kuali Foundation 3 * 4 * Licensed under the Educational Community License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.opensource.org/licenses/ecl2.php 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.kuali.rice.krad.data.provider.annotation; 17 18 import java.lang.annotation.Documented; 19 import java.lang.annotation.ElementType; 20 import java.lang.annotation.Retention; 21 import java.lang.annotation.RetentionPolicy; 22 import java.lang.annotation.Target; 23 24 import org.kuali.rice.krad.data.metadata.DataObjectCollection; 25 26 /** 27 * Defines that the associated Collection field contains a collection of DataObjects. 28 * 29 * <p>Analog to the {@link DataObjectCollection} metadata.</p> 30 * 31 * @author Kuali Rice Team (rice.collab@kuali.org) 32 */ 33 @Target(ElementType.FIELD) 34 @Retention(RetentionPolicy.RUNTIME) 35 @Documented 36 public @interface CollectionRelationship { 37 /** 38 * The element type of the collection. 39 * 40 * <p>If the collection contains Generics, it will be derived automatically.</p> 41 * 42 * @return the element type of the collection. 43 */ 44 Class<?> collectionElementClass() default Object.class; 45 46 /** 47 * The list of attribute relationships linking the parent object and the collection objects. 48 * 49 * @return list of attribute relationships linking the parent object and the collection objects. 50 */ 51 AttributeRelationship[] attributeRelationships(); 52 53 /** 54 * The default sort order for the collection. 55 * 56 * @return the default sort order for the collection. 57 */ 58 CollectionSortAttribute[] sortAttributes() default {}; 59 60 /** 61 * The minimum items that can appear in the collection. 62 * 63 * @return lhe minimum items that can appear in the collection. 64 */ 65 long minItemsInCollection() default 0L; 66 67 /** 68 * The maximum items that can appear in the collection. 69 * 70 * @return lhe maximum items that can appear in the collection. 71 */ 72 long maxItemsInCollection() default Long.MAX_VALUE; 73 74 /** 75 * Whether this collection uses an indirection table between the parent and collection objects. 76 * 77 * <p>This has no function at present, but is here for informational purposes.</p> 78 * 79 * @return whether this collection uses an indirection table between the parent and collection objects. 80 */ 81 boolean indirectCollection() default false; 82 83 /** 84 * When needed, how to label each element of the collection. 85 * 86 * <p>This is usually singular. Will default to the label of the contained element type.</p> 87 * 88 * @return how to label each element of the collection. 89 */ 90 String elementLabel() default ""; 91 92 /** 93 * The label of the collection itself. 94 * 95 * <p>This is usually plural.</p> 96 * 97 * @return the label of the collection itself. 98 */ 99 String label() default ""; 100 }