Package edu.ubb.warp.model

Examples of edu.ubb.warp.model.Booking


    ResourceDAO resourceDAO = df.getResourceDAO();
    ProjectDAO proDAO = df.getProjectDAO();
    ArrayList<Project> projectList = proDAO.getProjectsByUser(user);
    Resource userResource = resourceDAO.getResourceByUser(user);
    int min,max = 0;
    Booking bMinMax = bookDAO.getMinBookingByResource(userResource);
    min = bMinMax.getWeek();
    bMinMax = bookDAO.getMaxBookingByResource(userResource);
    max = bMinMax.getWeek();
   
    {
      jobs.addContainerProperty("Project", String.class, null);
      for(int i = min; i <= max; i++) {
        String s = "Week " + Integer.toString(i);
        jobs.addContainerProperty(s, String.class, null);
      }
     

     
      for(int j = 0; j < projectList.size(); j++) {
        String[] obj = new String[max - min + 2];
        obj[0] = projectList.get(j).getProjectName();
        int i = 1;
        for(int it = min; it <= max; it++) {
          Booking b = bookDAO.getBookingByResourceIDAndProjectIDAndWeek(userResource.getResourceID(),projectList.get(j).getProjectID(), i);
          obj[i] = Float.toString(b.getRatio());
          i++;
        }
        jobs.addItem(obj,j);
      }
    }
View Full Code Here


      if (p.isOpenedStatus() && max > today) {
        Label[] obj = new Label[max - today + 2];
        obj[0] = new Label(p.getProjectName());
        int index = 1;
        for (int i = today; i <= max; i++) {
          Booking b = bookingDao
              .getBookingByResourceIDAndProjectIDAndWeek(
                  userResource.getResourceID(),
                  p.getProjectID(), i);
          Label l = new Label(Colorizer.floatToHTML(b.getRatio()));
          l.setContentMode(Label.CONTENT_XHTML);
          obj[index] = l;
          index++;
        }
        bookingTable.addItem(obj, j);
View Full Code Here

          BookingDAO bookDAO = df.getBookingDAO();
          int maxweek;
          int weeknow = Timestamp.toInt(projectEnd);

          try {
            Booking bmax = bookDAO.getMaxBookingByProject(p);
            maxweek = bmax.getWeek();

            if (weeknow > maxweek) { // lehet updatelni

              try {
                p.setDeadLineDate(projectEnd);
View Full Code Here

    bookingTable.addContainerProperty("Ratio", Label.class, null);
    int start = project.getStartWeek();
    int end = project.getDeadLine();

    for (int i = start; i <= end; i++) {
      Booking b = bookingDao.getBookingByResourceIDAndProjectIDAndWeek(
          resourceID, project.getProjectID(), i);
      Object[] obj = new Object[2];
      obj[0] = formatter.format(Timestamp.toDate(i));
      Label l = new Label(Colorizer.floatToHTML(b.getRatio()));
      l.setContentMode(Label.CONTENT_XHTML);
      obj[1] = l;
      bookingTable.addItem(obj, i);
    }
    bookingTable.setSizeFull();
View Full Code Here

              BookingDAO book = df.getBookingDAO();
              int curentDate = Timestamp.toInt(new Date());
              try {

                Booking maxBook = book
                    .getMaxBookingByProject(me.project);

                if (curentDate > maxBook.getWeek()) {

                  me.project.setDeadLineDate(new Date());
                  me.project.setOpenedStatus(false);
                  ProjectDAO prdao = df.getProjectDAO();
                  try {
View Full Code Here

      ArrayList<Resource> resourceList;
     
      resourceList = resourceDAO.getResourcesByProject(p);
   
      int min,max = 0;
      Booking bMinMax = bookDAO.getMinBookingByProject(p);
      min = bMinMax.getWeek();
      bMinMax = bookDAO.getMaxBookingByProject(p);
      max = bMinMax.getWeek();
      {
        projectTable.addContainerProperty("Resource", String.class, null);
        for(int i = min; i <= max; i++) {
          String s = "Week " + Integer.toString(i);
          projectTable.addContainerProperty(s, String.class, null);
        }
       
 
       
        for(int j = 0; j < resourceList.size(); j++) {
          String[] obj = new String[max - min + 2];
          obj[0] = resourceList.get(j).getResourceName();
          int i = 1;
          for(int it = min; it <= max; it++) {
            Booking b = bookDAO.getBookingByResourceIDAndProjectIDAndWeek(resourceList.get(j).getResourceID(),p.getProjectID(), i);
            obj[i] = Float.toString(b.getRatio());
            i++;
          }
          projectTable.addItem(obj,j);
        }
      }
View Full Code Here

        int projectEnd = p.getDeadLine();
       
       
        try {
       
          Booking maxBook =book.getMaxBookingByProject(p);
       
          if (nowDate > maxBook.getWeek())
          {
           
            p.setDeadLineDate(new Date());
            p.setOpenedStatus(false);
           
View Full Code Here

    return bookings;
  }

  public Booking getBookingByResourceIDAndProjectIDAndWeek(int resourceID,
      int projectID, int week) throws DAOException {
    Booking booking = new Booking();
    try {
      String command = "SELECT * FROM Booking WHERE ResourceID = ? AND ProjectID = ? AND Week = ?";
      PreparedStatement statement = JdbcConnection.getConnection()
          .prepareStatement(command);
      statement.setInt(1, resourceID);
      statement.setInt(2, projectID);
      statement.setInt(3, week);
      ResultSet result = statement.executeQuery();
      if (result.next()) {
        booking = getBookingFromResult(result);
      } else {
        booking.setRatio(0);
        booking.setProjectID(projectID);
        booking.setResourceID(resourceID);
        booking.setWeek(week);
        return booking;
      }
    } catch (SQLException e) {
      throw new DAOException();
    }
View Full Code Here

      throw new BookingNotFoundException();
    }
  }

  private Booking getBookingFromResult(ResultSet result) throws SQLException {
    Booking booking = new Booking();
    booking.setProjectID(result.getInt("ProjectID"));
    booking.setResourceID(result.getInt("ResourceID"));
    booking.setRatio(result.getFloat("Ratio"));
    booking.setWeek(result.getInt("Week"));
    return booking;
  }
View Full Code Here

    return booking;
  }

  public Booking getMinBookingByResource(Resource resource)
      throws ResourceNotBookedException, DAOException {
    Booking booking = new Booking();
    try {
      String command = "SELECT * FROM Booking WHERE ResourceID = ? AND Week = (SELECT MIN(Week) FROM Booking WHERE ResourceID = ?)";
      PreparedStatement statement = JdbcConnection.getConnection()
          .prepareStatement(command);
      statement.setInt(1, resource.getResourceID());
View Full Code Here

TOP

Related Classes of edu.ubb.warp.model.Booking

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.