Coverage Report - org.kuali.rice.kim.api.group.GroupMemberQueryResults
 
Classes in this File Line Coverage Branch Coverage Complexity
GroupMemberQueryResults
0%
0/22
0%
0/4
1.118
GroupMemberQueryResults$1
N/A
N/A
1.118
GroupMemberQueryResults$Builder
0%
0/16
N/A
1.118
GroupMemberQueryResults$Constants
0%
0/2
N/A
1.118
GroupMemberQueryResults$Elements
0%
0/1
N/A
1.118
 
 1  
 /*
 2  
  * Copyright 2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 1.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/ecl1.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.group;
 17  
 
 18  
 import org.apache.commons.lang.builder.EqualsBuilder;
 19  
 import org.apache.commons.lang.builder.HashCodeBuilder;
 20  
 import org.apache.commons.lang.builder.ToStringBuilder;
 21  
 import org.kuali.rice.core.api.CoreConstants;
 22  
 import org.kuali.rice.core.api.criteria.QueryResults;
 23  
 import org.kuali.rice.core.api.mo.ModelBuilder;
 24  
 import org.kuali.rice.core.api.mo.ModelObjectComplete;
 25  
 import org.w3c.dom.Element;
 26  
 
 27  
 import javax.xml.bind.annotation.XmlAccessType;
 28  
 import javax.xml.bind.annotation.XmlAccessorType;
 29  
 import javax.xml.bind.annotation.XmlAnyElement;
 30  
 import javax.xml.bind.annotation.XmlElement;
 31  
 import javax.xml.bind.annotation.XmlElementWrapper;
 32  
 import javax.xml.bind.annotation.XmlRootElement;
 33  
 import javax.xml.bind.annotation.XmlType;
 34  
 import java.util.ArrayList;
 35  
 import java.util.Collection;
 36  
 import java.util.Collections;
 37  
 import java.util.List;
 38  
 
 39  
 /**
 40  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 41  
  */
 42  
 @XmlRootElement(name = GroupMemberQueryResults.Constants.ROOT_ELEMENT_NAME)
 43  
 @XmlAccessorType(XmlAccessType.NONE)
 44  
 @XmlType(name = GroupMemberQueryResults.Constants.TYPE_NAME, propOrder = {
 45  
                 GroupMemberQueryResults.Elements.RESULTS,
 46  
                 GroupMemberQueryResults.Elements.TOTAL_ROW_COUNT,
 47  
                 GroupMemberQueryResults.Elements.MORE_RESULTS_AVAILALBE,
 48  
                 CoreConstants.CommonElements.FUTURE_ELEMENTS })
 49  0
 public class GroupMemberQueryResults implements QueryResults<GroupMember>, ModelObjectComplete {
 50  
 
 51  
         @XmlElementWrapper(name = Elements.RESULTS, required = false)
 52  
         @XmlElement(name = Elements.RESULT_ELEM, required = false)
 53  
         private final List<GroupMember> results;
 54  
 
 55  
         @XmlElement(name = Elements.TOTAL_ROW_COUNT, required = false)
 56  
         private final Integer totalRowCount;
 57  
 
 58  
         @XmlElement(name = Elements.MORE_RESULTS_AVAILALBE, required = true)
 59  
         private final boolean moreResultsAvailable;
 60  
 
 61  0
         @SuppressWarnings("unused")
 62  
     @XmlAnyElement
 63  
     private final Collection<Element> _futureElements = null;
 64  
 
 65  0
         private GroupMemberQueryResults() {
 66  0
                 this.results = null;
 67  0
                 this.totalRowCount = null;
 68  0
                 this.moreResultsAvailable = false;
 69  0
         }
 70  
 
 71  0
         private GroupMemberQueryResults(Builder builder) {
 72  0
                 final List<GroupMember> temp = new ArrayList<GroupMember>();
 73  0
         for (GroupMember.Builder b : builder.getResults()) {
 74  0
             if (b != null) {
 75  0
                 temp.add(b.build());
 76  
             }
 77  
         }
 78  
 
 79  0
         this.results = Collections.unmodifiableList(temp);
 80  0
                 this.totalRowCount = builder.getTotalRowCount();
 81  0
                 this.moreResultsAvailable = builder.isMoreResultsAvailable();
 82  0
         }
 83  
 
 84  
         @Override
 85  
         public List<GroupMember> getResults() {
 86  0
                 return results;
 87  
         }
 88  
         
 89  
         @Override
 90  
         public Integer getTotalRowCount() {
 91  0
                 return totalRowCount;
 92  
         }
 93  
 
 94  
         @Override
 95  
         public boolean isMoreResultsAvailable() {
 96  0
                 return moreResultsAvailable;
 97  
         }
 98  
 
 99  
     @Override
 100  
     public int hashCode() {
 101  0
         return HashCodeBuilder.reflectionHashCode(this);
 102  
     }
 103  
 
 104  
     @Override
 105  
     public boolean equals(Object obj) {
 106  0
         return EqualsBuilder.reflectionEquals(obj, this);
 107  
     }
 108  
 
 109  
     @Override
 110  
     public String toString() {
 111  0
         return ToStringBuilder.reflectionToString(this);
 112  
     }
 113  
 
 114  0
         public static class Builder implements ModelBuilder, QueryResults<GroupMember.Builder> {
 115  
 
 116  
                 private List<GroupMember.Builder> results;
 117  
                 private Integer totalRowCount;
 118  
                 private boolean moreResultsAvailable;
 119  
 
 120  
         public static Builder create() {
 121  0
             return new Builder();
 122  
         }
 123  
 
 124  0
                 private Builder() {
 125  0
                         this.results = new ArrayList<GroupMember.Builder>();
 126  0
                         this.moreResultsAvailable = false;
 127  0
                 }
 128  
 
 129  
         @Override
 130  
                 public GroupMemberQueryResults build() {
 131  0
                         return new GroupMemberQueryResults(this);
 132  
                 }
 133  
 
 134  
         @Override
 135  
                 public List<GroupMember.Builder> getResults() {
 136  0
                         return Collections.unmodifiableList(this.results);
 137  
                 }
 138  
 
 139  
                 public void setResults(List<GroupMember.Builder> results) {
 140  0
                         this.results = new ArrayList<GroupMember.Builder>(results);
 141  0
                 }
 142  
 
 143  
         @Override
 144  
                 public Integer getTotalRowCount() {
 145  0
                         return this.totalRowCount;
 146  
                 }
 147  
 
 148  
                 public void setTotalRowCount(Integer totalRowCount) {
 149  0
                         this.totalRowCount = totalRowCount;
 150  0
                 }
 151  
 
 152  
         @Override
 153  
                 public boolean isMoreResultsAvailable() {
 154  0
                         return this.moreResultsAvailable;
 155  
                 }
 156  
 
 157  
                 public void setMoreResultsAvailable(boolean moreResultsAvailable) {
 158  0
                         this.moreResultsAvailable = moreResultsAvailable;
 159  0
                 }
 160  
                 
 161  
         }
 162  
         
 163  
         /**
 164  
          * Defines some internal constants used on this class.
 165  
          */
 166  0
         public static class Constants {
 167  
                 public final static String ROOT_ELEMENT_NAME = "GroupMemberQueryResults";
 168  
                 public final static String TYPE_NAME = "GroupMemberQueryResultsType";
 169  0
                 public final static String[] HASH_CODE_EQUALS_EXCLUDE = { CoreConstants.CommonElements.FUTURE_ELEMENTS };
 170  
         }
 171  
 
 172  
         /**
 173  
          * A private class which exposes constants which define the XML element
 174  
          * names to use when this object is marshaled to XML.
 175  
          */
 176  0
         public static class Elements {
 177  
                 public final static String RESULTS = "results";
 178  
                 public final static String RESULT_ELEM = "GroupMember";
 179  
                 public final static String TOTAL_ROW_COUNT = "totalRowCount";
 180  
                 public final static String MORE_RESULTS_AVAILALBE = "moreResultsAvailable";
 181  
         }
 182  
         
 183  
 }