View Javadoc

1   /**
2    * Copyright 2005-2014 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 org.apache.commons.lang.StringUtils;
19  import org.kuali.rice.kew.api.KewApiConstants;
20  import org.kuali.rice.kim.api.KimConstants;
21  import org.kuali.rice.kim.util.KimCommonUtilsInternal;
22  import org.kuali.rice.kns.lookup.KualiLookupableImpl;
23  import org.kuali.rice.krad.util.KRADConstants;
24  import org.kuali.rice.krad.util.UrlFactory;
25  
26  import java.util.Properties;
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 GroupLookupableImpl extends KualiLookupableImpl {
35  
36      private static final long serialVersionUID = -7862240710174441633L;
37  
38      public String getCreateNewUrl() {
39          String url = "";
40          if((getLookupableHelperService()).allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_TYPE_NAME)){
41              Properties parameters = new Properties();
42  	        parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD);
43  	        parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.INITIATE_COMMAND);
44  	        parameters.put(KRADConstants.DOCUMENT_TYPE_NAME, KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_TYPE_NAME);
45  	        if (StringUtils.isNotBlank(getReturnLocation())) {
46  	        	parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
47  	        	}
48              url = getCreateNewUrl(UrlFactory.parameterizeUrl(
49              		KimCommonUtilsInternal.getKimBasePath()+ KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_ACTION, parameters));
50          }
51          return url;
52      }
53  
54  }