Coverage Report - org.kuali.rice.kew.api.document.DocumentWithContent
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentWithContent
0%
0/16
0%
0/4
1.8
DocumentWithContent$Constants
0%
0/1
N/A
1.8
DocumentWithContent$Elements
0%
0/1
N/A
1.8
 
 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.api.document;
 17  
 
 18  
 import org.kuali.rice.core.api.CoreConstants;
 19  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 20  
 import org.w3c.dom.Element;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlAccessType;
 23  
 import javax.xml.bind.annotation.XmlAccessorType;
 24  
 import javax.xml.bind.annotation.XmlAnyElement;
 25  
 import javax.xml.bind.annotation.XmlElement;
 26  
 import javax.xml.bind.annotation.XmlRootElement;
 27  
 import javax.xml.bind.annotation.XmlType;
 28  
 import java.util.Collection;
 29  
 
 30  
 /**
 31  
  * Immutable implementation of the {@code DocumentWithContentContract}.  This class does not have a builder since it is
 32  
  * intended to simply be a wrapper a document and it's content.
 33  
  *
 34  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 35  
  */
 36  
 @XmlRootElement(name = DocumentWithContent.Constants.ROOT_ELEMENT_NAME)
 37  
 @XmlAccessorType(XmlAccessType.NONE)
 38  
 @XmlType(name = DocumentWithContent.Constants.TYPE_NAME, propOrder = {
 39  
     DocumentWithContent.Elements.DOCUMENT,
 40  
     DocumentWithContent.Elements.DOCUMENT_CONTENT,
 41  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 42  
 })
 43  
 public final class DocumentWithContent extends AbstractDataTransferObject implements DocumentWithContentContract {
 44  
 
 45  
     @XmlElement(name = Elements.DOCUMENT, required = true)
 46  
     private final Document document;
 47  
 
 48  
     @XmlElement(name = Elements.DOCUMENT_CONTENT, required = true)
 49  
     private final DocumentContent documentContent;
 50  
 
 51  0
     @SuppressWarnings("unused")
 52  
     @XmlAnyElement
 53  
     private final Collection<Element> _futureElements = null;
 54  
 
 55  
     /**
 56  
      * Private constructor used only by JAXB.
 57  
      */
 58  0
     private DocumentWithContent() {
 59  0
         this.document = null;
 60  0
         this.documentContent = null;
 61  0
     }
 62  
 
 63  0
     private DocumentWithContent(Document document, DocumentContent documentContent) {
 64  0
         if (document == null) {
 65  0
             throw new IllegalArgumentException("document was null");
 66  
         }
 67  0
         if (documentContent == null) {
 68  0
             throw new IllegalArgumentException("documentContent was null");
 69  
         }
 70  0
         this.document = document;
 71  0
         this.documentContent = documentContent;
 72  0
     }
 73  
 
 74  
     public static DocumentWithContent create(Document document, DocumentContent documentContent) {
 75  0
         return new DocumentWithContent(document, documentContent);
 76  
     }
 77  
 
 78  
     @Override
 79  
     public Document getDocument() {
 80  0
         return this.document;
 81  
     }
 82  
 
 83  
     @Override
 84  
     public DocumentContent getDocumentContent() {
 85  0
         return this.documentContent;
 86  
     }
 87  
 
 88  
     /**
 89  
      * Defines some internal constants used on this class.
 90  
      */
 91  0
     static class Constants {
 92  
         final static String ROOT_ELEMENT_NAME = "documentWithContent";
 93  
         final static String TYPE_NAME = "DocumentWithContentType";
 94  
     }
 95  
 
 96  
     /**
 97  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 98  
      */
 99  0
     static class Elements {
 100  
         final static String DOCUMENT = "document";
 101  
         final static String DOCUMENT_CONTENT = "documentContent";
 102  
     }
 103  
 
 104  
 }