View Javadoc
1   /**
2    * Copyright 2005-2016 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.impl.responsibility;
17  
18  import org.apache.commons.lang.StringUtils;
19  import org.kuali.rice.kim.api.KimConstants;
20  import org.kuali.rice.kns.lookup.KualiLookupableImpl;
21  import org.kuali.rice.krad.util.KRADConstants;
22  import org.kuali.rice.krad.util.UrlFactory;
23  
24  import java.util.Properties;
25  
26  public class ResponsibilityLookupableImpl extends KualiLookupableImpl {
27  
28      @Override
29      public String getCreateNewUrl() {
30          String url = "";
31  
32          if (getLookupableHelperService().allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_REVIEW_RESPONSIBILITY_DOCUMENT_TYPE_NAME)) {
33              Properties parameters = new Properties();
34              parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.MAINTENANCE_NEW_METHOD_TO_CALL);
35              parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, ReviewResponsibilityBo.class.getName());
36              if (StringUtils.isNotBlank(getReturnLocation())) {
37                  parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
38              }
39              url = UrlFactory.parameterizeUrl(KRADConstants.MAINTENANCE_ACTION, parameters);
40              url = "<a title=\"Create a new record\" href=\"" + url + "\"><img src=\"images/tinybutton-createnew.gif\" alt=\"create new\" width=\"70\" height=\"15\"/></a>";
41          }
42  
43          return url;
44      }
45  }