1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kim.lookup; |
17 | |
|
18 | |
import java.util.Properties; |
19 | |
import org.apache.commons.lang.StringUtils; |
20 | |
|
21 | |
import org.kuali.rice.kew.util.KEWConstants; |
22 | |
import org.kuali.rice.kim.service.KIMServiceLocatorInternal; |
23 | |
import org.kuali.rice.kim.service.UiDocumentService; |
24 | |
import org.kuali.rice.kim.util.KimCommonUtilsInternal; |
25 | |
import org.kuali.rice.kim.util.KimConstants; |
26 | |
import org.kuali.rice.kns.lookup.KualiLookupableImpl; |
27 | |
import org.kuali.rice.kns.util.GlobalVariables; |
28 | |
import org.kuali.rice.kns.util.KNSConstants; |
29 | |
import org.kuali.rice.kns.util.UrlFactory; |
30 | |
|
31 | |
|
32 | |
|
33 | |
|
34 | |
|
35 | |
|
36 | |
|
37 | 0 | public class PersonLookupableImpl extends KualiLookupableImpl { |
38 | |
|
39 | |
private UiDocumentService uiDocumentService; |
40 | |
private static final long serialVersionUID = 1707861010746829601L; |
41 | |
|
42 | |
@Override |
43 | |
public String getCreateNewUrl() { |
44 | 0 | String url = ""; |
45 | 0 | if((getLookupableHelperService()).allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_PERSON_DOCUMENT_TYPE_NAME) |
46 | |
&& getUiDocumentService().canModifyEntity(GlobalVariables.getUserSession().getPrincipalId(), null)){ |
47 | 0 | Properties parameters = new Properties(); |
48 | 0 | parameters.put(KNSConstants.DISPATCH_REQUEST_PARAMETER, KNSConstants.DOC_HANDLER_METHOD); |
49 | 0 | parameters.put(KNSConstants.PARAMETER_COMMAND, KEWConstants.INITIATE_COMMAND); |
50 | 0 | parameters.put(KNSConstants.DOCUMENT_TYPE_NAME, KimConstants.KimUIConstants.KIM_PERSON_DOCUMENT_TYPE_NAME); |
51 | 0 | if (StringUtils.isNotBlank(getReturnLocation())) { |
52 | 0 | parameters.put(KNSConstants.RETURN_LOCATION_PARAMETER, getReturnLocation()); |
53 | |
} |
54 | 0 | url = getCreateNewUrl(UrlFactory.parameterizeUrl( |
55 | |
KimCommonUtilsInternal.getKimBasePath()+KimConstants.KimUIConstants.KIM_PERSON_DOCUMENT_ACTION, parameters)); |
56 | |
|
57 | |
|
58 | |
|
59 | |
} |
60 | 0 | return url; |
61 | |
} |
62 | |
|
63 | |
public UiDocumentService getUiDocumentService() { |
64 | 0 | if ( uiDocumentService == null ) { |
65 | 0 | uiDocumentService = KIMServiceLocatorInternal.getUiDocumentService(); |
66 | |
} |
67 | 0 | return uiDocumentService; |
68 | |
} |
69 | |
|
70 | |
} |