View Javadoc

1   /**
2    * Copyright 2005-2012 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.view;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.rice.krad.datadictionary.uif.UifDictionaryBeanBase;
20  import org.kuali.rice.krad.datadictionary.parse.BeanTag;
21  import org.kuali.rice.krad.datadictionary.parse.BeanTagAttribute;
22  
23  import java.io.Serializable;
24  
25  /**
26   * A simple object that keeps track of various HistoryInformation
27   *
28   * TODO a variety of these settings are not used in the current implementation of breadcrumbs
29   * and history, they may be removed later if they prove unuseful in future changes
30   *
31   * @author Kuali Rice Team (rice.collab@kuali.org)
32   */
33  @BeanTag(name = "historyEntry", parent = "Uif-HistoryEntry")
34  public class HistoryEntry extends UifDictionaryBeanBase implements Serializable {
35      private static final long serialVersionUID = -8310916657379268794L;
36  
37      private String viewId;
38      private String pageId;
39      private String title;
40      private String url;
41      private String formKey;
42  
43      public HistoryEntry() {
44          super();
45      }
46  
47      public HistoryEntry(String viewId, String pageId, String title, String url, String formKey) {
48          super();
49  
50          this.viewId = viewId;
51          this.pageId = pageId;
52          this.title = title;
53          this.url = url;
54          this.formKey = formKey;
55      }
56  
57      /**
58       * Returns a representation of the history entry as a request parameter string
59       *
60       * @return String containing the entries values
61       */
62      public String toParam() {
63          viewId = (StringUtils.isNotBlank(viewId)) ? viewId : "null";
64          pageId = (StringUtils.isNotBlank(pageId)) ? pageId : "null";
65          return viewId
66                  + History.VAR_TOKEN
67                  + pageId
68                  + History.VAR_TOKEN
69                  + title
70                  + History.VAR_TOKEN
71                  + url
72                  + History.VAR_TOKEN
73                  + formKey;
74      }
75  
76      /**
77       * The viewId of the view
78       *
79       * @return the viewId
80       */
81      @BeanTagAttribute(name="viewId")
82      public String getViewId() {
83          return this.viewId;
84      }
85  
86      /**
87       * @param viewId the viewId to set
88       */
89      public void setViewId(String viewId) {
90          this.viewId = viewId;
91      }
92  
93      /**
94       * The pageId of the page on the view
95       *
96       * @return the pageId
97       */
98      @BeanTagAttribute(name="pageId")
99      public String getPageId() {
100         return this.pageId;
101     }
102 
103     /**
104      * @param pageId the pageId to set
105      */
106     public void setPageId(String pageId) {
107         this.pageId = pageId;
108     }
109 
110     /**
111      * The title of the view
112      *
113      * @return the title
114      */
115     @BeanTagAttribute(name="title")
116     public String getTitle() {
117         return this.title;
118     }
119 
120     /**
121      * @param title the title to set
122      */
123     public void setTitle(String title) {
124         this.title = title;
125     }
126 
127     /**
128      * The url of this HistoryEntry
129      *
130      * @return the url
131      */
132     @BeanTagAttribute(name="url")
133     public String getUrl() {
134         return this.url;
135     }
136 
137     /**
138      * @param url the url to set
139      */
140     public void setUrl(String url) {
141         this.url = url;
142     }
143 
144     /**
145      * @return the formKey
146      */
147     @BeanTagAttribute(name="formKey")
148     public String getFormKey() {
149         return this.formKey;
150     }
151 
152     /**
153      * The formKey of the form in the view
154      *
155      * @param formKey the formKey to set
156      */
157     public void setFormKey(String formKey) {
158         this.formKey = formKey;
159     }
160 
161 }