View Javadoc
1   package org.kuali.ole;
2   
3   /**
4    * Created by IntelliJ IDEA.
5    * User: palanivel
6    * Date: 3/8/12
7    * Time: 2:37 PM
8    * To change this template use File | Settings | File Templates.
9    */
10  
11  import org.kuali.ole.pojo.edi.MesssageTypeInformation;
12  
13  public enum MessageHeaderFixture {
14      MesssageTypeInformation("ORDERS",
15              "D",
16              "96A",
17              "UN",
18              "EAN008", null
19      ),
20      InterChangeControlRef(null, null, null, null, null,
21              "34"
22      ),;
23  
24      private String messageTypeId;
25      private String constant1;
26      private String constant2;
27      private String constant3;
28      private String constant4;
29      private String interchangeControlReference;
30  
31      public String getInterchangeControlReference() {
32          return interchangeControlReference;
33      }
34  
35      public void setInterchangeControlReference(String interchangeControlReference) {
36          this.interchangeControlReference = interchangeControlReference;
37      }
38  
39  
40      private MessageHeaderFixture(String messageTypeId, String constant1, String constant2, String constant3,
41                                   String constant4, String interchangeControlReference) {
42          this.messageTypeId = messageTypeId;
43          this.constant1 = constant1;
44          this.constant2 = constant2;
45          this.constant3 = constant3;
46          this.constant4 = constant4;
47          this.interchangeControlReference = interchangeControlReference;
48      }
49  
50      public MesssageTypeInformation createMesssageTypeInformation(Class clazz) {
51          MesssageTypeInformation messsageTypeInformation = null;
52          try {
53              messsageTypeInformation = (MesssageTypeInformation) clazz.newInstance();
54          } catch (InstantiationException e) {
55              throw new RuntimeException("MesssageTypeInformation creation failed. class = " + clazz);
56          } catch (IllegalAccessException e) {
57              throw new RuntimeException("MesssageTypeInformation creation failed. class = " + clazz);
58          }
59          messsageTypeInformation.setMessageTypeId(messageTypeId);
60          messsageTypeInformation.setConstant1(constant1);
61          messsageTypeInformation.setConstant2(constant2);
62          messsageTypeInformation.setConstant3(constant3);
63          messsageTypeInformation.setConstant4(constant4);
64          return messsageTypeInformation;
65      }
66  
67      public String createInterchangeControlReference() {
68          return interchangeControlReference;
69      }
70  
71  }