001 /*
002 * Copyright 2007-2009 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 */
016 package org.kuali.rice.kim.lookup;
017
018 import java.util.Properties;
019
020 import org.apache.commons.lang.StringUtils;
021 import org.kuali.rice.kew.util.KEWConstants;
022 import org.kuali.rice.kim.bo.types.impl.KimTypeImpl;
023 import org.kuali.rice.kim.util.KimConstants;
024 import org.kuali.rice.kns.lookup.KualiLookupableImpl;
025 import org.kuali.rice.kns.util.KNSConstants;
026 import org.kuali.rice.kns.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 */
034 public 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 Properties parameters = new Properties();
043 parameters.put(KNSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, KimTypeImpl.class.getName());
044 //parameters.put(KNSConstants.RETURN_LOCATION_PARAMETER, KNSConstants.PORTAL_ACTION);
045 parameters.put(KNSConstants.PARAMETER_COMMAND, KEWConstants.INITIATE_COMMAND);
046 parameters.put(KNSConstants.DOC_FORM_KEY, KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY);
047 if (StringUtils.isNotBlank(getReturnLocation())) {
048 parameters.put(KNSConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
049 }
050 url = getCreateNewUrl(UrlFactory.parameterizeUrl(KNSConstants.LOOKUP_ACTION, parameters));
051 //String url = "lookup.do?businessObjectClassName=org.kuali.rice.kim.bo.types.impl.KimTypeImpl&returnLocation=portal.do&docFormKey="+KimConstants.KimUIConstants.KIM_ROLE_DOCUMENT_SHORT_KEY;
052 }
053 return url;
054 }
055
056 }