Coverage Report - org.kuali.rice.ksb.api.registry.RemoveAndPublishResult
 
Classes in this File Line Coverage Branch Coverage Complexity
RemoveAndPublishResult
0%
0/15
N/A
1
RemoveAndPublishResult$Constants
0%
0/2
N/A
1
RemoveAndPublishResult$Elements
0%
0/1
N/A
1
 
 1  
 package org.kuali.rice.ksb.api.registry;
 2  
 
 3  
 import java.util.ArrayList;
 4  
 import java.util.Collection;
 5  
 import java.util.Collections;
 6  
 import java.util.List;
 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.XmlElementWrapper;
 13  
 import javax.xml.bind.annotation.XmlRootElement;
 14  
 import javax.xml.bind.annotation.XmlType;
 15  
 
 16  
 import org.apache.commons.lang.builder.EqualsBuilder;
 17  
 import org.apache.commons.lang.builder.HashCodeBuilder;
 18  
 import org.apache.commons.lang.builder.ToStringBuilder;
 19  
 import org.kuali.rice.core.api.CoreConstants;
 20  
 import org.kuali.rice.core.api.mo.ModelObjectComplete;
 21  
 import org.w3c.dom.Element;
 22  
 
 23  
 /**
 24  
  * Wraps information resulting from a "removeAndPublish" operation on the
 25  
  * registry.  Effectively contains a list of {@link ServiceEndpoint} instances
 26  
  * for services that were published and those that were removed
 27  
  * 
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  *
 30  
  */
 31  
 @XmlRootElement(name = RemoveAndPublishResult.Constants.ROOT_ELEMENT_NAME)
 32  
 @XmlAccessorType(XmlAccessType.NONE)
 33  
 @XmlType(name = RemoveAndPublishResult.Constants.TYPE_NAME, propOrder = {
 34  
                 RemoveAndPublishResult.Elements.SERVICES_REMOVED,
 35  
                 RemoveAndPublishResult.Elements.SERVICES_PUBLISHED,
 36  
                 CoreConstants.CommonElements.FUTURE_ELEMENTS
 37  
 })
 38  
 public class RemoveAndPublishResult implements ModelObjectComplete {
 39  
 
 40  
         private static final long serialVersionUID = 4279564869510247725L;
 41  
 
 42  
         @XmlElementWrapper(name = Elements.SERVICES_REMOVED, required = false)
 43  
         @XmlElement(name = Elements.SERVICE_REMOVED, required = false)
 44  
         private final List<ServiceEndpoint> servicesRemoved;
 45  
         
 46  
         @XmlElementWrapper(name = Elements.SERVICES_PUBLISHED, required = false)
 47  
         @XmlElement(name = Elements.SERVICE_PUBLISHED, required = false)
 48  
         private final List<ServiceEndpoint> servicesPublished;
 49  
         
 50  0
     @SuppressWarnings("unused")
 51  
     @XmlAnyElement
 52  
     private final Collection<Element> _futureElements = null;
 53  
 
 54  0
         private RemoveAndPublishResult() {
 55  0
                 this.servicesRemoved = null;
 56  0
                 this.servicesPublished = null;
 57  0
         }
 58  
         
 59  0
         private RemoveAndPublishResult(List<ServiceEndpoint> servicesRemoved, List<ServiceEndpoint> servicesPublished) {
 60  0
                 this.servicesRemoved = servicesRemoved;
 61  0
                 this.servicesPublished = servicesPublished;
 62  0
         }
 63  
         
 64  
         /**
 65  
          * Creates a new {@code RemoveAndPublishResult} from the given lists of services removed and published.
 66  
          * 
 67  
          * @param servicesRemoved the list of services removed by the operation, can be a null or empty list
 68  
          * @param servicesPublished the list of services published by the operation, can be a null or empty list
 69  
          * 
 70  
          * @return the constructed {@code RemoveAndPublishResult}, should never return null
 71  
          */
 72  
         public static RemoveAndPublishResult create(List<ServiceEndpoint> servicesRemoved, List<ServiceEndpoint> servicesPublished) {
 73  0
                 return new RemoveAndPublishResult(new ArrayList<ServiceEndpoint>(servicesRemoved),
 74  
                                 new ArrayList<ServiceEndpoint>(servicesPublished));
 75  
         }
 76  
 
 77  
         /**
 78  
          * Returns an unmodifiable list of services that were removed as the result
 79  
          * of a remove-and-publish operation.
 80  
          * 
 81  
          * @return an unmodifiable list of removed services, will never be null but
 82  
          * may be empty if no services were removed
 83  
          */
 84  
         public List<ServiceEndpoint> getServicesRemoved() {
 85  0
                 return Collections.unmodifiableList(servicesRemoved);
 86  
         }
 87  
 
 88  
         /**
 89  
          * Returns an unmodifiable list of services that were published as the result
 90  
          * of a remove-and-publish operation.
 91  
          * 
 92  
          * @return an unmodifiable list of published services, will never be null but
 93  
          * may be empty if no services were published
 94  
          */
 95  
         public List<ServiceEndpoint> getServicesPublished() {
 96  0
                 return Collections.unmodifiableList(servicesPublished);
 97  
         }
 98  
         
 99  
         @Override
 100  
     public int hashCode() {
 101  0
         return HashCodeBuilder.reflectionHashCode(this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 102  
     }
 103  
 
 104  
     @Override
 105  
     public boolean equals(Object object) {
 106  0
         return EqualsBuilder.reflectionEquals(object, this, Constants.HASH_CODE_EQUALS_EXCLUDE);
 107  
     }
 108  
 
 109  
     @Override
 110  
     public String toString() {
 111  0
         return ToStringBuilder.reflectionToString(this);
 112  
     }
 113  
         
 114  
         /**
 115  
      * Defines some internal constants used on this class.
 116  
      */
 117  0
     static class Constants {
 118  
 
 119  
             final static String ROOT_ELEMENT_NAME = "removeAndPublishResult";
 120  
         final static String TYPE_NAME = "RemoveAndPublishResultType";
 121  0
         final static String[] HASH_CODE_EQUALS_EXCLUDE = new String[] {CoreConstants.CommonElements.FUTURE_ELEMENTS };
 122  
     
 123  
     }
 124  
         
 125  
         /**
 126  
      * Exposes constants which define the XML element names to use when this object is marshalled to XML.
 127  
      */
 128  0
     static class Elements {
 129  
 
 130  
         final static String SERVICES_REMOVED = "servicesRemoved";
 131  
         final static String SERVICE_REMOVED = "serviceRemoved";
 132  
         final static String SERVICES_PUBLISHED = "servicesPublished";
 133  
         final static String SERVICE_PUBLISHED = "servicePublished";
 134  
 
 135  
     }
 136  
     
 137  
 }