01: /**
02: *
03: */package com.bostechcorp.cbesb.runtime.parser.impl;
04:
05: import org.w3c.dom.Document;
06:
07: import com.bostechcorp.cbesb.common.mdl.IMessageDefinition;
08: import com.bostechcorp.cbesb.runtime.parser.ParserException;
09:
10: /**
11: * @author mpreston
12: *
13: */
14: public class X12Serializer extends VariantSerializer {
15:
16: private char segmentTerminator = 0;
17: private char fieldSeparator = 0;
18: private char compositeSeparator = 0;
19:
20: /**
21: * @return the compositeSeparator
22: */
23: public char getCompositeSeparator() {
24: return compositeSeparator;
25: }
26:
27: /**
28: * @param compositeSeparator the compositeSeparator to set
29: */
30: public void setCompositeSeparator(char compositeSeparator) {
31: this .compositeSeparator = compositeSeparator;
32: }
33:
34: /**
35: * @return the fieldSeparator
36: */
37: public char getFieldSeparator() {
38: return fieldSeparator;
39: }
40:
41: /**
42: * @param fieldSeparator the fieldSeparator to set
43: */
44: public void setFieldSeparator(char fieldSeparator) {
45: this .fieldSeparator = fieldSeparator;
46: }
47:
48: /**
49: * @return the segmentTerminator
50: */
51: public char getSegmentTerminator() {
52: return segmentTerminator;
53: }
54:
55: /**
56: * @param segmentTerminator the segmentTerminator to set
57: */
58: public void setSegmentTerminator(char segmentTerminator) {
59: this .segmentTerminator = segmentTerminator;
60: }
61:
62: /* (non-Javadoc)
63: * @see com.bostechcorp.cbesb.runtime.parser.impl.VariantSerializer#preSerialize(org.w3c.dom.Document, com.bostechcorp.cbesb.common.mdl.IMessageDefinition)
64: */
65: @Override
66: public void preSerialize(Document doc,
67: IMessageDefinition messageDefinition)
68: throws ParserException {
69: if (segmentTerminator != 0) {
70: overrideMsgDefProperty("SegmentTerminator", String
71: .valueOf(segmentTerminator));
72: }
73: if (fieldSeparator != 0) {
74: overrideMsgDefProperty("FieldSeparator", String
75: .valueOf(fieldSeparator));
76: }
77: if (compositeSeparator != 0) {
78: overrideMsgDefProperty("CompositeSeparator", String
79: .valueOf(compositeSeparator));
80: }
81: }
82:
83: /* (non-Javadoc)
84: * @see com.bostechcorp.cbesb.runtime.parser.impl.VariantSerializer#postSerialize(java.lang.StringBuffer, com.bostechcorp.cbesb.common.mdl.IMessageDefinition)
85: */
86: @Override
87: public void postSerialize(StringBuffer msgData,
88: IMessageDefinition messageDefinition)
89: throws ParserException {
90: //Not needed.
91: }
92:
93: }
|