001: /*
002: * The contents of this file are subject to the terms of the Common Development
003: * and Distribution License (the License). You may not use this file except in
004: * compliance with the License.
005: *
006: * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007: * or http://www.netbeans.org/cddl.txt.
008: *
009: * When distributing Covered Code, include this CDDL Header Notice in each file
010: * and include the License file at http://www.netbeans.org/cddl.txt.
011: * If applicable, add the following below the CDDL Header, with the fields
012: * enclosed by brackets [] replaced by your own identifying information:
013: * "Portions Copyrighted [year] [name of copyright owner]"
014: *
015: * The Original Software is NetBeans. The Initial Developer of the Original
016: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017: * Microsystems, Inc. All Rights Reserved.
018: */
019: package org.netbeans.modules.etl.codegen;
020:
021: import org.netbeans.modules.sql.framework.model.SQLDefinition;
022: import org.netbeans.modules.sql.framework.model.TargetTable;
023: import com.sun.etl.engine.ETLTaskNode;
024: import com.sun.sql.framework.exception.BaseException;
025:
026: /**
027: * This will be use as context to be passed from ETLProcessFlowGenerator to various
028: * ETLStrategyBuilder.
029: *
030: * @author Ahimanikya Satapathy
031: * @version $Revision$
032: */
033: public class ETLStrategyBuilderContext {
034:
035: private StringBuilder dependentTasksForNextTask = new StringBuilder();
036: private ETLTaskNode globalCleanUpTask;
037: private ETLTaskNode initTask;
038: private ETLTaskNode lastPipelinedTask;
039: private ETLScriptBuilderModel model;
040: private ETLTaskNode nextTaskOnException;
041: private ETLTaskNode nextTaskOnSucess;
042: private ETLTaskNode predecessorTask;
043: private ETLTaskNode statsUpdateTask;
044: private TargetTable targetTable;
045:
046: /**
047: * @param initTask
048: * @param globalCleanupTask
049: * @param statsUpdateTask
050: * @param model
051: */
052: public ETLStrategyBuilderContext(ETLTaskNode initTask,
053: ETLTaskNode globalCleanupTask, ETLTaskNode statsUpdateTask,
054: ETLScriptBuilderModel model) {
055: this .initTask = initTask;
056: this .globalCleanUpTask = globalCleanupTask;
057: this .statsUpdateTask = statsUpdateTask;
058: this .model = model;
059: }
060:
061: /**
062: * Used to generate SQL to be shown in ShowSQL.
063: *
064: * @param sqlDefinition
065: * @param targetTable
066: * @param model
067: * @throws BaseException
068: */
069: public ETLStrategyBuilderContext(SQLDefinition sqlDefinition,
070: TargetTable targetTable) throws BaseException {
071: this .model = new ETLScriptBuilderModel();
072: this .model.setSqlDefinition(sqlDefinition);
073: this .model.applyConnectionDefinitions();
074: this .model.setConnectionDefinitionOverridesApplied(true);
075: this .targetTable = targetTable;
076: }
077:
078: /**
079: * @return Returns the dependentTasksForNextTask.
080: */
081: public StringBuilder getDependentTasksForNextTask() {
082: return dependentTasksForNextTask;
083: }
084:
085: public ETLTaskNode getGlobalCleanUpTask() {
086: return this .globalCleanUpTask;
087: }
088:
089: public ETLTaskNode getInitTask() {
090: return this .initTask;
091: }
092:
093: public ETLTaskNode getLastPipelinedTask() {
094: return this .lastPipelinedTask;
095: }
096:
097: /**
098: * @return Returns the generator.
099: */
100: public ETLScriptBuilderModel getModel() {
101: return model;
102: }
103:
104: /**
105: * @return Returns the nextTaskOnException.
106: */
107: public ETLTaskNode getNextTaskOnException() {
108: return nextTaskOnException;
109: }
110:
111: /**
112: * @return Returns the nextTaskOnSucess.
113: */
114: public ETLTaskNode getNextTaskOnSuccess() {
115: return nextTaskOnSucess;
116: }
117:
118: public ETLTaskNode getNextTaskOnSucess() {
119: return this .nextTaskOnSucess;
120: }
121:
122: /**
123: * @return Returns the predecessorTask.
124: */
125: public ETLTaskNode getPredecessorTask() {
126: return predecessorTask;
127: }
128:
129: public ETLTaskNode getStatsUpdateTask() {
130: return this .statsUpdateTask;
131: }
132:
133: public TargetTable getTargetTable() {
134: return targetTable;
135: }
136:
137: public void setDependentTasksForNextTask(
138: StringBuilder dependentTasksForNextTask) {
139: this .dependentTasksForNextTask = dependentTasksForNextTask;
140: }
141:
142: public void setGlobalCleanUpTask(ETLTaskNode globalCleanUpTask) {
143: this .globalCleanUpTask = globalCleanUpTask;
144: }
145:
146: public void setInitTask(ETLTaskNode initTask) {
147: this .initTask = initTask;
148: }
149:
150: public void setLastPipelinedTask(ETLTaskNode lastPipelinedTask) {
151: this .lastPipelinedTask = lastPipelinedTask;
152: }
153:
154: public void setNextTaskOnException(ETLTaskNode nextTaskOnException) {
155: this .nextTaskOnException = nextTaskOnException;
156: }
157:
158: public void setNextTaskOnSucess(ETLTaskNode nextTaskOnSucess) {
159: this .nextTaskOnSucess = nextTaskOnSucess;
160: }
161:
162: public void setPredecessorTask(ETLTaskNode predecessorTask) {
163: this .predecessorTask = predecessorTask;
164: }
165:
166: public void setStatsUpdateTask(ETLTaskNode statsUpdateTask) {
167: this .statsUpdateTask = statsUpdateTask;
168: }
169:
170: public void setTargetTable(TargetTable targetTable) {
171: this.targetTable = targetTable;
172: }
173: }
|