Package com.m4f.business.domain.extended

Examples of com.m4f.business.domain.extended.ExtendedSchool


    Locale locale = locales.get(0);
    //Provider provider = this.providerService.getProviderById(providerId, locale);
    //MediationService mediation = this.mediationService.getMediationService(provider.getMediationService(), locale);
    Collection<ExtendedCourse> courses = this.courseService.getCoursesByOwner(mediationService.getId(), null, locale);
    for(ExtendedCourse course : courses) {
      ExtendedSchool school = this.schoolService.getSchool(course.getSchool(), locale);
      if(school != null) schools.put(school.getId(), school);
    }
   
    for(ExtendedSchool school : schools.values()) {
      Element schoolNode = new Element(SCHOOL_ELEMENT);
      for(String attr : SCHOOL_ATTRS) {
        Element attrNode = new Element(attr);
        if(SCHOOL_ATTR_ID.equals(attr)) {
          //attrNode.setContent(school.getId() != null ? this.createCData(school.getId().toString()) : "");
          attrNode.setContent(mediationService.getId() != null && school.getId() != null ? new CDATA(new StringBuffer(String.valueOf(mediationService.getId())).append("-").append(String.valueOf(school.getId())).toString()) : new CDATA(""));
        } else if(SCHOOL_ATTR_NAME.equals(attr)) {
          attrNode.setContent(school.getName() != null ? new CDATA(school.getName()) : new CDATA(""));
        } else if(SCHOOL_ATTR_PHONE.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getTelephone() != null ?
              new CDATA(school.getContactInfo().getTelephone()) : new CDATA(""));
        } else if(SCHOOL_ATTR_FAX.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null &&school.getContactInfo().getFax() != null ?
              new CDATA(school.getContactInfo().getFax()) : new CDATA(""));
        } else if(SCHOOL_ATTR_MAIL.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getEmail() != null ?
              new CDATA(school.getContactInfo().getEmail()) : new CDATA(""));
        } else if(SCHOOL_ATTR_ADDR.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getStreetAddress() != null ?
              new CDATA(school.getContactInfo().getStreetAddress()) : new CDATA(""));
        } else if(SCHOOL_ATTR_PK.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getZipCode() != null ?
              new CDATA(school.getContactInfo().getZipCode()) : new CDATA(""));
        } else if(SCHOOL_ATTR_WEB.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getWebSite() != null ?
              new CDATA(school.getContactInfo().getWebSite()) : new CDATA(""));
        } else if(SCHOOL_ATTR_CITY.equals(attr)) {
          attrNode.addContent(school.getContactInfo() != null && school.getContactInfo().getCity() != null ?
              new CDATA(school.getContactInfo().getCity()) : new CDATA(""));
        } else if(SCHOOL_ATTR_FEED.equals(attr)) {         
          StringBuffer sb = new StringBuffer(contextPath).append("/").append(locale).append(COURSES_FEED).append(provider.getId()).append("/").append(school.getId());
          attrNode.addContent(new CDATA(sb.toString()));
        }
        schoolNode.addContent(attrNode);
      }
     
