Package com.m4f.utils.feeds.events.model

Examples of com.m4f.utils.feeds.events.model.Dump


    public void loadProviderFeed(@RequestParam Long providerId, @RequestParam(required=false, defaultValue="false") String manual, @RequestParam(required=false, defaultValue="true") String register)
                    throws ParserConfigurationException, SAXException, IOException, Exception {
    LOGGER.info("Updating provider with id: " + providerId);
    Provider provider = null;
    CronTaskReport report = null;
    Dump dump = null;
   
        try {
          // CRON REPORT
            report = cronTaskReportService.create();
            provider = this.providerService.getProviderById(providerId, null);
           
            report.setObject_id(providerId);
            report.setDate(new Date());
           
            if(("true").equals(manual)) {
              report.setType(CronTaskReport.TYPE.INTERNAL_FEED);
            } else {
              report.setType(CronTaskReport.TYPE.PROVIDER_FEED);
            }
           
      report.setDescription(new StringBuffer("Proveedor: ").append(provider.getName()).toString());
     
      // DUMP
      dump = this.dumpService.createDump();
          String message = "Proceso de importacion del proveedor: " + provider.getName() + " (" +
              provider.getId() + "-" + " " + ")";
      dump.setDescription(message);
      dump.setLaunched(Calendar.getInstance(new Locale("es")).getTime());
      dump.setOwner(provider.getId());
      dump.setOwnerClass(Provider.class.getName());
      this.dumpService.save(dump);
         
      // IMPORT PROVIDER'S SCHOOLS FROM FEED
      providerImporter.importSchools(provider, dump);
       
View Full Code Here


                    throws ParserConfigurationException, SAXException, IOException, Exception {
    LOGGER.info("Updating school with id: " + schoolId);
   
    Provider provider = null;
      School school = null;
    Dump dump = null;
    CronTaskReport report = null;
   
    try {
      school = schoolService.getSchool(schoolId, null);
      LOGGER.info("School name: " + school.getName());
View Full Code Here

    @ResponseStatus(HttpStatus.OK)
    public void loadFeed(@RequestParam Long providerId)
                    throws ParserConfigurationException, SAXException, IOException, Exception {
    Provider provider = null;
    CronTaskReport report = null;
    Dump dump = null;
   
        try {
          provider = this.providerService.getProviderById(providerId, null);
           
            // CRON REPORT
            report = cronTaskReportService.create();
            report.setObject_id(providerId);
            report.setDate(new Date());
            report.setType(CronTaskReport.TYPE.PROVIDER_FEED);
      report.setDescription(new StringBuffer("Proveedor: ").append(provider.getName()).toString());
     
      // DUMP
      dump = this.dumpService.createDump();
          String message = "Proceso de importacion del proveedor: " + provider.getName() + " (" +
              provider.getId() + "-" + " " + ")";
      dump.setDescription(message);
      dump.setLaunched(Calendar.getInstance(new Locale("es")).getTime());
      dump.setOwner(provider.getId());
      dump.setOwnerClass(Provider.class.getName());
      this.dumpService.save(dump);
         
      // IMPORT PROVIDER'S SCHOOLS FROM FEED
      providerImporter.importSchools(provider, dump);
     
View Full Code Here

    public void importSchool(@RequestParam(required=true) Long providerId, @RequestParam(required=true) Long schoolId,
        @RequestParam(required=true) Long dumpId)
                    throws ParserConfigurationException, SAXException, IOException, Exception {
      Provider provider = null;
      School school = null;
    Dump dump = null;
    CronTaskReport report = null;
   

    try {
      provider = providerService.getProviderById(providerId, null);
View Full Code Here

  public String getSummary(Principal principal, Model model, Locale locale) {
    try {
      Provider provider = this.serviceLocator.getTransversalService().getProviderByUserName(principal.getName(), locale);
      /* List of Longs for representing the number of xml error, validation errors, and successful operation */
      List<Long> stats = new ArrayList<Long>(3);
      Dump dump = this.serviceLocator.getDumpService().getLastDumpByOwner(provider.getId());
      /*Long parseErrors = this.serviceLocator.getEventService().countParserErrorEventsByDump(dump);
      Long storeErrors = this.serviceLocator.getEventService().countStoreErrorEventsByDump(dump);
      Long successful = this.serviceLocator.getEventService().countStoreSuccessEventsByDump(dump);
      stats.add(parseErrors);
      stats.add(storeErrors);
      stats.add(successful);*/
     
      model.addAttribute("dumpId", dump.getId());
      model.addAttribute("providerId", provider.getId());
    } catch(Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return "common.error";
    }
View Full Code Here

  @RequestMapping(value="/today/ajax/dump/{dumpId}", method=RequestMethod.GET)
  @ResponseBody
  public List<Long> getDump(@PathVariable Long dumpId, Principal principal, Locale locale) {
    List<Long> stats = new ArrayList<Long>(3);
    try {
      Dump dump = this.serviceLocator.getDumpService().getDump(dumpId);
      /* List of Longs for representing the number of xml error, validation errors, and successful operation */
      Long parseErrors = this.serviceLocator.getEventService().countParserErrorEventsByDump(dump, locale);
      Long storeErrors = this.serviceLocator.getEventService().countStoreErrorEventsByDump(dump, locale);
      Long successful = this.serviceLocator.getEventService().countStoreSuccessEventsByDump(dump, locale);
      stats.add(parseErrors);
View Full Code Here

 
  @RequestMapping(value="/{providerId}/summary", method=RequestMethod.GET)
  public String getDumps(@PathVariable Long providerId, Model model, Locale locale) {
    try {
      Provider provider = this.serviceLocator.getProviderService().getProviderById(providerId, locale);
      Dump dump = this.serviceLocator.getDumpService().getLastDumpByOwner(provider.getId());
      if(dump != null) {
        model.addAttribute("dumpId", dump.getId());
      }
      model.addAttribute("providerId", provider.getId());
    } catch(Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return "common.error";
View Full Code Here

 
  @RequestMapping(value="/{dumpId}/delete", method=RequestMethod.GET)
  public String delete(@PathVariable Long dumpId,
      Model model, Locale locale) {
    try {
      Dump dump = this.serviceLocator.getDumpService().getDump(dumpId);
      this.serviceLocator.getDumpService().delete(dump);
    } catch (Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return "common.error";
    }
View Full Code Here

 
  @RequestMapping(value="/{dumpId}/events/parser-error", method=RequestMethod.GET)
  public String getParseErrors(@PathVariable Long dumpId, Model model, Locale locale,
      @RequestParam(defaultValue="1", required=false) Integer page) {
    try {
      Dump dump = this.serviceLocator.getDumpService().getDump(dumpId);
      if(dump == null) {
        model.addAttribute("message", "Dump with id " + dumpId + " doesn´t exist.");
        return "common/error";
      }
      PageManager<ParserErrorEvent> paginator = new PageManager<ParserErrorEvent>();
View Full Code Here

 
  @RequestMapping(value="/{dumpId}/events/store-error", method=RequestMethod.GET)
  public String getStoreErrorEvents(@PathVariable Long dumpId, Model model,
      Locale locale, @RequestParam(defaultValue="1", required=false) Integer page) {
    try {
      Dump dump = this.serviceLocator.getDumpService().getDump(dumpId);
      if(dump == null) {
        model.addAttribute("message", "Dump with id " + dumpId + " doesn´t exist.");
        return "common/error";
      }
      model.addAttribute("errors",this.serviceLocator.getEventService().getStoreErrorEventsByDump(dump));
      PageManager<StoreErrorEvent> paginator = new PageManager<StoreErrorEvent>();
      paginator.setOffset(this.getPageSize());
      paginator.setUrlBase("/" + locale.getLanguage() + "/dump/" + dump.getId() +
          "/events/store-error");
      paginator.setStart((page-1)*paginator.getOffset());
      paginator.setSize(this.serviceLocator.getEventService().countStoreErrorEventsByDump(dump));
      paginator.setCollection(this.serviceLocator.getEventService().getStoreErrorEventByDump(dump,
          paginator.getStart(), paginator.getEnd(), null));
View Full Code Here

TOP

Related Classes of com.m4f.utils.feeds.events.model.Dump

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.