Examples of School


Examples of com.m4f.business.domain.School

 
  private void selectiveSchoolStore(School newSchool, Locale locale)
      throws NotSameClassException, Exception
      newSchool.setCreated(Calendar.getInstance(new Locale("es")).getTime());
      newSchool.setUpdated(newSchool.getCreated());
      School oldSchool;
      oldSchool = this.schoolService.getSchoolByExternalId(newSchool.getExternalId(), locale);
      if(oldSchool == null) {
        // Creacion de un centro nuevo.
        LOGGER.info("Adding new school: " + newSchool.getName());
        this.entities.add(newSchool);
      } else {
        // Actualizacion de un centro existente.
        // Logica de actualizacion
        SchoolComparator comparator = new SchoolComparator();
        if(comparator.compare(newSchool, oldSchool) == 0) {
          LOGGER.info("Existing school but NOT MODIFIED");
          return;
        }
        LOGGER.severe("Existing school but MODIFIED");
        Set<String> properties = new HashSet<String>();
        properties.add("telephone");
        properties.add("fax");
        properties.add("zipCode");
        properties.add("webSite");
        properties.add("streetAddress");
        properties.add("city");
        properties.add("email");
        this.beanManager.mergeObjects(newSchool.getContactInfo(),
            oldSchool.getContactInfo(), properties);
        properties = new HashSet<String>();
        properties.add("externalId");
        properties.add("name");
        properties.add("feed");
        this.beanManager.mergeObjects(newSchool, oldSchool, properties);
        //newSchool.setId(oldSchool.getId());
        //newSchool.setCreated(oldSchool.getCreated());
        oldSchool.setUpdated(Calendar.getInstance(new Locale("es")).getTime());
        //newSchool.setUpdated(oldSchool.getUpdated());
        this.entities.add(oldSchool);
      }
    }
View Full Code Here

Examples of com.m4f.business.domain.School

   
    courseData = courses.get(courseId);
    if(courseData == null) {
      courseData = new HashMap<String, Object>();
      Course course = this.serviceLocator.getCourseService().getCourse(courseId, locale);
      School school = this.serviceLocator.getSchoolService().getSchool(course.getSchool(), locale);
      Provider provider = this.serviceLocator.getProviderService().getProviderById(school.getProvider(), locale);
     
      String townName = school.getContactInfo() != null &&
          school.getContactInfo().getCity() != null ?
          school.getContactInfo().getCity() : "";
     

      //Town town = this.getTownByName(townName, locale);

      Town town = this.serviceLocator.getTerritorialService().getTownsMap(locale).get(townName);
View Full Code Here

Examples of net.sf.esims.model.entity.School

  public void testSaveAcademicYear() throws Exception {
    Date startDate = EsimsUtils.createDate(1, Calendar.JUNE, 2007);
    Date endDate = EsimsUtils.createDate(31, Calendar.MAY, 2008);
    SchoolEssence schoolEssence = UtilsForTestCases
        .createValidSchoolEssence();
    School school = schoolEssence.createSchool();
    this.schoolService.save(school);
    AcademicYear academicYear1 = new AcademicYear("2006-2007", school,
        startDate, endDate, "active");
    this.academicYearService.saveAcademicYear(academicYear1);
    // //cleanin up
View Full Code Here

Examples of org.bitbucket.andyrobr.clever.models.School

        assertNotNull(schoolsInDistrict);
        assertTrue(schoolsInDistrict.size() == 1);

        assertEquals(schoolsInDistrict.get(0), schools.get(0));

        School school = clever.getSchool(schoolsInDistrict.get(0).getId());

        assertEquals(school, schools.get(0));
    }
View Full Code Here

Examples of org.bitbucket.andyrobr.clever.models.School

    }

    @Test
    public void testGetTeachersFromSchool() throws Exception
    {
        School school = clever.getSchools().get(0);

        List<Teacher> teachers = clever.getTeachersFromSchool(school.getId());

        assertNotNull(teachers);
        assertTrue(teachers.size() == 1);

        School teacherSchool = clever.getSchoolFromTeacher(teachers.get(0).getId());

        assertEquals(teacherSchool, school);
    }
View Full Code Here

