Coverage Report - org.kuali.rice.kew.rule.bo.RuleBaseValuesInquirableImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
RuleBaseValuesInquirableImpl
0%
0/18
0%
0/2
1.5
 
 1  
 /**
 2  
  * Copyright 2005-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  
 package org.kuali.rice.kew.rule.bo;
 17  
 
 18  
 import org.kuali.rice.core.api.config.property.ConfigContext;
 19  
 import org.kuali.rice.kew.rule.RuleBaseValues;
 20  
 import org.kuali.rice.kew.rule.web.WebRuleUtils;
 21  
 import org.kuali.rice.kew.api.KewApiConstants;
 22  
 import org.kuali.rice.kns.inquiry.KualiInquirableImpl;
 23  
 import org.kuali.rice.kns.lookup.HtmlData;
 24  
 import org.kuali.rice.kns.web.ui.Section;
 25  
 import org.kuali.rice.krad.bo.BusinessObject;
 26  
 
 27  
 import java.util.List;
 28  
 import java.util.Map;
 29  
 
 30  
 /**
 31  
  * This is a description of what this class does - ewestfal don't forget to fill this in. 
 32  
  * 
 33  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 34  
  *
 35  
  */
 36  0
 public class RuleBaseValuesInquirableImpl extends KualiInquirableImpl {
 37  
 
 38  
         public static final String DOCUMENT_ID = "documentId";
 39  
 
 40  
         @Override
 41  
         public Object retrieveDataObject(Map fieldValues){
 42  0
                 RuleBaseValues rule = (RuleBaseValues)super.retrieveDataObject(fieldValues);
 43  0
                 WebRuleUtils.populateRuleMaintenanceFields(rule);
 44  0
                 return rule;
 45  
     }
 46  
         
 47  
         /**
 48  
          * This overridden method ...
 49  
          * 
 50  
          * @see org.kuali.rice.krad.inquiry.Inquirable#getBusinessObject(java.util.Map)
 51  
          */
 52  
         public BusinessObject getBusinessObject(Map fieldValues) {
 53  0
                 RuleBaseValues rule = (RuleBaseValues)super.getBusinessObject(fieldValues);
 54  0
                 WebRuleUtils.populateRuleMaintenanceFields(rule);
 55  0
                 return rule;
 56  
         }
 57  
 
 58  
         /**
 59  
          * This overridden method ...
 60  
          * 
 61  
          * @see org.kuali.rice.krad.inquiry.Inquirable#getSections(org.kuali.rice.krad.bo.BusinessObject)
 62  
          */
 63  
         public List getSections(BusinessObject bo) {
 64  0
                 List<Section> sections = super.getSections(bo);
 65  
 
 66  0
                 return WebRuleUtils.customizeSections((RuleBaseValues)bo, sections, false);
 67  
 
 68  
         }
 69  
         
 70  
 
 71  
     @Override
 72  
     public HtmlData getInquiryUrl(BusinessObject businessObject, String attributeName, boolean forceInquiry) {
 73  
             
 74  0
                 if(DOCUMENT_ID.equals(attributeName)) {
 75  
 
 76  0
                         HtmlData.AnchorHtmlData link = new HtmlData.AnchorHtmlData();
 77  0
                         RuleBaseValues rule = (RuleBaseValues)businessObject;
 78  
 
 79  0
                         String documentId = rule.getDocumentId();
 80  0
                         link.setDisplayText(documentId+"");
 81  
 
 82  0
                         String href = ConfigContext.getCurrentContextConfig().getKEWBaseURL() + "/" +
 83  
                         KewApiConstants.DOC_HANDLER_REDIRECT_PAGE + "?" + KewApiConstants.COMMAND_PARAMETER + "=" +
 84  
                         KewApiConstants.DOCSEARCH_COMMAND + "&" + KewApiConstants.DOCUMENT_ID_PARAMETER + "=" + documentId;
 85  
 
 86  0
                         link.setHref(href);
 87  
 
 88  0
                         return link;
 89  
                 }                
 90  0
         return super.getInquiryUrl(businessObject, attributeName, forceInquiry);
 91  
     }
 92  
 
 93  
 }