001package org.kuali.kpme.edo.api.group; 002 003import java.io.Serializable; 004import java.util.Collection; 005import javax.xml.bind.annotation.XmlAccessType; 006import javax.xml.bind.annotation.XmlAccessorType; 007import javax.xml.bind.annotation.XmlAnyElement; 008import javax.xml.bind.annotation.XmlElement; 009import javax.xml.bind.annotation.XmlRootElement; 010import javax.xml.bind.annotation.XmlType; 011import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; 012 013import org.joda.time.DateTime; 014import org.joda.time.LocalDate; 015import org.kuali.rice.core.api.CoreConstants; 016import org.kuali.rice.core.api.mo.AbstractDataTransferObject; 017import org.kuali.rice.core.api.mo.ModelBuilder; 018import org.kuali.rice.core.api.util.jaxb.DateTimeAdapter; 019import org.kuali.rice.core.api.util.jaxb.LocalDateAdapter; 020import org.w3c.dom.Element; 021 022@XmlRootElement(name = EdoGroupDefinition.Constants.ROOT_ELEMENT_NAME) 023@XmlAccessorType(XmlAccessType.NONE) 024@XmlType(name = EdoGroupDefinition.Constants.TYPE_NAME, propOrder = { 025 EdoGroupDefinition.Elements.KIM_ROLE_NAME, 026 EdoGroupDefinition.Elements.KIM_TYPE_NAME, 027 EdoGroupDefinition.Elements.WORKFLOW_TYPE, 028 EdoGroupDefinition.Elements.EDO_GROUP_ID, 029 EdoGroupDefinition.Elements.EDO_WORKFLOW_ID, 030 EdoGroupDefinition.Elements.DOSSIER_TYPE, 031 EdoGroupDefinition.Elements.WORKFLOW_LEVEL, 032 CoreConstants.CommonElements.VERSION_NUMBER, 033 CoreConstants.CommonElements.OBJECT_ID, 034 EdoGroupDefinition.Elements.ACTIVE, 035 EdoGroupDefinition.Elements.ID, 036 EdoGroupDefinition.Elements.EFFECTIVE_LOCAL_DATE, 037 EdoGroupDefinition.Elements.CREATE_TIME, 038 EdoGroupDefinition.Elements.USER_PRINCIPAL_ID, 039 CoreConstants.CommonElements.FUTURE_ELEMENTS 040}) 041public final class EdoGroupDefinition 042 extends AbstractDataTransferObject 043 implements EdoGroupDefinitionContract 044{ 045 046 @XmlElement(name = Elements.KIM_ROLE_NAME, required = false) 047 private final String kimRoleName; 048 @XmlElement(name = Elements.KIM_TYPE_NAME, required = false) 049 private final String kimTypeName; 050 @XmlElement(name = Elements.WORKFLOW_TYPE, required = false) 051 private final String workflowType; 052 @XmlElement(name = Elements.EDO_GROUP_ID, required = false) 053 private final String edoGroupId; 054 @XmlElement(name = Elements.EDO_WORKFLOW_ID, required = false) 055 private final String edoWorkflowId; 056 @XmlElement(name = Elements.DOSSIER_TYPE, required = false) 057 private final String dossierType; 058 @XmlElement(name = Elements.WORKFLOW_LEVEL, required = false) 059 private final String workflowLevel; 060 @XmlElement(name = CoreConstants.CommonElements.VERSION_NUMBER, required = false) 061 private final Long versionNumber; 062 @XmlElement(name = CoreConstants.CommonElements.OBJECT_ID, required = false) 063 private final String objectId; 064 @XmlElement(name = Elements.ACTIVE, required = false) 065 private final boolean active; 066 @XmlElement(name = Elements.ID, required = false) 067 private final String id; 068 @XmlJavaTypeAdapter(LocalDateAdapter.class) 069 @XmlElement(name = Elements.EFFECTIVE_LOCAL_DATE, required = false) 070 private final LocalDate effectiveLocalDate; 071 @XmlJavaTypeAdapter(DateTimeAdapter.class) 072 @XmlElement(name = Elements.CREATE_TIME, required = false) 073 private final DateTime createTime; 074 @XmlElement(name = Elements.USER_PRINCIPAL_ID, required = false) 075 private final String userPrincipalId; 076 @SuppressWarnings("unused") 077 @XmlAnyElement 078 private final Collection<Element> _futureElements = null; 079 080 /** 081 * Private constructor used only by JAXB. 082 * 083 */ 084 private EdoGroupDefinition() { 085 this.kimRoleName = null; 086 this.kimTypeName = null; 087 this.workflowType = null; 088 this.edoGroupId = null; 089 this.edoWorkflowId = null; 090 this.dossierType = null; 091 this.workflowLevel = null; 092 this.versionNumber = null; 093 this.objectId = null; 094 this.active = false; 095 this.id = null; 096 this.effectiveLocalDate = null; 097 this.createTime = null; 098 this.userPrincipalId = null; 099 } 100 101 private EdoGroupDefinition(Builder builder) { 102 this.kimRoleName = builder.getKimRoleName(); 103 this.kimTypeName = builder.getKimTypeName(); 104 this.workflowType = builder.getWorkflowType(); 105 this.edoGroupId = builder.getEdoGroupId(); 106 this.edoWorkflowId = builder.getEdoWorkflowId(); 107 this.dossierType = builder.getDossierType(); 108 this.workflowLevel = builder.getWorkflowLevel(); 109 this.versionNumber = builder.getVersionNumber(); 110 this.objectId = builder.getObjectId(); 111 this.active = builder.isActive(); 112 this.id = builder.getId(); 113 this.effectiveLocalDate = builder.getEffectiveLocalDate(); 114 this.createTime = builder.getCreateTime(); 115 this.userPrincipalId = builder.getUserPrincipalId(); 116 } 117 118 @Override 119 public String getKimRoleName() { 120 return this.kimRoleName; 121 } 122 123 @Override 124 public String getKimTypeName() { 125 return this.kimTypeName; 126 } 127 128 @Override 129 public String getWorkflowType() { 130 return this.workflowType; 131 } 132 133 @Override 134 public String getEdoGroupId() { 135 return this.edoGroupId; 136 } 137 138 @Override 139 public String getEdoWorkflowId() { 140 return this.edoWorkflowId; 141 } 142 143 @Override 144 public String getDossierType() { 145 return this.dossierType; 146 } 147 148 @Override 149 public String getWorkflowLevel() { 150 return this.workflowLevel; 151 } 152 153 @Override 154 public Long getVersionNumber() { 155 return this.versionNumber; 156 } 157 158 @Override 159 public String getObjectId() { 160 return this.objectId; 161 } 162 163 @Override 164 public boolean isActive() { 165 return this.active; 166 } 167 168 @Override 169 public String getId() { 170 return this.id; 171 } 172 173 @Override 174 public LocalDate getEffectiveLocalDate() { 175 return this.effectiveLocalDate; 176 } 177 178 @Override 179 public DateTime getCreateTime() { 180 return this.createTime; 181 } 182 183 @Override 184 public String getUserPrincipalId() { 185 return this.userPrincipalId; 186 } 187 188 189 /** 190 * A builder which can be used to construct {@link EdoGroupDefinition} instances. Enforces the constraints of the {@link EdoGroupDefinitionContract}. 191 * 192 */ 193 public final static class Builder 194 implements Serializable, EdoGroupDefinitionContract, ModelBuilder 195 { 196 197 private String kimRoleName; 198 private String kimTypeName; 199 private String workflowType; 200 private String edoGroupId; 201 private String edoWorkflowId; 202 private String dossierType; 203 private String workflowLevel; 204 private Long versionNumber; 205 private String objectId; 206 private boolean active; 207 private String id; 208 private LocalDate effectiveLocalDate; 209 private DateTime createTime; 210 private String userPrincipalId; 211 212 private Builder() { 213 // TODO modify this constructor as needed to pass any required values and invoke the appropriate 'setter' methods 214 } 215 216 public static Builder create() { 217 // TODO modify as needed to pass any required values and add them to the signature of the 'create' method 218 return new Builder(); 219 } 220 221 private Builder(String edoWorkflowId, String workflowLevel, String dossierType) { 222 // TODO modify this constructor as needed to pass any required values and invoke the appropriate 'setter' methods 223 setEdoWorkflowId(edoWorkflowId); 224 setWorkflowLevel(workflowLevel); 225 setDossierType(dossierType); 226 } 227 228 public static Builder create(String edoWorkflowId, String workflowLevel, String dossierType) { 229 // TODO modify as needed to pass any required values and add them to the signature of the 'create' method 230 return new Builder(edoWorkflowId, workflowLevel, dossierType); 231 } 232 233 public static Builder create(EdoGroupDefinitionContract contract) { 234 if (contract == null) { 235 throw new IllegalArgumentException("contract was null"); 236 } 237 // TODO if create() is modified to accept required parameters, this will need to be modified 238 Builder builder = create(); 239 builder.setKimRoleName(contract.getKimRoleName()); 240 builder.setKimTypeName(contract.getKimTypeName()); 241 builder.setWorkflowType(contract.getWorkflowType()); 242 builder.setEdoGroupId(contract.getEdoGroupId()); 243 builder.setEdoWorkflowId(contract.getEdoWorkflowId()); 244 builder.setDossierType(contract.getDossierType()); 245 builder.setWorkflowLevel(contract.getWorkflowLevel()); 246 builder.setVersionNumber(contract.getVersionNumber()); 247 builder.setObjectId(contract.getObjectId()); 248 builder.setActive(contract.isActive()); 249 builder.setId(contract.getId()); 250 builder.setEffectiveLocalDate(contract.getEffectiveLocalDate()); 251 builder.setCreateTime(contract.getCreateTime()); 252 builder.setUserPrincipalId(contract.getUserPrincipalId()); 253 return builder; 254 } 255 256 public EdoGroupDefinition build() { 257 return new EdoGroupDefinition(this); 258 } 259 260 @Override 261 public String getKimRoleName() { 262 return this.kimRoleName; 263 } 264 265 @Override 266 public String getKimTypeName() { 267 return this.kimTypeName; 268 } 269 270 @Override 271 public String getWorkflowType() { 272 return this.workflowType; 273 } 274 275 @Override 276 public String getEdoGroupId() { 277 return this.edoGroupId; 278 } 279 280 @Override 281 public String getEdoWorkflowId() { 282 return this.edoWorkflowId; 283 } 284 285 @Override 286 public String getDossierType() { 287 return this.dossierType; 288 } 289 290 @Override 291 public String getWorkflowLevel() { 292 return this.workflowLevel; 293 } 294 295 @Override 296 public Long getVersionNumber() { 297 return this.versionNumber; 298 } 299 300 @Override 301 public String getObjectId() { 302 return this.objectId; 303 } 304 305 @Override 306 public boolean isActive() { 307 return this.active; 308 } 309 310 @Override 311 public String getId() { 312 return this.id; 313 } 314 315 @Override 316 public LocalDate getEffectiveLocalDate() { 317 return this.effectiveLocalDate; 318 } 319 320 @Override 321 public DateTime getCreateTime() { 322 return this.createTime; 323 } 324 325 @Override 326 public String getUserPrincipalId() { 327 return this.userPrincipalId; 328 } 329 330 public void setKimRoleName(String kimRoleName) { 331 // TODO add validation of input value if required and throw IllegalArgumentException if needed 332 this.kimRoleName = kimRoleName; 333 } 334 335 public void setKimTypeName(String kimTypeName) { 336 // TODO add validation of input value if required and throw IllegalArgumentException if needed 337 this.kimTypeName = kimTypeName; 338 } 339 340 public void setWorkflowType(String workflowType) { 341 // TODO add validation of input value if required and throw IllegalArgumentException if needed 342 this.workflowType = workflowType; 343 } 344 345 public void setEdoGroupId(String edoGroupId) { 346 // TODO add validation of input value if required and throw IllegalArgumentException if needed 347 this.edoGroupId = edoGroupId; 348 } 349 350 public void setEdoWorkflowId(String edoWorkflowId) { 351 // TODO add validation of input value if required and throw IllegalArgumentException if needed 352 this.edoWorkflowId = edoWorkflowId; 353 } 354 355 public void setDossierType(String dossierType) { 356 // TODO add validation of input value if required and throw IllegalArgumentException if needed 357 this.dossierType = dossierType; 358 } 359 360 public void setWorkflowLevel(String workflowLevel) { 361 // TODO add validation of input value if required and throw IllegalArgumentException if needed 362 this.workflowLevel = workflowLevel; 363 } 364 365 public void setVersionNumber(Long versionNumber) { 366 // TODO add validation of input value if required and throw IllegalArgumentException if needed 367 this.versionNumber = versionNumber; 368 } 369 370 public void setObjectId(String objectId) { 371 // TODO add validation of input value if required and throw IllegalArgumentException if needed 372 this.objectId = objectId; 373 } 374 375 public void setActive(boolean active) { 376 // TODO add validation of input value if required and throw IllegalArgumentException if needed 377 this.active = active; 378 } 379 380 public void setId(String id) { 381 // TODO add validation of input value if required and throw IllegalArgumentException if needed 382 this.id = id; 383 } 384 385 public void setEffectiveLocalDate(LocalDate effectiveLocalDate) { 386 // TODO add validation of input value if required and throw IllegalArgumentException if needed 387 this.effectiveLocalDate = effectiveLocalDate; 388 } 389 390 public void setCreateTime(DateTime createTime) { 391 // TODO add validation of input value if required and throw IllegalArgumentException if needed 392 this.createTime = createTime; 393 } 394 395 public void setUserPrincipalId(String userPrincipalId) { 396 // TODO add validation of input value if required and throw IllegalArgumentException if needed 397 this.userPrincipalId = userPrincipalId; 398 } 399 400 } 401 402 403 /** 404 * Defines some internal constants used on this class. 405 * 406 */ 407 static class Constants { 408 409 final static String ROOT_ELEMENT_NAME = "edoGroupDefinition"; 410 final static String TYPE_NAME = "EdoGroupDefinitionType"; 411 412 } 413 414 415 /** 416 * A private class which exposes constants which define the XML element names to use when this object is marshalled to XML. 417 * 418 */ 419 static class Elements { 420 421 final static String KIM_ROLE_NAME = "kimRoleName"; 422 final static String KIM_TYPE_NAME = "kimTypeName"; 423 final static String WORKFLOW_TYPE = "workflowType"; 424 final static String EDO_GROUP_ID = "edoGroupId"; 425 final static String EDO_WORKFLOW_ID = "edoWorkflowId"; 426 final static String DOSSIER_TYPE = "dossierType"; 427 final static String WORKFLOW_LEVEL = "workflowLevel"; 428 final static String ACTIVE = "active"; 429 final static String ID = "id"; 430 final static String EFFECTIVE_LOCAL_DATE = "effectiveLocalDate"; 431 final static String CREATE_TIME = "createTime"; 432 final static String USER_PRINCIPAL_ID = "userPrincipalId"; 433 434 } 435 436} 437