|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
   package org.kuali.rice.kim.api.responsibility;  | 
  |  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 |     | 
     | 
  |  41 |     | 
     | 
  |  42 |     | 
   @XmlRootElement(name = ResponsibilityQueryResults.Constants.ROOT_ELEMENT_NAME)  | 
  |  43 |     | 
   @XmlAccessorType(XmlAccessType.NONE)  | 
  |  44 |     | 
   @XmlType(name = ResponsibilityQueryResults.Constants.TYPE_NAME, propOrder = { | 
  |  45 |     | 
                   ResponsibilityQueryResults.Elements.RESULTS,  | 
  |  46 |     | 
                   ResponsibilityQueryResults.Elements.TOTAL_ROW_COUNT,  | 
  |  47 |     | 
                   ResponsibilityQueryResults.Elements.MORE_RESULTS_AVAILALBE,  | 
  |  48 |     | 
                   CoreConstants.CommonElements.FUTURE_ELEMENTS })  | 
  |  49 |    0 |    public class ResponsibilityQueryResults implements QueryResults<Responsibility>, ModelObjectComplete { | 
  |  50 |     | 
     | 
  |  51 |     | 
           @XmlElementWrapper(name = Elements.RESULTS, required = false)  | 
  |  52 |     | 
           @XmlElement(name = Elements.RESULT_ELEM, required = false)  | 
  |  53 |     | 
           private final List<Responsibility> 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 ResponsibilityQueryResults() { | 
  |  66 |    0 |                    this.results = null;  | 
  |  67 |    0 |                    this.totalRowCount = null;  | 
  |  68 |    0 |                    this.moreResultsAvailable = false;  | 
  |  69 |    0 |            }  | 
  |  70 |     | 
     | 
  |  71 |    0 |            private ResponsibilityQueryResults(Builder builder) { | 
  |  72 |    0 |                    final List<Responsibility> temp = new ArrayList<Responsibility>();  | 
  |  73 |    0 |            for (Responsibility.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<Responsibility> 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<Responsibility.Builder> { | 
  |  115 |     | 
     | 
  |  116 |     | 
                   private List<Responsibility.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<Responsibility.Builder>();  | 
  |  126 |    0 |                            this.moreResultsAvailable = false;  | 
  |  127 |    0 |                    }  | 
  |  128 |     | 
     | 
  |  129 |     | 
           @Override  | 
  |  130 |     | 
                   public ResponsibilityQueryResults build() { | 
  |  131 |    0 |                            return new ResponsibilityQueryResults(this);  | 
  |  132 |     | 
                   }  | 
  |  133 |     | 
     | 
  |  134 |     | 
           @Override  | 
  |  135 |     | 
                   public List<Responsibility.Builder> getResults() { | 
  |  136 |    0 |                            return Collections.unmodifiableList(this.results);  | 
  |  137 |     | 
                   }  | 
  |  138 |     | 
     | 
  |  139 |     | 
                   public void setResults(List<Responsibility.Builder> results) { | 
  |  140 |    0 |                            this.results = new ArrayList<Responsibility.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 |     | 
     | 
  |  165 |     | 
     | 
  |  166 |    0 |            public static class Constants { | 
  |  167 |     | 
                   public final static String ROOT_ELEMENT_NAME = "responsibilityQueryResults";  | 
  |  168 |     | 
                   public final static String TYPE_NAME = "ResponsibilityQueryResultsType";  | 
  |  169 |    0 |                    public final static String[] HASH_CODE_EQUALS_EXCLUDE = { CoreConstants.CommonElements.FUTURE_ELEMENTS }; | 
  |  170 |     | 
           }  | 
  |  171 |     | 
     | 
  |  172 |     | 
             | 
  |  173 |     | 
     | 
  |  174 |     | 
     | 
  |  175 |     | 
     | 
  |  176 |    0 |            public static class Elements { | 
  |  177 |     | 
                   public final static String RESULTS = "results";  | 
  |  178 |     | 
                   public final static String RESULT_ELEM = "responsibility";  | 
  |  179 |     | 
                   public final static String TOTAL_ROW_COUNT = "totalRowCount";  | 
  |  180 |     | 
                   public final static String MORE_RESULTS_AVAILALBE = "moreResultsAvailable";  | 
  |  181 |     | 
           }  | 
  |  182 |     | 
             | 
  |  183 |     | 
   }  |