1 package org.kuali.ole;
2
3 import org.kuali.ole.pojo.edi.*;
4
5 import java.util.Arrays;
6 import java.util.List;
7
8
9
10
11
12
13
14
15 public enum SummaryFixture {
16 SUMMARYSECTION("S", null, null, null, null),
17 CONTROLINFORMATION(null, "1", "00033", null, null),
18 UNT(null, null, null, "00057", "34"),;
19
20 private String separatorInformation;
21 private String controlQualifier;
22 private String totalQuantitySegments;
23 private String segmentNumber;
24 private String linSegmentTotal;
25
26 private SummaryFixture(String separatorInformation, String controlQualifier,
27 String totalQuantitySegments, String segmentNumber,
28 String linSegmentTotal) {
29 this.separatorInformation = separatorInformation;
30 this.controlQualifier = controlQualifier;
31 this.totalQuantitySegments = totalQuantitySegments;
32 this.segmentNumber = segmentNumber;
33 this.linSegmentTotal = linSegmentTotal;
34 }
35
36 public SummarySection createSummarySectionPojo(Class clazz) {
37 SummarySection summarySection = null;
38 try {
39 summarySection = (SummarySection) clazz.newInstance();
40 } catch (InstantiationException e) {
41 throw new RuntimeException("SummarySection creation failed. class = " + clazz);
42 } catch (IllegalAccessException e) {
43 throw new RuntimeException("SummarySection creation failed. class = " + clazz);
44 }
45
46
47 summarySection.setSeparatorInformation(separatorInformation);
48
49 return summarySection;
50 }
51
52 public ControlInfomation createControlInfomationPojo(Class clazz) {
53 ControlInfomation controlInfomation = null;
54 try {
55 controlInfomation = (ControlInfomation) clazz.newInstance();
56 } catch (InstantiationException e) {
57 throw new RuntimeException("ControlInfomation creation failed. class = " + clazz);
58 } catch (IllegalAccessException e) {
59 throw new RuntimeException("ControlInfomation creation failed. class = " + clazz);
60 }
61 Control control = new Control();
62 control.setControlQualifier(controlQualifier);
63 control.setTotalQuantitySegments(totalQuantitySegments);
64 controlInfomation.addControlField(control);
65
66 return controlInfomation;
67 }
68
69 public UNTSummary createUNTSummaryPojo(Class clazz) {
70 UNTSummary untSummary = null;
71 try {
72 untSummary = (UNTSummary) clazz.newInstance();
73 } catch (InstantiationException e) {
74 throw new RuntimeException("UNTSummary creation failed. class = " + clazz);
75 } catch (IllegalAccessException e) {
76 throw new RuntimeException("UNTSummary creation failed. class = " + clazz);
77 }
78 untSummary.setSegmentNumber(segmentNumber);
79 untSummary.setLinSegmentTotal(linSegmentTotal);
80 return untSummary;
81 }
82
83 }