Package edu.ubb.warp.model

Examples of edu.ubb.warp.model.Project


    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);
        projects.addItem(
            new Object[] { Integer.toString(p.getProjectID()),
                p.getProjectName() }, i);
      }
      projects.setVisibleColumns(new Object[] { "Project Name" });
    } catch (DAOException e) {
      // this.getApplication().getMainWindow().showNotification("Error connecting to Database");
      e.printStackTrace();
View Full Code Here


    } else {
      projectList = projectDao.getProjectsByUser(user);
    }
   
    for (int i = 0; i < projectList.size(); i++) {
      Project p = projectList.get(i);
      if (p.isOpenedStatus()) {
        if (p.getDeadLineDate().compareTo(currentDate) < 0) {
          p.setOpenedStatus(false);
          projectDao.updateProject(p);
        } else {
          String s = p.getProjectName();
          Label l = new Label(s);
          l.setValue(s);
          projectsTable.addItem(new Object[] { l }, p.getProjectID());
        }
      }
    }
    projectPage = new ProjectInformationPageUI(user, projectList.get(0));
    tab1.addComponent(projectPage);
    projectsTable.addListener(new ItemClickListener() {

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

      public void itemClick(ItemClickEvent event) {

        int n = (Integer) event.getItemId();
        try {
          Project p = projectDao.getProjectByProjectID(n);
          if (projectPage == null) {
            projectPage = new ProjectInformationPageUI(user, p);
            tab1.addComponent(projectPage);
            projectPage.setImmediate(true);
          } else {
View Full Code Here

      String s = formatter.format(Timestamp.toDate(i));
      bookingTable.addContainerProperty(s, Label.class, null);
    }

    for (int j = 0; j < projectList.size(); j++) {
      Project p = projectList.get(j);
      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++;
        }
View Full Code Here

      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) {
            // TODO Auto-generated catch block
View Full Code Here

       */
      private static final long serialVersionUID = 1067848114647053543L;

      public void buttonClick(ClickEvent event) {
        //create a new project
        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();
                me.getApplication().getMainWindow()
                .showNotification("Database Error!");
View Full Code Here

      }
      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()));
View Full Code Here

      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()));
View Full Code Here

public class ProjectJdbcDAO implements ProjectDAO {

  public Project getProjectByProjectID(int projectID) throws DAOException,
      ProjectNotFoundException {
    Project project = new Project();
    try {
      String command = "SELECT * FROM `Projects` WHERE `ProjectID` = ?";
      PreparedStatement statement = JdbcConnection.getConnection()
          .prepareStatement(command);
      statement.setInt(1, projectID);
View Full Code Here

    return project;
  }

  public Project getProjectByProjectName(String projectName)
      throws DAOException, ProjectNotFoundException {
    Project project = new Project();
    try {
      String command = "SELECT * FROM `Projects` WHERE `projectName` = ?";
      PreparedStatement statement = JdbcConnection.getConnection()
          .prepareStatement(command);
      statement.setString(1, projectName);
View Full Code Here

    }
    return projects;
  }

  private Project getProjectFromResult(ResultSet result) throws SQLException {
    Project project = new Project();

    project.setProjectID(result.getInt("projectID"));
    project.setProjectName(result.getString("projectName"));
    project.setOpenedStatus(result.getBoolean("openedStatus"));
    project.setCurrentStatusID(result.getInt("currentStatusID"));
    project.setDeadLine(result.getInt("deadLine"));
    project.setNextRelease(result.getString("nextRelease"));
    project.setDescription(result.getString("description"));
    project.setStartWeek(result.getInt("startWeek"));

    return project;
  }
View Full Code Here

TOP

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

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.