Package org.openqreg.bean

Examples of org.openqreg.bean.SearchlogBean


* @return A populated SearchlogBean
*
* @throws SQLException
*/
protected static SearchlogBean populate(ResultSet rs) throws SQLException {
SearchlogBean valueObject = new SearchlogBean();
valueObject.setId((Long)rs.getObject(1));
valueObject.setUserid((String)rs.getObject(2));
valueObject.setCentreid((String)rs.getObject(3));
valueObject.setContext((String)rs.getObject(4));
valueObject.setStep((String)rs.getObject(5));
valueObject.setSearchinfo((String)rs.getObject(6));
valueObject.setTscreated((java.sql.Timestamp)rs.getObject(7));
return valueObject;
}
View Full Code Here


* @throws SQLException
*/
public static Collection<SearchlogBean> findAll(Connection con) throws SQLException {
PreparedStatement pStmt = null;
ResultSet rs = null;
SearchlogBean valueObject = null;
Collection<SearchlogBean> col = Collections.synchronizedList(new ArrayList<SearchlogBean>());
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;
SearchlogBean valueObject = null;
SearchlogKey primaryKey = (SearchlogKey) key;
try{
pStmt = con.prepareStatement(SearchlogBeanBase.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

   
  }
 
  public static SearchlogBean logToSearchLog(User user, String searchString, String context, String STEP) {
    try {
      SearchlogBean searchlogBean = new SearchlogBean();
      searchlogBean.setSearchinfo(searchString);
      searchlogBean.setUserid(user.getId());
      searchlogBean.setCentreid(user.getCentreid());
      searchlogBean.setContext(context);
      searchlogBean.setStep(STEP);
      searchlogBean.create();
      return searchlogBean;
    }catch (SQLException sqle) {
      log.log(Level.ERROR, "Error in creating search log", sqle);
    }
    return null;
View Full Code Here

    }
  }

  protected void searchData() {
   
    SearchlogBean searchlogBean = null;
    if(searchStringToLog != null && searchStringToLog.length() > 0) {
      searchlogBean = logToSearchLog(searchStringToLog.toString(),
          this.getClass().getSimpleName(), step);
    }
   
    Collection<Object> tempCol = Collections.synchronizedList(new ArrayList<Object>());
    try {
    //-1 is because we don't want a limit 
    col = PatientlogviewFinder.searchLog(user,-1, ssn,
        loggedUserid, user.getCentreid(), loggedContext,
        loggedStep, loggedIntervalFrom, loggedIntervalTo);
   
    //if only userid and no ssn, show only one hit for each patient 
    if (loggedUserid == null && ssn != null) {
      //if only ssn remove all duplicate users
     
      for(Iterator<Patientlogview> it = col.iterator(); it.hasNext();) {
        Patientlogview logview =  it.next();
        if(tempCol.contains(logview.getUserid())) {
          it.remove();
        }else {
          tempCol.add(logview.getUserid());
        }
      }
      //if only ssn and no userid, show only one hit for each user 
    } else if (loggedUserid != null && ssn == null) {
     
      for(Iterator<Patientlogview> it = col.iterator(); it.hasNext();) {
        Patientlogview logview =  it.next();
        if(tempCol.contains(logview.getPid())) {
          it.remove();
        }else {
          tempCol.add(logview.getPid());
        }
      }
    }
   
    //get the patientid once for each patient
   
    Collection<Long> onlyPid = Collections.synchronizedList(new ArrayList<Long>());
    for(Patientlogview searchedPatient : col) {
      if(!onlyPid.contains(searchedPatient.getPid())) {
        onlyPid.add(searchedPatient.getPid());
      }
    }
   
    //results are stored in the patientlog, once for each patient
    if (null != onlyPid && disp.isPatientlogLogPatientlists()) {
      for(Long pidToStore : onlyPid) {
        logToPatientLog(pidToStore, this.getClass().getSimpleName(), step,
          searchlogBean != null ? searchlogBean.getId() : null);
      }
    }
    if (loggedUserid != null) {
      // Search for spec. user committed, get User from DB
      loggedUser = (UserBean) UserFinderBase.findByPrimaryKey(
View Full Code Here

TOP

Related Classes of org.openqreg.bean.SearchlogBean

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.