Package org.openqreg.bean

Examples of org.openqreg.bean.LanguageBean


   * Create a new language.
   *
   * @return language
   */
  public LanguageBean createLanguage() {
    return new LanguageBean();
  }
View Full Code Here


* @throws SQLException
*/
public static Collection<LanguageBean> findAll(Connection con) throws SQLException {
PreparedStatement pStmt = null;
ResultSet rs = null;
LanguageBean valueObject = null;
Collection<LanguageBean> col = Collections.synchronizedList(new ArrayList<LanguageBean>());
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;
LanguageBean valueObject = null;
LanguageKey primaryKey = (LanguageKey) key;
try{
pStmt = con.prepareStatement(LanguageBeanBase.SELECT_STATEMENT);
pStmt.setObject(1, primaryKey.getLanguageid());
rs = pStmt.executeQuery();
while (rs.next()){
valueObject = populate(rs);
valueObject.afterPopulate(con);
}
return valueObject;
}finally{
if(null!=rs){
rs.close();
View Full Code Here

* @return A populated LanguageBean
*
* @throws SQLException
*/
protected static LanguageBean populate(ResultSet rs) throws SQLException {
LanguageBean valueObject = new LanguageBean();
valueObject.setLanguageid((String)rs.getObject(1));
valueObject.setStatus((Integer)rs.getObject(2));
valueObject.setCreatedby((String)rs.getObject(3));
valueObject.setTscreated((java.sql.Timestamp)rs.getObject(4));
valueObject.setUpdatedby((String)rs.getObject(5));
valueObject.setTsupdated((java.sql.Timestamp)rs.getObject(6));
return valueObject;
}
View Full Code Here

 

  public static CountryBean getCountry(String countryid) throws SQLException{
   
    Collection<LanguageBean> languages = LanguageFinderBase.findAll();
    LanguageBean language = languages.iterator().next();
   
    CountryBean testCountry = new CountryBean();
    testCountry.setId(countryid);
    testCountry.setPatientidstyle(new Integer(1));
    testCountry.setStatus(new Integer(Status.ACTIVE));
    testCountry.setDefaultlanguageid(language.getLanguageid());
    testCountry.setTimezone(TimeZone.getDefault().getDisplayName());
    testCountry.setCreatedby("System");
    testCountry.setTscreated(new Timestamp(System.currentTimeMillis()));
    testCountry.setUpdatedby("System");
    testCountry.setTsupdated(new Timestamp(System.currentTimeMillis()));
View Full Code Here

   
    return testCountry;
  }
 
  public static LanguageBean getLanguage(String languageid){
    LanguageBean testLanguage = new LanguageBean();
    testLanguage.setLanguageid(languageid);
    testLanguage.setStatus(new Integer(Status.ACTIVE));
    testLanguage.setCreatedby("System");
    testLanguage.setTscreated(new Timestamp(System.currentTimeMillis()));
    testLanguage.setUpdatedby("System");
    testLanguage.setTsupdated(new Timestamp(System.currentTimeMillis()));   
   
    return testLanguage;
  }
View Full Code Here

  }
 
  public static UserBean getUser(long id) throws SQLException{
   
    Collection<LanguageBean> languages = LanguageFinderBase.findAll();
    LanguageBean language = languages.iterator().next();
   
    Collection<UsergroupBean> usergroups = UsergroupFinderBase.findAll();
    UsergroupBean usergroup = usergroups.iterator().next();
   
    Collection<CentreBean> centres = CentreFinderBase.findAll();
    CentreBean centre = centres.iterator().next();
   
    String userid = "JUnit@"+ id +"@"+ System.currentTimeMillis();
    UserBean testUser = new UserBean();
    testUser.setId(userid);
    testUser.setLanguageid(language.getLanguageid());
    testUser.setGroupid(usergroup.getId());
    testUser.setCentreid(centre.getId());
   
    return testUser;
  }
View Full Code Here

  protected String getLanguages(){
    StringBuffer out = new StringBuffer();
    try {

      LanguageBean langBean = null;

      Collection<LanguageBean> col = null;
      col = LanguageFinderBase.findAll();
      Iterator<LanguageBean> it = col.iterator();

      out.append(toXML("totalno", "x"));
      out.append("<status>");
      out.append("OK");
      out.append("</status>\n");
      out.append("<step>");
      out.append("GETLANGUAGES");
      out.append("</step>\n");
      out.append("<languages>\n");

      while (it.hasNext()) {
        langBean = it.next();
        out.append("<lang>\n");
        out.append(toXML("id", langBean.getLanguageid()));
        out.append(
            toXML("text", langBean.getStatus().toString()));
        out.append(
            toXML("tscreated", langBean.getTscreated().toString()
                .substring(0, 16)));
        if (null != langBean.getTsupdated()) {
          out.append(
              toXML("tsupdated", langBean.getTsupdated()
                  .toString().substring(0, 16)));
        } else {
          out.append(toXML("tsupdated", ""));
        }
        out.append(
            toXML("createdby", langBean.getCreatedby()));
        out.append(
            toXML("updatedby", langBean.getUpdatedby()));
        out.append("</lang>\n");

      }
      out.append("</languages>\n");
    } catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.openqreg.bean.LanguageBean

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.