1 /**
2 * Copyright 2005-2015 The Kuali Foundation
3 *
4 * Licensed under the Educational Community License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.opensource.org/licenses/ecl2.php
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.kuali.rice.kim.lookup;
17
18 import java.util.Properties;
19
20 import org.apache.commons.lang.StringUtils;
21 import org.kuali.rice.kew.api.KewApiConstants;
22 import org.kuali.rice.kim.api.KimConstants;
23 import org.kuali.rice.kim.impl.type.KimTypeBo;
24 import org.kuali.rice.kns.lookup.KualiLookupableImpl;
25 import org.kuali.rice.krad.util.KRADConstants;
26 import org.kuali.rice.krad.util.UrlFactory;
27
28 /**
29 * This is a description of what this class does - shyu don't forget to fill this in.
30 *
31 * @author Kuali Rice Team (rice.collab@kuali.org)
32 *
33 */
34 public class RoleLookupableImpl extends KualiLookupableImpl {
35
36 private static final long serialVersionUID = -543816772634893348L;
37
38 @Override
39 public String getCreateNewUrl() {
40 String url = "";
41 if((getLookupableHelperService()).allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_TYPE_NAME)){
42 // we can use this if we want to go directly to the main document in the future
43 // Properties parameters = new Properties();
44 // parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD);
45 // parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.INITIATE_COMMAND);
46 // parameters.put(KRADConstants.DOCUMENT_TYPE_NAME, KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_TYPE_NAME);
47 // if (StringUtils.isNotBlank(getReturnLocation())) {
48 // parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
49 // }
50 // url = getCreateNewUrl(UrlFactory.parameterizeUrl(
51 // KimCommonUtilsInternal.getKimBasePath()+ KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_ACTION, parameters));
52 Properties parameters = new Properties();
53 parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, KimTypeBo.class.getName());
54 //parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, KRADConstants.PORTAL_ACTION);
55 parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.INITIATE_COMMAND);
56 parameters.put(KRADConstants.DOC_FORM_KEY, KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY);
57 if (StringUtils.isNotBlank(getReturnLocation())) {
58 parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
59 }
60 url = getCreateNewUrl(UrlFactory.parameterizeUrl(KRADConstants.LOOKUP_ACTION, parameters));
61 //String url = "lookup.do?businessObjectClassName=org.kuali.rice.kim.bo.types.impl.KimTypeImpl&returnLocation=portal.do&docFormKey="+KimApiConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY;
62 }
63 return url;
64 }
65
66 }