Package com.defaultcompany.external.activities

Examples of com.defaultcompany.external.activities.ExternalApprovalActivity


          approver.setEndDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
          approver.setComment(psMsg.getComment());
          approvalActs.add(draftAct);
          continue;
        }
        ExternalApprovalActivity childAct = (ExternalApprovalActivity) draftAct.clone();
        childAct.setName("결재");
        childAct.setTracingTag(null);
        childAct.setRole(null);
        childAct.setApprovalTypeByString(approver.getType());
       
        RoleMapping rm = RoleMapping.create();
        rm.setEndpoint(approver.getEmpCode());
        rm.fill(instance);
       
        // 결재 -> 합의
        if (!ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          AllActivity allAct = new AllActivity();
          allAct.setTracingTag(null);
         
          parent.addChildActivity(allAct);
          parent = allAct;
        // 합의 -> 결재
        } else if (ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && !ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          parent = (ComplexActivity) approvalLineAct;
        }
       
        parent.addChildActivity(childAct);
        childAct.setApprover(instance, rm);
       
        approver.setTracingTag(childAct.getTracingTag());
       
        preApprovalType = approver.getType();
        approvalActs.add(childAct);
      }
     
View Full Code Here


        approver.setStatus(ExternalApprovalActivity.SIGN_DRAFT);
        approver.setEndDate(new Timestamp(Calendar.getInstance().getTimeInMillis()));
        approver.setComment(adacMsg.getComment());
        continue;
      }
      ExternalApprovalActivity childAct = (ExternalApprovalActivity) draftAct.clone();
      childAct.setName("결재");
      childAct.setTracingTag(null);
      childAct.setRole(null);
      childAct.setApprovalTypeByString(approver.getType());
     
      RoleMapping rm = RoleMapping.create();
      rm.setEndpoint(approver.getEmpCode());
      rm.fill(instance);
     
      // 결재 -> 합의
      if (!ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
        AllActivity allAct = new AllActivity();
        allAct.setTracingTag(null);
       
        parent.addChildActivity(allAct);
        parent = allAct;
      // 합의 -> 결재
      } else if (ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && !ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
        parent = (ComplexActivity) approvalLineAct;
      }
     
      parent.addChildActivity(childAct);
      childAct.setApprover(instance, rm);
     
      approver.setTracingTag(childAct.getTracingTag());
     
      preApprovalType = approver.getType();
    }
   
    pm.changeProcessDefinition(adacMsg.getInstanceId(), tempPd);
