001package org.kuali.ole;
002
003/**
004 * Created by IntelliJ IDEA.
005 * User: palanivel
006 * Date: 3/8/12
007 * Time: 2:37 PM
008 * To change this template use File | Settings | File Templates.
009 */
010
011import org.kuali.ole.pojo.edi.MesssageTypeInformation;
012
013public enum MessageHeaderFixture {
014    MesssageTypeInformation("ORDERS",
015            "D",
016            "96A",
017            "UN",
018            "EAN008", null
019    ),
020    InterChangeControlRef(null, null, null, null, null,
021            "34"
022    ),;
023
024    private String messageTypeId;
025    private String constant1;
026    private String constant2;
027    private String constant3;
028    private String constant4;
029    private String interchangeControlReference;
030
031    public String getInterchangeControlReference() {
032        return interchangeControlReference;
033    }
034
035    public void setInterchangeControlReference(String interchangeControlReference) {
036        this.interchangeControlReference = interchangeControlReference;
037    }
038
039
040    private MessageHeaderFixture(String messageTypeId, String constant1, String constant2, String constant3,
041                                 String constant4, String interchangeControlReference) {
042        this.messageTypeId = messageTypeId;
043        this.constant1 = constant1;
044        this.constant2 = constant2;
045        this.constant3 = constant3;
046        this.constant4 = constant4;
047        this.interchangeControlReference = interchangeControlReference;
048    }
049
050    public MesssageTypeInformation createMesssageTypeInformation(Class clazz) {
051        MesssageTypeInformation messsageTypeInformation = null;
052        try {
053            messsageTypeInformation = (MesssageTypeInformation) clazz.newInstance();
054        } catch (InstantiationException e) {
055            throw new RuntimeException("MesssageTypeInformation creation failed. class = " + clazz);
056        } catch (IllegalAccessException e) {
057            throw new RuntimeException("MesssageTypeInformation creation failed. class = " + clazz);
058        }
059        messsageTypeInformation.setMessageTypeId(messageTypeId);
060        messsageTypeInformation.setConstant1(constant1);
061        messsageTypeInformation.setConstant2(constant2);
062        messsageTypeInformation.setConstant3(constant3);
063        messsageTypeInformation.setConstant4(constant4);
064        return messsageTypeInformation;
065    }
066
067    public String createInterchangeControlReference() {
068        return interchangeControlReference;
069    }
070
071}