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