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.rice.krad.uif.component.Component;
7 import org.kuali.rice.krad.uif.container.Group;
8 import org.kuali.rice.krad.uif.util.ObjectPropertyUtils;
9 import org.kuali.rice.krad.uif.view.View;
10
11 import java.util.Iterator;
12 import java.util.List;
13
14
15
16
17
18
19
20
21 public class OleGroup extends Group {
22 private static final Logger LOG = Logger
23 .getLogger(OleGroup.class);
24
25 private static String ALTER_DUE_DATE_ID = "AlterDueDateSection-HorizontalBoxSection";
26
27 private static String RENEWAL_ID = "RenewalDueDateSection-HorizontalBoxSection";
28
29 private static String PROXY_PATRON_ID = "RealPatronSection-HorizontalBoxSection";
30
31 private static String DAMAGED_ITEM_ID = "DamagedItem-HorizontalBoxSection";
32
33 private static String MISSING_PIECE_ID = "MissingPiece-HorizontalBoxSection";
34
35 private static String CLAIMS_RETURN_ID = "ClaimsReturn-HorizontalBoxSection";
36
37 private static String OVERRIDE_LOGIN = "OverRideLogInSectionLink";
38
39 private static String PATRON_NOTE_ID = "PatronUserNote-HorizontalBoxSection";
40
41 private static String CONFIRM_CIRULATION_LOCATION = "ConfirmCirculationLocationChange";
42
43 private static String MISSING_PIECE_RECORD_NOTE = "OLELoanView-RecordNote-MissingPiece-MessageBox";
44
45 private static String DAMAGED_RECORD_NOTE = "OLELoanView-RecordNote-Damaged-MessageBox";
46
47 private static String LOAN_CLAIMS_OPTIONS = "loanClaimsOption";
48
49
50
51
52
53
54
55
56
57
58
59
60
61 @Override
62 public void performInitialization(View view, Object form) {
63
64 super.performInitialization(view, form);
65
66 boolean alterDueDate = ((OleLoanForm) form).isAlterDueDateFlag();
67 boolean renewDueDateFlag = ((OleLoanForm) form).isRenewDueDateFlag();
68 boolean realPatronFlag = ((OleLoanForm) form).isRealPatronFlag();
69 boolean missingPieceDialog = ((OleLoanForm) form).isMissingPieceDialog();
70 boolean damagedItemDialog = ((OleLoanForm) form).isDamagedItemDialog();
71 boolean claimsReturnFlag = ((OleLoanForm) form).isClaimsReturnFlag();
72 boolean overrideFlag = ((OleLoanForm) form).isOverrideFlag();
73 boolean patronNoteFlag = ((OleLoanForm) form).isPatronNoteFlag();
74 boolean changeLocationFlag = ((OleLoanForm) form).isChangeLocationFlag();
75 boolean displayMissingPieceNotePopup = ((OleLoanForm) form).isDisplayMissingPieceNotePopup();
76 boolean displayDamagedRecordNotePopup = ((OleLoanForm) form).isDisplayDamagedRecordNotePopup();
77 boolean claimsFlag = ((OleLoanForm) form).isClaimsFlag();
78 LOG.info("alterDueDate " + alterDueDate);
79 List<? extends Component> items = getItems();
80 Iterator<? extends Component> itemIterator = items.iterator();
81 while (itemIterator.hasNext()) {
82 Component component = itemIterator.next();
83 if (component == null) {
84 continue;
85 }
86
87 LOG.info("checking component " + component.getId());
88
89
90 if (ALTER_DUE_DATE_ID.equals(component.getId())
91 && !alterDueDate) {
92 LOG.info("Omitting "+component.getId()+" from lifecycle");
93 itemIterator.remove();
94 }else if(RENEWAL_ID.equals(component.getId())
95 && !renewDueDateFlag){
96 LOG.info("Omitting "+component.getId()+" from lifecycle");
97 itemIterator.remove();
98 }else if(PROXY_PATRON_ID.equals(component.getId())
99 && !realPatronFlag){
100 LOG.info("Omitting "+component.getId()+" from lifecycle");
101 itemIterator.remove();
102 }else if(DAMAGED_ITEM_ID.equals(component.getId())
103 && !damagedItemDialog){
104 LOG.info("Omitting "+component.getId()+" from lifecycle");
105 itemIterator.remove();
106 }else if(MISSING_PIECE_ID.equals(component.getId())
107 && !missingPieceDialog){
108 LOG.info("Omitting "+component.getId()+" from lifecycle");
109 itemIterator.remove();
110 }else if(CLAIMS_RETURN_ID.equals(component.getId())
111 && !claimsReturnFlag){
112 LOG.info("Omitting "+component.getId()+" from lifecycle");
113 itemIterator.remove();
114 }else if(OVERRIDE_LOGIN.equals(component.getId())
115 && !overrideFlag){
116 LOG.info("Omitting "+component.getId()+" from lifecycle");
117 itemIterator.remove();
118 }else if(PATRON_NOTE_ID.equals(component.getId())
119 && !patronNoteFlag){
120 LOG.info("Omitting "+component.getId()+" from lifecycle");
121 itemIterator.remove();
122 }else if(CONFIRM_CIRULATION_LOCATION.equals(component.getId())
123 && !changeLocationFlag){
124 LOG.info("Omitting "+component.getId()+" from lifecycle");
125 itemIterator.remove();
126 }else if(MISSING_PIECE_RECORD_NOTE.equals(component.getId())
127 && !displayMissingPieceNotePopup){
128 LOG.info("Omitting "+component.getId()+" from lifecycle");
129 itemIterator.remove();
130 }else if(DAMAGED_RECORD_NOTE.equals(component.getId())
131 && !displayDamagedRecordNotePopup){
132 LOG.info("Omitting "+component.getId()+" from lifecycle");
133 itemIterator.remove();
134 }else if(LOAN_CLAIMS_OPTIONS.equals(component.getId())
135 && !claimsFlag){
136 LOG.info("Omitting "+component.getId()+" from lifecycle");
137 itemIterator.remove();
138 }
139 }
140 }
141
142
143
144 }