Package com.m4f.business.domain

Examples of com.m4f.business.domain.Provider


    report.setObject_id(mediationId);
    report.setDate(new Date());
    report.setType(CronTaskReport.TYPE.INTERNAL_FEED);
    try {
      // Start the process   
      Provider provider =  providerService.getProviderByMediationService(mediationId, null);   
      MediationService mediationService = mediatorService.getMediationService(mediationId, null);
      //Set report description
      report.setDescription(new StringBuffer("Servicio de mediación: ").append(mediationService.getName()).toString());
     
      if(!mediationService.getHasFeed()) { // All must be manual mediator, but it's another check.
View Full Code Here


      cronTaskReportService.save(report);
      return;
    }
    try {
      LOGGER.info("Creating feeds for " + mediationService.getName() + " service");   
      Provider provider =  providerService.getProviderByMediationService(mediationId, null);   
      FeedSchools feedSchools = internalFeedService.createFeedSchools(host, provider, mediationService);
      internalFeedService.saveFeedSchools(feedSchools);
      HashMap<Long, ExtendedSchool> schools = new HashMap<Long, ExtendedSchool>();
      Collection<ExtendedCourse> courses =
          extendedCourseService.getCoursesByOwner(mediationService.getId(), null, null);
View Full Code Here

 
  @RequestMapping(value = "/feed", method = {RequestMethod.POST,RequestMethod.GET})
    @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

    @RequestMapping(value = "/school", method = {RequestMethod.POST,RequestMethod.GET})
    @ResponseStatus(HttpStatus.OK)
    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);
      school = schoolService.getSchool(schoolId, null);
      dump = dumpService.getDump(dumpId);
     
      report = cronTaskReportService.create();
            report.setObject_id(providerId);
            report.setDate(new Date());
            report.setType(CronTaskReport.TYPE.PROVIDER_SCHOOLS);
      report.setDescription(new StringBuffer("School: ").append(provider.getName()).toString());
      int retries = 5;
      while(retries > 0) {
          try {
           providerImporter.importCourses(provider, school, dump);
           } catch(Exception e) {
View Full Code Here

    }
    for(School school : schools) {
      Map<String, List<Course>> courses = coursesParser.getCourses(school, null);
      for(String lang : courses.keySet() ) {
        Locale locale = new Locale(lang);
        Provider provider = providerService.getProviderById(providerId, locale);
        courseStorage.store(courses.get(lang), locale, school, provider);
      }
     
    }
  }
View Full Code Here

  public void getSchoolsTest() throws Exception {
    List<Provider> providers = providerService.getAllProviders(new Locale("es"));
    if(providers.size()==0) {
      Assert.fail("No hay providers");
    }
    Provider provider = providerService.getAllProviders(configurationService.getLocales().get(0)).get(0);
    int eventsSizeBefore = 0, eventsSizeAfter = 0;
    Feed feed = parserService.getFeed(new URI(provider.getFeed()));
    if(feed!=null) {
      eventsSizeBefore = parserService.getLoadEvents(feed).size();
    }
    List<School> schools = this.schoolsFeedParser.getSchools(provider, null);
    System.out.println("Parsed schools: " + schools.size());
    feed = parserService.getFeed(new URI(provider.getFeed()));
    if(feed!=null) {
      eventsSizeAfter = parserService.getLoadEvents(feed).size();
    }
    schoolStorage.store(schools, new Locale("es"), provider);
    Assert.assertTrue(eventsSizeAfter>eventsSizeBefore);
View Full Code Here

    report.setObject_id(mediationId);
    report.setDate(new Date());
    report.setType(CronTaskReport.TYPE.INTERNAL_FEED);
    try {
      // Start the process   
      Provider provider =  providerService.getProviderByMediationService(mediationId, null);   
      MediationService mediationService = mediatorService.getMediationService(mediationId, null);
      //Set report description
      report.setDescription(new StringBuffer("Servicio de mediación: ").append(mediationService.getName()).toString());
     
      if(!mediationService.getHasFeed()) { // All must be manual mediator, but it's another check.
View Full Code Here

  }
 
  @RequestMapping(method=RequestMethod.GET)
  @ResponseStatus(HttpStatus.OK)
  public void getHome(Locale locale) throws Exception {
    Provider provider = providerService.createProvider();
    provider.setName("Proveedor local");
    provider.setFeed("http://localhost/feeds/zentruak_test.xml");
    providerService.save(provider, new Locale("es"));
    provider = providerService.createProvider();
    provider.setName("Tolosaldea provider");
    provider.setFeed("http://www.ikastn.com/feed/ikasgida/tolosaldea.php");
    providerService.save(provider, new Locale("es"));
    provider = providerService.createProvider();
    provider.setName("Mungialdea provider");
    provider.setFeed("http://www.ikasizhazi.com/feeds/mungialdea.xml");
    providerService.save(provider, new Locale("es"));
    provider = providerService.createProvider();
    provider.setName("Durangaldea provider");
    provider.setFeed("http://hirubila.appspot.com/es/extended/public/school/feed/290008");
    providerService.save(provider, new Locale("es"));
  }
View Full Code Here

  protected IAppConfigurationService configurationService;
 
 
  @Test
  public void loadData() throws Exception {
    Provider provider = providerService.createProvider();
    provider.setName("Proveedor local");
    provider.setFeed("http://localhost/feeds/zentruak.xml");
    providerService.save(provider, new Locale("es"));
    List<Provider> providers = providerService.getAllProviders(new Locale("es"));
    if(providers.size()==0) {
      Assert.fail("No hay providers");
    }
    provider = providerService.createProvider();
    provider.setName("Tolosaldea provider");
    provider.setFeed("http://www.ikastn.com/feed/ikasgida/tolosaldea.php");
    providerService.save(provider, new Locale("es"));
    providers = providerService.getAllProviders(new Locale("es"));
    if(providers.size()==1) {
      Assert.fail("El numero de proveedores ha de ser 2");
    }
   
    provider = providerService.createProvider();
    provider.setName("Mungialdea provider");
    provider.setFeed("http://www.ikasizhazi.com/feeds/mungialdea.xml");
    providerService.save(provider, new Locale("es"));
    providers = providerService.getAllProviders(new Locale("es"));
    if(providers.size()==2) {
      Assert.fail("El numero de proveedores ha de ser 3");
    }
View Full Code Here

  @Override
  public void buildSeoEntity(Course course, Locale locale)
    throws Exception {
   
    School school = schoolService.getSchool(course.getSchool(), locale);
    Provider provider = providerService.getProviderById(course.getProvider(), locale);
   
    // Territorial data
    String townName = school.getContactInfo() != null &&
      school.getContactInfo().getCity() != null ?
      school.getContactInfo().getCity() : "";
   
    List<Town> towns = territorialService.findTownsByName(townName, locale);
   
    Town town = new Town();
    Province province = new Province();
    Region region = new Region();
    if(towns != null && towns.size() > 0) {
      town = towns.get(0);
      region = this.getRegionsMap().get(locale.getLanguage()).get(town.getRegion());
      province = this.getProvincesMap().get(locale.getLanguage()).get(town.getProvince());
    }           
    CourseCatalog catalog = new CourseCatalog(course, locale.getLanguage(),
      school, provider.getName(), province.getName(), region.getName(), town.getName());
   
    CourseCatalog catalogOld = catalogService.getCourseCatalogByCourseId(course.getId(), locale);
    if(catalogOld != null) {
      catalog.setId(catalogOld.getId());
    }
View Full Code Here

TOP

Related Classes of com.m4f.business.domain.Provider

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.