Package org.openqreg.bean

Examples of org.openqreg.bean.UsercentrerelKey


      return null;
    }

    // get ucrBean for the user on this centreId
    UsercentrerelBean ucrUC = (UsercentrerelBean) UsercentrerelFinderBase
        .findByPrimaryKey(con, new UsercentrerelKey(user.getId(),
            centreId));

    // ucrBean exists for this user on the centreId, user is ucrUser
    if (null != ucrUC) {
      return ucrUC.getGroupid();
View Full Code Here


      return false;
    }

    // get ucrBean for the user on this centreId
    UsercentrerelBean ucrUC = (UsercentrerelBean) UsercentrerelFinderBase
        .findByPrimaryKey(con, new UsercentrerelKey(user.getId(),
            centreId));

    Usergroup userGroup = (Usergroup) UsergroupFinderBase
        .findByPrimaryKey(new UsergroupKey(Dispatcher.getInstance()
            .getUser(user.getId()).getGroupid()));
View Full Code Here

     * get ucrBean for the on current (any centre is ok, as there should
     * never be a mix of ucr and nonUcr rights for one user)
     */
    UsercentrerelBean ucrUC = (UsercentrerelBean) UsercentrerelFinderBase
        .findByPrimaryKey(con,
            new UsercentrerelKey(user.getId(), user.getCentreid()));

    // ucrBean exists for this user on the centreId, user is ucrUser
    if (null != ucrUC) {
      return true;
    }
View Full Code Here

      return false;
    }

    // get ucrBean for the user on this centreId
    UsercentrerelBean ucrUC = (UsercentrerelBean) UsercentrerelFinderBase
        .findByPrimaryKey(con, new UsercentrerelKey(user.getId(),
            centreId));

    // ucrBean exists for this user on the centreId, user is ucrUser
    if (null != ucrUC) {
      return true;
View Full Code Here

*/
public static Object findByPrimaryKey(Connection con, PrimaryKey key) throws SQLException {
PreparedStatement pStmt = null;
ResultSet rs = null;
UsercentrerelBean valueObject = null;
UsercentrerelKey primaryKey = (UsercentrerelKey) key;
try{
pStmt = con.prepareStatement(UsercentrerelBeanBase.SELECT_STATEMENT);
pStmt.setObject(1, primaryKey.getUserid());
pStmt.setObject(2, primaryKey.getCentreid());
rs = pStmt.executeQuery();
while (rs.next()){
valueObject = populate(rs);
valueObject.afterPopulate(con);
}
View Full Code Here

/**
* @return The primaryKey
*
*/
public PrimaryKey getPrimaryKey() {
return new UsercentrerelKey(getUserid(), getCentreid());
}
View Full Code Here

    userId = null;
    lastSavedBy = null;
    lastSavedTS = null;
    userId = fetch.getValueAsString("USERCENTREREL_USERID");
    ucrBean = (UsercentrerelBean) UsercentrerelFinderBase.findByPrimaryKey(
        con, new UsercentrerelKey(userId, user.getCentreid()));
  }
View Full Code Here

      // nothing
      if (!"".equals(fGroupId)) {

        // get ucrBean for the user on this centreId
        UsercentrerelBean ucrBeanInDB = (UsercentrerelBean) UsercentrerelFinderBase
            .findByPrimaryKey(con, new UsercentrerelKey(userToEdit
                .getId(), fCentreId));

        if (null == ucrBeanInDB) {
          // new relation
          isNew = true;
          ucrBeanInDB = new UsercentrerelBean();
        }

        ucrBeanInDB.setStatus(fStatus);
        ucrBeanInDB.setGroupid(fGroupId);
        ucrBeanInDB.setTsupdated(tsNow);
        ucrBeanInDB.setUpdatedby(user.getId());

        // not stored in db since before, and is active
        // (new relations must be active to be created)
        if (isNew && Integer.valueOf(1).equals(fStatus)) {
          ucrBeanInDB.setUserid(userToEdit.getId());
          ucrBeanInDB.setTscreated(tsNow);
          ucrBeanInDB.setCreatedby(user.getId());
          ucrBeanInDB.setCentreid(fCentreId);
          ucrBeanInDB.create(con);
        }
        if (!isNew) {
          ucrBeanInDB.store(con);
        }
        // set groupId and status on users changed from nonUcr to ucr
        // on users new active centre ()
        if (setGroupToActiveCentre
            && fCentreId.equals(userToEdit.getCentreid())
            && null != fGroupId && null != fStatus) {
          setGroupToActiveCentre = false;
          userToEdit.setGroupid(fGroupId);
          userToEdit.setStatus(fStatus);
        }

        // if userToEdit has a group on this centre now
        // and user does not have relation to userToEdit on this centre
        // something is wrong, abuse
        if (null != UserRelation.retrieveGroupId(con, userToEdit,
            fCentreId)
            && !UserRelation.hasUserRelationToUserToEditOnCentre(
                con, user, userToEdit, fCentreId)) {
          abuseLog("updateData, before update", ucrBean.getUserid(),
              ucrBean.getCentreid(), ucrBean.getGroupid());
          rollback(con);
          return;
        }
      }
    }

    if (Integer.valueOf(0).equals(
        userGroups.get(userToEdit.getGroupid()).getUseucr())) {
      // if no ucr user remove all ucr beans.
      for (UsercentrerelBean ucr : UsercentrerelFinder.findByUserid(con, userToEdit.getId())) {
        ucr.remove(con);
      }
    } else {
      // ucrUser
      /**
       * check that the user is still active in relation to its current
       * centre, else move to an active relation<br/>
       * handle deactivated / activated ucr users
       *
       */
      boolean activeUcrExists = false;
      boolean changeCentre = false;
      String possibleActiveCentre = null;
      String currentGroupId = null;

      UsercentrerelBean ucrB = (UsercentrerelBean) UsercentrerelFinderBase
          .findByPrimaryKey(con, new UsercentrerelKey(userToEdit
              .getId(), userToEdit.getCentreid()));

      if (null == ucrB || !Integer.valueOf(1).equals(ucrB.getStatus())) {
        // not active
        for (UsercentrerelBean ucr : UsercentrerelFinder.findByUserid(con, userToEdit.getId())) {
View Full Code Here

  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
          .getId());
    } else {
      ucrBean = null;
View Full Code Here

      myself.setOwningcentre(myself.getCentreid());
    } else {
      // ucrUser
      UsercentrerelBean ucrBean = null;
      ucrBean = (UsercentrerelBean) UsercentrerelFinderBase
          .findByPrimaryKey(con, new UsercentrerelKey(myself.getId(),
              myself.getCentreid()));
      if (null == ucrBean
          || Integer.valueOf(0).equals(ucrBean.getStatus())) {
        abuseLog("updateData, no ucr relation to new centre or relation inactive ");
        myself = null;
View Full Code Here

TOP

Related Classes of org.openqreg.bean.UsercentrerelKey

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.