Coverage Report - org.kuali.rice.edl.impl.lookupable.EDocLiteLookupableHelperServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
EDocLiteLookupableHelperServiceImpl
0%
0/13
N/A
1
 
 1  
 /*
 2  
  * Copyright 2006-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 15  
  */
 16  
 
 17  
 package org.kuali.rice.edl.impl.lookupable;
 18  
 
 19  
 import org.kuali.rice.core.api.config.property.ConfigContext;
 20  
 import org.kuali.rice.edl.impl.UserAction;
 21  
 import org.kuali.rice.edl.impl.bo.EDocLiteAssociation;
 22  
 import org.kuali.rice.kns.lookup.HtmlData;
 23  
 import org.kuali.rice.kns.lookup.KualiLookupableHelperServiceImpl;
 24  
 import org.kuali.rice.kns.web.struts.form.LookupForm;
 25  
 import org.kuali.rice.krad.bo.BusinessObject;
 26  
 import org.kuali.rice.krad.util.UrlFactory;
 27  
 
 28  
 import java.util.ArrayList;
 29  
 import java.util.Collection;
 30  
 import java.util.List;
 31  
 import java.util.Properties;
 32  
 
 33  
 /**
 34  
  * This is a description of what this class does - sp20369 don't forget to fill this in.
 35  
  *
 36  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 37  
  *
 38  
  */
 39  
 
 40  0
 public class EDocLiteLookupableHelperServiceImpl  extends KualiLookupableHelperServiceImpl { //KualiLookupableHelperServiceImpl {
 41  
 
 42  
     private static final long serialVersionUID = 3157354920258155881L;
 43  
 
 44  
         /**
 45  
      * @returns links to "Create Document" action for the current edoclite
 46  
      */
 47  
         @Override
 48  
         public List<HtmlData> getCustomActionUrls(BusinessObject businessObject, List pkNames) {
 49  0
                 List<HtmlData> anchorHtmlDataList = new ArrayList<HtmlData>();
 50  0
             anchorHtmlDataList.add(getCreateDocumentUrl((EDocLiteAssociation) businessObject));        
 51  0
             return anchorHtmlDataList;
 52  
         }
 53  
         
 54  
     protected HtmlData getCreateDocumentUrl(EDocLiteAssociation edlAssociation) {
 55  0
             String href = "";
 56  
 
 57  0
         Properties parameters = new Properties();
 58  0
         parameters.put("userAction", UserAction.ACTION_CREATE);
 59  0
         parameters.put("edlName", edlAssociation.getEdlName());
 60  0
         href = UrlFactory.parameterizeUrl(
 61  
                         ConfigContext.getCurrentContextConfig().getKEWBaseURL()+"/EDocLite", 
 62  
                         parameters);
 63  
         
 64  0
         HtmlData.AnchorHtmlData anchorHtmlData = new HtmlData.AnchorHtmlData(href, null, "Create Document");
 65  0
         return anchorHtmlData;
 66  
     }
 67  
 
 68  
         /**
 69  
          * Since we don't have a maintenance document for EDocLiteAssociations, we need to
 70  
          * set showMaintenanceLinks to true manually.  Otherwise our "Create Document" link
 71  
          * won't show up.
 72  
          */
 73  
         @Override
 74  
         public Collection performLookup(LookupForm lookupForm,
 75  
                         Collection resultTable, boolean bounded) {
 76  0
                 lookupForm.setShowMaintenanceLinks(true);
 77  0
                 return super.performLookup(lookupForm, resultTable, bounded);
 78  
         }
 79  
 
 80  
 }