View Javadoc

1   /**
2    * Copyright 2005-2013 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. Analog to the
28   * {@link DataObjectCollection} metadata.
29   */
30  @Target(ElementType.FIELD)
31  @Retention(RetentionPolicy.RUNTIME)
32  @Documented
33  public @interface CollectionRelationship {
34  	/**
35  	 * The element type of the collection. If the collection contains Generics, it will be derived automatically.
36  	 */
37  	Class<?> collectionElementClass() default Object.class;
38  
39  	/**
40  	 * The list of attribute relationships linking the parent object and the collection objects.
41  	 */
42  	AttributeRelationship[] attributeRelationships();
43  
44  	/**
45  	 * Default sort order for the collection.
46  	 */
47  	CollectionSortAttribute[] sortAttributes() default {};
48  
49  	long minItemsInCollection() default 0L;
50  
51  	long maxItemsInCollection() default Long.MAX_VALUE;
52  
53  	/**
54  	 * Whether this collection uses an indirection table between the parent and collection objects. This has no function
55  	 * at present, but is here for informational purposes.
56  	 */
57  	boolean indirectCollection() default false;
58  
59  	/**
60  	 * When needed, how to label each element of the collection. (Usually singular) Will default to the label of the
61  	 * contained element type.
62  	 */
63  	String elementLabel() default "";
64  
65  	/**
66  	 * The label of the collection itself. (Usually plural)
67  	 */
68  	String label() default "";
69  }