Package edu.ubb.warp.dao

Examples of edu.ubb.warp.dao.ProjectDAO


 
  public void init_tab2() throws DAOException, ResourceNotFoundException, ResourceNotBookedException {
    DAOFactory df = DAOFactory.getInstance();
    BookingDAO bookDAO = df.getBookingDAO();
    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);
View Full Code Here


    /*
     * Space reserved for loading table w/ data
     */

    DAOFactory factory = DAOFactory.getInstance();
    final ProjectDAO pDao = factory.getProjectDAO();

    projectButton.addListener(new ClickListener() {

      public void buttonClick(ClickEvent event) {
        Project p = null;
        try {
          p = pDao.getProjectByProjectID(
          Integer.parseInt(projects.getItem(projects.getValue())
              .getItemProperty("Project ID").toString())
              );
          me.getApplication().getMainWindow().setContent(new ProjectPageUI(user, p));
        } catch (NumberFormatException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (DAOException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        } catch (ProjectNotFoundException e) {
          // TODO Auto-generated catch block
          e.printStackTrace();
        }

      }
    });

    ArrayList<Project> projectArray = null;
    try {
      projectArray = pDao.getProjectsByUser(user);
      System.out.println(projectArray.get(0).getProjectName());
      projects.addContainerProperty("Project ID", String.class, null);
      projects.addContainerProperty("Project Name", String.class, null);
      for (int i = 0; i < projectArray.size(); i++) {
        Project p = projectArray.get(i);
View Full Code Here

                if (curentDate > maxBook.getWeek()) {

                  me.project.setDeadLineDate(new Date());
                  me.project.setOpenedStatus(false);
                  ProjectDAO prdao = df.getProjectDAO();
                  try {
                    prdao.updateProject(me.project);
                  } catch (ProjectNameExistsException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                  }
                  // me.getApplication().getMainWindow().setContent(new
                  // HomePageUI(u));
                  me.getApplication().getMainWindow()
                      .removeWindow(w);
                } else {
                  me.getApplication()
                      .getMainWindow()
                      .showNotification(
                          "Booking already exists!");
                }

              } catch (DAOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
              } catch (ProjectNotBookedException e1) {
                // TODO Auto-generated catch block

                e1.printStackTrace();

                me.project.setDeadLineDate(new Date());
                me.project.setOpenedStatus(false);
                ProjectDAO prdao = df.getProjectDAO();
                try {
                  prdao.updateProject(me.project);
                } catch (ProjectNameExistsException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();

                }
View Full Code Here

  }

  private void initTable(Date start, Date end) throws DAOException,
      ResourceNotFoundException {
    DAOFactory df = DAOFactory.getInstance();
    final ProjectDAO projectDao = df.getProjectDAO();
    ResourceDAO resourceDao = df.getResourceDAO();

    int startNum = Timestamp.toInt(start);
    int endNum = Timestamp.toInt(end);

    historyTable.addContainerProperty("ProjectID", Integer.class, null);
    historyTable.addContainerProperty("Project Name", String.class, null);
    historyTable.addContainerProperty("StartDate", String.class, null);
    historyTable.addContainerProperty("Deadline", String.class, null);
    SimpleDateFormat formatter = new SimpleDateFormat("dd/MMM/yyyy");
    Resource u = null;
    try {
    u = resourceDao.getResourceByUser(user);
    } catch (Exception e) {
     
    }
    ArrayList<Project> projectList = null;
    if (manager) {
      projectList = projectDao.getAllProjectsByTimeFrame(startNum, endNum);
    } else {
      projectList = projectDao
          .getAllProjectsByResourceInTimeFrame(startNum, endNum,
              u.getResourceID());
    }
    for (Project p : projectList) {
      Object o[] = new Object[] { p.getProjectID(), p.getProjectName(),
          formatter.format(p.getStartDate()),
          formatter.format(p.getDeadLineDate()), };
      historyTable.addItem(o, p.getProjectID());
    }
    historyTable.setSelectable(true);
    historyTable.addListener(new ItemClickListener() {

      /**
       *
       */
      private static final long serialVersionUID = -1551161219444664337L;

      public void itemClick(ItemClickEvent event) {
        if (event.isDoubleClick()) {
          int i = (Integer) event.getItem()
              .getItemProperty("ProjectID").getValue();

          Project p = null;
          try {
            p = projectDao.getProjectByProjectID(i);
            System.out.println(p.getProjectName());
          } catch (DAOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
          } catch (ProjectNotFoundException e) {
View Full Code Here

        final Project p = new Project();
       
        int projectEnd = Timestamp.toInt((Date)date.getValue());
        int projectStart = Timestamp.toInt(new Date());
       
        ProjectDAO prdao = df.getProjectDAO();
        ResourceDAO res = df.getResourceDAO();
        if ((projectName.toString().length() != 0) &&
            (projectEnd > projectStart) &&
            (Integer.parseInt(list.getItem(list.getValue()).getItemProperty("Status ID").toString()) != 0))
        { 
          p.setDescription(projectDescription.toString());
          p.setOpenedStatus(true);
          p.setStartWeek(projectStart);
          p.setProjectName(projectName.toString());
          p.setDeadLine(projectEnd);
          p.setCurrentStatusID(Integer.parseInt(list.getItem(list.getValue()).getItemProperty("Status ID").toString()));
          p.setNextRelease(release.toString());
         
         
              try {
                prdao.insertProject(p);
                ResourceDAO resDao = df.getResourceDAO();
                res.insertUserTask(resDao.getResourceByUser(u).getResourceID(), p.getProjectID(), true);
              } catch (ProjectNameExistsException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
View Full Code Here

           
            p.setDeadLineDate(new Date());
            p.setOpenedStatus(false);
           
   
            ProjectDAO prdao = df.getProjectDAO();
           
           
            try {
              prdao.updateProject(p);
            } catch (ProjectNameExistsException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
             
            }
            me.getApplication().getMainWindow().setContent(new HomePageUI(u));
          }
         
        } catch (DAOException e1) {
          // TODO Auto-generated catch block
          e1.printStackTrace();
        } catch (ProjectNotBookedException e1) {
          // TODO Auto-generated catch block
         
          e1.printStackTrace();
         
          p.setDeadLineDate(new Date());
          p.setOpenedStatus(false);
          ProjectDAO prdao = df.getProjectDAO();
          try {
            prdao.updateProject(p);
          } catch (ProjectNameExistsException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
           
          }
View Full Code Here

TOP

Related Classes of edu.ubb.warp.dao.ProjectDAO

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.