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