package com.chenyang.nse.bussiness.engine.infa.powercenter961.maskdata;

import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.ATTRIBUTE;
import com.chenyang.nse.bussiness.engine.infa.basic.xmlbean.CONFIG;
import java.util.ArrayList;
import java.util.List;

public class Configutil {
   public static CONFIG getConfig() throws Exception {
      new CONFIG();
      CONFIG config = geCONFIGXml();
      return config;
   }

   public static CONFIG geCONFIGXml() throws Exception {
      CONFIG config = new CONFIG();
      config.setDESCRIPTION("Default session configuration object");
      config.setISDEFAULT("YES");
      config.setNAME("default_session_config");
      config.setVERSIONNUMBER("1");

      for(ATTRIBUTE attribute : geCONFIGATTRIBUTEXml()) {
         config.getATTRIBUTE().add(attribute);
      }

      return config;
   }

   public static List<ATTRIBUTE> geCONFIGATTRIBUTEXml() throws Exception {
      List<ATTRIBUTE> attributeList = new ArrayList();
      String[] tmpStr = null;
      String[] attributeInfo = new String[]{"Advanced_", "Constraint based load ordering_NO", "Cache LOOKUP() function_YES", "Default buffer block size_Auto", "Line Sequential buffer length_1024", "Maximum Memory Allowed For Auto Memory Attributes_512MB", "Maximum Percentage of Total Memory Allowed For Auto Memory Attributes_5", "Additional Concurrent Pipelines for Lookup Cache Creation_Auto", "Custom Properties_AutoCommit=Yes;", "Pre-build lookup cache_Auto", "Optimization Level_Medium", "DateTime Format String_MM/DD/YYYY HH24:MI:SS.US", "Pre 85 Timestamp Compatibility_NO", "Log Options_0", "Save session log by_Session runs", "Save session log for these runs_0", "Session Log File Max Size_0", "Session Log File Max Time Period_0", "Maximum Partial Session Log Files_1", "Writer Commit Statistics Log Frequency_1", "Writer Commit Statistics Log Interval_0", "Error handling_", "Stop on errors_0", "Override tracing_None", "On Stored Procedure error_Stop", "On Pre-session command task error_Stop", "On Pre-Post SQL error_Stop", "Enable Recovery_NO", "Error Log Type_None", "Error Log Table Name Prefix_", "Error Log File Name_PMError.log", "Log Source Row Data_NO", "Data Column Delimiter_|", "Partitioning Options_", "Dynamic Partitioning_Disabled", "Number of Partitions_1", "Multiplication Factor_Auto", "Session on Grid_", "Is Enabled_NO"};

      for(int i = 0; i < attributeInfo.length; ++i) {
         ATTRIBUTE attribute = new ATTRIBUTE();
         tmpStr = attributeInfo[i].split("_");
         attribute.setNAME(tmpStr[0]);
         if (tmpStr.length > 1) {
            attribute.setVALUE(tmpStr[1]);
         } else {
            attribute.setVALUE("");
         }

         attributeList.add(attribute);
      }

      return attributeList;
   }
}