View Full Code Here

    approvalLineDAO.update(approvalLine);
   
    // 승인
    if (ExternalApprovalActivity.SIGN_APPROVED.equalsIgnoreCase(aacMsg.getApprovalStatus())) {
     
      ExternalApprovalActivity approvalAct = (ExternalApprovalActivity) instance.getProcessDefinition().getActivity(aacMsg.getTracingTag());
      approvalAct.setApprovalStatus(instance, ExternalApprovalActivity.SIGN_APPROVED);
     
      pm.completeWorkitem(aacMsg.getInstanceId(), aacMsg.getTracingTag(), aacMsg.getTaskId(), new org.uengine.kernel.ResultPayload());
     
    // 반려
    } else if (ExternalApprovalActivity.SIGN_REJECT.equalsIgnoreCase(aacMsg.getApprovalStatus())) {
     
      ExternalApprovalActivity approvalAct = (ExternalApprovalActivity) instance.getProcessDefinition().getActivity(aacMsg.getTracingTag());
      approvalAct.setApprovalStatus(instance, ExternalApprovalActivity.SIGN_REJECT);
     
      instance.getWorkList().completeWorkItem(aacMsg.getTaskId(), new KeyedParameter[]{}, instance.getProcessTransactionContext());
     
      //반려시에는 ExternalApprovalActivity 의 afterComplete 를 타지 않는다.(바로 윗줄에 보면 worklist 테이블만 update 시킨다.) 따라서 수동 update
      Calendar endTime = GlobalContext.getNow(instance.getProcessTransactionContext());
     
      ApproverDAO approverDAO = new ApproverDAO(DefaultConnectionFactory.create().getDataSource());
      Approver approver = approverDAO.getByInstanceIdAndTracingTag(aacMsg.getApprovalKey(), Integer.parseInt(instance.getInstanceId()), aacMsg.getTracingTag());
      approver.setTruthEmpCode(aacMsg.getEndpoint());
      approver.setTaskId(approvalAct.getTaskIds(instance)[0]);
      approver.setStatus(ExternalApprovalActivity.SIGN_REJECT);
      approver.setEndDate(new Timestamp(endTime.getTimeInMillis()));
      approver.setComment(aacMsg.getComment());
      approverDAO.update(approver);
     
     
      //반려 로직
      ExternalApprovalLineActivity approvalLineAct = approvalAct.getApprovalLineActivity();
      int rejectOption = approvalLineAct.getRejectOption();
     
      // 기안 단계로 반려
      if (rejectOption == ExternalApprovalLineActivity.LOOPING_OPTION_BACK_TO_DRAFT) {
        approvalLineAct.getDraftActivity().compensateToThis(instance);
       
        // 결재 DB update
        List<Approver> _approverList = approverDAO.list(aacMsg.getApprovalKey());
        int version = _approverList.get(0).getVersion() + 1;
        for (int i = 0; i < _approverList.size(); i++) {
          Approver _approver = _approverList.get(i);
          _approver.setVersion(version);
          _approver.setComment(null);
          _approver.setEndDate(null);
          _approver.setTruthEmpCode(null);
          _approver.setStatus(null);
         
          if (i > 0) {
            _approver.setTracingTag(null);
            _approver.setTaskId(null);
          }
        }
        approvalLine.setVersion(version);
        approvalLineDAO.update(approvalLine);
        approverDAO.add(_approverList);
     
      // 바로 이전 결재로 반려
      } else if (rejectOption == ExternalApprovalLineActivity.LOOPING_OPTION_BACK_TO_PREV) {
        Vector<? extends Activity> childActs = approvalLineAct.getChildActivities();
        Activity currentAct = instance.getProcessDefinition().getActivity(aacMsg.getTracingTag());
        int prevIndex = 0;
        if (currentAct.getParentActivity() instanceof AllActivity) {
          prevIndex = childActs.indexOf(currentAct.getParentActivity()) - 1
        } else {
          prevIndex = childActs.indexOf(approvalAct) - 1;
        }
       
        Activity prevAct = childActs.get(prevIndex);
       
        Approver prevApprover = approverDAO.getByInstanceIdAndTracingTag(aacMsg.getApprovalKey(), Integer.parseInt(instance.getInstanceId()), prevAct.getTracingTag());
       
        prevAct.compensateToThis(instance);
       
        // ExternalApprovalActivity 의 afterExecute() 를 타기 때문에 강제로 다시 update
        approverDAO.update(prevApprover);
       
       
        // 결재 DB update
        List<Approver> _approverList = approverDAO.list(aacMsg.getApprovalKey());
        int version = _approverList.get(0).getVersion() + 1;
        for (int i = 0; i < _approverList.size(); i++) {
          Approver _approver = _approverList.get(i);
          _approver.setVersion(version);
         
          if ( aacMsg.getTracingTag().equalsIgnoreCase(_approver.getTracingTag()) &&
              _approver.getTaskId().equalsIgnoreCase(aacMsg.getTaskId()) ) {
           
            // 현재 결재자
            _approver.setComment(null);
            _approver.setEndDate(null);
            _approver.setTruthEmpCode(null);
            _approver.setStatus(null);
            _approver.setTaskId(null);
           
            // 이전 결재자
            Approver _prevApprover = _approverList.get(i - 1);
            _prevApprover.setComment(null);
            _prevApprover.setEndDate(null);
            _prevApprover.setTruthEmpCode(null);
            _prevApprover.setStatus(null);
           
          }
        }
        approvalLine.setVersion(version);
        approvalLineDAO.update(approvalLine);
        approverDAO.add(_approverList);
     
      // 플래그로 반려
      } else if (rejectOption == ExternalApprovalLineActivity.LOOPING_OPTION_BACK_TO_FLAG) {
        BackActivity backActivity = new BackActivity();
        backActivity.setTargetSource(BackActivity.Flag);
        backActivity.setFlag(approvalLineAct.getFlag());
        backActivity.executeActivity(instance);
       
      // 결재선 종료
      } else if (rejectOption == ExternalApprovalLineActivity.LOOPING_OPTION_FINISH) {
        approvalAct.setEndTime(instance, endTime);
        approvalAct.getApprovalLineActivity().fireComplete(instance);
       
      }
     
   
    // 전결
    } else if (ExternalApprovalActivity.SIGN_ARBITRARY_APPROVED.equalsIgnoreCase(aacMsg.getApprovalStatus())) {
     
      ExternalApprovalActivity approvalAct = (ExternalApprovalActivity) instance.getProcessDefinition().getActivity(aacMsg.getTracingTag());
      approvalAct.setApprovalStatus(instance, ExternalApprovalActivity.SIGN_ARBITRARY_APPROVED);
     
      String taskId = approvalAct.getTaskIds(instance)[0];
      Calendar endTime = GlobalContext.getNow(instance.getProcessTransactionContext());
      instance.getWorkList().completeWorkItem(taskId, new KeyedParameter[]{}, instance.getProcessTransactionContext());
      approvalAct.setEndTime(instance, endTime);

      //전결시에는 NavienApprovalActivity 의 afterComplete 를 타지 않는다.(바로 윗줄에 보면 worklist 테이블만 update 시킨다.) 따라서 수동 update
      ApproverDAO approverDAO = new ApproverDAO(DefaultConnectionFactory.create().getDataSource());
      Approver approver = approverDAO.getByInstanceIdAndTracingTag(aacMsg.getApprovalKey(), Integer.parseInt(instance.getInstanceId()), aacMsg.getTracingTag());
      approver.setTruthEmpCode(aacMsg.getEndpoint());
      approver.setTaskId(taskId);
      approver.setStatus(ExternalApprovalActivity.SIGN_ARBITRARY_APPROVED);
      approver.setEndDate(new Timestamp(endTime.getTimeInMillis()));
      approver.setComment(aacMsg.getComment());
      approverDAO.update(approver);
     
      approvalAct.getApprovalLineActivity().fireComplete(instance);
     
    }   
   
  }
