View Javadoc
1   /**
2    * Copyright 2005-2015 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.uif.lifecycle;
17  
18  import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
19  import org.kuali.rice.krad.uif.UifConstants;
20  import org.kuali.rice.krad.uif.component.Component;
21  import org.kuali.rice.krad.uif.lifecycle.ViewLifecycle.LifecycleEvent;
22  import org.kuali.rice.krad.uif.util.LifecycleElement;
23  
24  /**
25   * Lifecycle phase implementation representing the pre-process phase.
26   *
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   */
29  public class PreProcessElementPhase extends ViewLifecyclePhaseBase {
30  
31      /**
32       * {@inheritDoc}
33       */
34      @Override
35      public LifecycleEvent getEventToNotify() {
36          return null;
37      }
38  
39      /**
40       * {@inheritDoc}
41       */
42      @Override
43      public String getStartViewStatus() {
44          return UifConstants.ViewStatus.CREATED;
45      }
46  
47      /**
48       * {@inheritDoc}
49       */
50      @Override
51      public String getEndViewStatus() {
52          return UifConstants.ViewStatus.CACHED;
53      }
54  
55      /**
56       * {@inheritDoc}
57       */
58      @Override
59      public String getViewPhase() {
60          return UifConstants.ViewPhases.PRE_PROCESS;
61      }
62  
63      /**
64       * {@inheritDoc}
65       */
66      @Override
67      protected ViewLifecyclePhase initializeSuccessor(LifecycleElement nestedElement, String nestedPath,
68              Component nestedParent) {
69          if (nestedElement != null && !UifConstants.ViewStatus.CACHED.equals(nestedElement.getViewStatus())) {
70              ViewLifecyclePhase preProcessPhase = KRADServiceLocatorWeb.getViewLifecyclePhaseBuilder().buildPhase(
71                      UifConstants.ViewPhases.PRE_PROCESS, nestedElement, nestedParent, nestedPath, getRefreshPaths());
72              return preProcessPhase;
73          }
74  
75          return null;
76      }
77  
78  }