⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 importdefinitionelement.java

📁 数据仓库工具
💻 JAVA
字号:
/**
  ImportDefinitionElement - ImportDefinition element in xml file.

    Copyright (C) 2002-2003  Together

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 */

package org.webdocwf.util.loader;

import java.util.Vector;

import org.w3c.dom.Document;
import org.webdocwf.util.loader.logging.Logger;

/**
 * Class is wrapper for ImportDefinitionElement tag in XML file.
 *
 * @author     Zoran Milakovic
 * @version    1.1
 */
public class ImportDefinitionElement {

  private Logger logger;
  private LoaderJobAttrReader loaderJobReader;
  private CounterColumns counterColumns;

  String strImportDefinitionName = "";
  String strImportDefinitionTableName = "";
  int iImportDefinitionCommitCount;
  //String strImportDefinitionLogMode = "normal";
  String strImportDefinitionSelectStatement = "";
  String strRestartCounterTableName = "";
  String strRestartCounterImportDefinitionName = "";
  String strRestartCounterValue = "";
  boolean bRestartAutoCreate = false;
  Vector vecRestartCounterSortColumn = new Vector();

  int iObjectID = 0;
  int iObjectIDCT = 0;
  String strObjectIDTableName = "";
  String strObjectIDColumnName = "";

// TOS
  String strObjectIDNameColumnName = "";
  String strObjectIDNameColumnValue = "";

  boolean bObjectIDAutoCreate;
  int iObjectIDStartValue;
//  String strLogMode = "";
  int iCommitCount = 0;

  //importDefinition copy table
  String strOnErrorContinueXml="";
  String strDefaultCutOffData="";

  //copyTable
  //String strCopyTableLogMode = "normal";
  String strCopyTableName = "";
  String strCopyTableSourceTableName = "";
  String strCopyTableTargetTableName = "";
  String strCopyTableOidLogic="false";
  String strCopyTableOnErrorContinue="";

  String strCopyTableCommitCount;
  int iCopyTableCommitCount;

  String setFetchSizeID="";
  String setCursorNameID="";
  String setFetchSizeCT="";
  String setCursorNameCT="";


  /**
   * Method importXMLFile is used for setting of global variables
   * during importing values from XML file.
   * This method validates the imported data from XML file.
   * If there is an error Exception "NullPointerException" or "Exception" is thrown.
   * @param doc Parsed imports XML file.
   * @param iJobNumber Number of ImportJob tag which is processed.
   * @throws NullPointerException Constructs a NullPointerException with the specified detail message.
   * @throws Exception Constructs an Exception with the specified detail message.
   */
  public void importXMLFile (Document doc, int iJobNumber) throws NullPointerException,
  Exception {
    this.logger.write("full", "\timportXMLFile method is started.");
    //onErrorContinue
    this.strOnErrorContinueXml=OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "onErrorContinue", iJobNumber);
    this.strDefaultCutOffData=OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "dataCutOff", iJobNumber);
    //importDefinitionName
    this.strImportDefinitionName = OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "name", iJobNumber);
    //importDefinitionTableName
    this.strImportDefinitionTableName = OctopusXMLUtil.importAttributeValue(doc,
        "importDefinition", "tableName", iJobNumber);
    //commitCount
    String strCommitCount = OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "commitCount", iJobNumber);
    if (!strCommitCount.equals(""))
      this.iImportDefinitionCommitCount = Integer.parseInt(strCommitCount);
    else {
      if (loaderJobReader.getLoaderJobCommitCount()!= 0){
        this.iImportDefinitionCommitCount = loaderJobReader.getLoaderJobCommitCount();
      }else{
        if(this.iCommitCount!=0)
          this.iImportDefinitionCommitCount = this.iCommitCount;
        else
          this.iImportDefinitionCommitCount=loaderJobReader.getDefaultCommitCount();
      }
    }
    //copyTable
/*    
    this.strCopyTableLogMode = OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "logMode", iJobNumber);
    if (this.strCopyTableLogMode.equals("")) {
        this.strCopyTableLogMode = loaderJobReader.getDefaultLogMode();
    }
*/    
    this.strCopyTableName=OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "name", iJobNumber);
    this.strCopyTableSourceTableName=OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "sourceTableName", iJobNumber);
    this.strCopyTableTargetTableName=OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "targetTableName", iJobNumber);
    this.strCopyTableOidLogic=OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "oidLogic", iJobNumber);
    this.strCopyTableOnErrorContinue=OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "onErrorContinue", iJobNumber);
    //commitCount
    String strCopyTableCommitCount = OctopusXMLUtil.importAttributeValue(doc, "copyTable",
        "commitCount", iJobNumber);
    if (!strCopyTableCommitCount.equals("")){
      this.iCopyTableCommitCount = Integer.parseInt(strCopyTableCommitCount);
    }else {
      if (loaderJobReader.getLoaderJobCommitCount()!= 0){
        this.iCopyTableCommitCount = loaderJobReader.getLoaderJobCommitCount();
      }else{
        if(this.iCommitCount!=0)
          this.iCopyTableCommitCount = this.iCommitCount;
        else
          this.iCopyTableCommitCount=loaderJobReader.getDefaultCommitCount();
      }
    }
    String strIncrementCT = OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "objectIDIncrement", iJobNumber);
    if (!strIncrementCT.equals(""))
      this.iObjectIDCT = Integer.parseInt(strIncrementCT);
    else
      this.iObjectIDCT = loaderJobReader.getDefaultObjectIDIncrement();

