001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify
008: * it under the terms of the GNU General Public License as published by
009: * the Free Software Foundation; either version 2 of the License, or
010: * (at your option) any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * General Public License for more details.
016: *
017: * You should have received a copy of the GNU General Public License
018: * along with this program; if not, write to the Free Software
019: * Foundation, Inc.,59 Temple Place, Suite 330, Boston, MA 02111-1307
020: * USA
021: *
022: *
023: * $Id: VariableChildAttributesImpl.java 6328 2007-03-26 15:47:34Z mpreston $
024: */
025: package com.bostechcorp.cbesb.common.mdl.impl;
026:
027: import org.jdom.Attribute;
028: import org.jdom.Element;
029:
030: import com.bostechcorp.cbesb.common.mdl.IVariableChildAttributes;
031: import com.bostechcorp.cbesb.common.mdl.MDLDocConstants;
032:
033: public class VariableChildAttributesImpl extends
034: FormatChildAttributesImpl implements IVariableChildAttributes {
035:
036: private int minLength;
037: private int maxLength;
038: private String tag;
039:
040: /**
041: * constructor
042: */
043: public VariableChildAttributesImpl() {
044: minLength = -1;
045: maxLength = -1;
046: tag = "";
047: }
048:
049: /* (non-Javadoc)
050: * @see com.bostechcorp.cbesb.legacydata.mdl.VariableChildAttributes#getMinlength()
051: */
052: public int getMinLength() {
053: return minLength;
054: }
055:
056: /* (non-Javadoc)
057: * @see com.bostechcorp.cbesb.legacydata.mdl.VariableChildAttributes#setMinLength(int)
058: */
059: public void setMinLength(int minLength) {
060: this .minLength = minLength;
061: }
062:
063: /* (non-Javadoc)
064: * @see com.bostechcorp.cbesb.legacydata.mdl.VariableChildAttributes#getMaxlength()
065: */
066: public int getMaxLength() {
067: return maxLength;
068: }
069:
070: /* (non-Javadoc)
071: * @see com.bostechcorp.cbesb.legacydata.mdl.VariableChildAttributes#setMaxLength(int)
072: */
073: public void setMaxLength(int maxLength) {
074: this .maxLength = maxLength;
075: }
076:
077: /* (non-Javadoc)
078: * @see com.bostechcorp.cbesb.legacydata.mdl.VariableChildAttributes#getTag()
079: */
080: public String getTag() {
081: return tag;
082: }
083:
084: /* (non-Javadoc)
085: * @see com.bostechcorp.cbesb.legacydata.mdl.VariableChildAttributes#setTag(java.lang.String)
086: */
087: public void setTag(String tag) {
088: this .tag = tag;
089: }
090:
091: public void populateJDomAttributes(
092: MDLSerializerUtil serializerUtil, Element elem) {
093: if (tag != null && !tag.equals("")) {
094: Attribute attrTag = serializerUtil.createAttribute(
095: MDLDocConstants.MDL_VARIABLE_TAG, serializerUtil
096: .handleEscapedProperties(tag));
097: elem.setAttribute(attrTag);
098: }
099:
100: if (minLength != -1) {
101: Attribute attrMinLength = serializerUtil.createAttribute(
102: MDLDocConstants.MDL_VARIABLE_MINLENGTH, Integer
103: .toString(minLength));
104: elem.setAttribute(attrMinLength);
105: }
106:
107: if (maxLength != -1) {
108: Attribute attrMaxLength = serializerUtil.createAttribute(
109: MDLDocConstants.MDL_VARIABLE_MAXLENGTH, Integer
110: .toString(maxLength));
111: elem.setAttribute(attrMaxLength);
112: }
113:
114: }
115:
116: }
|