Examples of CentreKey


Examples of org.openqreg.bean.CentreKey

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

Examples of org.openqreg.bean.CentreKey

     * OR must have ADMINUSER_COUNTRY
     */

    try {
      CentreBean userCentre = (CentreBean) CentreFinderBase
          .findByPrimaryKey(new CentreKey(user.getCentreid()));
      CentreBean userToEditCentre = (CentreBean) CentreFinderBase
          .findByPrimaryKey(new CentreKey(userToEdit.getCentreid()));

      if (user.getCentreid().equals(userToEdit.getCentreid())
          || (disp.checkAccess(user.getId(), "ADMINUSER_CENTRE") && userCentre
              .getId().equals(userToEditCentre.getId()))
          || disp.checkAccess(user.getId(), "ADMINUSER_COUNTRY")
View Full Code Here

Examples of org.openqreg.bean.CentreKey

     * must be on the same centre as the one we are looking at<br/>
     * OR have ADMINMYSELF_CENTRE AND be in the same country<br/>
     * OR must have ADMINMYSELF_COUNTRY
     */
    CentreBean userCentre = (CentreBean) CentreFinderBase.findByPrimaryKey(
        con, new CentreKey(user.getCentreid()));
    CentreBean centre = (CentreBean) CentreFinderBase.findByPrimaryKey(con,
        new CentreKey(centreId));

    if (user.getCentreid().equals(centreId)
        || (Dispatcher.getInstance().checkGroupAccess(
            user.getGroupid(), "ADMINMYSELF_CENTREID") && userCentre
            .getCountryid().equals(centre.getCountryid()))
View Full Code Here

Examples of org.openqreg.bean.CentreKey

      return col;
    }
    String countId = countryId;
    if (null == countryId) {
      countId = ((CentreBean) CentreFinderBase.findByPrimaryKey(con,
          new CentreKey(user.getCentreid()))).getCountryid();
    }
    // Limit search if not superuser (SYSTEM, CC)
    if (isUcrUser(con, user)) {
      CentreBean centre = null;
      // get a collection of all ucrBeans for user, (all centres user
      // can be on)
      Collection<UsercentrerelBean> colUserCentres = UsercentrerelFinder
          .findByUseridPartOfCentrename(con, user.getId(),
              partOfCentrename);
      // loop ucrBeans check relation on each centre
      for (UsercentrerelBean ucrBean : colUserCentres) {
        if (null == ucrStatus || ucrStatus.equals(ucrBean.getStatus())) {
          centre = (CentreBean) CentreFinderBase.findByPrimaryKey(
              con, new CentreKey(ucrBean.getCentreid()));
          // if centre is active, add to collection
          if (null == centreStatus
              || centreStatus.equals(centre.getStatus())) {
            col.add(centre);
          }
View Full Code Here

Examples of org.openqreg.bean.CentreKey

      return retrieveCentreListForACountry(con, user, centreStatus,
          ucrStatus, null, null);
    }

    String countId = ((CentreBean) CentreFinderBase.findByPrimaryKey(con,
        new CentreKey(userToEdit.getCentreid()))).getCountryid();

    /**
     * if userToEdit exists AND user is superuser<br/>
     * return users centrelist for userToEdits country
     */
 
View Full Code Here

Examples of org.openqreg.bean.CentreKey

     * must be on the same centre as the one we are looking at<br/>
     * OR have ADMINMYSELF_CENTRE AND be in the same country<br/>
     * OR must have ADMINMYSELF_COUNTRY
     */
    CentreBean userCentre = (CentreBean) CentreFinderBase.findByPrimaryKey(
        con, new CentreKey(user.getCentreid()));
    CentreBean centre = (CentreBean) CentreFinderBase.findByPrimaryKey(con,
        new CentreKey(centreId));

    if (user.getCentreid().equals(centreId)
        || (Dispatcher.getInstance().checkGroupAccess(
            user.getGroupid(), "ADMINMYSELF_CENTREID") && userCentre
            .getCountryid().equals(centre.getCountryid()))
View Full Code Here

Examples of org.openqreg.bean.CentreKey

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

Examples of org.openqreg.bean.CentreKey

      con.setAutoCommit(false);
      centre1.create(con);
      centre1.setStatus(new Integer(Status.INACTIVE));
      centre1.store(con);

      CentreBean centre2 = (CentreBean) CentreFinderBase.findByPrimaryKey(con, new CentreKey(centre1.getId()));
      assertEquals("Centren skall vara lika", centre1, centre2);
      assertEquals("Centren skall ha samma status", centre1.getStatus(), centre2.getStatus());

      centre1.remove(con);
      centre2 = (CentreBean) CentreFinderBase.findByPrimaryKey(con, new CentreKey(centre1.getId()));
      assertNull("Ingen tr�ff f�rv�ntad", centre2);
      con.rollback();
      con.close();
     
    } catch (SQLException e) {
View Full Code Here

Examples of org.openqreg.bean.CentreKey

      //Spara och ladda attribut
      CentreBean centre1 = BeanFactory.getCentre(Thread.currentThread().getId());
      centre1.setAttribute("name1", "value1");
      centre1.create(con);
      CentreBean centre2 = (CentreBean)CentreFinderBase.findByPrimaryKey(con, new CentreKey(centre1.getId()));
      assertEquals("Centrena skall vara lika", centre1, centre2);
      assertEquals("Attributen skall vara lika", centre1.getAttribute("name1"), centre2.getAttribute("name1"));
     
      //Radera attribut
      centre2.removeAttribute("name1");
      assertNull("Attributet skall inte finnas", centre2.getAttribute("name1"));
      centre2.store(con);
      centre1 = (CentreBean)CentreFinderBase.findByPrimaryKey(con, new CentreKey(centre2.getId()));
      assertNull("Attributet skall inte finnas", centre2.getAttribute("name1"));

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

Examples of org.openqreg.bean.CentreKey

      if (null == ucrB || !Integer.valueOf(1).equals(ucrB.getStatus())) {
        // not active
        for (UsercentrerelBean ucr : UsercentrerelFinder.findByUserid(con, userToEdit.getId())) {
          if (Integer.valueOf(1).equals(ucr.getStatus())) {
            CentreBean cb = (CentreBean) CentreFinderBase
                .findByPrimaryKey(new CentreKey(ucr
                    .getCentreid()));
            if (cb.getStatus().equals(Integer.valueOf(1))) {
              activeUcrExists = true;
              possibleActiveCentre = ucr.getCentreid();
              currentGroupId = ucr.getGroupid();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.