Package edu.ubb.warp.dao

Examples of edu.ubb.warp.dao.DAOFactory


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

            private static final long serialVersionUID = -7782013424757219975L;

            public void buttonClick(ClickEvent event) {
              String val = (String) field.getValue();
              currentPage.user.setPhoneNumber(val);
              DAOFactory df = DAOFactory.getInstance();
              try {
                df.getUserDAO().updateUser(user);
              } catch (UserNameExistsException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              me.getApplication().getMainWindow().removeWindow(editWindow);
              me.getApplication().getMainWindow().setContent(new UserPageUI(user));
             
            }
          });
          editWindow.addComponent(saveButton);
         
          me.getApplication().getMainWindow().addWindow(editWindow);
        }
      });
      userPanel.addComponent(phoneLayout);
     
      HorizontalLayout emailLayout = new HorizontalLayout();
      emailLayout.addComponent(preEmailLabel);
      emailLayout.setSpacing(true);
      emailLayout.addComponent(emailLabel);
      emailLayout.addComponent(emailEditButton);
      emailEditButton.addListener(new ClickListener() {
       
        /**
         *
         */
        private static final long serialVersionUID = -2533599378971644874L;

        public void buttonClick(ClickEvent event) {
          final Window editWindow = new Window("Edit");
          final TextField field = new TextField((String)preEmailLabel.getValue());
          field.setValue(emailLabel.getValue());
          editWindow.addComponent(field);
          Button saveButton = new Button("save");
          editWindow.setImmediate(true);
          saveButton.setImmediate(true);
          saveButton.addListener(new ClickListener() {
           
            /**
             *
             */
            private static final long serialVersionUID = 5200647238632086761L;

            public void buttonClick(ClickEvent event) {
              String val = (String) field.getValue();
              currentPage.user.setEmail(val);
              DAOFactory df = DAOFactory.getInstance();
              try {
                df.getUserDAO().updateUser(user);
              } catch (UserNameExistsException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              me.getApplication().getMainWindow().removeWindow(editWindow);
              me.getApplication().getMainWindow().setContent(new UserPageUI(user));
             
            }
          });
          editWindow.addComponent(saveButton);
         
          me.getApplication().getMainWindow().addWindow(editWindow);
        }
      });
     
      userPanel.addComponent(emailLayout);
     
      passwordButton.addListener(new ClickListener() {

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

        public void buttonClick(ClickEvent event) {
          final Window editWindow = new Window("Edit");
          final PasswordField oldField = new PasswordField("Old Password");
         
          final PasswordField newField = new PasswordField("New Password");
          editWindow.addComponent(oldField);
          editWindow.addComponent(newField);
          Button saveButton = new Button("save");
          editWindow.setImmediate(true);
          saveButton.setImmediate(true);
          saveButton.addListener(new ClickListener() {

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

            public void buttonClick(ClickEvent event) {
              String val1 = (String) oldField.getValue();
              String val2 = (String) newField.getValue();
              if (Arrays.equals(Hash.hashString(val1), user.getPassword())) {
                currentPage.user.setPassword(Hash.hashString(val2));
              } else {
                currentPage.me.getApplication().getMainWindow().showNotification("Old password doesn't match");
                return;
              }
              DAOFactory df = DAOFactory.getInstance();
              try {
                df.getUserDAO().updateUser(user);
              } catch (UserNameExistsException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
              }
              me.getApplication().getMainWindow()
View Full Code Here

    this.addComponent(menuB);
    menuB.setWidth("100%");

    account.setIcon(new ThemeResource("icon.png"));

    DAOFactory df = DAOFactory.getInstance();
    UserDAO userDao = df.getUserDAO();
    ResourceDAO resourceDao = df.getResourceDAO();
    try {
      manager = userDao.userIsManager(user);
      String userName = resourceDao.getResourceByUser(user)
          .getResourceName();
      account.setText(userName);
View Full Code Here

  }

  protected void initUser() {
   
    menuB.setHtmlContentAllowed(true);
    DAOFactory df = DAOFactory.getInstance();
    RequestDAO rd = df.getRequestDAO();
    ResourceDAO resDao = df.getResourceDAO();
    try {
      if (rd.resourceHasRequests(resDao.getResourceByUser(user).getResourceID())) {
        request.setText(Colorizer.colorHTML("Request", Color.YELLOW));
      }
    } catch (DAOException e) {
View Full Code Here

  private Button resetPassButton = new Button("Reset users password");

  public DeleteUserPageUI(User u) {
    super(u);

    DAOFactory factory = DAOFactory.getInstance();
    final UserDAO userDao = factory.getUserDAO();
    ArrayList<User> userList = new ArrayList<User>();
    final ResourceDAO resDao = factory.getResourceDAO();
    // Space reserved for loading table with data

    try {
      userList = userDao.getAllUsers();
      userTable.addContainerProperty("UserID", String.class, null);
View Full Code Here

    this.addComponent(hl);
  }

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

import edu.ubb.warp.logic.Hash;
import edu.ubb.warp.model.User;

public class UserInserter {
  public static void InsertUsers() {
    DAOFactory df = DAOFactory.getInstance();
    UserDAO uDao = df.getUserDAO();
    User u1 = new User();
    User u2 = new User();
    u1.setEmail("mail@mail.com");
    u1.setPassword(Hash.hashString("password"));
    u1.setPhoneNumber("0743288115");
View Full Code Here

TOP

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

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.