001/**
002 * Copyright 2005-2018 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.krad.uif.lifecycle;
017
018import java.lang.annotation.Documented;
019import java.lang.annotation.ElementType;
020import java.lang.annotation.Retention;
021import java.lang.annotation.RetentionPolicy;
022import java.lang.annotation.Target;
023
024/**
025 * Annotation for {@link org.kuali.rice.krad.uif.util.LifecycleElement} bean properties to restrict which view
026 * lifecycle phases for which the property will be considered while initializing the successor phase queue.
027 * 
028 * <p>
029 * This annotation should be placed on the read method for any properties on the component that
030 * should be excluded from the view lifecycle. An optional array of phases at which the property
031 * should be included may be provided.
032 * </p>
033 * 
034 * @author Kuali Rice Team (rice.collab@kuali.org)
035 */
036@Target(ElementType.METHOD)
037@Retention(RetentionPolicy.RUNTIME)
038@Documented
039public @interface ViewLifecycleRestriction {
040
041    /**
042     * Lifecycle phase (including preceding phases) at which to include the annotated bean property.
043     * 
044     * @return lifecycle phase at which to include the annotated property
045     * @see org.kuali.rice.krad.uif.UifConstants.ViewPhases
046     */
047    String[] value() default {};
048
049    /**
050     * Lifecycle phase(s) at which to exclude the annotated bean property.
051     *
052     * <p>Note when this property is set by itself, all other phases not listed will be included. If value is
053     * set as well, only those phases within the value and not listed here will be included.</p>
054     *
055     * @return set of lifecycle phases at which to exclude the annotated property
056     * @see org.kuali.rice.krad.uif.UifConstants.ViewPhases
057     */
058    String[] exclude() default {};
059
060    /**
061     * Expression to evaluate (must result in boolean) that will determine if the property is included
062     * at the configured phases.
063     *
064     * <p>Expressions have access to the model as the default context. Also, no expression syntax (@{}) should
065     * be used.</p>
066     *
067     * @return String condition to evaluate
068     */
069    String condition() default "";
070
071}