View Javadoc
1 /*** 2 ImportDefinitionElement - ImportDefinition element in xml file. 3 4 Copyright (C) 2002-2003 Together 5 6 This library is free software; you can redistribute it and/or 7 modify it under the terms of the GNU Lesser General Public 8 License as published by the Free Software Foundation; either 9 version 2.1 of the License, or (at your option) any later version. 10 11 This library is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 Lesser General Public License for more details. 15 16 You should have received a copy of the GNU Lesser General Public 17 License along with this library; if not, write to the Free Software 18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 20 */ 21 22 package org.webdocwf.util.loader; 23 24 import java.util.Vector; 25 26 import org.w3c.dom.Document; 27 import org.webdocwf.util.loader.logging.Logger; 28 29 /*** 30 * Class is wrapper for ImportDefinitionElement tag in XML file. 31 * 32 * @author Zoran Milakovic 33 * @version 1.1 34 */ 35 public class ImportDefinitionElement { 36 37 private Logger logger; 38 private LoaderJobAttrReader loaderJobReader; 39 private CounterColumns counterColumns; 40 41 String strImportDefinitionName = ""; 42 String strImportDefinitionTableName = ""; 43 int iImportDefinitionCommitCount; 44 //String strImportDefinitionLogMode = "normal"; 45 String strImportDefinitionSelectStatement = ""; 46 String strRestartCounterTableName = ""; 47 String strRestartCounterImportDefinitionName = ""; 48 String strRestartCounterValue = ""; 49 boolean bRestartAutoCreate = false; 50 Vector vecRestartCounterSortColumn = new Vector(); 51 52 int iObjectID = 0; 53 int iObjectIDCT = 0; 54 String strObjectIDTableName = ""; 55 String strObjectIDColumnName = ""; 56 57 // TOS 58 String strObjectIDNameColumnName = ""; 59 String strObjectIDNameColumnValue = ""; 60 61 boolean bObjectIDAutoCreate; 62 int iObjectIDStartValue; 63 // String strLogMode = ""; 64 int iCommitCount = 0; 65 66 //importDefinition copy table 67 String strOnErrorContinueXml=""; 68 String strDefaultCutOffData=""; 69 70 //copyTable 71 //String strCopyTableLogMode = "normal"; 72 String strCopyTableName = ""; 73 String strCopyTableSourceTableName = ""; 74 String strCopyTableTargetTableName = ""; 75 String strCopyTableOidLogic="false"; 76 String strCopyTableOnErrorContinue=""; 77 78 String strCopyTableCommitCount; 79 int iCopyTableCommitCount; 80 81 String setFetchSizeID=""; 82 String setCursorNameID=""; 83 String setFetchSizeCT=""; 84 String setCursorNameCT=""; 85 86 87 /*** 88 * Method importXMLFile is used for setting of global variables 89 * during importing values from XML file. 90 * This method validates the imported data from XML file. 91 * If there is an error Exception "NullPointerException" or "Exception" is thrown. 92 * @param doc Parsed imports XML file. 93 * @param iJobNumber Number of ImportJob tag which is processed. 94 * @throws NullPointerException Constructs a NullPointerException with the specified detail message. 95 * @throws Exception Constructs an Exception with the specified detail message. 96 */ 97 public void importXMLFile (Document doc, int iJobNumber) throws NullPointerException, 98 Exception { 99 this.logger.write("full", "\timportXMLFile method is started."); 100 //onErrorContinue 101 this.strOnErrorContinueXml=OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 102 "onErrorContinue", iJobNumber); 103 this.strDefaultCutOffData=OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 104 "dataCutOff", iJobNumber); 105 //importDefinitionName 106 this.strImportDefinitionName = OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 107 "name", iJobNumber); 108 //importDefinitionTableName 109 this.strImportDefinitionTableName = OctopusXMLUtil.importAttributeValue(doc, 110 "importDefinition", "tableName", iJobNumber); 111 //commitCount 112 String strCommitCount = OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 113 "commitCount", iJobNumber); 114 if (!strCommitCount.equals("")) 115 this.iImportDefinitionCommitCount = Integer.parseInt(strCommitCount); 116 else { 117 if (loaderJobReader.getLoaderJobCommitCount()!= 0){ 118 this.iImportDefinitionCommitCount = loaderJobReader.getLoaderJobCommitCount(); 119 }else{ 120 if(this.iCommitCount!=0) 121 this.iImportDefinitionCommitCount = this.iCommitCount; 122 else 123 this.iImportDefinitionCommitCount=loaderJobReader.getDefaultCommitCount(); 124 } 125 } 126 //copyTable 127 /* 128 this.strCopyTableLogMode = OctopusXMLUtil.importAttributeValue(doc, 129 "copyTable", "logMode", iJobNumber); 130 if (this.strCopyTableLogMode.equals("")) { 131 this.strCopyTableLogMode = loaderJobReader.getDefaultLogMode(); 132 } 133 */ 134 this.strCopyTableName=OctopusXMLUtil.importAttributeValue(doc, 135 "copyTable", "name", iJobNumber); 136 this.strCopyTableSourceTableName=OctopusXMLUtil.importAttributeValue(doc, 137 "copyTable", "sourceTableName", iJobNumber); 138 this.strCopyTableTargetTableName=OctopusXMLUtil.importAttributeValue(doc, 139 "copyTable", "targetTableName", iJobNumber); 140 this.strCopyTableOidLogic=OctopusXMLUtil.importAttributeValue(doc, 141 "copyTable", "oidLogic", iJobNumber); 142 this.strCopyTableOnErrorContinue=OctopusXMLUtil.importAttributeValue(doc, 143 "copyTable", "onErrorContinue", iJobNumber); 144 //commitCount 145 String strCopyTableCommitCount = OctopusXMLUtil.importAttributeValue(doc, "copyTable", 146 "commitCount", iJobNumber); 147 if (!strCopyTableCommitCount.equals("")){ 148 this.iCopyTableCommitCount = Integer.parseInt(strCopyTableCommitCount); 149 }else { 150 if (loaderJobReader.getLoaderJobCommitCount()!= 0){ 151 this.iCopyTableCommitCount = loaderJobReader.getLoaderJobCommitCount(); 152 }else{ 153 if(this.iCommitCount!=0) 154 this.iCopyTableCommitCount = this.iCommitCount; 155 else 156 this.iCopyTableCommitCount=loaderJobReader.getDefaultCommitCount(); 157 } 158 } 159 String strIncrementCT = OctopusXMLUtil.importAttributeValue(doc, 160 "copyTable", "objectIDIncrement", iJobNumber); 161 if (!strIncrementCT.equals("")) 162 this.iObjectIDCT = Integer.parseInt(strIncrementCT); 163 else 164 this.iObjectIDCT = loaderJobReader.getDefaultObjectIDIncrement(); 165 166 //setFetchSize and setCursorName (importDefinition) 167 this.setFetchSizeID=OctopusXMLUtil.importAttributeValue(doc, 168 "importDefinition", "setFetchSize", iJobNumber); 169 if(this.setFetchSizeID.equalsIgnoreCase("")) 170 this.setFetchSizeID=this.loaderJobReader.getSetFetchSize(); 171 172 this.setCursorNameID=OctopusXMLUtil.importAttributeValue(doc, 173 "importDefinition", "setCursorName", iJobNumber); 174 if(this.setCursorNameID.equalsIgnoreCase("")) 175 this.setCursorNameID=this.loaderJobReader.getSetCursorName(); 176 177 178 //setFetchSize and setCursorName (copyTable) 179 this.setFetchSizeCT=OctopusXMLUtil.importAttributeValue(doc, 180 "copyTable", "setFetchSize", iJobNumber); 181 if(this.setFetchSizeCT.equalsIgnoreCase("")) 182 this.setFetchSizeCT=this.loaderJobReader.getSetFetchSize(); 183 184 this.setCursorNameCT=OctopusXMLUtil.importAttributeValue(doc, 185 "copyTable", "setCursorName", iJobNumber); 186 if(this.setCursorNameCT.equalsIgnoreCase("")) 187 this.setCursorNameCT=this.loaderJobReader.getSetFetchSize(); 188 189 190 //importDefinitonLogMode 191 /* 192 this.strImportDefinitionLogMode = OctopusXMLUtil.importAttributeValue(doc, 193 "importDefinition", "logMode", iJobNumber); 194 if (this.strImportDefinitionLogMode.equals("")) { 195 this.strImportDefinitionLogMode = loaderJobReader.getDefaultLogMode(); 196 } 197 */ 198 //importDefinitionSelectStatement 199 this.strImportDefinitionSelectStatement = OctopusXMLUtil.importAttributeValue(doc, 200 "importDefinition", "selectStatement", iJobNumber); 201 //increment 202 String strIncrement = OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 203 "objectIDIncrement", iJobNumber); 204 if (!strIncrement.equals("")) 205 this.iObjectID = Integer.parseInt(strIncrement); 206 else 207 this.iObjectID = loaderJobReader.getDefaultObjectIDIncrement(); 208 //objectIDTableName 209 this.strObjectIDTableName = OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 210 "objectIDTableName", iJobNumber); 211 if (this.strObjectIDTableName.equals("")) 212 this.strObjectIDTableName = loaderJobReader.getDefaultObjectIDTableName(); 213 //objectIDColumnName 214 this.strObjectIDColumnName = OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 215 "objectIDColumnName", iJobNumber); 216 if( this.strObjectIDColumnName.equals("") ) 217 this.strObjectIDColumnName = loaderJobReader.getDefaultObjectIDColumnName(); 218 219 //TOS 220 this.strObjectIDNameColumnName= OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 221 "objectIDNameColumnName", iJobNumber); 222 this.strObjectIDNameColumnValue= OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 223 "objectIDNameColumnValue", iJobNumber); 224 225 if(this.strObjectIDNameColumnName.equals("")) { 226 this.strObjectIDNameColumnName = loaderJobReader.getDefaultObjectIDNameColumnName(); 227 } 228 if(this.strObjectIDNameColumnValue.equals("")) { 229 this.strObjectIDNameColumnValue = loaderJobReader.getDefaultObjectIDNameColumnValue(); 230 } 231 232 //objectIDAutoCreate 233 String strObjectIDAutoCreate = OctopusXMLUtil.importAttributeValue(doc, "importDefinition", 234 "objectIDAutoCreate", iJobNumber); 235 if (strObjectIDAutoCreate.equals("")) 236 this.bObjectIDAutoCreate = loaderJobReader.getDefaultObjectIDAutoCreate(); 237 else 238 this.bObjectIDAutoCreate = (new Boolean(strObjectIDAutoCreate)).booleanValue(); 239 if (this.bObjectIDAutoCreate == true) { 240 String strObjectIDStartValue = OctopusXMLUtil.importAttributeValue(doc, 241 "importDefinition", "objectIDStartValue", iJobNumber); 242 if (strObjectIDStartValue.equals("")) 243 this.iObjectIDStartValue = loaderJobReader.getDefaultObjectIDStartValue(); 244 else 245 this.iObjectIDStartValue = Integer.parseInt(strObjectIDStartValue); 246 } 247 String strReturnCode = OctopusXMLUtil.importAttributeValue(doc, 248 "importDefinition", "returnCode", iJobNumber); 249 if(!strReturnCode.equals("")) 250 ReturnCode.setErrorReturnCode(Integer.parseInt(strReturnCode)); 251 else 252 ReturnCode.setErrorReturnCode(ReturnCode.getDefaultErrorReturnCode()); 253 // senka added this check 254 if (this.strImportDefinitionName!=""){ 255 this.vecRestartCounterSortColumn = OctopusXMLUtil.importValue(doc, "sortColumn", 256 "entry", iJobNumber); 257 } 258 } 259 260 /*** 261 * Set Logger object 262 * @param logger Logger object which is used for log file 263 */ 264 public void setLogger(Logger logger) { 265 this.logger = logger; 266 } 267 268 /*** 269 * Set LoaderJobAttrReader object 270 * @param loader LoaderJobAttrReader object,which stores loaderJob tag attributes 271 */ 272 public void setLoaderJob(LoaderJobAttrReader loader) { 273 this.loaderJobReader = loader; 274 } 275 }

This page was automatically generated by Maven