1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.web.struts.form; |
17 | |
|
18 | |
import java.util.ArrayList; |
19 | |
import java.util.List; |
20 | |
import java.util.Map; |
21 | |
|
22 | |
import javax.servlet.http.HttpServletRequest; |
23 | |
|
24 | |
import org.apache.commons.lang.StringUtils; |
25 | |
import org.apache.log4j.Logger; |
26 | |
import org.kuali.rice.kim.util.KimConstants; |
27 | |
import org.kuali.rice.kns.bo.Parameter; |
28 | |
import org.kuali.rice.kns.service.KNSServiceLocator; |
29 | |
import org.kuali.rice.kns.util.KNSConstants; |
30 | |
import org.kuali.rice.kns.util.PagingBannerUtils; |
31 | |
import org.kuali.rice.kns.web.struts.form.KualiTableRenderFormMetadata; |
32 | |
import org.kuali.rice.kns.web.struts.form.KualiTransactionalDocumentFormBase; |
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | |
|
38 | |
|
39 | |
|
40 | |
@SuppressWarnings("serial") |
41 | 0 | public abstract class IdentityManagementDocumentFormBase extends KualiTransactionalDocumentFormBase { |
42 | 0 | protected static final Logger LOG = Logger.getLogger(IdentityManagementDocumentFormBase.class); |
43 | |
protected static final String MAX_MEMBERS_PER_PAGE_PARM = "MAX_MEMBERS_PER_PAGE"; |
44 | |
protected transient KualiTableRenderFormMetadata memberTableMetadata; |
45 | 0 | protected int recordsPerPage = -1; |
46 | 0 | protected boolean inquiry = false; |
47 | |
|
48 | |
protected static final String CHANGE_NAMESPACE_METHOD_TO_CALL = "methodToCall.changeNamespace"; |
49 | |
protected static final String CHANGE_MEMBER_TYPE_CODE_METHOD_TO_CALL = "methodToCall.changeMemberTypeCode"; |
50 | |
protected static final String CHANGE_DEL_ROLE_MEMBER_METHOD_TO_CALL = "methodToCall.changeDelegationRoleMember"; |
51 | |
|
52 | |
|
53 | |
|
54 | |
|
55 | |
@SuppressWarnings("unchecked") |
56 | |
@Override |
57 | |
public void populate(HttpServletRequest request) { |
58 | 0 | super.populate(request); |
59 | |
|
60 | 0 | memberTableMetadata = new KualiTableRenderFormMetadata(); |
61 | |
|
62 | 0 | if (KNSConstants.TableRenderConstants.SWITCH_TO_PAGE_METHOD.equals(getMethodToCall())) { |
63 | 0 | final String paramPrefix = KNSConstants.DISPATCH_REQUEST_PARAMETER + "." + KNSConstants.TableRenderConstants.SWITCH_TO_PAGE_METHOD + "."; |
64 | 0 | memberTableMetadata.setSwitchToPageNumber(PagingBannerUtils.getNumbericalValueAfterPrefix(paramPrefix, request.getParameterNames())); |
65 | 0 | if (memberTableMetadata.getSwitchToPageNumber() == -1) { |
66 | 0 | throw new RuntimeException("Couldn't find page number"); |
67 | |
} |
68 | |
} |
69 | 0 | } |
70 | |
|
71 | |
public KualiTableRenderFormMetadata getMemberTableMetadata() { |
72 | 0 | return this.memberTableMetadata; |
73 | |
} |
74 | |
|
75 | |
public void setMemberTableMetadata( |
76 | |
KualiTableRenderFormMetadata memberTableMetadata) { |
77 | 0 | this.memberTableMetadata = memberTableMetadata; |
78 | 0 | } |
79 | |
|
80 | |
public int getRecordsPerPage() { |
81 | 0 | if ( recordsPerPage == -1 ) { |
82 | 0 | Parameter param = KNSServiceLocator.getParameterService().retrieveParameter(KimConstants.NAMESPACE_CODE, KNSConstants.DetailTypes.DOCUMENT_DETAIL_TYPE, MAX_MEMBERS_PER_PAGE_PARM); |
83 | 0 | if ( param != null ) { |
84 | |
try { |
85 | 0 | recordsPerPage = Integer.parseInt( param.getParameterValue() ); |
86 | 0 | } catch ( NumberFormatException ex ) { |
87 | 0 | LOG.error( "Unable to parse parameter " + KimConstants.NAMESPACE_CODE+"/"+KNSConstants.DetailTypes.DOCUMENT_DETAIL_TYPE+"/"+MAX_MEMBERS_PER_PAGE_PARM + "(+"+param.getParameterValue()+") as an int - defaulting to 1." ); |
88 | 0 | recordsPerPage = 1; |
89 | 0 | } |
90 | |
} else { |
91 | 0 | LOG.error( "Unable to find " + KimConstants.NAMESPACE_CODE+"/"+KNSConstants.DetailTypes.DOCUMENT_DETAIL_TYPE+"/"+MAX_MEMBERS_PER_PAGE_PARM + " - defaulting to 1." ); |
92 | 0 | recordsPerPage = 1; |
93 | |
} |
94 | |
} |
95 | 0 | return recordsPerPage; |
96 | |
} |
97 | |
|
98 | |
|
99 | |
public boolean isCanExport() { |
100 | 0 | return false; |
101 | |
} |
102 | |
|
103 | |
@SuppressWarnings("unchecked") |
104 | |
public List getMemberRows() { |
105 | 0 | return new ArrayList(); |
106 | |
} |
107 | |
|
108 | |
|
109 | |
|
110 | |
|
111 | |
public boolean isInquiry() { |
112 | 0 | return this.inquiry; |
113 | |
} |
114 | |
|
115 | |
|
116 | |
|
117 | |
|
118 | |
public void setInquiry(boolean inquiry) { |
119 | 0 | this.inquiry = inquiry; |
120 | 0 | } |
121 | |
} |