View Javadoc
1   package org.kuali.ole;
2   
3   /**
4    * Created by IntelliJ IDEA.
5    * User: palanivel
6    * Date: 3/7/12
7    * Time: 6:53 PM
8    * To change this template use File | Settings | File Templates.
9    */
10  
11  import org.kuali.ole.pojo.edi.ReceiverInformation;
12  import org.kuali.ole.pojo.edi.Schedule;
13  import org.kuali.ole.pojo.edi.SenderInformation;
14  import org.kuali.ole.pojo.edi.SendersAndReceiversConstant;
15  
16  public enum SendersAndReceiverFixture {
17  
18  
19      SendersAndReceiversConstant("UNOC",
20              "3", null, null, null, null, null, null, null
21      ),
22      SenderInformation(null, null, "DUL-WCS",
23              "ZZ", null, null, null, null, null
24      ),
25      ReceiverInformation(null, null, null, null, "HAR2",
26              "ZZ", null, null, null
27      ),
28      Schedule(null, null, null, null, null, null, "111026",
29              "1215", null),
30      InterchangeControlReference(null, null, null, null, null, null, null, null, "34"),;
31  
32      private String code;
33      private String value;
34      private String senderId;
35      private String senderIdType;
36      private String receiverId;
37      private String receiverIdType;
38      private String preparationDate;
39      private String preparationTime;
40      private String interChangeControlReference;
41  
42      public String getInterChangeControlReference() {
43          return interChangeControlReference;
44      }
45  
46      public void setInterChangeControlReference(String interChangeControlReference) {
47          this.interChangeControlReference = interChangeControlReference;
48      }
49  
50      private SendersAndReceiverFixture(String code, String value, String senderId, String senderIdType,
51                                        String receiverId, String receiverIdType, String preparationDate,
52                                        String preparationTime, String interChangeControlReference) {
53          this.code = code;
54          this.value = value;
55          this.senderId = senderId;
56          this.senderIdType = senderIdType;
57          this.receiverId = receiverId;
58          this.receiverIdType = receiverIdType;
59          this.preparationDate = preparationDate;
60          this.preparationTime = preparationTime;
61          this.interChangeControlReference = interChangeControlReference;
62      }
63  
64      public SendersAndReceiversConstant createSenderAndReceiverConstant(Class clazz) {
65          // SenderAndReceiver senderAndReceiver= null;
66          SendersAndReceiversConstant sendersAndReceiversConstant = null;
67          try {
68              sendersAndReceiversConstant = (SendersAndReceiversConstant) clazz.newInstance();
69          } catch (InstantiationException e) {
70              throw new RuntimeException("SendersAndReceiversConstant creation failed. class = " + clazz);
71          } catch (IllegalAccessException e) {
72              throw new RuntimeException("SendersAndReceiversConstant creation failed. class = " + clazz);
73          }
74          sendersAndReceiversConstant.setCode(code);
75          sendersAndReceiversConstant.setValue(value);
76  
77          return sendersAndReceiversConstant;
78      }
79  
80      public SenderInformation createSenderInformation(Class clazz) {
81          SenderInformation senderInformation = null;
82          try {
83              senderInformation = (SenderInformation) clazz.newInstance();
84          } catch (InstantiationException e) {
85              throw new RuntimeException("SenderInformation creation failed. class = " + clazz);
86          } catch (IllegalAccessException e) {
87              throw new RuntimeException("SenderInformation creation failed. class = " + clazz);
88          }
89          senderInformation.setSenderId(senderId);
90          senderInformation.setSenderIdType(senderIdType);
91  
92          return senderInformation;
93      }
94  
95      public ReceiverInformation createReceiverInformation(Class clazz) {
96          ReceiverInformation receiverInformation = null;
97          try {
98              receiverInformation = (ReceiverInformation) clazz.newInstance();
99          } catch (InstantiationException e) {
100             throw new RuntimeException("ReceiverInformation creation failed. class = " + clazz);
101         } catch (IllegalAccessException e) {
102             throw new RuntimeException("ReceiverInformation creation failed. class = " + clazz);
103         }
104         receiverInformation.setReceiverId(receiverId);
105         receiverInformation.setReceiverIdType(receiverIdType);
106 
107         return receiverInformation;
108     }
109 
110     public Schedule createSchedule(Class clazz) {
111         Schedule schedule = null;
112         try {
113             schedule = (Schedule) clazz.newInstance();
114         } catch (InstantiationException e) {
115             throw new RuntimeException("Schedule creation failed. class = " + clazz);
116         } catch (IllegalAccessException e) {
117             throw new RuntimeException("Schedule creation failed. class = " + clazz);
118         }
119         schedule.setPreparationDate(preparationDate);
120         schedule.setPreparationTime(preparationTime);
121         return schedule;
122     }
123 
124     public String createInterchangeControlReference() {
125         return getInterChangeControlReference();
126     }
127 
128 
129 }