Coverage Report - org.kuali.rice.ksb.api.bus.support.JavaServiceConfiguration
 
Classes in this File Line Coverage Branch Coverage Complexity
JavaServiceConfiguration
72%
8/11
25%
1/4
1.4
JavaServiceConfiguration$1
N/A
N/A
1.4
JavaServiceConfiguration$Builder
92%
12/13
50%
1/2
1.4
JavaServiceConfiguration$Constants
0%
0/1
N/A
1.4
JavaServiceConfiguration$Elements
0%
0/1
N/A
1.4
 
 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.ksb.api.bus.support;
 17  
 
 18  
 import java.util.ArrayList;
 19  
 import java.util.Collections;
 20  
 import java.util.List;
 21  
 
 22  
 import javax.xml.bind.annotation.XmlAccessType;
 23  
 import javax.xml.bind.annotation.XmlAccessorType;
 24  
 import javax.xml.bind.annotation.XmlElement;
 25  
 import javax.xml.bind.annotation.XmlElementWrapper;
 26  
 import javax.xml.bind.annotation.XmlRootElement;
 27  
 import javax.xml.bind.annotation.XmlType;
 28  
 
 29  
 @XmlRootElement(name = JavaServiceConfiguration.Constants.ROOT_ELEMENT_NAME)
 30  
 @XmlAccessorType(XmlAccessType.NONE)
 31  
 @XmlType(name = JavaServiceConfiguration.Constants.TYPE_NAME, propOrder = {
 32  
                 JavaServiceConfiguration.Elements.SERVICE_INTERFACES
 33  
 })
 34  2
 public final class JavaServiceConfiguration extends AbstractServiceConfiguration {
 35  
 
 36  
         private static final long serialVersionUID = -4226512121638441108L;
 37  
 
 38  
         @XmlElementWrapper(name = Elements.SERVICE_INTERFACES, required = false)
 39  
         @XmlElement(name = Elements.SERVICE_INTERFACE, required = false)
 40  
         private final List<String> serviceInterfaces;
 41  
         
 42  
         /**
 43  
      * Private constructor used only by JAXB.
 44  
      */
 45  
         private JavaServiceConfiguration() {
 46  5
                 super();
 47  5
                 this.serviceInterfaces = null;
 48  5
         }
 49  
 
 50  
         
 51  
         private JavaServiceConfiguration(Builder builder) {
 52  2
                 super(builder);
 53  2
                 this.serviceInterfaces = builder.getServiceInterfaces() == null ? null : new ArrayList<String>(builder.getServiceInterfaces());
 54  2
         }
 55  
         
 56  
         public static JavaServiceConfiguration fromServiceDefinition(JavaServiceDefinition javaServiceDefinition) {
 57  2
                 return Builder.create(javaServiceDefinition).build();
 58  
         }
 59  
                 
 60  
         public List<String> getServiceInterfaces() {
 61  0
                 if (this.serviceInterfaces == null) {
 62  0
                         return Collections.emptyList();
 63  
                 }
 64  0
                 return Collections.unmodifiableList(this.serviceInterfaces);
 65  
         }
 66  
                 
 67  56
         public static final class Builder extends AbstractServiceConfiguration.Builder<JavaServiceConfiguration> {
 68  
 
 69  
                 private static final long serialVersionUID = 4300659121377259098L;
 70  
 
 71  
                 private List<String> serviceInterfaces;
 72  
                                 
 73  
                 public List<String> getServiceInterfaces() {
 74  4
                         return serviceInterfaces;
 75  
                 }
 76  
                 
 77  
                 public void setServiceInterfaces(List<String> serviceInterfaces) {
 78  2
                         if (serviceInterfaces == null) {
 79  0
                                 this.serviceInterfaces = null;
 80  
                         } else {
 81  2
                                 this.serviceInterfaces = new ArrayList<String>(serviceInterfaces);
 82  
                         }
 83  2
                 }
 84  
                 
 85  2
                 private Builder() {}
 86  
                 
 87  
                 public static Builder create() {
 88  2
                         return new Builder();
 89  
                 }
 90  
                 
 91  
                 public static Builder create(JavaServiceDefinition javaServiceDefinition) {
 92  2
                         Builder builder = create();
 93  2
                         builder.copyServiceDefinitionProperties(javaServiceDefinition);
 94  2
                         builder.setServiceInterfaces(javaServiceDefinition.getServiceInterfaces());
 95  2
                         return builder;
 96  
                 }
 97  
 
 98  
                 @Override
 99  
                 public JavaServiceConfiguration build() {
 100  2
                         return new JavaServiceConfiguration(this);
 101  
                 }
 102  
                 
 103  
         }
 104  
         
 105  
         /**
 106  
      * Defines some internal constants used on this class.
 107  
      */
 108  0
     static class Constants {
 109  
             final static String ROOT_ELEMENT_NAME = "javaServiceConfiguration";
 110  
         final static String TYPE_NAME = "JavaServiceConfigurationType";
 111  
     }
 112  
 
 113  
     /**
 114  
      * A private class which exposes constants which define the XML element names to use
 115  
      * when this object is marshalled to XML.
 116  
      */
 117  0
     static class Elements {
 118  
             protected final static String SERVICE_INTERFACES = "serviceInterfaces";
 119  
             protected final static String SERVICE_INTERFACE = "serviceInterface";
 120  
     }
 121  
         
 122  
 }