001: /*
002: * Copyright 2004 Clinton Begin
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License");
005: * you may not use this file except in compliance with the License.
006: * You may obtain a copy of the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS,
012: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013: * See the License for the specific language governing permissions and
014: * limitations under the License.
015: */
016: package com.ibatis.sqlmap.engine.mapping.sql.dynamic.elements;
017:
018: import com.ibatis.sqlmap.engine.mapping.sql.SqlChild;
019:
020: import java.util.ArrayList;
021: import java.util.Iterator;
022: import java.util.List;
023:
024: public class SqlTag implements SqlChild, DynamicParent {
025:
026: private String name;
027: private SqlTagHandler handler;
028:
029: // general attributes
030: private String prependAttr;
031: private String propertyAttr;
032: private String removeFirstPrepend;
033:
034: // conditional attributes
035: private String comparePropertyAttr;
036: private String compareValueAttr;
037:
038: // iterate attributes
039: private String openAttr;
040: private String closeAttr;
041: private String conjunctionAttr;
042:
043: private SqlTag parent;
044: private List children = new ArrayList();
045:
046: private boolean postParseRequired = false;
047:
048: public String getName() {
049: return name;
050: }
051:
052: public void setName(String name) {
053: this .name = name;
054: }
055:
056: public SqlTagHandler getHandler() {
057: return handler;
058: }
059:
060: public void setHandler(SqlTagHandler handler) {
061: this .handler = handler;
062: }
063:
064: public boolean isPrependAvailable() {
065: return prependAttr != null && prependAttr.length() > 0;
066: }
067:
068: public boolean isCloseAvailable() {
069: return closeAttr != null && closeAttr.length() > 0;
070: }
071:
072: public boolean isOpenAvailable() {
073: return openAttr != null && openAttr.length() > 0;
074: }
075:
076: public boolean isConjunctionAvailable() {
077: return conjunctionAttr != null && conjunctionAttr.length() > 0;
078: }
079:
080: public String getPrependAttr() {
081: return prependAttr;
082: }
083:
084: public void setPrependAttr(String prependAttr) {
085: this .prependAttr = prependAttr;
086: }
087:
088: public String getPropertyAttr() {
089: return propertyAttr;
090: }
091:
092: public void setPropertyAttr(String propertyAttr) {
093: this .propertyAttr = propertyAttr;
094: }
095:
096: public String getComparePropertyAttr() {
097: return comparePropertyAttr;
098: }
099:
100: public void setComparePropertyAttr(String comparePropertyAttr) {
101: this .comparePropertyAttr = comparePropertyAttr;
102: }
103:
104: public String getCompareValueAttr() {
105: return compareValueAttr;
106: }
107:
108: public void setCompareValueAttr(String compareValueAttr) {
109: this .compareValueAttr = compareValueAttr;
110: }
111:
112: public String getOpenAttr() {
113: return openAttr;
114: }
115:
116: public void setOpenAttr(String openAttr) {
117: this .openAttr = openAttr;
118: }
119:
120: public String getCloseAttr() {
121: return closeAttr;
122: }
123:
124: public void setCloseAttr(String closeAttr) {
125: this .closeAttr = closeAttr;
126: }
127:
128: public String getConjunctionAttr() {
129: return conjunctionAttr;
130: }
131:
132: public void setConjunctionAttr(String conjunctionAttr) {
133: this .conjunctionAttr = conjunctionAttr;
134: }
135:
136: public void addChild(SqlChild child) {
137: if (child instanceof SqlTag) {
138: ((SqlTag) child).parent = this ;
139: }
140: children.add(child);
141: }
142:
143: public Iterator getChildren() {
144: return children.iterator();
145: }
146:
147: public SqlTag getParent() {
148: return parent;
149: }
150:
151: public String getRemoveFirstPrepend() {
152: return removeFirstPrepend;
153: }
154:
155: public void setRemoveFirstPrepend(String removeFirstPrepend) {
156: this .removeFirstPrepend = removeFirstPrepend;
157: }
158:
159: /**
160: * @return Returns the postParseRequired.
161: */
162: public boolean isPostParseRequired() {
163: return postParseRequired;
164: }
165:
166: /**
167: * @param iterateAncestor The postParseRequired to set.
168: */
169: public void setPostParseRequired(boolean iterateAncestor) {
170: this.postParseRequired = iterateAncestor;
171: }
172: }
|