Coverage Report - edu.sampleu.bookstore.kew.BookTypeQualifierResolver
 
Classes in this File Line Coverage Branch Coverage Complexity
BookTypeQualifierResolver
0%
0/11
0%
0/2
2
 
 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  
 /**
 17  
  * 
 18  
  */
 19  
 package edu.sampleu.bookstore.kew;
 20  
 
 21  
 import edu.sampleu.bookstore.bo.Book;
 22  
 import edu.sampleu.bookstore.bo.BookstoreKimAttributes;
 23  
 import org.apache.commons.lang.StringUtils;
 24  
 import org.kuali.rice.kew.engine.RouteContext;
 25  
 import org.kuali.rice.krad.document.MaintenanceDocument;
 26  
 import org.kuali.rice.krad.maintenance.Maintainable;
 27  
 import org.kuali.rice.krad.workflow.attribute.QualifierResolverBase;
 28  
 
 29  
 import java.util.ArrayList;
 30  
 import java.util.Collections;
 31  
 import java.util.HashMap;
 32  
 import java.util.List;
 33  
 import java.util.Map;
 34  
 
 35  
 /**
 36  
  * Qualifier Resolver for Book Type
 37  
  *
 38  
  */
 39  0
 public class BookTypeQualifierResolver extends QualifierResolverBase {
 40  
 
 41  
         /* (non-Javadoc)
 42  
          * @see org.kuali.rice.kew.role.QualifierResolver#resolve(org.kuali.rice.kew.engine.RouteContext)
 43  
          */
 44  
         public List<Map<String, String>> resolve(RouteContext context) {
 45  0
         List<Map<String, String>> qualifiers = new ArrayList<Map<String, String>>();
 46  0
         MaintenanceDocument doc = (MaintenanceDocument) getDocument(context);
 47  0
                 Maintainable maint = doc.getNewMaintainableObject();
 48  0
                 Book book = (Book) maint.getDataObject();
 49  0
                 if (StringUtils.isNotEmpty(book.getTypeCode())) {
 50  0
                         qualifiers.add(Collections.singletonMap(BookstoreKimAttributes.BOOK_TYPE_CODE, book.getTypeCode()));
 51  0
                         decorateWithCommonQualifiers(qualifiers, context, null);
 52  
                 }
 53  
                 else {
 54  0
             Map<String, String> basicQualifier = new HashMap<String, String>();
 55  0
             qualifiers.add(basicQualifier);
 56  
                 }
 57  0
                 return qualifiers;
 58  
         }
 59  
 
 60  
 }