//setFetchSize and setCursorName (importDefinition)
    this.setFetchSizeID=OctopusXMLUtil.importAttributeValue(doc,
        "importDefinition", "setFetchSize", iJobNumber);
    if(this.setFetchSizeID.equalsIgnoreCase(""))
      this.setFetchSizeID=this.loaderJobReader.getSetFetchSize();

    this.setCursorNameID=OctopusXMLUtil.importAttributeValue(doc,
        "importDefinition", "setCursorName", iJobNumber);
    if(this.setCursorNameID.equalsIgnoreCase(""))
      this.setCursorNameID=this.loaderJobReader.getSetCursorName();


//setFetchSize and setCursorName (copyTable)
    this.setFetchSizeCT=OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "setFetchSize", iJobNumber);
    if(this.setFetchSizeCT.equalsIgnoreCase(""))
      this.setFetchSizeCT=this.loaderJobReader.getSetFetchSize();

    this.setCursorNameCT=OctopusXMLUtil.importAttributeValue(doc,
        "copyTable", "setCursorName", iJobNumber);
    if(this.setCursorNameCT.equalsIgnoreCase(""))
      this.setCursorNameCT=this.loaderJobReader.getSetFetchSize();


//importDefinitonLogMode
/*
    this.strImportDefinitionLogMode = OctopusXMLUtil.importAttributeValue(doc,
        "importDefinition", "logMode", iJobNumber);
    if (this.strImportDefinitionLogMode.equals("")) {
        this.strImportDefinitionLogMode = loaderJobReader.getDefaultLogMode();
    }
*/    
    //importDefinitionSelectStatement
    this.strImportDefinitionSelectStatement = OctopusXMLUtil.importAttributeValue(doc,
        "importDefinition", "selectStatement", iJobNumber);
    //increment
    String strIncrement = OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "objectIDIncrement", iJobNumber);
    if (!strIncrement.equals(""))
      this.iObjectID = Integer.parseInt(strIncrement);
    else
      this.iObjectID = loaderJobReader.getDefaultObjectIDIncrement();
    //objectIDTableName
    this.strObjectIDTableName = OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "objectIDTableName", iJobNumber);
    if (this.strObjectIDTableName.equals(""))
      this.strObjectIDTableName = loaderJobReader.getDefaultObjectIDTableName();
    //objectIDColumnName
    this.strObjectIDColumnName = OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "objectIDColumnName", iJobNumber);
    if( this.strObjectIDColumnName.equals("") )
      this.strObjectIDColumnName = loaderJobReader.getDefaultObjectIDColumnName();

    //TOS
    this.strObjectIDNameColumnName= OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "objectIDNameColumnName", iJobNumber);
    this.strObjectIDNameColumnValue= OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "objectIDNameColumnValue", iJobNumber);

    if(this.strObjectIDNameColumnName.equals("")) {
      this.strObjectIDNameColumnName = loaderJobReader.getDefaultObjectIDNameColumnName();
    }
    if(this.strObjectIDNameColumnValue.equals("")) {
      this.strObjectIDNameColumnValue = loaderJobReader.getDefaultObjectIDNameColumnValue();
    }

    //objectIDAutoCreate
    String strObjectIDAutoCreate = OctopusXMLUtil.importAttributeValue(doc, "importDefinition",
        "objectIDAutoCreate", iJobNumber);
    if (strObjectIDAutoCreate.equals(""))
      this.bObjectIDAutoCreate = loaderJobReader.getDefaultObjectIDAutoCreate();
    else
      this.bObjectIDAutoCreate = (new Boolean(strObjectIDAutoCreate)).booleanValue();
    if (this.bObjectIDAutoCreate == true) {
      String strObjectIDStartValue = OctopusXMLUtil.importAttributeValue(doc,
          "importDefinition", "objectIDStartValue", iJobNumber);
      if (strObjectIDStartValue.equals(""))
        this.iObjectIDStartValue = loaderJobReader.getDefaultObjectIDStartValue();
      else
        this.iObjectIDStartValue = Integer.parseInt(strObjectIDStartValue);
    }
    String strReturnCode = OctopusXMLUtil.importAttributeValue(doc,
        "importDefinition", "returnCode", iJobNumber);
    if(!strReturnCode.equals(""))
      ReturnCode.setErrorReturnCode(Integer.parseInt(strReturnCode));
    else
      ReturnCode.setErrorReturnCode(ReturnCode.getDefaultErrorReturnCode());
    this.vecRestartCounterSortColumn = OctopusXMLUtil.importValue(doc, "sortColumn",
        "entry", iJobNumber);
  }

  /**
   * Set Logger object
   * @param logger Logger object which is used for log file
   */
  public void setLogger(Logger logger) {
    this.logger = logger;
  }

  /**
   * Set LoaderJobAttrReader object
   * @param loader LoaderJobAttrReader object,which stores loaderJob tag attributes
   */
  public void setLoaderJob(LoaderJobAttrReader loader) {
    this.loaderJobReader = loader;
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -