Пример #1
0
  private Cursor initServlet(HttpServletRequest request) {
    String element = request.getParameter("element");
    String offsetString = request.getParameter("offset");
    String reinit = request.getParameter("reinit");
    String backend = request.getParameter("backend");

    if (reinit != null) {
      log.info("Forcing reinitialization...");
      Parametro parametro = new Parametro(ParameterService.ID_STARTUP_DATE);
      parameterService.persistParametro(parametro);
    }

    Long offset = null;
    try {
      if (StringUtils.isNotEmpty(offsetString)) {
        offset = Long.valueOf(offsetString);
      }
    } catch (NumberFormatException e) {
      log.error("Error getting offset cursor " + request.getParameter("offset"));
    }

    Cursor cursor = new Cursor(element, offset, StringUtils.isNotEmpty(backend));
    log.info("Cursor: " + cursor.toString());
    return cursor;
  }
Пример #2
0
 private void startup(Cursor cursor) {
   try {
     final Date lastSystemRun = parameterService.getLastInitDate();
     if (initializationNeeded(lastSystemRun)) {
       log.info("Init Incisos UEs UCCs...");
       incisoUEUCCService.init();
       log.info("Init Rubro...");
       catalogService.initRubro();
       log.info("Init RubroCatalogo...");
       catalogService.initRubroCatalogo();
       if (lastSystemRun == null) {
         log.info("Init Catalog...");
         catalogService.initCatalog(cursor);
       }
       Date lastModifiedDate = Util.getLastModifiedDate(Util.CATALOG_SQL_URL);
       if (lastModifiedDate != null) {
         log.debug(
             "Last modified date for "
                 + Util.CATALOG_SQL_URL
                 + " is: "
                 + Util.formatDate_DD_MM_YYYY_HH_MM(lastModifiedDate));
         createCatalogBackendTask("medium-queue", lastModifiedDate);
       } else {
         log.error("Last modified date for " + Util.CATALOG_SQL_URL + " is null !");
       }
       parameterService.setLastInitDate(new Date());
       log.info("Date of initialization updated: " + parameterService.getLastInitDate());
     } else {
       log.info("Date of last initialization: " + lastSystemRun + ", exiting initialization.");
       log.debug("Initializing memory cache...");
       catalogService.initRubroCatalogo();
       incisoUEUCCService.initIncisos();
       incisoUEUCCService.initUEs();
       incisoUEUCCService.initEstadoCompras();
       incisoUEUCCService.initTiposCompra();
       incisoUEUCCService.initSubTiposCompra();
       incisoUEUCCService.initTipoResolucion();
       // incisoUEUCCService.initMonedas();
     }
   } catch (SystemException e) {
     log.error("Error on application startup...", e);
   } catch (QuotaException e) {
     log.error(e.getMessage(), e);
     createInitBackendTask("slow-queue", cursor);
   }
 }