001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041: package org.netbeans.modules.sql.framework.ui.view.property;
042:
043: import java.beans.PropertyEditor;
044:
045: import org.netbeans.modules.sql.framework.model.SQLCondition;
046: import org.netbeans.modules.sql.framework.model.SQLGroupBy;
047: import org.openide.nodes.Node;
048:
049: import com.sun.sql.framework.exception.BaseException;
050: import com.sun.sql.framework.utils.Attribute;
051: import com.sun.sql.framework.utils.StringUtil;
052:
053: /**
054: * @author Ahimanikya Satapathy
055: */
056: public class FFTargetTableProperties {
057:
058: protected TargetTableProperties mDeligate;
059:
060: public FFTargetTableProperties(TargetTableProperties deligate) {
061: mDeligate = deligate;
062: }
063:
064: /**
065: * Gets the alias name for this mDeligate.
066: *
067: * @return alias name
068: */
069: public String getAliasName() {
070: return mDeligate.getAliasName();
071: }
072:
073: /**
074: * Gets the batch size for this mDeligate.
075: *
076: * @return Integer representing batch size for the table
077: */
078: public Integer getBatchSize() {
079: return mDeligate.getBatchSize();
080: }
081:
082: public SQLCondition getJoinCondition() {
083: return mDeligate.getJoinCondition();
084: }
085:
086: /**
087: * get condition text
088: *
089: * @return sql condition
090: */
091: public String getJoinConditionText() {
092: return mDeligate.getJoinConditionText();
093: }
094:
095: public SQLCondition getFilterCondition() {
096: return mDeligate.getFilterCondition();
097: }
098:
099: /**
100: * get condition text
101: *
102: * @return sql condition
103: */
104: public String getFilterConditionText() {
105: return mDeligate.getFilterConditionText();
106: }
107:
108: public PropertyEditor getCustomEditor(Node.Property property) {
109: return mDeligate.getCustomEditor(property);
110: }
111:
112: /**
113: * Gets display name of this mDeligate.
114: *
115: * @return table disply name.
116: */
117: public String getDisplayName() {
118: return mDeligate.getDisplayName();
119: }
120:
121: /**
122: * Gets delimited String list of foreign keys associated with this mDeligate.
123: *
124: * @return delimited String list of foreign keys
125: */
126: public String getForeignKeys() {
127: return mDeligate.getForeignKeys();
128: }
129:
130: /**
131: * Gets delimited String list of indices associated with this mDeligate.
132: *
133: * @return delimited String list of indices
134: */
135: public String getIndices() {
136: return mDeligate.getIndices();
137: }
138:
139: /**
140: * RSS Table methods
141: */
142: /**
143: * Get the FileName for this Flat file source table
144: * "Delimited", "FixedWidth" etc.
145: *
146: * @return LoadType
147: */
148: public String getUrl() {
149: Attribute attr = mDeligate.getOrgProperty("URL");
150: if (attr != null) {
151: return attr.getAttributeValue().toString();
152: } else {
153: return "";
154: }
155: }
156:
157: /**
158: * Gets name of parent DatabaseModel for this table
159: *
160: * @return name of parent DatabaseModel
161: */
162: public String getModelName() {
163: return mDeligate.getModelName();
164: }
165:
166: /**
167: * Gets delimited String list of primary key columns associated with this mDeligate.
168: *
169: * @return delimited String list of primary key columns
170: */
171: public String getPrimaryKeys() {
172: return mDeligate.getPrimaryKeys();
173: }
174:
175: /**
176: * get report group by object
177: *
178: * @return SQLGroupBy
179: */
180: public SQLGroupBy getSQLGroupBy() {
181: return mDeligate.getSQLGroupBy();
182: }
183:
184: /**
185: * get string representation of statement type
186: *
187: * @return statement type
188: */
189: public String getStrStatementType() {
190: return mDeligate.getStrStatementType();
191: }
192:
193: /**
194: * get whether to create target table
195: *
196: * @return whether to create target table
197: */
198: public boolean isCreateTargetTable() {
199: return mDeligate.isCreateTargetTable();
200: }
201:
202: /**
203: * Indicates whether contents of target table should be truncated before loading new
204: * data.
205: *
206: * @return true if contents should be truncated; false otherwise
207: */
208: public boolean isTruncateBeforeLoad() {
209: return mDeligate.isTruncateBeforeLoad();
210: }
211:
212: /**
213: * Get the LoadType attribute for this Flat file source table
214: * "Delimited", "FixedWidth" etc.
215: *
216: * @return LoadType
217: */
218: public String getFileType() {
219: Attribute attr = mDeligate.getOrgProperty("LOADTYPE");
220: if (attr != null) {
221: return attr.getAttributeValue().toString();
222: } else {
223: return "";
224: }
225: }
226:
227: /**
228: * Get the FileName for this Flat file source table
229: * "Delimited", "FixedWidth" etc.
230: *
231: * @return LoadType
232: */
233: public String getFileName() {
234: Attribute attr = mDeligate.getOrgProperty("FILENAME");
235: if (attr != null) {
236: return attr.getAttributeValue().toString();
237: } else {
238: return "";
239: }
240: }
241:
242: public String getTextQualifier() {
243: Attribute attr = mDeligate.getOrgProperty("QUALIFIER");
244: if (attr != null) {
245: return attr.getAttributeValue().toString();
246: } else {
247: return "";
248: }
249: }
250:
251: public boolean isFirstLineHeader() {
252: Attribute attr = mDeligate.getOrgProperty("ISFIRSTLINEHEADER");
253: if (attr != null) {
254: return Boolean.valueOf(attr.getAttributeValue().toString());
255: } else {
256: return false;
257: }
258: }
259:
260: public String getFieldDelimiter() {
261: Attribute attr = mDeligate.getOrgProperty("FIELDDELIMITER");
262: if (attr != null) {
263: return attr.getAttributeValue().toString();
264: } else {
265: return "";
266: }
267: }
268:
269: public String getRecordDelimiter() {
270: Attribute attr = mDeligate.getOrgProperty("RECORDDELIMITER");
271: if (attr != null) {
272: return StringUtil.escapeControlChars(attr
273: .getAttributeValue().toString());
274: } else {
275: return "";
276: }
277: }
278:
279: public Integer getRowsToSkip() {
280: Attribute attr = mDeligate.getOrgProperty("ROWSTOSKIP");
281: if (attr != null) {
282: return Integer.valueOf(attr.getAttributeValue().toString());
283: } else {
284: return 0;
285: }
286: }
287:
288: public boolean isTrimWhiteSpace() {
289: Attribute attr = mDeligate.getOrgProperty("TRIMWHITESPACE");
290: if (attr != null) {
291: return Boolean.valueOf(attr.getAttributeValue().toString());
292: } else {
293: return false;
294: }
295: }
296:
297: /**
298: * Sets the alias name for this table
299: *
300: * @param aName alias name
301: */
302: public void setAliasName(String aName) {
303: this .mDeligate.setAliasName(aName);
304: }
305:
306: public void setBatchSize(int batchS) {
307: mDeligate.setBatchSize(new Integer(batchS));
308: }
309:
310: /**
311: * Sets the batch size for this table
312: *
313: * @param newSize new value for batch size
314: */
315: public void setBatchSize(Integer newSize) {
316: mDeligate.setBatchSize(newSize);
317: }
318:
319: public void setJoinCondition(SQLCondition filter)
320: throws BaseException {
321: mDeligate.setJoinCondition(filter);
322: }
323:
324: /**
325: * set the condition text
326: *
327: * @param cond sql condition
328: */
329: public void setJoinConditionText(String cond) {
330: mDeligate.setJoinConditionText(cond);
331: }
332:
333: public void setFilterCondition(SQLCondition filter)
334: throws BaseException {
335: mDeligate.setFilterCondition(filter);
336: }
337:
338: /**
339: * set the condition text
340: *
341: * @param cond sql condition
342: */
343: public void setFilterConditionText(String cond) {
344: mDeligate.setFilterConditionText(cond);
345: }
346:
347: /**
348: * set whether to create target table if does not exist
349: *
350: * @param create whether to create target table
351: */
352: public void setCreateTargetTable(boolean create) {
353: mDeligate.setCreateTargetTable(create);
354: }
355:
356: /**
357: * set group by object
358: *
359: * @param groupBy - SQLGroupBy
360: */
361: public void setSQLGroupBy(SQLGroupBy groupBy) {
362: mDeligate.setSQLGroupBy(groupBy);
363: }
364:
365: public void setStrStatementType(String sType) {
366: mDeligate.setStrStatementType(sType);
367: }
368:
369: /**
370: * Sets whether contents of target table should be truncated before loading new data.
371: *
372: * @param flag true if contents should be truncated; false otherwise
373: */
374: public void setTruncateBeforeLoad(boolean flag) {
375: mDeligate.setTruncateBeforeLoad(flag);
376: }
377:
378: public void setFileType(String newFileType) {
379: mDeligate.setOrgProperty("LOADTYPE", newFileType);
380: }
381:
382: public void setFileName(String newFileName) {
383: mDeligate.setOrgProperty("FILENAME", newFileName);
384: }
385:
386: public void setFieldDelimiter(String newDelimiter) {
387: mDeligate.setOrgProperty("FIELDDELIMITER", newDelimiter);
388: }
389:
390: public void setTextQualifier(String newTextQualifier) {
391: mDeligate.setOrgProperty("QUALIFIER", newTextQualifier);
392: }
393:
394: public void setFirstLineHeader(boolean firstLineHeader) {
395: Boolean b = new Boolean(firstLineHeader);
396: mDeligate.setOrgProperty("ISFIRSTLINEHEADER", b.toString());
397: }
398:
399: public void setRecordDelimiter(String newDelimiter) {
400: mDeligate.setOrgProperty("RECORDDELIMITER", newDelimiter);
401: }
402:
403: public void setRowsToSkip(String rowsToSkip) {
404: mDeligate.setOrgProperty("ROWSTOSKIP", rowsToSkip);
405: }
406:
407: public void setTrimWhiteSpace(boolean trimWhiteSpace) {
408: Boolean b = new Boolean(trimWhiteSpace);
409: mDeligate.setOrgProperty("TRIMWHITESPACE", b.toString());
410: }
411:
412: /**
413: * RSS Table methods
414: */
415: /**
416: * Get the FileName for this Flat file source table
417: * "Delimited", "FixedWidth" etc.
418: *
419: * @return LoadType
420: */
421: public void setUrl(String newUrl) {
422: mDeligate.setOrgProperty("URL", newUrl);
423: }
424: }
|