001/** 002 * Copyright 2005-2016 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kim.lookup; 017 018import java.util.Properties; 019 020import org.apache.commons.lang.StringUtils; 021import org.kuali.rice.kew.api.KewApiConstants; 022import org.kuali.rice.kim.api.KimConstants; 023import org.kuali.rice.kim.impl.type.KimTypeBo; 024import org.kuali.rice.kns.lookup.KualiLookupableImpl; 025import org.kuali.rice.krad.util.KRADConstants; 026import org.kuali.rice.krad.util.UrlFactory; 027 028/** 029 * This is a description of what this class does - shyu don't forget to fill this in. 030 * 031 * @author Kuali Rice Team (rice.collab@kuali.org) 032 * 033 */ 034public class RoleLookupableImpl extends KualiLookupableImpl { 035 036 private static final long serialVersionUID = -543816772634893348L; 037 038 @Override 039 public String getCreateNewUrl() { 040 String url = ""; 041 if((getLookupableHelperService()).allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_TYPE_NAME)){ 042 // we can use this if we want to go directly to the main document in the future 043// Properties parameters = new Properties(); 044// parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD); 045// parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.INITIATE_COMMAND); 046// parameters.put(KRADConstants.DOCUMENT_TYPE_NAME, KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_TYPE_NAME); 047// if (StringUtils.isNotBlank(getReturnLocation())) { 048// parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation()); 049// } 050// url = getCreateNewUrl(UrlFactory.parameterizeUrl( 051// KimCommonUtilsInternal.getKimBasePath()+ KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_ACTION, parameters)); 052 Properties parameters = new Properties(); 053 parameters.put(KRADConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, KimTypeBo.class.getName()); 054 //parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, KRADConstants.PORTAL_ACTION); 055 parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.INITIATE_COMMAND); 056 parameters.put(KRADConstants.DOC_FORM_KEY, KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY); 057 if (StringUtils.isNotBlank(getReturnLocation())) { 058 parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation()); 059 } 060 url = getCreateNewUrl(UrlFactory.parameterizeUrl(KRADConstants.LOOKUP_ACTION, parameters)); 061 //String url = "lookup.do?businessObjectClassName=org.kuali.rice.kim.bo.types.impl.KimTypeImpl&returnLocation=portal.do&docFormKey="+KimApiConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY; 062 } 063 return url; 064 } 065 066}