Examples of org.bitbucket.andyrobr.clever.models.School

    }

    @Test
    public void testGetStudentsFromSchool() throws Exception
    {
        School school = clever.getSchools().get(0);

        List<Student> students = clever.getStudentsFromSchool(school.getId());

        assertNotNull(students);
        assertTrue(students.size() == 1);

        School studentSchool = clever.getSchoolFromStudent(students.get(0).getId());

        assertEquals(studentSchool, school);
    }
View Full Code Here

Examples of org.bitbucket.andyrobr.clever.models.School

        // TODO I'm creating a new object mapper here because my original mapper has an instance of the deserializer
        // associated with it. Therefore, if I try to read the value using codec, I'll get an infinite loop (it'll come
        // back here).
        ObjectMapper mapper = new ObjectMapper();
        School school = mapper.readValue(node, School.class);

        // Apply nested properties by hand
        JsonNode locationNode = node.get("location");
        JsonNode principalNode = node.get("principal");

        school.setAddress(locationNode.get("address").getTextValue());
        school.setCity(locationNode.get("city").getTextValue());
        school.setState(locationNode.get("state").getTextValue());
        school.setPostalCode(locationNode.get("zip").getTextValue());

        school.setPrincipalName(principalNode.get("name").getTextValue());
        school.setPrincipalEmail(principalNode.get("email").getTextValue());

        return school;
    }
View Full Code Here

Examples of org.javalite.activejdbc.test_models.School

*/
public class ValidationWithResourceBundlesTest extends ActiveJDBCTest{

    @Test
    public void shouldPullCorrectMessageFromResourceBundle(){
        School s = new School();
        s.validate();
        a(s.errors().get("school_name")).shouldBeEqual("School name missing");
    }
View Full Code Here

Examples of trafficdefinition.School

    switch (tool) {
    // Create school
    case School:
      if (e.getButton() == MouseEvent.BUTTON1) {
        currentTrafficLayer.AddTrafficElement(new School(transformedPoint));
      }

      repaint();
      break;
    case Hotspot:
View Full Code Here

Examples of trafficdefinition.School

    }

