View Javadoc
1   package org.kuali.ole.deliver;
2   
3   import org.apache.log4j.Logger;
4   import org.kuali.ole.deliver.form.OleLoanForm;
5   import org.kuali.ole.describe.form.EditorForm;
6   import org.kuali.ole.krad.OleComponent;
7   import org.kuali.ole.krad.OleComponentUtils;
8   import org.kuali.rice.krad.uif.component.Component;
9   import org.kuali.rice.krad.uif.container.Group;
10  import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
11  import org.kuali.rice.krad.uif.view.View;
12  
13  import java.util.Iterator;
14  import java.util.List;
15  
16  /**
17   * Created with IntelliJ IDEA.
18   * User: palanivel
19   * Date: 4/29/14
20   * Time: 3:55 PM
21   * To change this template use File | Settings | File Templates.
22   */
23  public class OleGroup extends Group {
24      private static final Logger LOG = Logger
25              .getLogger(OleGroup.class);
26  
27      private static String ALTER_DUE_DATE_ID = "AlterDueDateSection-HorizontalBoxSection";
28  
29      private static String RENEWAL_ID = "RenewalDueDateSection-HorizontalBoxSection";
30  
31      private static String PROXY_PATRON_ID = "RealPatronSection-HorizontalBoxSection";
32  
33      private static String DAMAGED_ITEM_ID = "DamagedItem-HorizontalBoxSection";
34  
35      private static String MISSING_PIECE_ID = "MissingPiece-HorizontalBoxSection";
36  
37      private static String CLAIMS_RETURN_ID = "ClaimsReturn-HorizontalBoxSection";
38  
39      private static String OVERRIDE_LOGIN = "OverRideLogInSectionLink";
40  
41      private static String PATRON_NOTE_ID = "PatronUserNote-HorizontalBoxSection";
42  
43      private static String CONFIRM_CIRULATION_LOCATION = "ConfirmCirculationLocationChange";
44  
45      private static String MISSING_PIECE_RECORD_NOTE = "OLELoanView-RecordNote-MissingPiece-MessageBox";
46  
47      private static String DAMAGED_RECORD_NOTE = "OLELoanView-RecordNote-Damaged-MessageBox";
48  
49      private static String LOAN_CLAIMS_OPTIONS = "loanClaimsOption";
50  
51      private static String INVALID_BARCODE_ID = "InvalidBarcode-MessageBox";
52  
53      /**
54       * The following actions are performed:
55       *
56       * <ul>
57       * <li>Sets the bindByNamePrefix if blank on any InputField and
58       * FieldGroup instances within the items List</li>
59       * </ul>
60       *
61       * @see org.kuali.rice.krad.uif.component.ComponentBase#performInitialization(org.kuali.rice.krad.uif.view.View,
62       *      java.lang.Object)
63       */
64      @Override
65      public void performInitialization(View view, Object form) {
66  
67          super.performInitialization(view, form);
68  
69  //        boolean alterDueDate = ((OleLoanForm) form).isAlterDueDateFlag();
70  //        boolean renewDueDateFlag = ((OleLoanForm) form).isRenewDueDateFlag();
71  //        boolean realPatronFlag =  ((OleLoanForm) form).isRealPatronFlag();
72  //        boolean missingPieceDialog = ((OleLoanForm) form).isMissingPieceDialog();
73  //        boolean damagedItemDialog =  ((OleLoanForm) form).isDamagedItemDialog();
74  //        boolean claimsReturnFlag = ((OleLoanForm) form).isClaimsReturnFlag();
75  //        boolean overrideFlag = ((OleLoanForm) form).isOverrideFlag();
76  //        boolean patronNoteFlag = ((OleLoanForm) form).isPatronNoteFlag();
77  //        boolean changeLocationFlag = ((OleLoanForm) form).isChangeLocationFlag();
78  //        boolean displayMissingPieceNotePopup = ((OleLoanForm) form).isDisplayMissingPieceNotePopup();
79  //        boolean displayDamagedRecordNotePopup = ((OleLoanForm) form).isDisplayDamagedRecordNotePopup();
80  //        boolean claimsFlag = ((OleLoanForm) form).isClaimsFlag();
81  //        LOG.info("alterDueDate " + alterDueDate);
82  //        List<? extends Component> items = getItems();
83  //        Iterator<? extends Component> itemIterator = items.iterator();
84  //        while (itemIterator.hasNext()) {
85  //            Component component = itemIterator.next();
86  //            if (component == null) {
87  //                continue;
88  //            }
89  //
90  //            LOG.info("checking component " + component.getId());
91  //
92  //
93  //            if (ALTER_DUE_DATE_ID.equals(component.getId())
94  //                    && !alterDueDate) {
95  //                LOG.info("Omitting "+component.getId()+" from lifecycle");
96  //                itemIterator.remove();
97  //            }else if(RENEWAL_ID.equals(component.getId())
98  //                    && !renewDueDateFlag){
99  //                LOG.info("Omitting "+component.getId()+" from lifecycle");
100 //                itemIterator.remove();
101 //            }else if(PROXY_PATRON_ID.equals(component.getId())
102 //                    && !realPatronFlag){
103 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
104 //                itemIterator.remove();
105 //            }else if(DAMAGED_ITEM_ID.equals(component.getId())
106 //                    && !damagedItemDialog){
107 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
108 //                itemIterator.remove();
109 //            }else if(MISSING_PIECE_ID.equals(component.getId())
110 //                    && !missingPieceDialog){
111 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
112 //                itemIterator.remove();
113 //            }else if(CLAIMS_RETURN_ID.equals(component.getId())
114 //                    && !claimsReturnFlag){
115 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
116 //                itemIterator.remove();
117 //            }else if(OVERRIDE_LOGIN.equals(component.getId())
118 //                    && !overrideFlag){
119 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
120 //                itemIterator.remove();
121 //            }else if(PATRON_NOTE_ID.equals(component.getId())
122 //                    && !patronNoteFlag){
123 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
124 //                itemIterator.remove();
125 //            }else if(CONFIRM_CIRULATION_LOCATION.equals(component.getId())
126 //                    && !changeLocationFlag){
127 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
128 //                itemIterator.remove();
129 //            }else if(MISSING_PIECE_RECORD_NOTE.equals(component.getId())
130 //                    && !displayMissingPieceNotePopup){
131 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
132 //                itemIterator.remove();
133 //            }else if(DAMAGED_RECORD_NOTE.equals(component.getId())
134 //                    && !displayDamagedRecordNotePopup){
135 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
136 //                itemIterator.remove();
137 //            }else if(LOAN_CLAIMS_OPTIONS.equals(component.getId())
138 //                    && !claimsFlag){
139 //                LOG.info("Omitting "+component.getId()+" from lifecycle");
140 //                itemIterator.remove();
141 //            }
142 //        }
143     }
144 
145 	/**
146 	 * Filters {@link OleComponent} instances based on
147 	 * {@link OleComponent#getFilterModelProperty()}, if the current model is
148 	 * available.
149 	 */
150 	@Override
151 	protected <T> void copyProperties(T component) {
152 		List<? extends Component> srcitems = getItems();
153 		
154 		// prevent super() from copying items
155 		setItems(null);
156 		super.copyProperties(component);
157 		setItems(srcitems);
158 		
159 		Group groupCopy = (Group) component;
160 		groupCopy.setItems(OleComponentUtils.filterItems(srcitems));
161 	}
162 
163 }