package com.mega.bizpro.client.utils; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.Date; import com.mega.modeling.api.MegaRoot; import com.mega.modeling.api.MegaToolkit; import com.mega.modeling.api.MegaTransaction; public class Importer { private HopexHandler hh = null; private File file = null; private FileInputStream fis = null; private static MegaToolkit mgToolkit = null; private static MegaRoot mgRoot = null; public void start() throws IOException{ System.out.println("Start : " + new Date()); hh = HopexHandler.getInstance(); hh.logMessage("Importer is alive"); try { mgRoot = hh.getRoot(); mgToolkit = hh.getMgToolkit(); hh.logMessage("Open file"); //final String report = (String) mgRoot.callFunction("~qnta3JvmFDTA[Excel Import]", "C:\\Users\\Public\\Documents\\HOPEX V4\\JFO\\TestImport.xlsx", "C:\\Users\\Public\\Documents\\HOPEX V4\\JFO\\TestImport_result.xlsx", true, null); //final String report = (String) mgRoot.callFunction("~qnta3JvmFDTA[Excel Import]", new Object[] {"C:\\Users\\Public\\Documents\\HOPEX V4\\JFO\\TestImport.xlsx", "C:\\Users\\Public\\Documents\\HOPEX V4\\JFO\\TestImport_result.xlsx", true, mgRoot}); final String report = (String) mgRoot.callFunction("~qnta3JvmFDTA[Excel Import]", new Object[] {"C:\\Users\\Public\\Documents\\HOPEX V4\\JFO\\TestImport.xlsx", "C:\\Users\\Public\\Documents\\HOPEX V4\\JFO\\TestImport_result.xlsx", true, null}); hh.logMessage("Close file"); hh.logMessage(report); //mgRoot.getCollection("~pj)grmQ9pG90[Business Process]").create(); hh.logMessage("Dispatching"); //hh.save(); hh.dispatch(); hh.close(); hh.logMessage("End : " + new Date()); } //catch (IOException e) { catch (Exception e) { e.printStackTrace(); hh.logMessage("Error : " + new Date()); hh.getErrorLogFormater().logError(e); hh.close(); } } public static void main(String[] args) throws IOException { Importer imp = new Importer(); imp.start(); } }