Package org.openbravo.service.db

Examples of org.openbravo.service.db.DataImportService


      InitialClientSetupData[] dataCOA = null;
      if (bCreateAccounting) {
        dataCOA = InitialClientSetupData.selectCOAModules(this, strModules);
        ModuleUtiltiy.orderModuleByDependency(this, dataCOA);
        if (dataCOA != null && dataCOA.length != 0) {
          DataImportService myData = DataImportService.getInstance();
          for (int i = 0; i < dataCOA.length; i++) {
            String strPath = vars.getSessionValue("#SOURCEPATH") + "/modules" + dataCOA[i].path;
            FileInputStream in = new FileInputStream(strPath);
            AccountingValueData av = new AccountingValueData(vars, in, true, "C");
            m_info.append(SALTO_LINEA).append(
                Utility.messageBD(this, "StartingAccounting", vars.getLanguage())).append(
                SALTO_LINEA);
            if (!createAccounting(conn, vars, strCurrency, InitialClientSetupData.currency(this,
                strCurrency), hasProduct, hasBPartner, hasProject, hasMCampaign, hasSRegion, av
                .getFieldProvider())) {
              releaseRollbackConnection(conn);
              conn = this.getTransactionConnection();
              m_info.append(SALTO_LINEA).append(
                  Utility.messageBD(this, "CreateAccountingFailed", vars.getLanguage())).append(
                  SALTO_LINEA);
            } else {
              if (!InitialClientSetupData
                  .existsClientModule(this, strClient, dataCOA[i].adModuleId)) {
                InitialClientSetupData.insertClientModule(this, strClient, vars.getUser(),
                    dataCOA[i].adModuleId, dataCOA[i].version);
              }
              m_info.append(SALTO_LINEA).append(
                  Utility.messageBD(this, "CreateReferenceDataSuccess", vars.getLanguage()))
                  .append(SALTO_LINEA);
              strSummary.append(SALTO_LINEA).append(
                  Utility.messageBD(this, "CreateReferenceDataSuccess", vars.getLanguage()))
                  .append(SALTO_LINEA);
            }
          }
        }
      }

      // Import Reference data
      InitialClientSetupData[] data = InitialClientSetupData.selectRDModules(this, strModules);
      ModuleUtiltiy.orderModuleByDependency(this, data);

      if (data != null && data.length != 0) {
        DataImportService myData = DataImportService.getInstance();
        StringBuffer strError = new StringBuffer("");

        for (int j = 0; j < data.length; j++) {
          String strPath = vars.getSessionValue("#SOURCEPATH") + "/modules/" + data[j].javapackage
              + "/referencedata/standard";
          File datasetFile = new File(strPath + "/" + Utility.wikifiedName(data[j].datasetname)
              + ".xml");
          if (!datasetFile.exists()) {
            continue;
          }

          String strXml = Utility.fileToString(datasetFile.getPath());
          ImportResult myResult = myData.importDataFromXML((Client) OBDal.getInstance().get(
              Client.class, strClient), (Organization) OBDal.getInstance().get(Organization.class,
              "0"), strXml, (Module) OBDal.getInstance().get(Module.class, data[j].adModuleId));
          m_info.append(SALTO_LINEA).append("File: ").append(datasetFile.getName()).append(":")
              .append(SALTO_LINEA);
          if (myResult.getLogMessages() != null && !myResult.getLogMessages().equals("")
View Full Code Here


    if (strModules != null && !strModules.equals("")) {
      UpdateReferenceDataData[] data = UpdateReferenceDataData.selectModules(this, strModules,
          strOrganization);
      ModuleUtiltiy.orderModuleByDependency(this, data);
      if (data != null && data.length != 0) {
        DataImportService myData = DataImportService.getInstance();
        m_info.append(SALTO_LINEA).append(
            Utility.messageBD(this, "StartingReferenceData", vars.getLanguage())).append(
            SALTO_LINEA);

        StringBuffer strError = new StringBuffer("");
        for (int j = 0; j < data.length; j++) {
          String strPath = vars.getSessionValue("#SOURCEPATH") + "/modules/" + data[j].javapackage
              + "/referencedata/standard";
          File datasetFile = new File(strPath + "/" + Utility.wikifiedName(data[j].datasetname)
              + ".xml");
          if (!datasetFile.exists()) {
            continue;
          }

          String strXml = Utility.fileToString(datasetFile.getPath());
          ImportResult myResult = myData.importDataFromXML((Client) OBDal.getInstance().get(
              Client.class, vars.getClient()), (Organization) OBDal.getInstance().get(
              Organization.class, strOrganization), strXml, (Module) OBDal.getInstance().get(
              Module.class, data[j].adModuleId));
          m_info.append(SALTO_LINEA).append("File: ").append(datasetFile.getName()).append(":")
              .append(SALTO_LINEA);
View Full Code Here

          log4j.info("Importing data from " + amd.name + " module. Dataset: "
              + Utility.wikifiedName(amd.dsName) + ".xml");

          // Import data from the xml file
          final String strXml = Utility.fileToString(datasetFile.getPath());
          final DataImportService importService = DataImportService.getInstance();
          final ImportResult result = importService.importDataFromXML(OBDal.getInstance().get(
              Client.class, "0"), OBDal.getInstance().get(Organization.class, "0"), strXml, OBDal
              .getInstance().get(Module.class, amd.adModuleId));
          if (result.hasErrorOccured()) {
            log4j.error(result.getErrorMessages());
            if (result.getException() != null) {
View Full Code Here

      // import coa
      if (!strCreateAccounting.equals("")) {
        InitialOrgSetupData[] dataCOA = InitialOrgSetupData.selectCOAModules(this, strModules);
        ModuleUtiltiy.orderModuleByDependency(this, dataCOA);

        final DataImportService myData = DataImportService.getInstance();
        for (int i = 0; i < dataCOA.length; i++) {
          final String strPath = vars.getSessionValue("#SOURCEPATH") + "/modules" + dataCOA[i].path;
          final FileInputStream in = new FileInputStream(strPath);
          final AccountingValueData av = new AccountingValueData(vars, in, true, "C");
          m_info.append(SALTO_LINEA).append(
              Utility.messageBD(this, "StartingAccounting", vars.getLanguage()))
              .append(SALTO_LINEA);
          if (!createAccounting(vars, strOrganization, C_Currency_ID, InitialOrgSetupData.currency(
              this, C_Currency_ID), hasProduct, hasBPartner, hasProject, hasMCampaign, hasSRegion,
              av.getFieldProvider())) {
            m_info.append(SALTO_LINEA).append(
                Utility.messageBD(this, "CreateAccountingFailed", vars.getLanguage())).append(
                SALTO_LINEA);
          } else {
            if (!InitialOrgSetupData.existsOrgModule(this, strClient, AD_Org_ID,
                dataCOA[i].adModuleId)) {
              InitialOrgSetupData.insertOrgModule(this, strClient, AD_Org_ID, vars.getUser(),
                  dataCOA[i].adModuleId, dataCOA[i].version);
            }
            m_info.append(SALTO_LINEA).append(
                Utility.messageBD(this, "CreateReferenceDataSuccess", vars.getLanguage())).append(
                SALTO_LINEA);
            strSummary.append(SALTO_LINEA).append(
                Utility.messageBD(this, "CreateReferenceDataSuccess", vars.getLanguage())).append(
                SALTO_LINEA);
          }
        }
      }
      // import rd
      InitialOrgSetupData[] data = InitialOrgSetupData.selectRDModules(this, strModules);
      ModuleUtiltiy.orderModuleByDependency(this, data);
      if (data != null && data.length != 0) {
        final DataImportService myData = DataImportService.getInstance();
        StringBuffer strError = new StringBuffer("");

        for (int j = 0; j < data.length; j++) {

          final String strPath = vars.getSessionValue("#SOURCEPATH") + "/modules/"
              + data[j].javapackage + "/referencedata/standard";
          File datasetFile = new File(strPath + "/" + Utility.wikifiedName(data[j].datasetname)
              + ".xml");
          if (!datasetFile.exists()) {
            continue;
          }

          final String strXml = Utility.fileToString(datasetFile.getPath());
          final ImportResult myResult = myData.importDataFromXML(OBDal.getInstance().get(
              Client.class, strClient), OBDal.getInstance().get(Organization.class, AD_Org_ID),
              strXml, OBDal.getInstance().get(Module.class, data[j].adModuleId));
          m_info.append(SALTO_LINEA).append("File: ").append(datasetFile.getName()).append(":")
              .append(SALTO_LINEA);
          if (myResult.getLogMessages() != null && !myResult.getLogMessages().equals("")
View Full Code Here

TOP

Related Classes of org.openbravo.service.db.DataImportService

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.