1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.ole.sys.batch;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.springframework.beans.factory.InitializingBean;
22
23
24
25
26
27 public abstract class AbstractFlatFileSpecificationBase implements FlatFileSpecification, InitializingBean {
28 protected Class<?> defaultBusinessObjectClass;
29 protected List<FlatFileObjectSpecification> objectSpecifications;
30 private List<Class<?>> childrenList = new ArrayList<Class<?>>();
31
32
33
34
35 public FlatFileObjectSpecification getObjectSpecification(Class<?> businessObjectClass) {
36 for (FlatFileObjectSpecification objectSpecification : objectSpecifications) {
37 if (objectSpecification.getBusinessObjectClass().equals(businessObjectClass)) {
38 return objectSpecification;
39 }
40 }
41 return null;
42 }
43
44
45
46
47 public List<FlatFileObjectSpecification> getObjectSpecifications() {
48 return objectSpecifications;
49 }
50
51
52
53
54
55
56 public void setObjectSpecifications(List<FlatFileObjectSpecification> objectSpecifications) {
57 this.objectSpecifications = objectSpecifications;
58 }
59
60 public void setDefaultBusinessObjectClass(Class<?> businessObjectClass) {
61 this.defaultBusinessObjectClass = businessObjectClass;
62 }
63
64 public void afterPropertiesSet() throws Exception{
65 Class<?> child;
66 for(FlatFileObjectSpecification specification: objectSpecifications) {
67 if(specification.getParentBusinessObjectClass() != null) {
68 child = specification.getBusinessObjectClass();
69 if(childrenList.contains(child)) {
70
71 throw new Exception("The child " + child + " can't have more than one parent");
72 } else {
73 childrenList.add(child);
74 }
75 }
76 }
77 }
78
79 }