View Javadoc

1   package org.kuali.ole.describe.form;
2   
3   import org.kuali.ole.describe.bo.BoundwithSelection;
4   import org.kuali.ole.describe.bo.DocumentTreeNode;
5   import org.kuali.ole.describe.bo.OleWorkBibDocument;
6   import org.kuali.ole.docstore.discovery.model.SearchCondition;
7   import org.kuali.ole.docstore.discovery.model.SearchParams;
8   import org.kuali.ole.docstore.model.bo.WorkBibDocument;
9   import org.kuali.ole.docstore.model.bo.WorkHoldingsDocument;
10  import org.kuali.ole.docstore.model.bo.WorkItemDocument;
11  import org.kuali.rice.core.api.util.tree.Tree;
12  import org.kuali.rice.krad.uif.UifConstants;
13  import org.kuali.rice.krad.util.KRADUtils;
14  import org.kuali.rice.krad.web.form.UifFormBase;
15  
16  import java.util.*;
17  
18  /**
19   * Created with IntelliJ IDEA.
20   * User: Sreekanth
21   * Date: 11/26/12
22   * Time: 01:46 PM
23   * To change this template use File | Settings | File Templates.
24   */
25  public class BoundwithForm extends UifFormBase {
26  
27      private SearchParams searchParams;
28      private List<OleWorkBibDocument> workBibDocumentList;
29      private List<WorkHoldingsDocument> workHoldingsDocumentList;
30      private List<WorkItemDocument> workItemDocumentList;
31      private List<WorkBibDocument> bibDocumentList;
32  
33  
34      private List<DocumentTreeNode>   displayRecordList          = new ArrayList<DocumentTreeNode>();
35      private String  message;
36      private String  author;
37      private String  id;
38      private String  title;
39      private String  description;
40      private String  publicationDate;
41      private String  barcode;
42      private String  searchResults;
43      private String  control;
44      private boolean select;
45      private boolean selectTree1;
46      private boolean selectTree2;
47      private boolean selectBoundwithTree;
48      private String selectedInstance;
49      private String labelText;
50      private String tree2LabelText;
51      private String boundwithTreeLabelText;
52  
53      private String status;
54      private boolean isSelected;
55       private DocumentTreeNode documentTreeNode;
56      private Tree<BoundwithSelection,String> bibTree1 = new Tree<BoundwithSelection, String>();
57      private Tree<BoundwithSelection,String> bibTree2 = new Tree<BoundwithSelection, String>();
58      private Tree<BoundwithSelection,String> boundWithTree = new Tree<BoundwithSelection, String>();
59      private Map<String,String> instanceMap = new HashMap<String, String>();
60      private Map<String,String> bibMap = new HashMap<String, String>();
61  
62      private Tree<DocumentTreeNode,String> leftTree = new Tree<DocumentTreeNode, String>();
63      private Tree<DocumentTreeNode,String> rightTree = new Tree<DocumentTreeNode, String>();
64      private Tree<DocumentTreeNode,String> boundwithTree = new Tree<DocumentTreeNode, String>();
65  
66  
67      protected Map<String, String> actionParameters = new HashMap<String, String>();;
68  
69  
70      public BoundwithForm() {
71         // select = false;
72  
73          List<SearchCondition> searchConditions = getSearchParams().getSearchFieldsList();
74          if (null == searchConditions) {
75              searchConditions = new ArrayList<SearchCondition>();
76          }
77          searchConditions.add(new SearchCondition());
78          searchConditions.add(new SearchCondition());
79      }
80  
81  
82      /**
83       * @see org.kuali.rice.krad.uif.view.ViewModel#getActionParameters()
84       */
85      @Override
86      public Map<String, String> getActionParameters() {
87          return this.actionParameters;
88      }
89  
90      /**
91       * Returns the action parameters map as a {@code Properties} instance
92       *
93       * @return Properties action parameters
94       */
95      public Properties getActionParametersAsProperties() {
96          return KRADUtils.convertMapToProperties(actionParameters);
97      }
98  
99      /**
100      * @see org.kuali.rice.krad.uif.view.ViewModel#setActionParameters(java.util.Map<java.lang.String,java.lang.String>)
101      */
102     @Override
103     public void setActionParameters(Map<String, String> actionParameters) {
104         this.actionParameters = actionParameters;
105     }
106 
107     /**
108      * Retrieves the value for the given action parameter, or empty string if
109      * not found
110      *
111      * @param actionParameterName - name of the action parameter to retrieve value for
112      * @return String parameter value or empty string
113      */
114     public String getActionParamaterValue(String actionParameterName) {
115         if ((actionParameters != null) && actionParameters.containsKey(actionParameterName)) {
116             return actionParameters.get(actionParameterName);
117         }
118 
119         return "";
120     }
121 
122     /**
123      * Returns the action event that was sent in the action parameters (if any)
124      *
125      * <p>
126      * The action event is a special action parameter that can be sent to indicate a type of action being taken. This
127      * can be looked at by the view or components to render differently
128      * </p>
129      *
130      *
131      * @return String action event name or blank if action event was not sent
132      */
133     public String getActionEvent() {
134         if ((actionParameters != null) && actionParameters.containsKey(UifConstants.UrlParams.ACTION_EVENT)) {
135             return actionParameters.get(UifConstants.UrlParams.ACTION_EVENT);
136         }
137 
138         return "";
139     }
140 
141 
142     public Map<String, String> getActionParameters(Map<String,String> actionParametersMap) {
143         this.actionParameters = actionParametersMap;
144         return actionParametersMap;
145     }
146 
147 
148 
149     public SearchParams getSearchParams() {
150         if (null == searchParams) {
151             searchParams = new SearchParams();
152         }
153         return searchParams;
154     }
155 
156     public void setSearchParams(SearchParams searchParams) {
157         this.searchParams = searchParams;
158     }
159 
160     public List<OleWorkBibDocument> getWorkBibDocumentList() {
161         return workBibDocumentList;
162     }
163 
164     public DocumentTreeNode getDocumentTreeNode() {
165         if(null == documentTreeNode)
166         {
167             documentTreeNode = new DocumentTreeNode();
168         }
169         return documentTreeNode;
170     }
171 
172     public void setDocumentTreeNode(DocumentTreeNode documentTreeNode) {
173         this.documentTreeNode = documentTreeNode;
174     }
175 
176     public void setWorkBibDocumentList(List<OleWorkBibDocument> workBibDocumentList) {
177         this.workBibDocumentList = workBibDocumentList;
178     }
179 
180     public List<WorkHoldingsDocument> getWorkHoldingsDocumentList() {
181         return workHoldingsDocumentList;
182     }
183 
184     public void setWorkHoldingsDocumentList(List<WorkHoldingsDocument> workHoldingsDocumentList) {
185         this.workHoldingsDocumentList = workHoldingsDocumentList;
186     }
187 
188     public List<WorkItemDocument> getWorkItemDocumentList() {
189         return workItemDocumentList;
190     }
191 
192     public void setWorkItemDocumentList(List<WorkItemDocument> workItemDocumentList) {
193         this.workItemDocumentList = workItemDocumentList;
194     }
195 
196     public List<WorkBibDocument> getBibDocumentList() {
197         return bibDocumentList;
198     }
199 
200     public void setBibDocumentList(List<WorkBibDocument> bibDocumentList) {
201         this.bibDocumentList = bibDocumentList;
202     }
203 
204 
205 
206     public String getLabelText() {
207         return labelText;
208     }
209 
210     public void setLabelText(String labelText) {
211         this.labelText = labelText;
212     }
213 
214 
215 
216     public String getMessage() {
217         return message;
218     }
219 
220     public String getSelectedInstance() {
221         return selectedInstance;
222     }
223 
224     public void setSelectedInstance(String selectedInstance) {
225         this.selectedInstance = selectedInstance;
226     }
227 
228     public void setMessage(String message) {
229         this.message = message;
230     }
231 
232     public String getAuthor() {
233         return author;
234     }
235 
236     public void setAuthor(String author) {
237         this.author = author;
238     }
239 
240     public String getId() {
241         return id;
242     }
243 
244     public void setId(String id) {
245         this.id = id;
246     }
247 
248     public String getTitle() {
249         return title;
250     }
251 
252     public void setTitle(String title) {
253         this.title = title;
254     }
255 
256     public String getDescription() {
257         return description;
258     }
259 
260     public void setDescription(String description) {
261         this.description = description;
262     }
263 
264     public String getPublicationDate() {
265         return publicationDate;
266     }
267 
268     public void setPublicationDate(String publicationDate) {
269         this.publicationDate = publicationDate;
270     }
271 
272     public String getBarcode() {
273         return barcode;
274     }
275 
276     public void setBarcode(String barcode) {
277         this.barcode = barcode;
278     }
279 
280     public String getSearchResults() {
281         return searchResults;
282     }
283 
284     public void setSearchResults(String searchResults) {
285         this.searchResults = searchResults;
286     }
287 
288     public String getControl() {
289         return control;
290     }
291 
292     public void setControl(String control) {
293         this.control = control;
294     }
295 
296     public String getTree2LabelText() {
297         return tree2LabelText;
298     }
299 
300     public void setTree2LabelText(String tree2LabelText) {
301         this.tree2LabelText = tree2LabelText;
302     }
303 
304     public boolean isSelectTree1() {
305         return selectTree1;
306     }
307 
308     public void setSelectTree1(boolean selectTree1) {
309         this.selectTree1 = selectTree1;
310     }
311 
312     public boolean isSelectTree2() {
313         return selectTree2;
314     }
315 
316     public void setSelectTree2(boolean selectTree2) {
317         this.selectTree2 = selectTree2;
318     }
319 
320     public List<DocumentTreeNode> getDisplayRecordList() {
321         return displayRecordList;
322     }
323 
324     public void setDisplayRecordList(List<DocumentTreeNode> displayRecordList) {
325         this.displayRecordList = displayRecordList;
326     }
327 
328 
329 
330 
331 
332     public void clearFormFields() {
333         this.setId("");
334         this.setAuthor("");
335         this.setTitle("");
336         this.setDescription("");
337         this.setPublicationDate("");
338         this.setBarcode("");
339     }
340 
341     public boolean isSelected() {
342         return isSelected;
343     }
344 
345     public void setSelected(boolean selected) {
346         isSelected = selected;
347     }
348 
349     public String getStatus() {
350         return status;
351     }
352 
353     public void setStatus(String status) {
354         this.status = status;
355     }
356 
357     public Tree<BoundwithSelection, String> getBibTree1() {
358         return bibTree1;
359     }
360 
361     public void setBibTree1(Tree<BoundwithSelection, String> bibTree1) {
362         this.bibTree1 = bibTree1;
363     }
364 
365     public Tree<BoundwithSelection, String> getBibTree2() {
366         return bibTree2;
367     }
368 
369     public void setBibTree2(Tree<BoundwithSelection, String> bibTree2) {
370         this.bibTree2 = bibTree2;
371     }
372 
373     public Tree<BoundwithSelection, String> getBoundWithTree() {
374         return boundWithTree;
375     }
376 
377     public void setBoundWithTree(Tree<BoundwithSelection, String> boundWithTree) {
378         this.boundWithTree = boundWithTree;
379     }
380 
381     public Map<String, String> getInstanceMap() {
382         return instanceMap;
383     }
384 
385     public void setInstanceMap(Map<String, String> instanceMap) {
386         this.instanceMap = instanceMap;
387     }
388 
389     public String getBoundwithTreeLabelText() {
390         return boundwithTreeLabelText;
391     }
392 
393     public void setBoundwithTreeLabelText(String boundwithTreeLabelText) {
394         this.boundwithTreeLabelText = boundwithTreeLabelText;
395     }
396 
397     public boolean isSelectBoundwithTree() {
398         return selectBoundwithTree;
399     }
400 
401     public void setSelectBoundwithTree(boolean selectBoundwithTree) {
402         this.selectBoundwithTree = selectBoundwithTree;
403     }
404 
405     public boolean isSelect() {
406         return select;
407     }
408 
409     public void setSelect(boolean select) {
410         this.select = select;
411     }
412 
413     public Map<String, String> getBibMap() {
414         return bibMap;
415     }
416 
417     public void setBibMap(Map<String, String> bibMap) {
418         this.bibMap = bibMap;
419     }
420 
421     public Tree<DocumentTreeNode, String> getLeftTree() {
422         return leftTree;
423     }
424 
425     public void setLeftTree(Tree<DocumentTreeNode, String> leftTree) {
426         this.leftTree = leftTree;
427     }
428 
429     public Tree<DocumentTreeNode, String> getRightTree() {
430         return rightTree;
431     }
432 
433     public void setRightTree(Tree<DocumentTreeNode, String> rightTree) {
434         this.rightTree = rightTree;
435     }
436 
437     public Tree<DocumentTreeNode, String> getBoundwithTree() {
438         return boundwithTree;
439     }
440 
441     public void setBoundwithTree(Tree<DocumentTreeNode, String> boundwithTree) {
442         this.boundwithTree = boundwithTree;
443     }
444 }