View Full Code Here


  @Override
  public void updateSchools(List<ExtendedSchool> newSchools, Locale locale)
      throws Exception {
    Map<Long, ExtendedSchool> indexedSchools = this.getSchools(null, locale);
    ExtendedSchool school;
    for(ExtendedSchool 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

        internalFeedService.saveFeedSchools(feedSchools);
        HashMap<Long, ExtendedSchool> schools = new HashMap<Long, ExtendedSchool>();
        Collection<ExtendedCourse> courses =
          extendedCourseService.getCoursesByOwner(mediationService.getId(), null, null);
        for(ExtendedCourse course : courses) {
          ExtendedSchool school = extendedSchoolService.getSchool(course.getSchool(), Locale.getDefault());
          if(school != null) schools.put(school.getId(), school);
        }
        for(ExtendedSchool school : schools.values()) {
          FeedCourses feedCourse = internalFeedService.createFeedCourses(FRONTEND_HOST,
              provider, mediationService, school, this.getAvailableLanguages());  
          internalFeedService.saveFeedCourses(feedCourse);
View Full Code Here

        internalFeedService.saveFeedSchools(feedSchools);
        HashMap<Long, ExtendedSchool> schools = new HashMap<Long, ExtendedSchool>();
        Collection<ExtendedCourse> courses =
          extendedCourseService.getCoursesByOwner(mediationService.getId(), null, null);
        for(ExtendedCourse course : courses) {
          ExtendedSchool school = extendedSchoolService.getSchool(course.getSchool(), Locale.getDefault());
          if(school != null) schools.put(school.getId(), school);
        }
        for(ExtendedSchool school : schools.values()) {
          FeedCourses feedCourse = internalFeedService.createFeedCourses(host,
              provider, mediationService, school, this.getAvailableLanguages());  
          internalFeedService.saveFeedCourses(feedCourse);
View Full Code Here

      internalFeedService.saveFeedSchools(feedSchools);
      HashMap<Long, ExtendedSchool> schools = new HashMap<Long, ExtendedSchool>();
      Collection<ExtendedCourse> courses =
          extendedCourseService.getCoursesByOwner(mediationService.getId(), null, null);
      for(ExtendedCourse course : courses) {
        ExtendedSchool school = extendedSchoolService.getSchool(course.getSchool(), Locale.getDefault());
        if(school != null) schools.put(school.getId(), school);
      }
      for(ExtendedSchool school : schools.values()) {
        FeedCourses feedCourse = internalFeedService.createFeedCourses(host,
            provider, mediationService, school, this.getAvailableLanguages());  
        internalFeedService.saveFeedCourses(feedCourse);
View Full Code Here

        internalFeedService.saveFeedSchools(feedSchools);
        HashMap<Long, ExtendedSchool> schools = new HashMap<Long, ExtendedSchool>();
        Collection<ExtendedCourse> courses =
          extendedCourseService.getCoursesByOwner(mediationService.getId(), null, null);
        for(ExtendedCourse course : courses) {
          ExtendedSchool school = extendedSchoolService.getSchool(course.getSchool(), Locale.getDefault());
          if(school != null) schools.put(school.getId(), school);
        }
        for(ExtendedSchool school : schools.values()) {
          FeedCourses feedCourse = internalFeedService.createFeedCourses(FRONTEND_HOST,
              provider, mediationService, school, this.getAvailableLanguages());  
          internalFeedService.saveFeedCourses(feedCourse);
View Full Code Here

  @Secured("ROLE_MANUAL_MEDIATOR")
  @RequestMapping(method=RequestMethod.GET)
  public String getForm(Principal user, Model model,
      @RequestHeader("referer") String referer, HttpSession session) {
    try {
      ExtendedSchool school = this.serviceLocator.getExtendedSchoolService().createSchool();
      school.setCreated(Calendar.getInstance(new Locale("es")).getTime());
      model.addAttribute("school", school);
      session.setAttribute(this.REFERER_PARAM, referer);
    } catch(Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return "common.error";
View Full Code Here

  @RequestMapping(value="/edit/{schoolId}", method=RequestMethod.GET)
  public String getView(@PathVariable Long schoolId, Model model,
      Locale locale, @RequestHeader("referer") String referer,
      HttpSession session) {
    try {
      ExtendedSchool school = this.serviceLocator.getExtendedSchoolService().getSchool(schoolId, locale);
      model.addAttribute("school", school);
      session.setAttribute(this.REFERER_PARAM, referer);
    } catch (Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return "common.error";
View Full Code Here

  @Secured({"ROLE_MANUAL_MEDIATOR","ROLE_ADMIN"})
  @RequestMapping(value="/detail/{schoolId}", method=RequestMethod.GET)
  public String getDetail(@PathVariable Long schoolId,
      Model model, Locale locale) {
    try {
      ExtendedSchool school = this.serviceLocator.getExtendedSchoolService().getSchool(schoolId, locale);
      model.addAttribute("school", school);
    } catch (Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return "common.error";
    }
View Full Code Here

  @Secured("ROLE_MANUAL_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 {
      ExtendedSchool school = this.serviceLocator.getExtendedSchoolService().getSchool(schoolId, locale);
      this.serviceLocator.getExtendedSchoolService().delete(school, locale);
    } catch (Exception e) {
      LOGGER.severe(StackTraceUtil.getStackTrace(e));
      return "common.error";
    }
View Full Code Here

TOP

Related Classes of com.m4f.business.domain.extended.ExtendedSchool

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.