Package de.iritgo.aktera.importer

Examples of de.iritgo.aktera.importer.ImportManager


   */
  protected void convertToXml(ModelRequest request, String fileName, String xslt)
    throws IOException, javax.xml.transform.TransformerConfigurationException,
    javax.xml.transform.TransformerException, ModelException
  {
    ImportManager im = (ImportManager) request.getSpringBean(ImportManager.ID);

    if (im.validateXmlFile(new File(fileName)))
    {
      return;
    }

    if (StringTools.isTrimEmpty(xslt))
View Full Code Here


   */
  protected boolean analyze(final ModelRequest req, ModelResponse res, final String fileName, final String handlerId,
          final boolean bulkImport, String xslt, final Properties properties) throws ModelException
  {
    final I18N i18n = (I18N) req.getSpringBean(I18N.ID);
    final ImportManager im = (ImportManager) req.getSpringBean(ImportManager.ID);

    FileTools.newAkteraFile("/var/tmp/iritgo").mkdirs();

    final File lockFile = FileTools.newAkteraFile("/var/tmp/iritgo/import.lck");

    if ("Y".equals(req.getParameter("force")))
    {
      lockFile.delete();
    }

    if (lockFile.exists())
    {
      return false;
    }

    try
    {
      lockFile.createNewFile();

      File reportFile = FileTools.newAkteraFile("/var/tmp/iritgo/import-report.txt");

      reportFile.delete();
      reportFile.createNewFile();

      final PrintWriter reporter = new PrintWriter(new FileOutputStream(reportFile), true);

      convertToXml(req, fileName, xslt);

      if (im.validateXmlFile(new File(fileName)))
      {
        new Thread()
        {
          public void run()
          {
            boolean ok = true;

            try
            {
              File file = new File(fileName);
              Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
                      "file://" + file.getAbsolutePath());

              if (doc.getChildNodes().getLength() > 0)
              {
                XPath xPath = XPathFactory.newInstance().newXPath();
                Node importElem = (Node) xPath.evaluate("import", doc, XPathConstants.NODE);

                if (importElem != null)
                {
                  reporter.println(i18n.msg(req, "Aktera", "startingImportAnalysis"));
                  ok = im.analyzeImport(req, doc, importElem, reporter, i18n, handlerId, bulkImport, properties);
                }
                else
                {
                  reporter.println(i18n
                          .msg(req, "AkteraImporter", "importErrorNoImportRootNodeFound"));
View Full Code Here

   */
  protected boolean perform(final ModelRequest req, ModelResponse res, final String fileName, final String handlerId,
          String xslt, final boolean bulkImport, final Properties properties) throws ModelException
  {
    final I18N i18n = (I18N) req.getSpringBean(I18N.ID);
    final ImportManager im = (ImportManager) req.getSpringBean(ImportManager.ID);

    FileTools.newAkteraFile("/var/tmp/iritgo").mkdirs();

    final File lockFile = FileTools.newAkteraFile("/var/tmp/iritgo/import.lck");

    if (lockFile.exists())
    {
      return true;
    }

    try
    {
      lockFile.createNewFile();

      File reportFile = FileTools.newAkteraFile("/var/tmp/iritgo/import-report.txt");

      reportFile.delete();
      reportFile.createNewFile();

      final PrintWriter reporter = new PrintWriter(new FileOutputStream(reportFile), true);

      convertToXml(req, fileName, xslt);

      if (im.validateXmlFile(new File(fileName)))
      {
        new Thread()
        {
          public void run()
          {
            boolean ok = true;
            File file = null;

            try
            {
              file = new File(fileName);

              Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(
                      "file://" + file.getAbsolutePath());

              XPath xPath = XPathFactory.newInstance().newXPath();

              Node importElem = (Node) xPath.evaluate("import", doc, XPathConstants.NODE);

              reporter.println(i18n.msg(req, "Aktera", "startingImport"));

              ok = im.performImport(req, doc, importElem, reporter, i18n, handlerId, bulkImport, properties);
            }
            catch (ParserConfigurationException x)
            {
              reporter.println(i18n.msg(req, "Aktera", "importError", x.toString()));
            }
View Full Code Here

TOP

Related Classes of de.iritgo.aktera.importer.ImportManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.