Package com.google.code.lightssh.common

Examples of com.google.code.lightssh.common.ApplicationException


   * @param procInstId 流程实例ID
   * @param operator 操作人
   */
  public void claimAndComplete(String procInstId,String operator){
    if( StringUtils.isEmpty(operator) )
      throw new ApplicationException("操作人不能为空!");
   
    Task task = this.getCurrentTask( procInstId );
   
    if( task == null )
      throw new ApplicationException("无法获取活动的任务[流程实例ID="+procInstId+"]");
   
    taskService.claim( task.getId(), operator );
    taskService.complete(task.getId());
  }
View Full Code Here


   * 变更认领人
   */
  public void changeAssignee( String taskId,String userId ){
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+taskId+"]不存在!");
   
    taskService.setAssignee(taskId, userId);
  }
View Full Code Here

   * 添加会签人
   */
  @Deprecated
  public void addAssignee( String taskId,List<String> userIds ){
    if( userIds == null || userIds.isEmpty() )
      throw new ApplicationException("添加的会签人不能为空!");
   
    Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+taskId+"]不存在!");
   
    if( StringUtils.isNotEmpty(task.getParentTaskId()) )
      throw new ApplicationException("任务["+task.getName()+"]已是会签任务!");
   
    //taskService.
   
    for( String user:userIds ){
      TaskEntity newTask = (TaskEntity) taskService.newTask(); //TODO 更改ID规则
View Full Code Here

  /**
   * 完成任务
   */
  public void complete( MyTask myTask,String user ){
    if( myTask == null || StringUtils.isEmpty(user) )
      throw new ApplicationException("参数为空!");
   
    String taskId = myTask.getId();
    if( StringUtils.isEmpty(taskId) )
      throw new ApplicationException("任务编号不能为空!");
   
    ExecutionType type = myTask.getType();
    if( type == null )
      throw new ApplicationException("任务操作类型不能为空!");
   
    String message = myTask.getMessage();
    if( StringUtils.isEmpty(message)  )
      throw new ApplicationException("流转意见不能为空!");
   
    Task task = taskService.createTaskQuery().taskId(myTask.getId()).singleResult();
    if( task == null )
      throw new ApplicationException("任务["+myTask.getId()+"]不存在!");
   
    //task.getParentTaskId();
    //identityService.setAuthenticatedUserId( user );
   
    //保存操作日志
View Full Code Here

     */ 
    protected void turnTransition(ExecutionType type,String user,Task task
        ,HistoricTaskInstance histTask, Map<String, Object> variables){ 
     
    if( task == null || !(task instanceof TaskEntity))
      throw new ApplicationException("当前任务为空或类型不正确!");
   
        // 当前节点 
        ActivityImpl currActivity = getActivityImpl(task, null)
        // 清空当前流向 
        List<PvmTransition> oriPvmTransitionList = clearTransition(currActivity)
View Full Code Here

  public void undoTask( String procInstId,String user){
   
    List<Task> activeTasks = taskService.createTaskQuery()
        .processInstanceId(procInstId).active().list();
    if( activeTasks == null || activeTasks.size() != 1 )
      throw new ApplicationException("流程活动任务不存在或存在多个,无法回退!");
   
    Task task = activeTasks.get(0); //当前任务节点
    if( task == null )
      throw new ApplicationException("无法获取当前任务,无法回退!");
   
    List<HistoricTaskInstance> histTaskList = historyService
        .createHistoricTaskInstanceQuery().finished()
        .orderByHistoricTaskInstanceEndTime().desc()
        .listPage(0, 1);
    HistoricTaskInstance histTask = (histTaskList==null
        ||histTaskList.isEmpty())?null:histTaskList.get(0);
   
    if( histTask == null )
      throw new ApplicationException("历史任务不存在,无法回退!");
   
    if( histTask.getAssignee() == null || !histTask.getAssignee().equals(user) )
      throw new ApplicationException("其它操作用户已完成了新任务,无法回退!");
   
    //流程转向
    turnTransition(ExecutionType.FALLBACK,user,task,histTask,null);
  }
View Full Code Here

   * @param taskId 任务ID
   * @param users 会签用户
   */
  public void countersignTask(String operator,String taskId,String[] users){
    if( StringUtils.isEmpty(taskId) )
      throw new ApplicationException("会签任务ID不能为空!");
   
    if( users == null )
      throw new ApplicationException("会签用户不能为空!");
   
    Task task = getTask(taskId);
    if( task == null )
      throw new ApplicationException("任务ID["+taskId+"]不存在!");
   
    if( StringUtils.isEmpty(operator) ){
      operator = task.getAssignee();
      log.warn("会签操作人为空,使用任务签收人[{}]",task.getAssignee());
    }
   
    StringBuffer message = new StringBuffer("添加会签人[");
    int i = 0;
   
    //对用户不能重复添加会签
    List<Task> subTasks = taskService.getSubTasks(taskId); //子任务
    Map<String,Task> subTaskMap = new HashMap<String,Task>();
    if( subTasks != null && subTasks.size() > 0 ){
      for(Task item: subTasks){
        subTaskMap.put(item.getAssignee(), item);
      }
    }
   
    for( String user:users ){
      if( task.getAssignee().equals(user) )
        throw new ApplicationException("不能添加自己["+user+"]为会签人");
       
      if( subTaskMap.get(user) != null )
        throw new ApplicationException("任务已添加会签人["+user+"]");
     
      TaskEntity subTask = (TaskEntity)taskService.newTask();
      subTask.setParentTaskId(taskId); //上级Task
      subTask.setName( task.getName() + "-["+user+"]会签");
      subTask.setAssignee( user ); //会签用户
View Full Code Here

  public void updateCronExp( String name,String group,CronExpression cronExp ){
    Trigger trigger = null;
    try{
      trigger = scheduler.getTrigger( TriggerKey.triggerKey(name, group) );
    }catch(Exception e ){
      throw new ApplicationException(e);
    }
    if( trigger == null )
      throw new ApplicationException("时钟["+group+"]["+name+"]不存在!");
   
    boolean enabled = !TriggerState.PAUSED.equals(getTriggerState(trigger.getKey()));
    JobInterval jobInterval = jobIntervalManager.get( name );
    boolean insert = false;
    if( jobInterval == null ){
View Full Code Here

          if( !jobInterval.isEnabled() )
            scheduler.pauseTrigger(trigger.getKey());
        }
      }
    } catch (SchedulerException e) {
      throw new ApplicationException(e);
    }
   
  }
View Full Code Here

    Trigger target = null;
    try {
      target = scheduler.getTrigger(TriggerKey.triggerKey(triggerName,group));
    } catch (SchedulerException e) {
      log.warn("获取定时任务[{}]异常:{}",triggerName,e.getMessage());
      throw new ApplicationException( e );
    }
   
    if( target == null )
      throw new ApplicationException( "找不到相关定时任务["+triggerName+"]" );
     
    description = target.getDescription();
    boolean enabled = false;
   
    try {
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.common.ApplicationException

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.