View Full Code Here

    if (readyIndex > 0) {
      String preApprovalType = null;
      for (int i = readyIndex; i < approverList.size(); i++) {
        Approver approver = approverList.get(i);
       
        ExternalApprovalActivity childAct = (ExternalApprovalActivity) draftAct.clone();
        childAct.setName("결재");
        childAct.setTracingTag(null);
        childAct.setRole(null);
        childAct.setApprovalTypeByString(approver.getType());
       
        RoleMapping rm = RoleMapping.create();
        rm.setEndpoint(approver.getEmpCode());
        rm.fill(instance);
       
        // 결재 -> 합의
        if (!ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          AllActivity allAct = new AllActivity();
          allAct.setTracingTag(null);
         
          parent.addChildActivity(allAct);
          parent = allAct;
        // 합의 -> 결재
        } else if (ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(preApprovalType) && !ExternalApprovalActivity.APPROVAL_TYPE_COOPERATION.equals(approver.getType())) {
          parent = (ComplexActivity) approvalLineAct;
        }
       
        parent.addChildActivity(childAct);
        childAct.setApprover(instance, rm);
       
        approver.setTracingTag(childAct.getTracingTag());
       
        preApprovalType = approver.getType();
      }
     
      pm.changeProcessDefinition(alcMsg.getInstanceId(), tempPd);
View Full Code Here

TOP

Related Classes of com.defaultcompany.external.activities.ExternalApprovalActivity

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.