Coverage Report - org.kuali.rice.kns.datadictionary.exporter.DocumentEntryMapper
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentEntryMapper
0%
0/27
0%
0/8
3.5
 
 1  
 /*
 2  
  * Copyright 2005-2007 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.kns.datadictionary.exporter;
 17  
 
 18  
 import org.kuali.rice.kew.api.KewApiServiceLocator;
 19  
 import org.kuali.rice.kew.api.doctype.DocumentType;
 20  
 import org.kuali.rice.kns.datadictionary.DocumentEntry;
 21  
 import org.kuali.rice.krad.datadictionary.exporter.ExportMap;
 22  
 import org.kuali.rice.krad.service.DocumentHelperService;
 23  
 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
 24  
 
 25  
 /**
 26  
  * DocumentEntryMapper
 27  
  * 
 28  
  * 
 29  
  */
 30  
 @Deprecated
 31  0
 public abstract class DocumentEntryMapper {
 32  
     
 33  
     protected DocumentType getDocumentType(String documentTypeName) {
 34  0
         return KewApiServiceLocator.getDocumentTypeService().getDocumentTypeByName(documentTypeName);
 35  
     }
 36  
 
 37  
     /**
 38  
      * @param entry
 39  
      * @return Map containing entries for properties common to all DocumentEntry subclasses
 40  
      */
 41  
     @SuppressWarnings("unchecked")
 42  
         protected ExportMap mapEntry(DocumentEntry entry) {
 43  0
         if (entry == null) {
 44  0
             throw new IllegalArgumentException("invalid (null) entry");
 45  
         }
 46  
 
 47  
         // simple properties
 48  0
         ExportMap entryMap = new ExportMap(entry.getJstlKey());
 49  
 
 50  0
         Class businessRulesClass = entry.getBusinessRulesClass();
 51  0
         if (businessRulesClass != null) {
 52  0
             entryMap.set("businessRulesClass", businessRulesClass.getName());
 53  
         }
 54  
 
 55  0
         entryMap.set("documentTypeName", entry.getDocumentTypeName());
 56  
 
 57  0
         DocumentType docType = getDocumentType(entry.getDocumentTypeName());
 58  0
         entryMap.set("label", docType.getLabel());
 59  
 
 60  0
         if (docType.getDescription() != null) {
 61  0
             entryMap.set("description", docType.getDescription());
 62  
         }
 63  
 
 64  0
         DocumentHelperService documentHelperService = KRADServiceLocatorWeb.getDocumentHelperService();
 65  0
         entryMap.set("documentAuthorizerClass", documentHelperService.getDocumentAuthorizer(entry.getDocumentTypeName()).getClass().getName());
 66  0
         entryMap.set("documentPresentationControllerClass", documentHelperService.getDocumentPresentationController(entry.getDocumentTypeName()).getClass().getName());
 67  
 
 68  0
         entryMap.set("allowsNoteAttachments", Boolean.toString(entry.getAllowsNoteAttachments()));
 69  
 
 70  0
         entryMap.set("allowsNoteFYI", Boolean.toString(entry.getAllowsNoteFYI()));
 71  
         
 72  0
         if (entry.getAttachmentTypesValuesFinderClass() != null) {
 73  0
             entryMap.set("attachmentTypesValuesFinderClass", entry.getAttachmentTypesValuesFinderClass().getName());
 74  
         }
 75  
 
 76  0
         entryMap.set("displayTopicFieldInNotes", Boolean.toString(entry.getDisplayTopicFieldInNotes()));
 77  
         
 78  0
         entryMap.set("usePessimisticLocking", Boolean.toString(entry.getUsePessimisticLocking()));
 79  0
         entryMap.set("useWorkflowPessimisticLocking", Boolean.toString(entry.getUseWorkflowPessimisticLocking()));
 80  0
         entryMap.set("sessionDocument", Boolean.toString(entry.isSessionDocument()));
 81  
         
 82  0
         entryMap.set(new AttributesMapBuilder().buildAttributesMap(entry));
 83  0
         entryMap.set(new CollectionsMapBuilder().buildCollectionsMap(entry));
 84  
 
 85  0
         return entryMap;
 86  
     }
 87  
 
 88  
 }