Examples of IDAO


Examples of com.l2client.dao.IDAO


public class DAOActionLoadCsvTest extends TestCase{
 
  public void testSelf() {
    final IDAO dao = CSVDatastoreDAO.get();
    dao.init();
//    InputController.getInstance().setInGameInputHandler(new InputHandler());
    BaseUsable[] ret = dao.loadAllActions();
    String name = dao.getNpcName(30370);
    assertTrue("Any actions returned", ret != null && ret.length > 0);
    assertNotNull(name);
    dao.finit();
  }
View Full Code Here

Examples of com.l2client.dao.IDAO


public class DAOActionLoadTest extends TestCase{
 
  public void testSelf() {
    final IDAO dao = DatastoreDAO.get();
    dao.init();
//    InputController.getInstance().setInGameInputHandler(new InputHandler());
    BaseUsable[] ret = dao.loadAllActions();
    dao.finit();
    assertTrue("Any actions returned", ret != null && ret.length > 0);

  }
View Full Code Here

Examples of org.uengine.util.dao.IDAO

   
    return new int[]{};
  }
 
  public static int getCurrnetRunningCount(TransactionContext tc,String defVerId,String tracingTag) throws Exception {
    IDAO dao = (IDAO)ConnectiveDAO.createDAOImpl(tc, currnetRunningCount_SQL, IDAO.class);
    dao.set("defVerId", defVerId);
    dao.set("tracingTag", tracingTag);
    dao.select();
    if(dao.next()){
      return ((Number)dao.get("CNT")).intValue();
    }
   
    return 0;
  }
View Full Code Here

Examples of org.uengine.util.dao.IDAO

  }
   
  protected Map retreiveTargetStartingPoints() throws Exception{
    Map targetKeys = new HashMap();
   
    IDAO targetKeysDAO = GenericDAO.createDAOImpl(getTargetConnectionFactory(), SQL_RETREIVETARGETSTARTINGPOINTS, IDAO.class);
    targetKeysDAO.select();
    if(targetKeysDAO.size() ==0) throw new UEngineException("Failed to retreive starting points from source server: No rows are returned.");
   
    while(targetKeysDAO.next()){
      Date recentModified = (Date)targetKeysDAO.get("recentModified");
      Number lastKey = (Number)targetKeysDAO.get("lastkey");
      String objectName = (String)targetKeysDAO.get("objectName");
     
      SychronizationStartingPoint startingPoint = new SychronizationStartingPoint();
     
      startingPoint.setKeyFieldName((String)targetKeysDAO.get("keyFieldName"));
      startingPoint.setObjectName((String)targetKeysDAO.get("objectName"));
     
      if(recentModified != null)
        startingPoint.setStartingPoint(recentModified);
      else
        startingPoint.setStartingPoint(lastKey);
View Full Code Here

Examples of org.uengine.util.dao.IDAO

    /**
     * Retreives the source data first.
     */
   
    IDAO sourceDAO = GenericDAO.createDAOImpl(getSourceConnectionFactory(), SQL_RETREIVE_SOURCE, IDAO.class);
    sourceDAO.set("key", startingKey);
    sourceDAO.select();
   
    AbstractGenericDAO implSourceDAO = (AbstractGenericDAO)sourceDAO.getImplementationObject();
   
    /**
     * Change the connection information of the source data in order to store to the target server.
     */
    ConnectionFactory targetConnectionFactoryInTransaction = new ConnectionFactory(){
      public Connection getConnection() throws Exception{       
        return targetConnectionInTransaction;
      }
    };
   
    implSourceDAO.setConnectionFactory(targetConnectionFactoryInTransaction);

    /**
     * Let the SQLs auto-generated again.
     */
    implSourceDAO.setConnective(true);
    implSourceDAO.setSqlStmt(null);
    implSourceDAO.setAutoSQLGeneration(true);
    implSourceDAO.setTableName(objectName);
    implSourceDAO.setKeyField(keyFieldName);
   
    /** Create and store the insert and update SQL in order to use them later
     * since we don't have to generate them again and again within the following while-loop.
     */   
    implSourceDAO.createInsertSql();
    String insertSql = implSourceDAO.getSqlStmt();
   
    implSourceDAO.createUpdateSql();
    String updateSql = implSourceDAO.getSqlStmt();
   
   
    /**
     * this loop will insert(if new) or update(if exist) all of the source rowset
     */   
    while(sourceDAO.next() && !stopSignaled){
      System.out.print("  . "+ keyFieldName +"=["+ sourceDAO.get(keyFieldName) + "]");

      // this will check if the source value already exists
      IDAO testDAO = ConnectiveDAO.createDAOImpl(targetConnectionFactoryInTransaction, "select 1 from " + objectName + " where " + keyFieldName +" = ?key", IDAO.class);
      testDAO.set("key", sourceDAO.get(keyFieldName));
      testDAO.select();

      if(testDAO.size() > 0){
        implSourceDAO.setSqlStmt(updateSql);
        System.out.println(" [UPDATE]" + sourceDAO);
      }else{
        implSourceDAO.setSqlStmt(insertSql);
        System.out.println(" [INSERT]" + sourceDAO);
View Full Code Here

Examples of org.uengine.util.dao.IDAO

 
  public void executeActivity(ProcessInstance instance) throws Exception{
   
    Connection con = null;

    IDAO dao = ConnectiveDAO.createDAOImpl(instance.getProcessTransactionContext(), null, IDAO.class);

    MappingContext mappingContext = getMappingContext();

    //Using DAO
/*    for(int i=0; i<mappingContext.getMappingElements().length; i++){
View Full Code Here

Examples of org.uengine.util.dao.IDAO

  public String getDBMSProductName() throws Exception {
    return "Oracle";
  }

  public Calendar getNow() throws Exception {
    IDAO nowQuery = (IDAO)create(IDAO.class, "SELECT TO_CHAR( SYSDATE , 'YYYYMMDDHH24MISS' ) as NOW from dual");
    nowQuery.select();
   
    if(nowQuery.next()){
      Calendar now = Calendar.getInstance();
     
      String dateTimeStr = (String)nowQuery.get("NOW");
      int year = Integer.parseInt(dateTimeStr.substring(0, 4));
      int month = Integer.parseInt(dateTimeStr.substring(4, 6)) - 1;
      int date = Integer.parseInt(dateTimeStr.substring(6, 8));
      int hour = Integer.parseInt(dateTimeStr.substring(8, 10));
      int min = Integer.parseInt(dateTimeStr.substring(10, 12));
View Full Code Here

Examples of org.uengine.util.dao.IDAO

          forColumnName = forColumnName.replaceFirst("Proc","");
         
          if(forWhat.equals("WorkList")) forColumnName = "taskid";

          Long key  = null;
          IDAO gdao = ConnectiveDAO.createDAOImpl(
              getConnectionFactory(),
              "select isNull(max(seq),0) + 1 as lastKey from bpm_seq where tbname = '" + forTableName + "'",
              IDAO.class
            );
            gdao.select();
            if(gdao.next()){
              Number currKey = (Number)gdao.get("lastKey");
            key = new Long(currKey.longValue());
            } else {
              key = new Long(1);
            }
           
          IDAO udao = ConnectiveDAO.createDAOImpl(
              getConnectionFactory(),
              //"update bpm_seq set seq = ?seq , moddate = current timestamp where  tbname = '" + forTableName + "'",
              "update bpm_seq set seq = ?seq , moddate = getdate() where  tbname = ?tbname",
              IDAO.class
            );
         
          udao.set("seq", key);
          udao.set("tbname", forTableName);
         
          int modcount = udao.update();
          if(modcount == 0){
            IDAO idao = ConnectiveDAO.createDAOImpl(
                getConnectionFactory(),
                "insert into bpm_seq (tbname, seq, description, moddate) values(?tbname, ?seq, ?description, getdate())",
                IDAO.class
              );
            idao.set("tbname", forTableName);
            idao.set("seq", key);
            idao.set("description", forTableName);
            idao.insert();         
          }
         
          return key;
         
        } catch (Exception e) {
View Full Code Here

Examples of org.uengine.util.dao.IDAO

    return "MSsql";
  }
 
  public Calendar getNow() throws Exception {
    //IDAO nowQuery = (IDAO)create(IDAO.class, "select convert(varchar(10), getdate(), 120) as now");
    IDAO nowQuery = (IDAO)create(IDAO.class, "select getdate() as now");
    nowQuery.select();
   
    if(nowQuery.next()){
      Calendar now = Calendar.getInstance();
      now.setTime((Date)nowQuery.get("now"));
     
      return now;
    }else{
      throw new Exception("Can't get current system date from DB.");
    }
View Full Code Here

Examples of org.uengine.util.dao.IDAO

      String sharedContextKey = tableName + "@" + keyFieldValue;
      sharedContextKey = sharedContextKey.toUpperCase();
     
      if(getSharedContext(sharedContextKey)!=null){
        IDAO cachedOne = (IDAO)getSharedContext(sharedContextKey);
       
        try{
          cachedOne.first();
        }catch(Exception e){}
       
        return cachedOne;
      }
     
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.