Coverage Report - org.kuali.rice.kew.api.doctype.DocumentType
 
Classes in this File Line Coverage Branch Coverage Complexity
DocumentType
0%
0/57
N/A
1.07
DocumentType$1
N/A
N/A
1.07
DocumentType$Builder
0%
0/82
0%
0/4
1.07
DocumentType$Constants
0%
0/1
N/A
1.07
DocumentType$Elements
0%
0/1
N/A
1.07
 
 1  
 package org.kuali.rice.kew.api.doctype;
 2  
 
 3  
 import java.io.Serializable;
 4  
 import java.util.Collection;
 5  
 import java.util.HashMap;
 6  
 import java.util.Map;
 7  
 
 8  
 import javax.xml.bind.annotation.XmlAccessType;
 9  
 import javax.xml.bind.annotation.XmlAccessorType;
 10  
 import javax.xml.bind.annotation.XmlAnyElement;
 11  
 import javax.xml.bind.annotation.XmlElement;
 12  
 import javax.xml.bind.annotation.XmlRootElement;
 13  
 import javax.xml.bind.annotation.XmlType;
 14  
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 15  
 
 16  
 import org.apache.commons.lang.StringUtils;
 17  
 import org.kuali.rice.core.api.CoreConstants;
 18  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 19  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 20  
 import org.w3c.dom.Element;
 21  
 
 22  
 @XmlRootElement(name = DocumentType.Constants.ROOT_ELEMENT_NAME)
 23  
 @XmlAccessorType(XmlAccessType.NONE)
 24  
 @XmlType(name = DocumentType.Constants.TYPE_NAME, propOrder = {
 25  
         DocumentType.Elements.ID,
 26  
         DocumentType.Elements.NAME,
 27  
         DocumentType.Elements.DOCUMENT_TYPE_VERSION,
 28  
         DocumentType.Elements.LABEL,
 29  
         DocumentType.Elements.DESCRIPTION,
 30  
         DocumentType.Elements.PARENT_ID,
 31  
         DocumentType.Elements.ACTIVE,
 32  
         DocumentType.Elements.DOC_HANDLER_URL,
 33  
         DocumentType.Elements.HELP_DEFINITION_URL,
 34  
         DocumentType.Elements.DOC_SEARCH_HELP_URL,
 35  
         DocumentType.Elements.POST_PROCESSOR_NAME,
 36  
         DocumentType.Elements.APPLICATION_ID,
 37  
         DocumentType.Elements.CURRENT,
 38  
         DocumentType.Elements.BLANKET_APPROVE_GROUP_ID,
 39  
         DocumentType.Elements.SUPER_USER_GROUP_ID,
 40  
         DocumentType.Elements.POLICIES,
 41  
         CoreConstants.CommonElements.VERSION_NUMBER,
 42  
         CoreConstants.CommonElements.FUTURE_ELEMENTS
 43  
 })
 44  0
 public final class DocumentType extends AbstractDataTransferObject implements DocumentTypeContract {
 45  
 
 46  
     private static final long serialVersionUID = 6866926296038814812L;
 47  
 
 48  
     @XmlElement(name = Elements.ID, required = false)
 49  
     private final String id;
 50  
 
 51  
     @XmlElement(name = Elements.NAME, required = true)
 52  
     private final String name;
 53  
 
 54  
     @XmlElement(name = Elements.DOCUMENT_TYPE_VERSION, required = false)
 55  
     private final Integer documentTypeVersion;
 56  
 
 57  
     @XmlElement(name = Elements.LABEL, required = false)
 58  
     private final String label;
 59  
 
 60  
     @XmlElement(name = Elements.DESCRIPTION, required = false)
 61  
     private final String description;
 62  
 
 63  
     @XmlElement(name = Elements.PARENT_ID, required = false)
 64  
     private final String parentId;
 65  
 
 66  
     @XmlElement(name = Elements.ACTIVE, required = true)
 67  
     private final boolean active;
 68  
 
 69  
     @XmlElement(name = Elements.DOC_HANDLER_URL, required = false)
 70  
     private final String docHandlerUrl;
 71  
 
 72  
     @XmlElement(name = Elements.HELP_DEFINITION_URL, required = false)
 73  
     private final String helpDefinitionUrl;
 74  
 
 75  
     @XmlElement(name = Elements.DOC_SEARCH_HELP_URL, required = false)
 76  
     private final String docSearchHelpUrl;
 77  
 
 78  
     @XmlElement(name = Elements.POST_PROCESSOR_NAME, required = false)
 79  
     private final String postProcessorName;
 80  
 
 81  
     @XmlElement(name = Elements.APPLICATION_ID, required = false)
 82  
     private final String applicationId;
 83  
 
 84  
     @XmlElement(name = Elements.CURRENT, required = true)
 85  
     private final boolean current;
 86  
 
 87  
     @XmlElement(name = Elements.BLANKET_APPROVE_GROUP_ID, required = false)
 88  
     private final String blanketApproveGroupId;
 89  
 
 90  
     @XmlElement(name = Elements.SUPER_USER_GROUP_ID, required = false)
 91  
     private final String superUserGroupId;
 92  
 
 93  
     @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false)
 94  
     private final Long versionNumber;
 95  
 
 96  
     @XmlElement(name = Elements.POLICIES, required = false)
 97  
     @XmlJavaTypeAdapter(DocumentTypePolicyMapAdapter.class)
 98  
     private final Map<DocumentTypePolicy, String> policies;
 99  
 
 100  0
     @SuppressWarnings("unused")
 101  
     @XmlAnyElement
 102  
     private final Collection<Element> _futureElements = null;
 103  
 
 104  
     /**
 105  
      * Private constructor used only by JAXB.
 106  
      */
 107  0
     private DocumentType() {
 108  0
         this.id = null;
 109  0
         this.name = null;
 110  0
         this.documentTypeVersion = null;
 111  0
         this.label = null;
 112  0
         this.description = null;
 113  0
         this.parentId = null;
 114  0
         this.active = false;
 115  0
         this.docHandlerUrl = null;
 116  0
         this.helpDefinitionUrl = null;
 117  0
         this.docSearchHelpUrl = null;
 118  0
         this.postProcessorName = null;
 119  0
         this.applicationId = null;
 120  0
         this.current = false;
 121  0
         this.blanketApproveGroupId = null;
 122  0
         this.superUserGroupId = null;
 123  0
         this.policies = null;
 124  0
         this.versionNumber = null;
 125  0
     }
 126  
 
 127  0
     private DocumentType(Builder builder) {
 128  0
         this.name = builder.getName();
 129  0
         this.id = builder.getId();
 130  0
         this.documentTypeVersion = builder.getDocumentTypeVersion();
 131  0
         this.label = builder.getLabel();
 132  0
         this.description = builder.getDescription();
 133  0
         this.parentId = builder.getParentId();
 134  0
         this.active = builder.isActive();
 135  0
         this.docHandlerUrl = builder.getDocHandlerUrl();
 136  0
         this.helpDefinitionUrl = builder.getHelpDefinitionUrl();
 137  0
         this.docSearchHelpUrl = builder.getDocSearchHelpUrl();
 138  0
         this.postProcessorName = builder.getPostProcessorName();
 139  0
         this.applicationId = builder.getApplicationId();
 140  0
         this.current = builder.isCurrent();
 141  0
         this.blanketApproveGroupId = builder.getBlanketApproveGroupId();
 142  0
         this.superUserGroupId = builder.getSuperUserGroupId();
 143  0
         this.policies = new HashMap<DocumentTypePolicy, String>(builder.getPolicies());
 144  0
         this.versionNumber = builder.getVersionNumber();
 145  0
     }
 146  
 
 147  
     @Override
 148  
     public String getId() {
 149  0
         return this.id;
 150  
     }
 151  
 
 152  
     @Override
 153  
     public String getName() {
 154  0
         return this.name;
 155  
     }
 156  
 
 157  
     @Override
 158  
     public Integer getDocumentTypeVersion() {
 159  0
         return this.documentTypeVersion;
 160  
     }
 161  
 
 162  
     @Override
 163  
     public String getLabel() {
 164  0
         return this.label;
 165  
     }
 166  
 
 167  
     @Override
 168  
     public String getDescription() {
 169  0
         return this.description;
 170  
     }
 171  
 
 172  
     @Override
 173  
     public String getParentId() {
 174  0
         return this.parentId;
 175  
     }
 176  
 
 177  
     @Override
 178  
     public boolean isActive() {
 179  0
         return this.active;
 180  
     }
 181  
 
 182  
     @Override
 183  
     public String getDocHandlerUrl() {
 184  0
         return this.docHandlerUrl;
 185  
     }
 186  
 
 187  
     @Override
 188  
     public String getHelpDefinitionUrl() {
 189  0
         return this.helpDefinitionUrl;
 190  
     }
 191  
 
 192  
     @Override
 193  
     public String getDocSearchHelpUrl() {
 194  0
         return this.docSearchHelpUrl;
 195  
     }
 196  
     
 197  
     @Override
 198  
     public String getPostProcessorName() {
 199  0
         return this.postProcessorName;
 200  
     }
 201  
 
 202  
     @Override
 203  
     public String getApplicationId() {
 204  0
         return this.applicationId;
 205  
     }
 206  
 
 207  
     @Override
 208  
     public boolean isCurrent() {
 209  0
         return this.current;
 210  
     }
 211  
 
 212  
     @Override
 213  
     public String getBlanketApproveGroupId() {
 214  0
         return this.blanketApproveGroupId;
 215  
     }
 216  
 
 217  
     @Override
 218  
     public String getSuperUserGroupId() {
 219  0
         return this.superUserGroupId;
 220  
     }
 221  
 
 222  
     @Override
 223  
     public Map<DocumentTypePolicy, String> getPolicies() {
 224  0
         return this.policies;
 225  
     }
 226  
 
 227  
     @Override
 228  
     public Long getVersionNumber() {
 229  0
         return this.versionNumber;
 230  
     }
 231  
 
 232  
     /**
 233  
      * A builder which can be used to construct {@link DocumentType} instances. Enforces the
 234  
      * constraints of the {@link DocumentTypeContract}.
 235  
      */
 236  0
     public final static class Builder implements Serializable, ModelBuilder, DocumentTypeContract {
 237  
 
 238  
         private static final long serialVersionUID = 1678979180435181578L;
 239  
 
 240  
         private String id;
 241  
         private String name;
 242  
         private Integer documentTypeVersion;
 243  
         private String label;
 244  
         private String description;
 245  
         private String parentId;
 246  
         private boolean active;
 247  
         private String docHandlerUrl;
 248  
         private String helpDefinitionUrl;
 249  
         private String docSearchHelpUrl;
 250  
         private String postProcessorName;
 251  
         private String applicationId;
 252  
         private boolean current;
 253  
         private String blanketApproveGroupId;
 254  
         private String superUserGroupId;
 255  
         private Map<DocumentTypePolicy, String> policies;
 256  
         private Long versionNumber;
 257  
 
 258  0
         private Builder(String name) {
 259  0
             setName(name);
 260  0
             setActive(true);
 261  0
             setCurrent(true);
 262  0
             this.policies = new HashMap<DocumentTypePolicy, String>();
 263  0
         }
 264  
 
 265  
         public static Builder create(String name) {
 266  0
             return new Builder(name);
 267  
         }
 268  
 
 269  
         public static Builder create(DocumentTypeContract contract) {
 270  0
             if (contract == null) {
 271  0
                 throw new IllegalArgumentException("contract was null");
 272  
             }
 273  0
             Builder builder = create(contract.getName());
 274  0
             builder.setId(contract.getId());
 275  0
             builder.setDocumentTypeVersion(contract.getDocumentTypeVersion());
 276  0
             builder.setLabel(contract.getLabel());
 277  0
             builder.setDescription(contract.getDescription());
 278  0
             builder.setParentId(contract.getParentId());
 279  0
             builder.setActive(contract.isActive());
 280  0
             builder.setDocHandlerUrl(contract.getDocHandlerUrl());
 281  0
             builder.setHelpDefinitionUrl(contract.getHelpDefinitionUrl());
 282  0
             builder.setDocSearchHelpUrl(contract.getDocSearchHelpUrl());
 283  0
             builder.setPostProcessorName(contract.getPostProcessorName());
 284  0
             builder.setApplicationId(contract.getApplicationId());
 285  0
             builder.setCurrent(contract.isCurrent());
 286  0
             builder.setBlanketApproveGroupId(contract.getBlanketApproveGroupId());
 287  0
             builder.setSuperUserGroupId(contract.getSuperUserGroupId());
 288  0
             builder.setPolicies(new HashMap<DocumentTypePolicy, String>(contract.getPolicies()));
 289  0
             builder.setVersionNumber(contract.getVersionNumber());
 290  0
             return builder;
 291  
         }
 292  
 
 293  
         public DocumentType build() {
 294  0
             return new DocumentType(this);
 295  
         }
 296  
 
 297  
         @Override
 298  
         public String getId() {
 299  0
             return this.id;
 300  
         }
 301  
 
 302  
         @Override
 303  
         public String getName() {
 304  0
             return this.name;
 305  
         }
 306  
 
 307  
         @Override
 308  
         public Integer getDocumentTypeVersion() {
 309  0
             return this.documentTypeVersion;
 310  
         }
 311  
 
 312  
         @Override
 313  
         public String getLabel() {
 314  0
             return this.label;
 315  
         }
 316  
 
 317  
         @Override
 318  
         public String getDescription() {
 319  0
             return this.description;
 320  
         }
 321  
 
 322  
         @Override
 323  
         public String getParentId() {
 324  0
             return this.parentId;
 325  
         }
 326  
 
 327  
         @Override
 328  
         public boolean isActive() {
 329  0
             return this.active;
 330  
         }
 331  
 
 332  
         @Override
 333  
         public String getDocHandlerUrl() {
 334  0
             return this.docHandlerUrl;
 335  
         }
 336  
         
 337  
         @Override
 338  
         public String getHelpDefinitionUrl() {
 339  0
             return this.helpDefinitionUrl;
 340  
         }
 341  
 
 342  
         @Override
 343  
         public String getDocSearchHelpUrl() {
 344  0
             return this.docSearchHelpUrl;
 345  
         }
 346  
 
 347  
         @Override
 348  
         public String getPostProcessorName() {
 349  0
             return this.postProcessorName;
 350  
         }
 351  
 
 352  
         @Override
 353  
         public String getApplicationId() {
 354  0
             return this.applicationId;
 355  
         }
 356  
 
 357  
         @Override
 358  
         public boolean isCurrent() {
 359  0
             return this.current;
 360  
         }
 361  
 
 362  
         @Override
 363  
         public String getBlanketApproveGroupId() {
 364  0
             return this.blanketApproveGroupId;
 365  
         }
 366  
 
 367  
         @Override
 368  
         public String getSuperUserGroupId() {
 369  0
             return this.superUserGroupId;
 370  
         }
 371  
 
 372  
         @Override
 373  
         public Map<DocumentTypePolicy, String> getPolicies() {
 374  0
             return this.policies;
 375  
         }
 376  
 
 377  
         @Override
 378  
         public Long getVersionNumber() {
 379  0
             return this.versionNumber;
 380  
         }
 381  
 
 382  
         public void setId(String id) {
 383  0
             this.id = id;
 384  0
         }
 385  
 
 386  
         public void setName(String name) {
 387  0
             if (StringUtils.isBlank(name)) {
 388  0
                 throw new IllegalArgumentException("name was null or blank");
 389  
             }
 390  0
             this.name = name;
 391  0
         }
 392  
 
 393  
         public void setDocumentTypeVersion(Integer documentTypeVersion) {
 394  0
             this.documentTypeVersion = documentTypeVersion;
 395  0
         }
 396  
 
 397  
         public void setLabel(String label) {
 398  0
             this.label = label;
 399  0
         }
 400  
 
 401  
         public void setDescription(String description) {
 402  0
             this.description = description;
 403  0
         }
 404  
 
 405  
         public void setParentId(String parentId) {
 406  0
             this.parentId = parentId;
 407  0
         }
 408  
 
 409  
         public void setActive(boolean active) {
 410  0
             this.active = active;
 411  0
         }
 412  
 
 413  
         public void setDocHandlerUrl(String docHandlerUrl) {
 414  0
             this.docHandlerUrl = docHandlerUrl;
 415  0
         }
 416  
 
 417  
         public void setHelpDefinitionUrl(String helpDefinitionUrl) {
 418  0
             this.helpDefinitionUrl = helpDefinitionUrl;
 419  0
         }
 420  
 
 421  
         public void setDocSearchHelpUrl(String docSearchHelpUrl) {
 422  0
             this.docSearchHelpUrl = docSearchHelpUrl;
 423  0
         }
 424  
         
 425  
         public void setPostProcessorName(String postProcessorName) {
 426  0
             this.postProcessorName = postProcessorName;
 427  0
         }
 428  
 
 429  
         public void setApplicationId(String applicationId) {
 430  0
             this.applicationId = applicationId;
 431  0
         }
 432  
 
 433  
         public void setCurrent(boolean current) {
 434  0
             this.current = current;
 435  0
         }
 436  
 
 437  
         public void setBlanketApproveGroupId(String blanketApproveGroupId) {
 438  0
             this.blanketApproveGroupId = blanketApproveGroupId;
 439  0
         }
 440  
 
 441  
         public void setSuperUserGroupId(String superUserGroupId) {
 442  0
             this.superUserGroupId = superUserGroupId;
 443  0
         }
 444  
 
 445  
         public void setPolicies(Map<DocumentTypePolicy, String> policies) {
 446  0
             this.policies = policies;
 447  0
         }
 448  
 
 449  
         public void setVersionNumber(Long versionNumber) {
 450  0
             this.versionNumber = versionNumber;
 451  0
         }
 452  
 
 453  
     }
 454  
 
 455  
     /**
 456  
      * Defines some internal constants used on this class.
 457  
      */
 458  0
     static class Constants {
 459  
         final static String ROOT_ELEMENT_NAME = "documentType";
 460  
         final static String TYPE_NAME = "DocumentTypeType";
 461  
     }
 462  
 
 463  
     /**
 464  
      * A private class which exposes constants which define the XML element names to use when this
 465  
      * object is marshalled to XML.
 466  
      */
 467  0
     static class Elements {
 468  
         final static String ID = "id";
 469  
         final static String NAME = "name";
 470  
         final static String DOCUMENT_TYPE_VERSION = "documentTypeVersion";
 471  
         final static String LABEL = "label";
 472  
         final static String DESCRIPTION = "description";
 473  
         final static String PARENT_ID = "parentId";
 474  
         final static String ACTIVE = "active";
 475  
         final static String DOC_HANDLER_URL = "docHandlerUrl";
 476  
         final static String HELP_DEFINITION_URL = "helpDefinitionUrl";
 477  
         final static String DOC_SEARCH_HELP_URL = "docSearchHelpUrl";
 478  
         final static String POST_PROCESSOR_NAME = "postProcessorName";
 479  
         final static String APPLICATION_ID = "applicationId";
 480  
         final static String CURRENT = "current";
 481  
         final static String BLANKET_APPROVE_GROUP_ID = "blanketApproveGroupId";
 482  
         final static String SUPER_USER_GROUP_ID = "superUserGroupId";
 483  
         final static String POLICIES = "policies";
 484  
     }
 485  
 
 486  
 }