コード例 #1
0
  public MostrarFINRetornoMasivo() {
    Locale loc = I18N.getLocaleAsObject();
    ResourceBundle bundle =
        ResourceBundle.getBundle(
            "com.geopista.app.catastro.intercambio.language.Importacioni18n",
            loc,
            this.getClass().getClassLoader());
    I18N.plugInsResourceBundle.put("Importacion", bundle);

    final TaskMonitorDialog progressDialog =
        new TaskMonitorDialog(application.getMainFrame(), null);

    progressDialog.setTitle(application.getI18nString("CargandoDatosIniciales"));
    progressDialog.report(application.getI18nString("CargandoDatosIniciales"));
    progressDialog.addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent e) {

            // Wait for the dialog to appear before starting the
            // task. Otherwise
            // the task might possibly finish before the dialog
            // appeared and the
            // dialog would never close. [Jon Aquino]
            new Thread(
                    new Runnable() {
                      public void run() {
                        try {
                          jbInit();
                        } catch (Exception e) {
                          e.printStackTrace();
                        } finally {
                          progressDialog.setVisible(false);
                        }
                      }
                    })
                .start();
          }
        });
    GUIUtil.centreOnWindow(progressDialog);
    progressDialog.setVisible(true);
  }
コード例 #2
0
  public void getMapFiles(PlugInContext pluginContext, boolean searchlocal, boolean searchremote) {
    final ArrayList localMapIds = new ArrayList();

    if (searchlocal) {
      final String rutaBase =
          aplicacion.getUserPreference(
              AppContext.PREFERENCES_DATA_PATH_KEY, AppContext.DEFAULT_DATA_PATH, true);
      ;

      // Comprobamos si existe la ruta base y en caso de que no exista la
      // creamos
      File rutaBaseFile = new File(rutaBase);
      if (!rutaBaseFile.exists()) {
        rutaBaseFile.mkdirs();
      }

      final TaskMonitorDialog progressDialog =
          new TaskMonitorDialog(aplicacion.getMainFrame(), pluginContext.getErrorHandler());
      progressDialog.allowCancellationRequests();
      progressDialog.setTitle(aplicacion.getI18nString("BuscandoMapas"));
      progressDialog.report(aplicacion.getI18nString("BuscandoMapasLocales"));
      progressDialog.addComponentListener(
          new ComponentAdapter() {
            public void componentShown(ComponentEvent e) {
              // Wait for the dialog to appear before starting the
              // task. Otherwise
              // the task might possibly finish before the dialog
              // appeared and the
              // dialog would never close. [Jon Aquino]
              new Thread(
                      new Runnable() {
                        public void run() {
                          try {

                            ArrayList listaMap =
                                GeopistaFunctionUtils.searchDirectory(rutaBase, progressDialog);

                            Iterator Iter = listaMap.iterator();

                            while (Iter.hasNext()) {
                              GeopistaMap currentMap = (GeopistaMap) Iter.next();

                              if (!(currentMap.isExtracted()
                                  && currentMap.getIdEntidad() != AppContext.getIdEntidad())) {
                                listModel.addElement(currentMap);
                                String systemId = currentMap.getSystemId();
                                if (systemId.startsWith("e")) systemId = systemId.substring(1);
                                localMapIds.add(systemId);
                              }
                            }
                          } catch (Exception e) {

                          } finally {
                            progressDialog.setVisible(false);
                          }
                        }
                      })
                  .start();
            }
          });
      if (aplicacion.getMainFrame() == null) // sin ventana de referencia
      GUIUtil.centreOnScreen(progressDialog);
      else GUIUtil.centreOnWindow(progressDialog);
      progressDialog.setVisible(true);
    }
    if (searchremote) {
      // final String sUrlPrefix = aplicacion.getString("geopista.conexion.servidor");
      final String sUrlPrefix;
      // ------NUEVO------>
      //            if(SSOAuthManager.isSSOActive())
      //            	sUrlPrefix = aplicacion.getString(SSOConstants.SSO_SERVER_URL);
      //            else
      sUrlPrefix = aplicacion.getString("geopista.conexion.servidor");
      // ----FIN NUEVO---->
      if (aplicacion.isOnline()) {
        try {

          if (!aplicacion.isLogged()) {
            aplicacion.setProfile("Geopista");
            aplicacion.login();
          }

          if (aplicacion.isLogged()) {
            final TaskMonitorDialog progressDialog2 =
                new TaskMonitorDialog(aplicacion.getMainFrame(), pluginContext.getErrorHandler());
            progressDialog2.setTitle(aplicacion.getI18nString("BuscandoMapas"));
            progressDialog2.report(aplicacion.getI18nString("BuscandoMapasBaseDatos"));
            progressDialog2.addComponentListener(
                new ComponentAdapter() {
                  public void componentShown(ComponentEvent e) {
                    // Wait for the dialog to appear before
                    // starting the task. Otherwise
                    // the task might possibly finish before the
                    // dialog appeared and the
                    // dialog would never close. [Jon Aquino]
                    new Thread(
                            new Runnable() {
                              public void run() {
                                try {
                                  Object[] mapSystemIds = localMapIds.toArray();
                                  Arrays.sort(mapSystemIds);
                                  AdministradorCartografiaClient administradorCartografiaClient =
                                      new AdministradorCartografiaClient(
                                          sUrlPrefix + "/AdministradorCartografiaServlet");
                                  Collection lMaps =
                                      administradorCartografiaClient.getMaps(
                                          Locale.getDefault().toString());
                                  Iterator lMapsIter = lMaps.iterator();
                                  while (lMapsIter.hasNext()) {
                                    try {

                                      GeopistaMap currentMap = (GeopistaMap) lMapsIter.next();
                                      int codeIndex =
                                          Arrays.binarySearch(
                                              mapSystemIds, currentMap.getSystemId());
                                      if (codeIndex >= 0) continue;
                                      listModel.addElement(currentMap);
                                    } catch (Exception e) {
                                      e.printStackTrace();
                                    }
                                  }
                                } catch (Exception e) {

                                } finally {
                                  progressDialog2.setVisible(false);
                                }
                              }
                            })
                        .start();
                  }
                });
            if (aplicacion.getMainFrame() == null) GUIUtil.centreOnScreen(progressDialog2);
            else GUIUtil.centreOnWindow(progressDialog2);
            progressDialog2.setVisible(true);
          }
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    }
  }
コード例 #3
0
  /** Realiza el proceso de importación en cuanto se accede a esta pantalla */
  public void enteredFromLeft(Map dataMap) {
    sbMessage = new StringBuffer();
    final TaskMonitorDialog progressDialog =
        new TaskMonitorDialog(application.getMainFrame(), null);

    progressDialog.setTitle(I18N.get("Importacion", "importar.general.proceso.importando"));
    progressDialog.report(I18N.get("Importacion", "importar.general.proceso.importando"));
    progressDialog.addComponentListener(
        new ComponentAdapter() {
          public void componentShown(ComponentEvent e) {
            // Wait for the dialog to appear before starting the
            // task. Otherwise
            // the task might possibly finish before the dialog
            // appeared and the
            // dialog would never close. [Jon Aquino]
            new Thread(
                    new Runnable() {
                      public void run() {
                        try {
                          String rutaImp =
                              (String) blackboard.get(ImportarUtils_LCGIII.FILE_TO_IMPORT);
                          notInsertedRows = 0;
                          insertedRows = 0;
                          totalRows = 0;

                          XMLReader parser = new SAXParser();
                          parser.setFeature(
                              "http://apache.org/xml/features/validation/schema", true);
                          parser.setFeature("http://xml.org/sax/features/validation", true);

                          blackboard.put("UnidadesInsertadas", new Integer(0));
                          blackboard.put("UnidadesNoInsertadas", new Integer(0));
                          blackboard.put("ListaDatosRegistro", new ArrayList());

                          Fichero fich = new Fichero();
                          fich.setIdTipoFichero(Fichero.FIN_RETORNO);

                          // Inicializar la lista total de parcelas importadas (se almacenan las
                          // ref.catastrales)
                          blackboard.put("ListaTotalFincasImportadas", new ArrayList());
                          parser.setContentHandler(
                              new FinRetornoXMLHandler(parser, progressDialog, fich, true));
                          parser.parse(rutaImp);

                          insertedRows =
                              ((Integer) blackboard.get("UnidadesInsertadas")).intValue();
                          notInsertedRows =
                              ((Integer) blackboard.get("UnidadesNoInsertadas")).intValue();
                          totalRows = insertedRows + notInsertedRows;

                          progressDialog.report(
                              I18N.get("Importacion", "importar.general.proceso.grabando"));
                          ArrayList lstDatosRegistro =
                              (ArrayList) blackboard.get("ListaDatosRegistro");

                          // Llamada a método de REGISTRO DE EXPEDIENTES
                          Iterator itRegistro = lstDatosRegistro.iterator();
                          while (itRegistro.hasNext()) {
                            Object o = itRegistro.next();
                            ArrayList lst = null;
                            if (((DatosRegistroExpedientes) o).getLstFincas() != null
                                && ((DatosRegistroExpedientes) o).getLstFincas().size() != 0)
                              lst = ((DatosRegistroExpedientes) o).getLstFincas();
                            else if (((DatosRegistroExpedientes) o).getLstBienes() != null
                                && ((DatosRegistroExpedientes) o).getLstBienes().size() != 0)
                              lst = ((DatosRegistroExpedientes) o).getLstBienes();

                            if (ConstantesRegExp.clienteCatastro != null) {
                              fich.setContenido(fileToString(new File(rutaImp)));
                              ArrayList lstExp = new ArrayList();
                              lstExp.add(
                                  ((DatosRegistroExpedientes) o)
                                      .getExpediente()
                                      .getNumeroExpediente());
                              // A crearFichero se le pasa la lista de expedientes
                              ConstantesRegExp.clienteCatastro.crearFichero(lstExp, fich);
                            }
                          }

                        } catch (Exception e) {
                          e.printStackTrace();
                        } finally {
                          progressDialog.setVisible(false);
                        }
                      }
                    })
                .start();
          }
        });
    GUIUtil.centreOnWindow(progressDialog);

    progressDialog.setVisible(true);

    printFinalMessage();

    try {
      // Iniciamos la ayuda
      String helpHS = "help/catastro/importadores/importadoresHelp_es.hs";
      ClassLoader c1 = this.getClass().getClassLoader();
      URL hsURL = HelpSet.findHelpSet(c1, helpHS);
      HelpSet hs = new HelpSet(null, hsURL);
      HelpBroker hb = hs.createHelpBroker();
      // fin de la ayuda
      hb.enableHelpKey(this, "FinRetorno", hs);
    } catch (Exception excp) {
      excp.printStackTrace();
    }
  }