Package org.openqreg.bean

Examples of org.openqreg.bean.UserKey


/**
* @return The primaryKey
*
*/
public PrimaryKey getPrimaryKey() {
return new UserKey(getId());
}
View Full Code Here


    User user = this.getUser(userId);
    if (null != user) {
      UserBean updatedUser = null;
      try {
        updatedUser = (UserBean) UserFinderBase
            .findByPrimaryKey(new UserKey(user.getId()));
        ClassPopulater.populateFromObjectIgnoreNull(user, updatedUser);
        user.removeAllAttributes();
        Map<String, String> attr = updatedUser.getAttributes();
        Set<String> set = attr.keySet();
        for (String elem : set) {
View Full Code Here

      con.setAutoCommit(false);
     
      UserBean user1 = BeanFactory.getUser(Thread.currentThread().getId());
      user1.setAttribute("name1", "value1");
      user1.create(con);
      UserBean user2 = (UserBean)UserFinderBase.findByPrimaryKey(con, new UserKey(user1.getId()));
      assertEquals("Userna skall vara lika", user1, user2);
      con.rollback();
      con.close();
    } catch (SQLException sqle) {
      fail("SQLException on testEquals: "+ sqle.getMessage());
View Full Code Here

      //Spara och ladda attribut
      UserBean user1 = BeanFactory.getUser(Thread.currentThread().getId());
      user1.setAttribute("name1", "value1");
      user1.create(con);
      UserBean user2 = (UserBean)UserFinderBase.findByPrimaryKey(con, new UserKey(user1.getId()));
      assertEquals("Attributen skall vara lika", user1.getAttribute("name1"), user2.getAttribute("name1"));
     
      //Radera attribut
      user2.removeAttribute("name1");
      assertNull("Attributet skall inte finnas", user2.getAttribute("name1"));
      user2.store(con);
      user1 = (UserBean)UserFinderBase.findByPrimaryKey(con, new UserKey(user2.getId()));
      assertNull("Attributet skall inte finnas", user2.getAttribute("name1"));

      //Uppdatera attribut
      user1.setAttribute("name1", "value1");
      user1.store(con);
      user1.setAttribute("name1", "newvalue1");
      user1.store(con);
      user2 = (UserBean)UserFinderBase.findByPrimaryKey(con, new UserKey(user1.getId()));
      assertEquals("Attributet skall ha nytt v�rde", "newvalue1", user2.getAttribute("name1"));
      user2.removeAllAttributes();
      user2.store(con);
     
      //Skapa tre attribut, d�refter uppdatera ett och radera ett
      assertTrue("Det skall inte finnas n�gra attribut", user2.getAttributes().isEmpty());
      user2.setAttribute("name1", "value1");
      user2.setAttribute("name2", "value2");
      user2.setAttribute("name3", "value3");
      user2.store(con);
     
      user2.setAttribute("name1", "newvalue1");
      user2.setAttribute("name3", "");
      user2.removeAttribute("name2");
      assertEquals("Det skall finnas tv� attribut", 2, user2.getAttributes().size());
      user2.store(con);
     
      user1 = (UserBean)UserFinderBase.findByPrimaryKey(con, new UserKey(user2.getId()));
      assertEquals("Det skall finnas ett attribut", 1, user1.getAttributes().size());
      assertEquals("Fel attributv�rde", "newvalue1", user1.getAttribute("name1"));
      assertNull("Attributet skall inte finnas", user1.getAttribute("name2"));
      assertNull("Attributet skall inte finnas", user1.getAttribute("name3"));
     
      user1.remove(con);
      user2 = (UserBean)UserFinderBase.findByPrimaryKey(con, new UserKey(user1.getId()));
      assertNull("User skall inte finnas", user2);
      con.rollback();
      con.close();
     
    }catch(SQLException sqle){
View Full Code Here

      return;
    }

    // tempUser = the user we are inviting
    User tempUser = (User) UserFinderBase.findByPrimaryKey(con,
        new UserKey(userId));

    // user does not exist
    if (tempUser == null) {
      ucrBean = null;
      message = lang.getTranslation(langId,
View Full Code Here

    Connection con = null;
    try {
      con = DbHandler.getConnection();
      con.setAutoCommit(false);
      UserBean user = (UserBean) UserFinderBase.findByPrimaryKey(new UserKey("System"));

      UsergroupBean ug1 = new UsergroupBean();
      ug1.setId("JUnit@Master1");
      ug1.setDescription("JUnit@Master1");
      ug1.setUseucr(Integer.valueOf(0));
View Full Code Here

        for (String uId : fileShareUsers) {
          FileshareuserBean fsuBean = new FileshareuserBean();
          fsuBean.setFileid(fileBean.getId());
          fsuBean.setUserid(uId);
          fileUser = (User) UserFinderBase
              .findByPrimaryKey(new UserKey(uId));
          if (null != fileUser) {
            //set correct label ending up on switch
            fsuBean.setUserdescription(fileUser.getFirstname()
                + " " + fileUser.getLastname());
          }
View Full Code Here

   * con)
   */
  @Override
  protected void populateKeysAndBeans(Connection con) throws SQLException {
    userToEdit = (UserBean) UserFinderBase.findByPrimaryKey(con,
        new UserKey(fetch.getValueAsString("USER_ID")));
    if (userToEdit != null) {
      ucrBean = (UsercentrerelBean) UsercentrerelFinderBase
          .findByPrimaryKey(con, new UsercentrerelKey(userToEdit
              .getId(), userToEdit.getCentreid()));
      ucrUserToEdit = UsercentrerelFinder.findByUseridReturnMap(con, userToEdit
View Full Code Here

    }
  }

  @Override
  protected void populateKeysAndBeans(Connection con) throws SQLException {
    myself = (UserBean) UserFinderBase.findByPrimaryKey(new UserKey(fetch
        .getValueAsString("USERID")));
  }
View Full Code Here

      }
    }
    if (loggedUserid != null) {
      // Search for spec. user committed, get User from DB
      loggedUser = (UserBean) UserFinderBase.findByPrimaryKey(
          new UserKey(loggedUserid));
    }
    if (col != null) {
      nrofvalues = new Integer(col.size());
    }
    } catch (SQLException e) {
View Full Code Here

TOP

Related Classes of org.openqreg.bean.UserKey

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.