    // If the adult has a job and she has to take children to school
    if (hasJob && (childrenToTakeToSchool != null)) {
      // Get the children's school
      School school = childrenToTakeToSchool.get(0).getSchool();

      // Estimate distance between home->school and home->work
      float distanceHomeSchool = home.getAddress().DistanceFrom(school.getClosestEdge());
      float distanceHomeWork = home.getAddress().DistanceFrom(jobLocation);

      // Estimate the time needed to travel from school->home->work,
      // school->home and home->work
      int estimatedTravelTimeSchoolHomeWork = Math.round((distanceHomeSchool + distanceHomeWork) / Constants.averageSpeed);
      int estimatedTravelTimeHomeSchool = Math.round(distanceHomeSchool / Constants.averageSpeed);
      int estimatedTravelTimeHomeWork = Math.round(distanceHomeWork / Constants.averageSpeed);

      int timeBetweenSchoolOpeningAndJobStarting = job.getStartingTime() - school.getTimeOpening();

      // Calculate the time to leave the house so that the child will
      // be at school on time
      int timeOfDepartureFromHouseToSchool = Math.max(0, school.getTimeOpening() - estimatedTravelTimeHomeSchool);

      // If the adult cannot go from school back home, stay for 20 minutes
      // and then go to work, then go straight from school to work
      if ((estimatedTravelTimeSchoolHomeWork + 20 * 60) > timeBetweenSchoolOpeningAndJobStarting) {
        // Create route for home->school->work
        List<Edge> tripEdges = new ArrayList<Edge>();

        tripEdges.add(home.getAddress());
        tripEdges.add(school.getClosestEdge());
        tripEdges.add(jobLocation);

        String route = MultipleTripExpander.ExpandTrips(tripEdges);

        // Write the route
        routesList.add(new Route(timeOfDepartureFromHouseToSchool, "<vehicle id=\"home-school-work-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" type=\"" + vehicle.getName() + "\" depart=\"" + String.valueOf(timeOfDepartureFromHouseToSchool) + "\" color=\"" + color + "\">" + "<route color=\"" + color + "\">" + route + "</route>" + "</vehicle>"));
      }
      // If there is enough time go back home and later go to work
      else {
        // Create route for home->school->home
        List<Edge> tripEdges = new ArrayList<Edge>();

        tripEdges.add(home.getAddress());
        tripEdges.add(school.getClosestEdge());
        tripEdges.add(home.getAddress());

        String route = MultipleTripExpander.ExpandTrips(tripEdges);

        // Write the route
        routesList.add(new Route(timeOfDepartureFromHouseToSchool, "<vehicle id=\"home-school-home-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" type=\"" + vehicle.getName() + "\" depart=\"" + String.valueOf(timeOfDepartureFromHouseToSchool) + "\" color=\"" + color + "\">" + "<route color=\"" + color + "\">" + route + "</route>" + "</vehicle>"));

        // Estimate what time the adult has to leave home to be at work
        // on time
        int timeOfDepartureFromHouseToWork = Math.max(0, job.getStartingTime() - estimatedTravelTimeHomeWork);

        // Write the trip home->work
        tripsList.add(new Trip(timeOfDepartureFromHouseToWork,"<trip id=\"house-work-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" depart=\"" + String.valueOf(timeOfDepartureFromHouseToWork) + "\" from=\"" + home.getAddress().getId() + "\" to=\"" + jobLocation.getId() + "\" color=\"" + color + "\" type=\"" + vehicle.getName() + "\" />\n"));
      }
    }
    // If the adult has a job but doesn't have to take children to school
    else if (hasJob && (childrenToTakeToSchool == null)) {
      // Just go to work

      // Try to estimate the distance between home and work
      float distanceToTravel = home.getAddress().DistanceFrom(jobLocation);

      // Estimate the time needed to cover this distance
      int estimatedTravelTime = Math.round(distanceToTravel / Constants.averageSpeed);

      // Calculate the time to leave the house so that the adult will be
      // at work on time
      int timeOfDepartureFromHouse = Math.max(0, job.getStartingTime() - estimatedTravelTime);

      // Create route from house to work
      tripsList.add(new Trip(timeOfDepartureFromHouse,"<trip id=\"house-work-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" depart=\"" + String.valueOf(timeOfDepartureFromHouse) + "\" from=\"" + home.getAddress().getId() + "\" to=\"" + jobLocation.getId() + "\" color=\"" + color + "\" type=\"" + vehicle.getName() + "\" />\n"));
    }
    // If the adult is unemployeed and has to take children to school
    else if (!hasJob && (childrenToTakeToSchool != null)) {
      // Get the children's school
      School school = childrenToTakeToSchool.get(0).getSchool();

      // Try to estimate the distance that the vehicle will need to
      // travel
      float distanceHomeSchool = home.getAddress().DistanceFrom(school.getClosestEdge());

      // Estimate the time needed to go from school to home
      int estimatedTravelTimeHomeSchool = Math.round(distanceHomeSchool / Constants.averageSpeed);

      // Calculate the time to leave the house
      int timeOfDepartureFromHouse = Math.max(0, school.getTimeOpening() - estimatedTravelTimeHomeSchool);

      // Go from home to school and back
      List<Edge> tripEdges = new ArrayList<Edge>();

      tripEdges.add(home.getAddress());
      tripEdges.add(school.getClosestEdge());
      tripEdges.add(home.getAddress());

      String route = MultipleTripExpander.ExpandTrips(tripEdges);

      // Write the route
      routesList.add(new Route(timeOfDepartureFromHouse,"<vehicle id=\"home-school-home-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" type=\"" + vehicle.getName() + "\" depart=\"" + String.valueOf(timeOfDepartureFromHouse) + "\" color=\"" + color + "\">"+"<route color=\"" + color + "\">" + route + "</route>"+"</vehicle>"));
    }

