001    /**
002     * Copyright 2005-2012 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 org.apache.commons.lang.StringUtils;
019    import org.kuali.rice.kew.api.KewApiConstants;
020    import org.kuali.rice.kim.api.KimConstants;
021    import org.kuali.rice.kim.util.KimCommonUtilsInternal;
022    import org.kuali.rice.kns.lookup.KualiLookupableImpl;
023    import org.kuali.rice.krad.util.KRADConstants;
024    import org.kuali.rice.krad.util.UrlFactory;
025    
026    import 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     */
034    public class GroupLookupableImpl extends KualiLookupableImpl {
035    
036        private static final long serialVersionUID = -7862240710174441633L;
037    
038        public String getCreateNewUrl() {
039            String url = "";
040            if((getLookupableHelperService()).allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_TYPE_NAME)){
041                Properties parameters = new Properties();
042                    parameters.put(KRADConstants.DISPATCH_REQUEST_PARAMETER, KRADConstants.DOC_HANDLER_METHOD);
043                    parameters.put(KRADConstants.PARAMETER_COMMAND, KewApiConstants.INITIATE_COMMAND);
044                    parameters.put(KRADConstants.DOCUMENT_TYPE_NAME, KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_TYPE_NAME);
045                    if (StringUtils.isNotBlank(getReturnLocation())) {
046                            parameters.put(KRADConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
047                            }
048                url = getCreateNewUrl(UrlFactory.parameterizeUrl(
049                            KimCommonUtilsInternal.getKimBasePath()+ KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_ACTION, parameters));
050            }
051            return url;
052        }
053    
054    }