Package com.m4f.business.domain

Examples of com.m4f.business.domain.School


    public void loadSchoolFeed(@RequestParam Long schoolId)
                    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());
      provider = providerService.getProviderById(school.getProvider(), null);
      //school = schoolService.getSchool(schoolId, null);
      dump = dumpService.getLastDumpByOwner(school.getProvider());
     
      report = cronTaskReportService.create();
            report.setObject_id(school.getProvider());
            report.setDate(new Date());
            report.setType(CronTaskReport.TYPE.PROVIDER_SCHOOLS);
      report.setDescription(new StringBuffer("School: ").append(provider.getName()).toString());
      int retries = 1;
      boolean errors = false;
      StringBuffer errorsSb = new StringBuffer();
      while(retries > 0) {
          try {
           providerImporter.importCourses(provider, school, dump);
           retries = -1; // Break the loop
           } catch(Exception e) {
             LOGGER.severe(StackTraceUtil.getStackTrace(e));
             LOGGER.info("" + retries + " Fail importing courses: "+school.getName() );
             retries--;
             if(!(retries > 0)) {
               errors = true;
               errorsSb.append(school.getName()).append(" -> ").append(e.getCause()).append("\n");
               LOGGER.severe(StackTraceUtil.getStackTrace(e));
             }
           }
      }     
     
View Full Code Here


    @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) {
             LOGGER.info("" + retries + " Fail importing courses: "+school.getName() );
             retries--;
             if(!(retries > 0)) {
               throw e;
             }
           }
View Full Code Here

                  }
                }
        }
        LOGGER.finest("-------------------------------------------------------------------");*/
      PageManager<Course> paginator = new PageManager<Course>();
      School school = this.schoolService.getSchool(new Long(954), null);
        long total = this.courseService.countCoursesBySchool(school);
        paginator.setOffset(RANGE);
        paginator.setStart(0);
        paginator.setSize(total);
        LOGGER.finest("-------------------------------------------------------------------");
        for (Integer page : paginator.getTotalPagesIterator()) {
                int start = (page - 1) * RANGE;
                int end = (page) * RANGE;
         Collection<Course> courses = this.courseService.getCoursesBySchool(school.getId(), null, null, start, end);
         for(Course course : courses) {
             CourseCatalog c_es = this.catalogService.getCourseCatalogByCourseId(course.getId(), new Locale("es"));
             CourseCatalog c_eu = this.catalogService.getCourseCatalogByCourseId(course.getId(), new Locale("eu"));
             if(c_es == null) {
               LOGGER.finest("Id: " + course.getId());
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();
View Full Code Here

 
  @Override
  @Cacheflush(cacheName="schools")
  public void updateSchools(List<School> newSchools, Locale localethrows Exception {
    Map<Long, School> indexedSchools = this.getSchools(locale);
    School school;
    for(School newSchool : newSchools) {
      if(indexedSchools.containsKey(newSchool.getId())) {
        school = indexedSchools.get(newSchool.getId());
        indexedSchools.remove(newSchool.getId());
        // TODO Copy newSchool into school
View Full Code Here

  @Override
  @Cacheable(cacheName="schools")
  public School getSchoolByExternalId(String externalId, Locale locale) {
    String filter = "externalId == externalIdParam";
    String params = "java.lang.String externalIdParam";
    School school = this.DAO.findEntity(School.class, locale, filter,
        params, new Object[] {externalId});
    return school;
  }
View Full Code Here

   */
  @RequestMapping(value="/update/school", method=RequestMethod.GET)
  @ResponseStatus(HttpStatus.OK)
  public void updateManualSchoolInformation(@RequestParam(required=false) Long schoolId, Locale locale) throws Exception {
    try {
      School school = this.serviceLocator.getSchoolService().getSchool(schoolId, locale);
      if(school != null) {
        Map<String, String> params = new HashMap<String, String>();
        params.put("schoolId", String.valueOf(school.getId()));
       
        this.serviceLocator.getWorkerFactory().createWorker().addWork(
            this.serviceLocator.getAppConfigurationService().getGlobalConfiguration().SCHOOL_QUEUE,
            "/task/school/feed", params);
      } else {
View Full Code Here

  @Secured("ROLE_AUTOMATIC_MEDIATOR")
  @RequestMapping(value="/edit/{schoolId}", method=RequestMethod.GET)
  public String getView(@PathVariable Long schoolId, Model model, @RequestHeader("referer") String referer,
      HttpSession session, Locale locale) {
    try {
      School school = this.serviceLocator.getSchoolService().getSchool(schoolId, locale);
      model.addAttribute("school", school);
      session.setAttribute(this.REFERER_PARAM, referer);
    } catch (Exception e) {
      return this.viewHelper.errorManagement(e);
    }
View Full Code Here

  @Secured({"ROLE_AUTOMATIC_MEDIATOR","ROLE_ADMIN"})
  @RequestMapping(value="/detail/{schoolId}", method=RequestMethod.GET)
  public String getDetail(@PathVariable Long schoolId,
      Model model, Locale locale) {
    try {
      School school = this.serviceLocator.getSchoolService().getSchool(schoolId, locale);
      model.addAttribute("school", school);
    } catch (Exception e) {
      return this.viewHelper.errorManagement(e);
    }
    return "school.detail";
View Full Code Here

  @Secured("ROLE_AUTOMATIC_MEDIATOR")
  @RequestMapping(value="/delete/{schoolId}", method=RequestMethod.GET)
  public String delete(@PathVariable Long schoolId, Model model, Locale locale,
      @RequestHeader("referer") String referer, @RequestHeader("Host") String host) {
    try {
      School school = this.serviceLocator.getSchoolService().getSchool(schoolId, locale);
      this.serviceLocator.getSchoolService().delete(school, locale);
    } catch (Exception e) {
      return this.viewHelper.errorManagement(e);
    }
    String returnURL = this.buildReturnURL(host, referer, locale);
View Full Code Here

TOP

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

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.