Coverage Report - org.kuali.rice.krad.service.impl.DocumentAdHocServiceImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentAdHocServiceImpl
0%
0/18
0%
0/2
1.5
 
 1  
 /*
 2  
  * Copyright 2007-2010 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.krad.service.impl;
 17  
 
 18  
 import org.kuali.rice.kim.api.group.Group;
 19  
 import org.kuali.rice.kim.api.services.KimApiServiceLocator;
 20  
 import org.kuali.rice.krad.bo.AdHocRoutePerson;
 21  
 import org.kuali.rice.krad.bo.AdHocRouteWorkgroup;
 22  
 import org.kuali.rice.krad.document.Document;
 23  
 import org.kuali.rice.krad.service.BusinessObjectService;
 24  
 import org.kuali.rice.krad.service.DocumentAdHocService;
 25  
 import org.kuali.rice.krad.service.KRADServiceLocator;
 26  
 
 27  
 import java.util.HashMap;
 28  
 import java.util.List;
 29  
 
 30  
 /**
 31  
  * Implementation for {@link DocumentAdHocService}.
 32  
  *
 33  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 34  
  *
 35  
  */
 36  0
 public class DocumentAdHocServiceImpl implements DocumentAdHocService {
 37  
 
 38  
         /**
 39  
          * {@inheritDoc}
 40  
          */
 41  
         public void addAdHocs(Document document) {
 42  
         /* Instead of reading the doc header to see if doc is in saved status
 43  
          * its probably easier and faster to just do this all the time and
 44  
          * store a null when appropriate.
 45  
          */
 46  
         List<AdHocRoutePerson> adHocRoutePersons;
 47  
         List<AdHocRouteWorkgroup> adHocRouteWorkgroups;
 48  0
         HashMap criteriaPerson = new HashMap();
 49  0
         HashMap criteriaWorkgroup = new HashMap();
 50  
 
 51  0
         criteriaPerson.put("documentNumber", document.getDocumentNumber());
 52  0
         criteriaPerson.put("type", AdHocRoutePerson.PERSON_TYPE);
 53  0
         adHocRoutePersons = (List) getBusinessObjectService().findMatching(AdHocRoutePerson.class, criteriaPerson);
 54  0
         criteriaWorkgroup.put("documentNumber", document.getDocumentNumber());
 55  0
         criteriaWorkgroup.put("type", AdHocRouteWorkgroup.WORKGROUP_TYPE);
 56  0
         adHocRouteWorkgroups = (List) getBusinessObjectService().findMatching(AdHocRouteWorkgroup.class, criteriaWorkgroup);
 57  
 
 58  
         //populate group namespace and names on adHocRoutWorkgroups
 59  0
         for (AdHocRouteWorkgroup adHocRouteWorkgroup : adHocRouteWorkgroups) {
 60  0
             Group group = KimApiServiceLocator.getGroupService().getGroup(adHocRouteWorkgroup.getId());
 61  0
             adHocRouteWorkgroup.setRecipientName(group.getName());
 62  0
             adHocRouteWorkgroup.setRecipientNamespaceCode(group.getNamespaceCode());
 63  0
         }
 64  0
         document.setAdHocRoutePersons(adHocRoutePersons);
 65  0
         document.setAdHocRouteWorkgroups(adHocRouteWorkgroups);
 66  0
         }
 67  
 
 68  
     protected BusinessObjectService getBusinessObjectService() {
 69  0
             return KRADServiceLocator.getBusinessObjectService();
 70  
     }
 71  
 
 72  
 }