Coverage Report - org.kuali.rice.kim.api.identity.principal.EntityNamePrincipalName
 
Classes in this File Line Coverage Branch Coverage Complexity
EntityNamePrincipalName
0%
0/12
0%
0/2
1.333
EntityNamePrincipalName$1
N/A
N/A
1.333
EntityNamePrincipalName$Builder
0%
0/19
0%
0/4
1.333
EntityNamePrincipalName$Constants
0%
0/1
N/A
1.333
EntityNamePrincipalName$Elements
0%
0/1
N/A
1.333
 
 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.kim.api.identity.principal;
 17  
 
 18  
 import org.kuali.rice.core.api.CoreConstants;
 19  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 20  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 21  
 import org.kuali.rice.kim.api.identity.name.EntityName;
 22  
 import org.w3c.dom.Element;
 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.XmlRootElement;
 29  
 import javax.xml.bind.annotation.XmlType;
 30  
 import java.io.Serializable;
 31  
 import java.util.Collection;
 32  
 
 33  
 @XmlRootElement(name = EntityNamePrincipalName.Constants.ROOT_ELEMENT_NAME)
 34  
 @XmlAccessorType(XmlAccessType.NONE)
 35  
 @XmlType(name = EntityNamePrincipalName.Constants.TYPE_NAME, propOrder = {
 36  
     EntityNamePrincipalName.Elements.DEFAULT_NAME,
 37  
     EntityNamePrincipalName.Elements.PRINCIPAL_NAME,
 38  
     CoreConstants.CommonElements.FUTURE_ELEMENTS
 39  
 })
 40  0
 public class EntityNamePrincipalName extends AbstractDataTransferObject {
 41  
     @XmlElement(name = Elements.PRINCIPAL_NAME, required = false)
 42  
     private final String principalName;
 43  
     @XmlElement(name = Elements.DEFAULT_NAME, required = false)
 44  
     private final EntityName defaultName;
 45  0
     @SuppressWarnings("unused")
 46  
     @XmlAnyElement
 47  
     private final Collection<Element> _futureElements = null;
 48  
 
 49  
 
 50  0
     private EntityNamePrincipalName() {
 51  0
         this.principalName = null;
 52  0
         this.defaultName = null;
 53  0
     }
 54  
 
 55  0
     private EntityNamePrincipalName(Builder builder) {
 56  0
         this.principalName = builder.getPrincipalName();
 57  0
         this.defaultName = builder.getDefaultName() == null ? null : builder.getDefaultName().build();
 58  0
     }
 59  
 
 60  
     public String getPrincipalName() {
 61  0
         return principalName;
 62  
     }
 63  
 
 64  
     public EntityName getDefaultName() {
 65  0
         return defaultName;
 66  
     }
 67  
     /**
 68  
      * A builder which can be used to construct {@link EntityDefault} instances.
 69  
      *
 70  
      */
 71  0
     public final static class Builder
 72  
         implements Serializable, ModelBuilder
 73  
     {
 74  
         private String principalName;
 75  
         private EntityName.Builder defaultName;
 76  
 
 77  
         public static Builder create() {
 78  0
             return new Builder();
 79  
         }
 80  
 
 81  
         public static Builder create(String principalName, EntityName.Builder defaultName) {
 82  0
             Builder builder = new Builder();
 83  0
             builder.setPrincipalName(principalName);
 84  0
             builder.setDefaultName(defaultName);
 85  0
             return builder;
 86  
         }
 87  
 
 88  
         public static Builder create(EntityNamePrincipalName immutable) {
 89  0
             if (immutable == null) {
 90  0
                 throw new IllegalArgumentException("contract was null");
 91  
             }
 92  0
             Builder builder = new Builder();
 93  0
             if (immutable.getDefaultName() != null) {
 94  0
                 builder.setDefaultName(EntityName.Builder.create(immutable.getDefaultName()));
 95  
             }
 96  0
             return builder;
 97  
         }
 98  
 
 99  
         public String getPrincipalName() {
 100  0
             return principalName;
 101  
         }
 102  
 
 103  
         public void setPrincipalName(String principalName) {
 104  0
             this.principalName = principalName;
 105  0
         }
 106  
 
 107  
         public EntityName.Builder getDefaultName() {
 108  0
             return defaultName;
 109  
         }
 110  
 
 111  
         public void setDefaultName(EntityName.Builder defaultName) {
 112  0
             this.defaultName = defaultName;
 113  0
         }
 114  
 
 115  
         public EntityNamePrincipalName build() {
 116  0
             return new EntityNamePrincipalName(this);
 117  
         }
 118  
 
 119  
     }
 120  
 
 121  
     /**
 122  
      * Defines some internal constants used on this class.
 123  
      *
 124  
      */
 125  0
     static class Constants {
 126  
 
 127  
         final static String ROOT_ELEMENT_NAME = "entityNamePrincipalName";
 128  
         final static String TYPE_NAME = "EntityNamePrincipalNameType";
 129  
     }
 130  
 
 131  
 
 132  
     /**
 133  
      * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML.
 134  
      *
 135  
      */
 136  0
     static class Elements {
 137  
         final static String DEFAULT_NAME = "defaultName";
 138  
         final static String PRINCIPAL_NAME = "principalName";
 139  
     }
 140  
 
 141  
 }