Package org.openqreg.bean

Examples of org.openqreg.bean.UsergroupBean


* @throws SQLException
*/
public static Collection<UsergroupBean> findAll(Connection con) throws SQLException {
PreparedStatement pStmt = null;
ResultSet rs = null;
UsergroupBean valueObject = null;
Collection<UsergroupBean> col = Collections.synchronizedList(new ArrayList<UsergroupBean>());
try{
pStmt = con.prepareStatement(FIND_ALL_STATEMENT);
rs = pStmt.executeQuery();
while (rs.next()){
valueObject = populate(rs);
valueObject.afterPopulate(con);
col.add(valueObject);
}
return col;
}finally{
if(null!=rs){
View Full Code Here


* @throws SQLException
*/
public static Object findByPrimaryKey(Connection con, PrimaryKey key) throws SQLException {
PreparedStatement pStmt = null;
ResultSet rs = null;
UsergroupBean valueObject = null;
UsergroupKey primaryKey = (UsergroupKey) key;
try{
pStmt = con.prepareStatement(UsergroupBeanBase.SELECT_STATEMENT);
pStmt.setObject(1, primaryKey.getId());
rs = pStmt.executeQuery();
while (rs.next()){
valueObject = populate(rs);
valueObject.afterPopulate(con);
}
return valueObject;
}finally{
if(null!=rs){
rs.close();
View Full Code Here

      uga.setStatus(AjaxWidgetAnswer.STATUS_NOSERVICE);
      return uga;
    }
    User user = Dispatcher.getInstance().getUser(userId);
    // we have access carry on...
    UsergroupBean userGroupBean = ugr.getUserGroup();
    Collection<String> groupRelations = ugr.getGroupRelations();
    uga.setUserGroup(userGroupBean);
    Connection con = null;
    try {
      try {
        //add default answer text, listboxtexts, guisettings, containers
        addDefaultAnswer(user, ugr, uga);
       
        con = DbHandler.getConnection();
        con.setAutoCommit(false);
        userGroupBean.setUpdatedby(userId);
        userGroupBean.setTsupdated(new Timestamp(System
            .currentTimeMillis()));
        userGroupBean.store(con);

        // userGroup groups
        Collection<GrouprelationBean> col = GrouprelationFinder
            .findByUsergroupid(con, userGroupBean.getId());
        // loop exsisting groupRelations update or remove based on status
        for (GrouprelationBean sBean : col) {
          if (!groupRelations.contains(sBean.getRelatestoid())) {
            sBean.remove(con);
            groupRelations.remove(sBean.getRelatestoid());
          } else {
            groupRelations.remove(sBean.getRelatestoid());
          }
        }
        // loop remaining groupRelations and create them
        for (String ugId : groupRelations) {
          GrouprelationBean sBean = new GrouprelationBean();
          sBean.setCreatedby(userId);
          sBean.setUsergroupid(userGroupBean.getId());
          sBean.setRelatestoid(ugId);
          sBean.setStatus(Integer.valueOf(1));
          sBean.setTscreated(new Timestamp(System.currentTimeMillis()));
          sBean.create(con);
        }
View Full Code Here

TOP

Related Classes of org.openqreg.bean.UsergroupBean

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.