Package org.uengine.util.dao

Examples of org.uengine.util.dao.IDAO


        return pvv;
  }
 
  public boolean set(ProcessInstance instance, String scope, Serializable value) throws Exception {
    if("bpm_procinst".equalsIgnoreCase(getTableName()) && instance instanceof EJBProcessInstance){
      IDAO dao = ((EJBProcessInstance)instance).getProcessInstanceDAO();
      dao.set(getFieldName(), value);
      return true;
    }

    Object keyValue = ((EJBProcessInstance)instance).getProcessInstanceDAO().get(getCorrelatedFieldName());

    IDAO dao = (IDAO)instance.getProcessTransactionContext().getSharedContext("DAO." + getTableName() + (keyValue!=null ? "@" + keyValue : ""));
    if(dao==null){
      get(instance, scope);
      dao = (IDAO)instance.getProcessTransactionContext().getSharedContext("DAO." + getTableName() + (keyValue!=null ? "@" + keyValue : ""));
    }
   
    final boolean isExistingTuple;;
   
    if(dao==null){
      dao = ConnectiveDAO.createDAOImpl(instance.getProcessTransactionContext(), null, IDAO.class);
      instance.getProcessTransactionContext().setSharedContext("DAO." + getTableName() + (keyValue!=null ? "@" + keyValue : ""), dao);
     
      isExistingTuple = false;
           
    }else{
      isExistingTuple = true;
    }
   
    if(!dao.getImplementationObject().isAutoSQLGeneration()){ //'isAutoSQLGeneration()' was simply used for flagging whether a transaction listener has been attached.
      final IDAO finalDAO = dao;
      dao.set(getCorrelationFieldName(), ((EJBProcessInstance)instance).getProcessInstanceDAO().get(getCorrelatedFieldName()));
     
      instance.getProcessTransactionContext().addTransactionListener(new TransactionListener(){

        public void beforeCommit(TransactionContext tx) throws Exception {
          finalDAO.getImplementationObject().setTableName(getTableName());
          finalDAO.getImplementationObject().setSqlStmt(null);
          finalDAO.getImplementationObject().setAutoSQLGeneration(true);
          finalDAO.getImplementationObject().setKeyField(getCorrelationFieldName());
         
          if(isExistingTuple)
            finalDAO.getImplementationObject().update();
          else{
            //don't need to determine the existing tuple here since line 127 determines already.
/*            finalDAO.getImplementationObject().select();
           
            finalDAO.getImplementationObject().setSqlStmt(null);
           
            if(finalDAO.next()){
              finalDAO.getImplementationObject().update();
            }else{
*/ 
            finalDAO.getImplementationObject().insert();
//            }
          }
        }

        public void beforeRollback(TransactionContext tx) throws Exception {
View Full Code Here


          if(UEngineUtil.isNotEmpty(strategyIdInString)){
            Number strategyId = new Integer(strategyIdInString);
           
            ((EJBProcessInstance) instance).getProcessInstanceDAO().setStrategyId(strategyId);
   
            IDAO strategyDAO = instance.getProcessTransactionContext().findSynchronizedDAO("bpm_strtg", "strtgId", strategyId, IDAO.class);
            int instanceCnt = strategyDAO.getInt("instCnt");
            strategyDAO.set("instCnt", instanceCnt + 1);   // increase instance count
           
          }
        }
      }
    }
View Full Code Here

    throws Exception {
    // TODO Auto-generated method stub
   
    RoleMapping rm = RoleMapping.create();
   
    IDAO roleUser = null;
   
    if ( getRoleId() != null ) {
      if ( getGroupId() != null ){
        roleUser = GenericDAO.createDAOImpl(
            DefaultConnectionFactory.create(),
            "select R.EMPCODE from EMPTABLE E, PARTTABLE P, ROLEUSERTABLE R where E.ISDELETED='0' and P.PARTCODE = ?groupCode and E.PARTCODE=P.PARTCODE and R.ROLECODE = ?roleCode and R.EMPCODE = E.EMPCODE ",
            IDAO.class
        );
       
        roleUser.set("roleCode", getRoleId());
        roleUser.set("groupCode", getGroupId());
        roleUser.select();
      } else if ( getReferenceRole() != null && getReferenceRole().getMapping(instance) != null ) {
        roleUser = GenericDAO.createDAOImpl(
            DefaultConnectionFactory.create(),
            "select R.EMPCODE from EMPTABLE E, (select PARTCODE, EMPCODE from EMPTABLE where EMPCODE= ?empCode) T, ROLEUSERTABLE R where E.ISDELETED='0' and E.PARTCODE =  T.PARTCODE and R.ROLECODE = ?roleCode and R.EMPCODE = E.EMPCODE ",
            IDAO.class
        );
       
        roleUser.set("empCode", getReferenceRole().getMapping(instance).getEndpoint());
        roleUser.set("roleCode", getRoleId());
        roleUser.select();
      } else {
        roleUser = GenericDAO.createDAOImpl(
            DefaultConnectionFactory.create(),
            "select empCode from roleUserTable where roleCode = ?roleCode",
            IDAO.class
        );
       
        roleUser.set("roleCode", getRoleId());
        roleUser.select();
      }
    } else {
      if ( getGroupId() != null ){
        roleUser = GenericDAO.createDAOImpl(
            DefaultConnectionFactory.create(),
            "select EMPCODE from EMPTABLE where ISDELETED='0' and PARTCODE =  ?PARTCODE ",
            IDAO.class
        );
       
        roleUser.set("PARTCODE", getGroupId());
        roleUser.select();
      } else if ( getReferenceRole() != null && getReferenceRole().getMapping(instance) != null ) {
        roleUser = GenericDAO.createDAOImpl(
            DefaultConnectionFactory.create(),
            "select E.EMPCODE from EMPTABLE E, (select PARTCODE, EMPCODE from EMPTABLE where EMPCODE= ?empCode) T where E.ISDELETED='0' and E.PARTCODE =  T.PARTCODE",
            IDAO.class
        );
       
        roleUser.set("empCode", getReferenceRole().getMapping(instance).getEndpoint());
        roleUser.select();
      } else {
       
      }
    }
   
    if(roleUser != null)
    {
      while(roleUser.next()){
        String endpoint = roleUser.getString("empCode");
       
        rm.setEndpoint(endpoint);
        rm.fill(instance);
        rm.moveToAdd();
      }
View Full Code Here

    sql.append(" FROM EMPTABLE E ");
    sql.append(" LEFT JOIN PARTTABLE P ");
    sql.append(" ON E.PARTCODE   = P.PARTCODE ");
    sql.append(" WHERE E.EMPCODE = ?EMPCODE ");

    IDAO user = GenericDAO.createDAOImpl(
        DefaultConnectionFactory.create(),
        sql.toString(),
        IDAO.class
    );
   
    user.set("EMPCODE", getEndpoint());
    user.select();
   
    if (user.next()){
      String  PASSWORD   = user.getString("PASSWORD")==null?"RIP":user.getString("PASSWORD");
      String  EMPNAME    = user.getString("EMPNAME")==null?"":user.getString("EMPNAME");
      String  JIKNAME    = user.getString("JIKNAME")==null?"":user.getString("JIKNAME");
      String  EMAIL      = user.getString("EMAIL")==null?"":user.getString("EMAIL");
      String  PARTCODE   = user.getString("PARTCODE")==null?"":user.getString("PARTCODE");
      String  PARTNAME   = user.getString("PARTNAME")==null?"":user.getString("PARTNAME");
      String  NATEON     = user.getString("NATEON")==null?"":user.getString("NATEON");
      String  MSN      = user.getString("MSN")==null?"":user.getString("MSN");
      String  LOCALE     = user.getString("LOCALE")==null?"":user.getString("LOCALE");
      String  GLOBALCOM   = user.getString("GLOBALCOM")==null?"":user.getString("GLOBALCOM");
     
      setResourceName(EMPNAME);
      setEmailAddress(EMAIL);
      setTitle(JIKNAME);
      setGroupId(PARTCODE);
View Full Code Here

 
  private List<HashMap> getCommentList(){
    List<HashMap> commentList = new ArrayList<HashMap>();
   
    try {
      IDAO commentDAO = ConnectiveDAO.createDAOImpl(instance.getProcessTransactionContext().getConnectionFactory(),                            
        "select * from doc_comments where instance_id=?instanceId order by id",  
        IDAO.class);                      
      commentDAO.set("instanceId",instance.getInstanceId());
      commentDAO.select();
     
      int cnt = 0;
      while(commentDAO.next()){
        HashMap dmap = new HashMap();
        String apprStat = "SIGN_"+commentDAO.getString("OPT_TYPE").toUpperCase();
        String tracingTag = commentDAO.getString("tracingTag");
        String endpoint = commentDAO.getString("empno");
        String resourceName = commentDAO.getString("empname");

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String approveDate = sdf.format(commentDAO.getDate("created_date"));
       
        String title = commentDAO.getString("emptitle");
       
        if(HumanApprovalActivity.SIGN_REJECT.equals(apprStat) ){
          this.isRejectActivityIndex = cnt;
        }
       
        String stepName = commentDAO.getString("apprtitle");
        dmap.put("stepName",stepName);
        dmap.put("approveDate", notNull(approveDate));
        dmap.put("approveStep", apprStat);
        dmap.put("endpoint", endpoint);
        dmap.put("jikCheck", title);
View Full Code Here

 
  private List<HashMap> getCommentList(){
    List<HashMap> commentList = new ArrayList<HashMap>();
   
    try {
      IDAO commentDAO = ConnectiveDAO.createDAOImpl(instance.getProcessTransactionContext().getConnectionFactory(),                            
        "select * from doc_comments where instance_id=?instanceId order by id",  
        IDAO.class);                      
      commentDAO.set("instanceId",instance.getInstanceId());
      commentDAO.select();
     
      int cnt = 0;
      while(commentDAO.next()){
        HashMap dmap = new HashMap();
        String apprStat = "SIGN_"+commentDAO.getString("OPT_TYPE").toUpperCase();
        String tracingTag = commentDAO.getString("tracingTag");
        String endpoint = commentDAO.getString("empno");
        String resourceName = commentDAO.getString("empname");

        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        String approveDate = sdf.format(commentDAO.getDate("created_date"));
       
        String title = commentDAO.getString("emptitle");
       
        if(FormApprovalActivity.SIGN_REJECT.equals(apprStat) ){
          this.isRejectActivityIndex = cnt;
        }
       
        String stepName = commentDAO.getString("apprtitle");
        dmap.put("stepName",stepName);
        dmap.put("approveDate", notNull(approveDate));
        dmap.put("approveStep", apprStat);
        dmap.put("endpoint", endpoint);
        dmap.put("jikCheck", title);
View Full Code Here

TOP

Related Classes of org.uengine.util.dao.IDAO

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.