Package edu.ubb.warp.model

Examples of edu.ubb.warp.model.Request


          e1.printStackTrace();
        }
        Resource res = selectedResource;
        TreeMap<Integer, Float> tm = getValues();
        for (Map.Entry<Integer, Float> e : tm.entrySet()) {
          Request r = new Request();
          r.setProjectID(project.getProjectID());
          r.setRejected(false);
          r.setResourceID(res.getResourceID());
          r.setSenderID(userRes.getResourceID());
          r.setWeek(e.getKey());
          r.setRatio(e.getValue());
          try {
            requestDao.insertRequest(r);
          } catch (DAOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
View Full Code Here


      private static final long serialVersionUID = -237113785224349354L;

      public void handleAction(Action action, Object sender, Object target) {
        if (ACTION_EDIT.equals(action)) {
          int i = (Integer) target;
          Request r = myRequestsList.get(i);
          me.getApplication().getMainWindow().addWindow(new EditRequestUI(r, page));
          System.out.println(r.getProjectID());
        }
       
        if (ACTION_DELETE.equals(action)) {
          int i = (Integer) target;
          Request r = myRequestsList.get(i);
          try {
            requestDao.deleteRequest(r);
            me.getApplication().getMainWindow().showNotification("Deleting", Notification.TYPE_HUMANIZED_MESSAGE);
            initMyReqTable();
          } catch (DAOException e) {
            e.printStackTrace();
            System.err.println("Delete Error");
            me.getApplication().getMainWindow().showNotification("Can't delete that", Notification.TYPE_WARNING_MESSAGE);
          } catch (ResourceNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (ProjectNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (BookingNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
          System.out.println("Deleting");
        }
      }
     
      public Action[] getActions(Object target, Object sender) {
        return ACTIONS;
      }
    });
   
    //adding containerProperty's to table
    myRequestsTable.addContainerProperty("Sender", String.class, null);
    myRequestsTable.addContainerProperty("Project", String.class, null);
    myRequestsTable.addContainerProperty("Resource", String.class, null);
    myRequestsTable.addContainerProperty("Date", String.class, null);
    myRequestsTable.addContainerProperty("Ratio wanted", Label.class, null);
    myRequestsTable.addContainerProperty("Current ratio", Label.class, null);
    myRequestsTable.addContainerProperty("Expired", String.class, null);
   
    for (int i = 0; i < myRequestsList.size(); i++) {
      Request r = myRequestsList.get(i);
      if (r.getWeek() < todayInt) {
        r.setRejected(true);
        requestDao.updateRequest(r);
        continue;
      }
      Object[] obj = new Object[7];
     
      obj[0] = userResource.getResourceName();
     
      Project p = projectDao.getProjectByProjectID(r.getProjectID());
      obj[1] = p.getProjectName();
     
      Resource res = resourceDao.getResourceByResourceID(r.getResourceID());
      obj[2] = res.getResourceName();
     
      String date = formatter.format(Timestamp.toDate(r.getWeek()));
      obj[3] = date;
      Label l = new Label(Colorizer.floatToHTML(r.getRatio()));
      l.setContentMode(Label.CONTENT_XHTML);
      obj[4] = l;
     
      Float f = bookingDao.getBookingsSumByResourceIDandWeek(r.getResourceID(), r.getWeek());
      l = new Label(Colorizer.floatToHTML(f));
      l.setContentMode(Label.CONTENT_XHTML);
      obj[5] = l;
     
      obj[6] = Boolean.toString(r.isRejected());
     
      myRequestsTable.addItem(obj,i);
    }
   
  }
View Full Code Here

       */
      private static final long serialVersionUID = 4199041679593834096L;

      public void handleAction(Action action, Object sender, Object target) {
        if (ACTION_HIDE.equals(action)) {
          Request r = otherRequestsList.get((Integer)target);
          try {
            requestDao.setRequestVisible(userResource.getResourceID(), r.getRequestID(), false);
            initOtherRequestsTable();
            otherRequestsTab.setImmediate(true);
          } catch (DAOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (ProjectNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (ResourceNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (BookingNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          }
        }
      }
     
      public Action[] getActions(Object target, Object sender) {
        return ACTIONS2;
      }
    });
   
    otherRequestsTable.addContainerProperty("Sender", String.class, null);
    otherRequestsTable.addContainerProperty("Project", String.class, null);
    otherRequestsTable.addContainerProperty("Resource", String.class, null);
    otherRequestsTable.addContainerProperty("Date", String.class, null);
    otherRequestsTable.addContainerProperty("Ratio wanted", String.class, null);
    otherRequestsTable.addContainerProperty("Current ratio", String.class, null);
   

    for (int i = 0; i < otherRequestsList.size(); i++) {
      Request r = otherRequestsList.get(i);
      if (r.getWeek() < todayInt) {
        r.setRejected(true);
        requestDao.updateRequest(r);
        continue;
      }
      String[] obj = new String[6];
     
      u = resourceDao.getResourceByResourceID(r.getSenderID());
      obj[0] = u.getResourceName();
     
      Project p = projectDao.getProjectByProjectID(r.getProjectID());
      obj[1] = p.getProjectName();
     
      Resource res = resourceDao.getResourceByResourceID(r.getResourceID());
      obj[2] = res.getResourceName();
     
      String date = formatter.format(Timestamp.toDate(r.getWeek()));
      obj[3] = date;
     
      obj[4] = decFormatter.format(r.getRatio());
     
      Float f = bookingDao.getBookingsSumByResourceIDandWeek(r.getResourceID(), r.getWeek());
      obj[5] = decFormatter.format(f);
     
      otherRequestsTable.addItem(obj,i);
    }
   
View Full Code Here

public class RequestJdbcDAO implements RequestDAO {

  public Request getRequestByRequestID(int requestID) throws DAOException,
      RequestNotFoundException {
    Request request = new Request();
    try {
      String command = "SELECT * FROM `Requests` WHERE `RequestID` = ?";
      PreparedStatement statement = JdbcConnection.getConnection()
          .prepareStatement(command);
      statement.setInt(1, requestID);
View Full Code Here

      throw new DAOException();
    }
  }

  private Request getRequestFromResult(ResultSet result) throws SQLException {
    Request request = new Request();
    request.setProjectID(result.getInt("ProjectID"));
    request.setRatio(result.getFloat("Ratio"));
    request.setRejected(result.getBoolean("Rejected"));
    request.setRequestID(result.getInt("RequestID"));
    request.setResourceID(result.getInt("ResourceID"));
    request.setSenderID(result.getInt("SenderID"));
    request.setWeek(result.getInt("Week"));
    return request;
  }
View Full Code Here

TOP

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

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.