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.openide.nodes.Node;
047:
048: import com.sun.sql.framework.exception.BaseException;
049: import com.sun.sql.framework.utils.Attribute;
050: import com.sun.sql.framework.utils.StringUtil;
051:
052: /**
053: * @author Ahimanikya Satapathy
054: */
055: public class FFSourceTableProperties {
056:
057: protected SourceTableProperties mDeligate;
058:
059: public FFSourceTableProperties(SourceTableProperties deligate) {
060: mDeligate = deligate;
061: }
062:
063: /**
064: * Gets the alias name for this mDeligate.
065: *
066: * @return alias name
067: */
068: public String getAliasName() {
069: return mDeligate.getAliasName();
070: }
071:
072: /**
073: * Gets the batch size for this mDeligate.
074: *
075: * @return Integer representing batch size for the table
076: */
077: public Integer getBatchSize() {
078: return mDeligate.getBatchSize();
079: }
080:
081: public PropertyEditor getCustomEditor(Node.Property property) {
082: return mDeligate.getCustomEditor(property);
083: }
084:
085: /**
086: * Gets display name of this mDeligate.
087: *
088: * @return table disply name.
089: */
090: public String getDisplayName() {
091: return mDeligate.getDisplayName();
092: }
093:
094: // RFE-102428
095: /**
096: * Gets staging name of this mDeligate.
097: *
098: * @return staging table name.
099: */
100: public String getStagingTableName() {
101: return mDeligate.getStagingTableName();
102: }
103:
104: /**
105: * Gets data extraction condition.
106: *
107: * @return
108: */
109: public SQLCondition getExtractionCondition() {
110: return mDeligate.getExtractionCondition();
111: }
112:
113: /**
114: * get the extraction conidition text
115: *
116: * @return sql condition
117: */
118: public String getExtractionConditionText() {
119: return mDeligate.getExtractionConditionText();
120: }
121:
122: public String getExtractionType() {
123: return mDeligate.getExtractionType();
124: }
125:
126: /**
127: * Gets delimited String list of foreign keys associated with this mDeligate.
128: *
129: * @return delimited String list of foreign keys
130: */
131: public String getForeignKeys() {
132: return mDeligate.getForeignKeys();
133: }
134:
135: /**
136: * Gets delimited String list of indices associated with this mDeligate.
137: *
138: * @return delimited String list of indices
139: */
140: public String getIndices() {
141: return mDeligate.getIndices();
142: }
143:
144: /**
145: * Get the LoadType attribute for this Flat file source table
146: * "Delimited", "FixedWidth" etc.
147: *
148: * @return LoadType
149: */
150: public String getFileType() {
151: Attribute attr = mDeligate.getOrgProperty("LOADTYPE");
152: if (attr != null) {
153: return attr.getAttributeValue().toString();
154: } else {
155: return "";
156: }
157: }
158:
159: /**
160: * Get the FileName for this Flat file source table
161: * "Delimited", "FixedWidth" etc.
162: *
163: * @return LoadType
164: */
165: public String getFileName() {
166: Attribute attr = mDeligate.getOrgProperty("FILENAME");
167: if (attr != null) {
168: return attr.getAttributeValue().toString();
169: } else {
170: return "";
171: }
172: }
173:
174: public String getTextQualifier() {
175: Attribute attr = mDeligate.getOrgProperty("QUALIFIER");
176: if (attr != null) {
177: return attr.getAttributeValue().toString();
178: } else {
179: return "";
180: }
181: }
182:
183: public boolean isFirstLineHeader() {
184: Attribute attr = mDeligate.getOrgProperty("ISFIRSTLINEHEADER");
185: if (attr != null) {
186: return Boolean.valueOf(attr.getAttributeValue().toString());
187: } else {
188: return false;
189: }
190: }
191:
192: public String getFieldDelimiter() {
193: Attribute attr = mDeligate.getOrgProperty("FIELDDELIMITER");
194: if (attr != null) {
195: return attr.getAttributeValue().toString();
196: } else {
197: return "";
198: }
199: }
200:
201: public String getRecordDelimiter() {
202: Attribute attr = mDeligate.getOrgProperty("RECORDDELIMITER");
203: if (attr != null) {
204: return StringUtil.escapeControlChars(attr
205: .getAttributeValue().toString());
206: } else {
207: return "";
208: }
209: }
210:
211: public Integer getRowsToSkip() {
212: Attribute attr = mDeligate.getOrgProperty("ROWSTOSKIP");
213: if (attr != null) {
214: return Integer.valueOf(attr.getAttributeValue().toString());
215: } else {
216: return 0;
217: }
218: }
219:
220: public boolean isTrimWhiteSpace() {
221: Attribute attr = mDeligate.getOrgProperty("TRIMWHITESPACE");
222: if (attr != null) {
223: return Boolean.valueOf(attr.getAttributeValue().toString());
224: } else {
225: return false;
226: }
227: }
228:
229: /**
230: * RSS Table methods
231: */
232: /**
233: * Get the FileName for this Flat file source table
234: * "Delimited", "FixedWidth" etc.
235: *
236: * @return LoadType
237: */
238: public String getUrl() {
239: Attribute attr = mDeligate.getOrgProperty("URL");
240: if (attr != null) {
241: return attr.getAttributeValue().toString();
242: } else {
243: return "";
244: }
245: }
246:
247: /**
248: * Gets name of parent DatabaseModel for this table
249: *
250: * @return name of parent DatabaseModel
251: */
252: public String getModelName() {
253: return mDeligate.getModelName();
254: }
255:
256: /**
257: * Gets delimited String list of primary key columns associated with this mDeligate.
258: *
259: * @return delimited String list of primary key columns
260: */
261: public String getPrimaryKeys() {
262: return mDeligate.getPrimaryKeys();
263: }
264:
265: /**
266: * Gets data validation condition.
267: *
268: * @return
269: */
270: public SQLCondition getValidationCondition() {
271: return mDeligate.getValidationCondition();
272: }
273:
274: /**
275: * get the validation conidition text
276: *
277: * @return sql condition
278: */
279: public String getValitionConditionText() {
280: return mDeligate.getValitionConditionText();
281: }
282:
283: /**
284: * get whether to drop staging table before extraction
285: *
286: * @return whether to drop staging table
287: */
288: public boolean isDropStagingTable() {
289: return mDeligate.isDropStagingTable();
290: }
291:
292: /**
293: * get whether to truncate staging table before extraction
294: *
295: * @return whether to truncate staging table
296: */
297: public boolean isTruncateStagingTable() {
298: return mDeligate.isTruncateStagingTable();
299: }
300:
301: /**
302: * check if distinct rows of a column needs to be selected
303: *
304: * @return distinct
305: */
306: public boolean isSelectDistinct() {
307: return mDeligate.isSelectDistinct();
308: }
309:
310: /**
311: * Sets the alias name for this table
312: *
313: * @param aName alias name
314: */
315: public void setAliasName(String aName) {
316: this .mDeligate.setAliasName(aName);
317: }
318:
319: public void setFileType(String newFileType) {
320: mDeligate.setOrgProperty("LOADTYPE", newFileType);
321: }
322:
323: public void setFileName(String newFileName) {
324: mDeligate.setOrgProperty("FILENAME", newFileName);
325: }
326:
327: public void setFieldDelimiter(String newDelimiter) {
328: mDeligate.setOrgProperty("FIELDDELIMITER", newDelimiter);
329: }
330:
331: public void setTextQualifier(String newTextQualifier) {
332: mDeligate.setOrgProperty("QUALIFIER", newTextQualifier);
333: }
334:
335: public void setFirstLineHeader(boolean firstLineHeader) {
336: Boolean b = new Boolean(firstLineHeader);
337: mDeligate.setOrgProperty("ISFIRSTLINEHEADER", b.toString());
338: }
339:
340: public void setRecordDelimiter(String newDelimter) {
341: mDeligate.setOrgProperty("RECORDDELIMITER", newDelimter);
342: }
343:
344: public void setRowsToSkip(String rowsToSkip) {
345: mDeligate.setOrgProperty("ROWSTOSKIP", rowsToSkip);
346: }
347:
348: public void setTrimWhiteSpace(boolean trimWhiteSpace) {
349: Boolean b = new Boolean(trimWhiteSpace);
350: mDeligate.setOrgProperty("TRIMWHITESPACE", b.toString());
351: }
352:
353: public void setBatchSize(int batchS) {
354: mDeligate.setBatchSize(batchS);
355: }
356:
357: /**
358: * Sets the batch size for this table
359: *
360: * @param newSize new value for batch size
361: */
362: public void setBatchSize(Integer newSize) {
363: mDeligate.setBatchSize(newSize.intValue());
364: }
365:
366: /**
367: * Drop Staging table before extraction
368: *
369: * @param whether to drop staging table
370: */
371: public void setDropStagingTable(boolean drop) {
372: mDeligate.setDropStagingTable(drop);
373: }
374:
375: public void setExtractionCondition(SQLCondition cond)
376: throws BaseException {
377: mDeligate.setExtractionCondition(cond);
378: }
379:
380: //RFE-102428
381: /**
382: * set the Staging table name
383: *
384: * @param stName stging table name
385: */
386: public void setStagingTableName(String stName) {
387: mDeligate.setStagingTableName(stName);
388: }
389:
390: /**
391: * Truncate Staging table before extraction
392: *
393: * @param whether to truncate staging table
394: */
395: public void setTruncateStagingTable(boolean truncateTable) {
396: mDeligate.setTruncateStagingTable(truncateTable);
397: }
398:
399: /**
400: * set the extraction condition text
401: *
402: * @param cond extraction condition text
403: */
404: public void setExtractionConditionText(String cond) {
405: mDeligate.setExtractionConditionText(cond);
406: }
407:
408: public void setExtractionType(String eType) {
409: mDeligate.setExtractionType(eType);
410: }
411:
412: /**
413: * set wehether to select distinct rows of a column
414: *
415: * @param distinct distinct
416: */
417: public void setSelectDistinct(boolean distinct) {
418: mDeligate.setSelectDistinct(distinct);
419: }
420:
421: public void setValidationCondition(SQLCondition cond)
422: throws BaseException {
423: mDeligate.setValidationCondition(cond);
424: }
425:
426: /**
427: * set the validation condition text
428: *
429: * @param cond extraction condition text
430: */
431: public void setValidationConditionText(String cond) {
432: mDeligate.setValidationConditionText(cond);
433: }
434:
435: /**
436: * RSS Table methods
437: */
438: /**
439: * Get the FileName for this Flat file source table
440: * "Delimited", "FixedWidth" etc.
441: *
442: * @return LoadType
443: */
444: public void setUrl(String newUrl) {
445: mDeligate.setOrgProperty("URL", newUrl);
446: }
447: }
|