1 package org.kuali.student.r2.common.validator;
2
3 import org.kuali.student.r1.common.dictionary.dto.ObjectStructureDefinition;
4
5
6
7
8
9
10
11
12 public class ObjectStructureHierarchy {
13
14 private ObjectStructureDefinition objectStructure;
15
16 private ObjectStructureHierarchy parentObjectStructureHierarchy;
17
18 public ObjectStructureDefinition getObjectStructure() {
19 return objectStructure;
20 }
21
22 public void setObjectStructure(ObjectStructureDefinition objectStructure) {
23 this.objectStructure = objectStructure;
24 }
25
26 public ObjectStructureHierarchy getParentObjectStructureHierarchy() {
27 return parentObjectStructureHierarchy;
28 }
29
30 public void setParentObjectStructureHierarchy(ObjectStructureHierarchy parentObjectStructureHierarchy) {
31 this.parentObjectStructureHierarchy = parentObjectStructureHierarchy;
32 }
33
34 public ObjectStructureDefinition getParentObjectStructure() {
35 if (parentObjectStructureHierarchy == null){
36 return null;
37 }
38
39 return parentObjectStructureHierarchy.getObjectStructure();
40 }
41
42 public ObjectStructureDefinition getRootObjectStructure() {
43 ObjectStructureHierarchy rootObjectStructure = this;
44
45 while (rootObjectStructure.getParentObjectStructureHierarchy() != null){
46 rootObjectStructure = rootObjectStructure.getParentObjectStructureHierarchy();
47 }
48
49 return rootObjectStructure.getObjectStructure();
50 }
51 }