001 /** 002 * Copyright 2005-2011 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.kuali.rice.krms.api.repository.agenda; 017 018 import java.io.Serializable; 019 import java.util.Collection; 020 021 import javax.xml.bind.annotation.XmlAccessType; 022 import javax.xml.bind.annotation.XmlAccessorType; 023 import javax.xml.bind.annotation.XmlAnyElement; 024 import javax.xml.bind.annotation.XmlElement; 025 import javax.xml.bind.annotation.XmlRootElement; 026 import javax.xml.bind.annotation.XmlType; 027 028 import org.kuali.rice.core.api.CoreConstants; 029 import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 030 import org.kuali.rice.core.api.mo.ModelBuilder; 031 032 /** 033 * This is a description of what this class does - ewestfal don't forget to fill this in. 034 * 035 * @author Kuali Rice Team (rice.collab@kuali.org) 036 * 037 */ 038 @XmlRootElement(name = AgendaTreeSubAgendaEntry.Constants.ROOT_ELEMENT_NAME) 039 @XmlAccessorType(XmlAccessType.NONE) 040 @XmlType(name = AgendaTreeSubAgendaEntry.Constants.TYPE_NAME, propOrder = { 041 AgendaTreeSubAgendaEntry.Elements.AGENDA_ITEM_ID, 042 AgendaTreeSubAgendaEntry.Elements.SUB_AGENDA_ID, 043 CoreConstants.CommonElements.FUTURE_ELEMENTS 044 }) 045 public final class AgendaTreeSubAgendaEntry extends AbstractDataTransferObject implements AgendaTreeEntryDefinition { 046 047 private static final long serialVersionUID = 8594116503548506936L; 048 049 @XmlElement(name = Elements.AGENDA_ITEM_ID, required = true) 050 private final String agendaItemId; 051 052 @XmlElement(name = Elements.SUB_AGENDA_ID, required = true) 053 private final String subAgendaId; 054 055 @SuppressWarnings("unused") 056 @XmlAnyElement 057 private final Collection<org.w3c.dom.Element> _futureElements = null; 058 059 /** 060 * Used only by JAXB. 061 */ 062 private AgendaTreeSubAgendaEntry() { 063 this.agendaItemId = null; 064 this.subAgendaId = null; 065 } 066 067 private AgendaTreeSubAgendaEntry(Builder builder) { 068 this.agendaItemId = builder.getAgendaItemId(); 069 this.subAgendaId = builder.getSubAgendaId(); 070 } 071 072 @Override 073 public String getAgendaItemId() { 074 return agendaItemId; 075 } 076 077 public String getSubAgendaId() { 078 return this.subAgendaId; 079 } 080 081 public static class Builder implements ModelBuilder, Serializable { 082 083 private static final long serialVersionUID = 3548736700798501429L; 084 085 private String agendaItemId; 086 private String subAgendaId; 087 088 /** 089 * Private constructor for creating a builder with all of it's required attributes. 090 */ 091 private Builder(String agendaItemId, String subAgendaId) { 092 setAgendaItemId(agendaItemId); 093 setSubAgendaId(subAgendaId); 094 } 095 096 public static Builder create(String agendaItemId, String subAgendaId){ 097 return new Builder(agendaItemId, subAgendaId); 098 } 099 100 public String getAgendaItemId() { 101 return this.agendaItemId; 102 } 103 104 public String getSubAgendaId() { 105 return this.subAgendaId; 106 } 107 108 public void setAgendaItemId(String agendaItemId) { 109 if (agendaItemId == null) { 110 throw new IllegalArgumentException("agendaItemId was null"); 111 } 112 this.agendaItemId = agendaItemId; 113 } 114 115 public void setSubAgendaId(String subAgendaId) { 116 if (subAgendaId == null) { 117 throw new IllegalArgumentException("subAgendaId was null"); 118 } 119 this.subAgendaId = subAgendaId; 120 } 121 122 @Override 123 public AgendaTreeSubAgendaEntry build() { 124 return new AgendaTreeSubAgendaEntry(this); 125 } 126 127 } 128 129 /** 130 * Defines some internal constants used on this class. 131 */ 132 static class Constants { 133 final static String ROOT_ELEMENT_NAME = "agendaTreeSubAgendaEntry"; 134 final static String TYPE_NAME = "AgendaTreeSubAgendaEntryType"; 135 } 136 137 /** 138 * A private class which exposes constants which define the XML element names to use 139 * when this object is marshalled to XML. 140 */ 141 static class Elements { 142 final static String AGENDA_ITEM_ID = "agendaItemId"; 143 final static String SUB_AGENDA_ID = "subAgendaId"; 144 } 145 146 }