    // If the adult has a job and she doesn't have to pick up kids from
    // school
    if (hasJob && (childrenToPickupFromSchool == null)) {
      // Create route from work to home
      tripsList.add(new Trip(job.getEndingTime(),"<trip id=\"work-house-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" depart=\"" + String.valueOf(job.getEndingTime()) + "\" from=\"" + jobLocation.getId() + "\" to=\"" + home.getAddress().getId() + "\" color=\"" + color + "\" type=\"" + vehicle.getName() + "\" />\n"));
    }
    // If the adult has a job and she has to pickup kids from school
    else if (hasJob && (childrenToPickupFromSchool != null)) {
      // Get the children's school
      School school = childrenToPickupFromSchool.get(0).getSchool();

      // Estimate distance between home-school and school-work
      float distanceHomeSchool = home.getAddress().DistanceFrom(school.getClosestEdge());
      float distanceHomeWork = home.getAddress().DistanceFrom(jobLocation);

      // Estimate the time needed to go from work to school and then from
      // school to home
      int estimatedTravelTimeWorkSchoolHome = Math.round((distanceHomeSchool + distanceHomeWork) / Constants.averageSpeed);

      int timeBetweenJobEndingAndSchoolClosing = school.getTimeClosing() - job.getEndingTime();

      // If the adult doesn't have enough time after work to go home for
      // 20 minutes
      if ((estimatedTravelTimeWorkSchoolHome + 20 * 60) > timeBetweenJobEndingAndSchoolClosing) {
        // Go straight from work to school and then home
        List<Edge> tripEdges = new ArrayList<Edge>();

        tripEdges.add(jobLocation);
        tripEdges.add(school.getClosestEdge());
        tripEdges.add(home.getAddress());

        // Build the route
        String route = MultipleTripExpander.ExpandTrips(tripEdges);

        routesList.add(new Route(job.getEndingTime(),"<vehicle id=\"work-school-home-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" type=\"" + vehicle.getName() + "\" depart=\"" + String.valueOf(job.getEndingTime()) + "\" color=\"" + color + "\">"+"<route color=\"" + color + "\">" + route + "</route>"+"</vehicle>"));
      }
      // If the adult has enough time to go home after work
      else {
        // Go from work to home and from home to school and from school
        // to home
        // Create route from work to home
        tripsList.add(new Trip(job.getEndingTime(),"<trip id=\"work-house-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" depart=\"" + String.valueOf(job.getEndingTime()) + "\" from=\"" + jobLocation.getId() + "\" to=\"" + home.getAddress().getId() + "\" color=\"" + color + "\" type=\"" + vehicle.getName() + "\" />\n"));

        // Estimate the time needed to cover the distance from home to
        // school
        int estimatedTravelTime = (int) Math.round(distanceHomeSchool / Constants.averageSpeed);

        // Calculate the time to leave the house so that the adult will
        // be at school on time
        int timeOfDepartureFromHouse = Math.max(0, school.getTimeClosing() - estimatedTravelTime);

        // Build the route
        List<Edge> tripEdges = new ArrayList<Edge>();

        tripEdges.add(home.getAddress());
        tripEdges.add(school.getClosestEdge());
        tripEdges.add(home.getAddress());

        String route = MultipleTripExpander.ExpandTrips(tripEdges);

        routesList.add(new Route(timeOfDepartureFromHouse,"<vehicle id=\"home-school-home-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" type=\"" + vehicle.getName() + "\" depart=\"" + String.valueOf(timeOfDepartureFromHouse) + "\" color=\"" + color + "\">"+"<route color=\"" + color + "\">" + route + "</route>"+"</vehicle>"));
      }

    }
    // If the adult has no job and has children to pick up
    else if (!hasJob && (childrenToPickupFromSchool != null)) {
      School school = childrenToPickupFromSchool.get(0).getSchool();

      // Try to estimate the distance between home and school
      float distanceToTravel = home.getAddress().DistanceFrom(school.getClosestEdge());

      // Estimate the time needed to cover this distance
      int estimatedTravelTime = (int) Math.round(distanceToTravel / Constants.averageSpeed);

      // Calculate the time to leave the house so that the adult will be
      // at school on time
      int timeOfDepartureFromHouse = Math.max(0, school.getTimeClosing() - estimatedTravelTime);

      // Create route from house to school and back
      List<Edge> tripEdges = new ArrayList<Edge>();

      tripEdges.add(home.getAddress());
      tripEdges.add(school.getClosestEdge());
      tripEdges.add(home.getAddress());

      String route = MultipleTripExpander.ExpandTrips(tripEdges);
      routesList.add(new Route(timeOfDepartureFromHouse, "<vehicle id=\"home-school-home-" + String.valueOf(home.getId()) + "-" + String.valueOf(counter) + "\" type=\"" + vehicle.getName() + "\" depart=\"" + String.valueOf(timeOfDepartureFromHouse) + "\" color=\"" + color + "\">"+"<route color=\"" + color + "\">" + route + "</route>"+"</vehicle>"));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.