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.impl.GenericPermission;
023    import org.kuali.rice.kim.bo.impl.GroupImpl;
024    import org.kuali.rice.kim.bo.types.impl.KimTypeImpl;
025    import org.kuali.rice.kim.util.KimCommonUtils;
026    import org.kuali.rice.kim.util.KimConstants;
027    import org.kuali.rice.kns.lookup.KualiLookupableImpl;
028    import org.kuali.rice.kns.util.KNSConstants;
029    import org.kuali.rice.kns.util.UrlFactory;
030    
031    /**
032     * This is a description of what this class does - shyu don't forget to fill this in. 
033     * 
034     * @author Kuali Rice Team (rice.collab@kuali.org)
035     *
036     */
037    public class GroupLookupableImpl extends KualiLookupableImpl {
038    
039        private static final long serialVersionUID = -7862240710174441633L;
040    
041        public String getCreateNewUrl() {
042            String url = "";
043            if((getLookupableHelperService()).allowsNewOrCopyAction(KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_TYPE_NAME)){
044                Properties parameters = new Properties();
045                    parameters.put(KNSConstants.DISPATCH_REQUEST_PARAMETER, KNSConstants.DOC_HANDLER_METHOD);
046                    parameters.put(KNSConstants.PARAMETER_COMMAND, KEWConstants.INITIATE_COMMAND);
047                    parameters.put(KNSConstants.DOCUMENT_TYPE_NAME, KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_TYPE_NAME);
048                    if (StringUtils.isNotBlank(getReturnLocation())) {
049                            parameters.put(KNSConstants.RETURN_LOCATION_PARAMETER, getReturnLocation());
050                            }
051                url = getCreateNewUrl(UrlFactory.parameterizeUrl(
052                            KimCommonUtils.getKimBasePath()+KimConstants.KimUIConstants.KIM_GROUP_DOCUMENT_ACTION, parameters));                            
053            }
054            return url;
055        }
056    
057    }