Coverage Report - org.kuali.rice.kew.api.document.DocumentContentUpdate
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentContentUpdate
0%
0/25
0%
0/4
1.273
DocumentContentUpdate$1
N/A
N/A
1.273
DocumentContentUpdate$Builder
0%
0/41
0%
0/4
1.273
DocumentContentUpdate$Constants
0%
0/1
N/A
1.273
DocumentContentUpdate$Elements
0%
0/1
N/A
1.273
 
 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 java.io.Serializable;
 19  
 import java.util.ArrayList;
 20  
 import java.util.Collection;
 21  
 import java.util.Collections;
 22  
 import java.util.List;
 23  
 
 24  
 import javax.xml.bind.annotation.XmlAccessType;
 25  
 import javax.xml.bind.annotation.XmlAccessorType;
 26  
 import javax.xml.bind.annotation.XmlAnyElement;
 27  
 import javax.xml.bind.annotation.XmlElement;
 28  
 import javax.xml.bind.annotation.XmlElementWrapper;
 29  
 import javax.xml.bind.annotation.XmlRootElement;
 30  
 import javax.xml.bind.annotation.XmlType;
 31  
 
 32  
 import org.kuali.rice.core.api.CoreConstants;
 33  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 34  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 35  
 import org.kuali.rice.kew.api.document.attribute.WorkflowAttributeDefinition;
 36  
 import org.w3c.dom.Element;
 37  
 
 38  
 /**
 39  
  * Defines an update to document content on a particular workflow document.
 40  
  * Contains general application content as well as a list of attribute
 41  
  * definitions and searchable definitions.  When passed to the appropriate
 42  
  * workflow services to perform an update on document content, if any of the
 43  
  * internal content or definitions on this object have not been set then they
 44  
  * will not be updated.  This allows for this data structure to be used to only
 45  
  * update the portion of the document content that is desired to be updated.
 46  
  * 
 47  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 48  
  * 
 49  
  */
 50  
 @XmlRootElement(name = DocumentContentUpdate.Constants.ROOT_ELEMENT_NAME)
 51  
 @XmlAccessorType(XmlAccessType.NONE)
 52  
 @XmlType(name = DocumentContentUpdate.Constants.TYPE_NAME, propOrder = {
 53  
     DocumentContentUpdate.Elements.APPLICATION_CONTENT,
 54  
     DocumentContentUpdate.Elements.ATTRIBUTE_CONTENT,
 55  
     DocumentContentUpdate.Elements.SEARCHABLE_CONTENT,
 56  
     DocumentContentUpdate.Elements.ATTRIBUTE_DEFINITIONS,
 57  
     DocumentContentUpdate.Elements.SEARCHABLE_DEFINITIONS,
 58  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 59  
 })
 60  0
 public final class DocumentContentUpdate extends AbstractDataTransferObject {
 61  
 
 62  
         private static final long serialVersionUID = -7386661044232391889L;
 63  
 
 64  
         @XmlElement(name = Elements.APPLICATION_CONTENT, required = false)
 65  
         private final String applicationContent;
 66  
         
 67  
         @XmlElement(name = Elements.ATTRIBUTE_CONTENT, required = false)
 68  
         private final String attributeContent;
 69  
 
 70  
         @XmlElement(name = Elements.SEARCHABLE_CONTENT, required = false)
 71  
         private final String searchableContent;
 72  
         
 73  
         @XmlElementWrapper(name = Elements.ATTRIBUTE_DEFINITIONS, required = false)
 74  
         @XmlElement(name = Elements.ATTRIBUTE_DEFINITION, required = false)
 75  
     private List<WorkflowAttributeDefinition> attributeDefinitions;
 76  
 
 77  
         @XmlElementWrapper(name = Elements.SEARCHABLE_DEFINITIONS, required = false)
 78  
         @XmlElement(name = Elements.SEARCHABLE_DEFINITION, required = false)
 79  
         private List<WorkflowAttributeDefinition> searchableDefinitions;
 80  
     
 81  0
         @SuppressWarnings("unused")
 82  
     @XmlAnyElement
 83  
     private final Collection<Element> _futureElements = null;
 84  
     
 85  
         /**
 86  
      * Private constructor used only by JAXB.
 87  
      */
 88  0
         private DocumentContentUpdate() {
 89  0
             this.applicationContent = null;
 90  0
             this.attributeContent = null;
 91  0
             this.searchableContent = null;
 92  0
             this.attributeDefinitions = null;
 93  0
             this.searchableDefinitions = null;
 94  0
         }
 95  
         
 96  0
     private DocumentContentUpdate(Builder builder) {
 97  0
             this.applicationContent = builder.getApplicationContent();
 98  0
             this.attributeContent = builder.getAttributeContent();
 99  0
             this.searchableContent = builder.getSearchableContent();
 100  0
             if (builder.getAttributeDefinitions() != null) {
 101  0
                     this.attributeDefinitions = new ArrayList<WorkflowAttributeDefinition>(builder.getAttributeDefinitions());
 102  
             } else {
 103  0
                     this.attributeDefinitions = new ArrayList<WorkflowAttributeDefinition>();
 104  
             }
 105  0
             if (builder.getSearchableDefinitions() != null) {
 106  0
                     this.searchableDefinitions = new ArrayList<WorkflowAttributeDefinition>(builder.getSearchableDefinitions());
 107  
             } else {
 108  0
                     this.searchableDefinitions = new ArrayList<WorkflowAttributeDefinition>();
 109  
             }
 110  0
     }
 111  
         
 112  
         public String getApplicationContent() {
 113  0
                 return applicationContent;
 114  
         }
 115  
         
 116  
         public String getAttributeContent() {
 117  0
                 return attributeContent;
 118  
         }
 119  
         
 120  
         public String getSearchableContent() {
 121  0
                 return searchableContent;
 122  
         }
 123  
 
 124  
         public List<WorkflowAttributeDefinition> getAttributeDefinitions() {
 125  0
                 return Collections.unmodifiableList(attributeDefinitions);
 126  
         }
 127  
 
 128  
         public List<WorkflowAttributeDefinition> getSearchableDefinitions() {
 129  0
                 return Collections.unmodifiableList(searchableDefinitions);
 130  
         }
 131  
         
 132  
         /**
 133  
          * A builder which can be used to construct {@link DocumentContentUpdate} instances.
 134  
          */
 135  0
         public final static class Builder implements Serializable, ModelBuilder {
 136  
 
 137  
                 private static final long serialVersionUID = -1680695196516508680L;
 138  
 
 139  
                 private String attributeContent;
 140  
                 private String applicationContent;
 141  
                 private String searchableContent;
 142  
                 private List<WorkflowAttributeDefinition> attributeDefinitions;
 143  
                 private List<WorkflowAttributeDefinition> searchableDefinitions;
 144  
 
 145  0
                 private Builder() {
 146  0
                         this.attributeContent = "";
 147  0
                         this.applicationContent = "";
 148  0
                         this.searchableContent = "";
 149  0
                         this.attributeDefinitions = new ArrayList<WorkflowAttributeDefinition>();
 150  0
                         this.searchableDefinitions = new ArrayList<WorkflowAttributeDefinition>();
 151  0
                 }
 152  
 
 153  
                 public static Builder create() {
 154  0
                         return new Builder();
 155  
                 }
 156  
 
 157  
                 public static Builder create(DocumentContent documentContent) {
 158  0
                         if (documentContent == null) {
 159  0
                                 throw new IllegalArgumentException("documentContent was null");
 160  
                         }
 161  0
                         Builder builder = create();
 162  0
                         builder.setAttributeContent(documentContent.getAttributeContent());
 163  0
                         builder.setApplicationContent(documentContent.getApplicationContent());
 164  0
                         builder.setSearchableContent(documentContent.getSearchableContent());
 165  0
                         return builder;
 166  
                 }
 167  
                 
 168  
                 public static Builder create(DocumentContentUpdate documentContentUpdate) {
 169  0
                         if (documentContentUpdate == null) {
 170  0
                                 throw new IllegalArgumentException("documentContentUpdate was null");
 171  
                         }
 172  0
                         Builder builder = create();
 173  0
                         builder.setAttributeContent(documentContentUpdate.getAttributeContent());
 174  0
                         builder.setApplicationContent(documentContentUpdate.getApplicationContent());
 175  0
                         builder.setSearchableContent(documentContentUpdate.getSearchableContent());
 176  0
                         builder.setAttributeDefinitions(documentContentUpdate.getAttributeDefinitions());
 177  0
                         builder.setSearchableDefinitions(documentContentUpdate.getSearchableDefinitions());
 178  0
                         return builder;
 179  
                 }
 180  
 
 181  
                 public DocumentContentUpdate build() {
 182  0
                         return new DocumentContentUpdate(this);
 183  
                 }
 184  
 
 185  
                 public String getAttributeContent() {
 186  0
                         return attributeContent;
 187  
                 }
 188  
 
 189  
                 public void setAttributeContent(String attributeContent) {
 190  0
                         this.attributeContent = attributeContent;
 191  0
                 }
 192  
 
 193  
                 public String getApplicationContent() {
 194  0
                         return applicationContent;
 195  
                 }
 196  
 
 197  
                 public void setApplicationContent(String applicationContent) {
 198  0
                         this.applicationContent = applicationContent;
 199  0
                 }
 200  
 
 201  
                 public String getSearchableContent() {
 202  0
                         return searchableContent;
 203  
                 }
 204  
 
 205  
                 public void setSearchableContent(String searchableContent) {
 206  0
                         this.searchableContent = searchableContent;
 207  0
                 }
 208  
 
 209  
                 public List<WorkflowAttributeDefinition> getAttributeDefinitions() {
 210  0
                         return attributeDefinitions;
 211  
                 }
 212  
 
 213  
                 public void setAttributeDefinitions(List<WorkflowAttributeDefinition> attributeDefinitions) {
 214  0
                         this.attributeDefinitions = attributeDefinitions;
 215  0
                 }
 216  
 
 217  
                 public List<WorkflowAttributeDefinition> getSearchableDefinitions() {
 218  0
                         return searchableDefinitions;
 219  
                 }
 220  
 
 221  
                 public void setSearchableDefinitions(List<WorkflowAttributeDefinition> searchableDefinitions) {
 222  0
                         this.searchableDefinitions = searchableDefinitions;
 223  0
                 }
 224  
 
 225  
         }
 226  
         
 227  
     /**
 228  
      * Defines some internal constants used on this class.
 229  
      */
 230  0
     static class Constants {
 231  
         final static String ROOT_ELEMENT_NAME = "documentContentUpdate";
 232  
         final static String TYPE_NAME = "DocumentContentUpdateType";
 233  
     }
 234  
 
 235  
     /**
 236  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 237  
      */
 238  0
     static class Elements {
 239  
         final static String APPLICATION_CONTENT = "applicationContent";
 240  
         final static String ATTRIBUTE_CONTENT = "attributeContent";
 241  
         final static String SEARCHABLE_CONTENT = "searchableContent";
 242  
         final static String ATTRIBUTE_DEFINITION = "attributeDefinition";
 243  
         final static String ATTRIBUTE_DEFINITIONS = "attributeDefinitions";
 244  
         final static String SEARCHABLE_DEFINITION = "searchableDefinition";
 245  
         final static String SEARCHABLE_DEFINITIONS = "searchableDefinitions";
 246  
     }
 247  
 
 248  
 }