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.model; 017 018import org.kuali.rice.krad.uif.component.Component; 019import org.kuali.rice.krad.uif.lifecycle.LifecycleElementState; 020import org.kuali.rice.krad.uif.lifecycle.ViewLifecyclePhase; 021import org.kuali.rice.krad.uif.lifecycle.ViewLifecycleTaskBase; 022 023/** 024 * Perform post-expression evaluation tasks. 025 * 026 * <p> 027 * This task is used for optimization in core KRAD features. Since expression evaluation can be 028 * heavy, common behavior defined as expressions in delivered UIF components can be moved to this 029 * task in order to handle evaluation in code instead. 030 * </p> 031 * 032 * @author Kuali Rice Team (rice.collab@kuali.org) 033 */ 034public class AfterEvaluateExpressionTask extends ViewLifecycleTaskBase<Component> { 035 036 /** 037 * Create a task to assign component IDs during the apply model phase. 038 * 039 * @param phase The apply model phase for the component. 040 */ 041 public AfterEvaluateExpressionTask() { 042 super(Component.class); 043 } 044 045 /** 046 * {@inheritDoc} 047 */ 048 @Override 049 protected void performLifecycleTask() { 050 LifecycleElementState elementState = getElementState(); 051 if (!(elementState instanceof ViewLifecyclePhase)) { 052 return; 053 } 054 055 ViewLifecyclePhase phase = (ViewLifecyclePhase) elementState; 056 Component component = (Component) phase.getElement(); 057 component.afterEvaluateExpression(); 058 } 059 060}