Package com.google.code.lightssh.common.model

Examples of com.google.code.lightssh.common.model.Result


  /**
   * 读消息
   */
  public String read( ){
    result = new Result();
    if( publish == null ){
      result.setStatus(false);
      result.setMessage("参数错误!");
     
      return SUCCESS;
View Full Code Here


 
  /**
   * 删除消息
   */
  public String remove( ){
    result = new Result();
    if( publish == null || StringUtils.isEmpty(publish.getId())
        || publish.getMessage() == null ){
      result.setStatus(false);
      result.setMessage("参数错误!");
     
View Full Code Here

 
  /**
   * 会签
   */
  public String countersign( ){
    this.result = new Result();
   
    if( StringUtils.isEmpty(taskId)){
      result.setStatus(false);
      result.setMessage("参数错误:任务ID不能为空!");
      return SUCCESS;
View Full Code Here

   */
  protected Collection<Result> executeJobQueue( Collection<JobQueue> items ){
    Collection<Result> results = null;
    if( items == null || items.isEmpty() ){
      results = new ArrayList<Result>();
      results.add( new Result(false,"参数为空!") );
      return results;
    }
   
    try{
      results = doBusiness(items);//业务处理

      if( results == null )
        throw new ApplicationException("返回结果为空!");
      //Map<String,JobQueue> map = new HashMap<String,JobQueue>();
     
      for(Result result:results ){
        JobQueue item = (JobQueue)result.getObject();
        if( item == null ){//TODO
          throw new ApplicationException("返回结果Result[key="
              +result.getKey()+"]关联Object为空!");
        }
       
        if( !result.isSuccess() && item != null ){
          item.incFailureCount();
          item.setStatus(JobQueue.Status.FAILURE );
          item.setErrMsg(result.getMessage());
        }
      }
    }catch( Exception e ){
      results = new ArrayList<Result>();
      for(JobQueue item:items){
        results.add(new Result(false,item.getRefId(),item,e.getMessage()));
       
        item.incFailureCount();
        item.setStatus( JobQueue.Status.FAILURE );
       
        String errMsg = e.getMessage()+(e.getCause()==null?"":e.getCause().getMessage());
View Full Code Here

 
  /**
   * 检查依赖
   */
  protected Result checkRelyOn(JobQueue jq,PlanDetail detail,Map<String,Result> mapResults){
    Result result = new Result(true,jq.getRefId(),jq,null);
    PlanDetail relyOn = detail.getPrecondition();
    if( relyOn != null ){
      String relyOnKey = relyOn.getId();
      //从数据库中取最新记录
      PlanDetail dbRelyOn = planManager.getDetail(relyOnKey);
      if( dbRelyOn != null && dbRelyOn.getStatus() != null
          && !dbRelyOn.getStatus().equals( relyOn.getStatus() )){
        relyOn = dbRelyOn;
        detail.setPrecondition( dbRelyOn );
      }
      boolean relyOnFinished = relyOn.isFinished();//已经完成
      boolean exeRelyOnFinished = mapResults.get(relyOnKey)!=null
        && mapResults.get(relyOnKey).isSuccess(); //当前批次执行完成
     
      if( !(relyOnFinished || exeRelyOnFinished) ){
        result.setStatus(false);
        result.setMessage("依赖任务["+relyOnKey+"]未完成!");
        return result;
      }
    }
   
    return result;
View Full Code Here

    List<Result> results = new ArrayList<Result>();//返回结果
    Map<String,Result> mapResults = new HashMap<String,Result>();
    for( PlanDetail detail:details ){
      SchedulerType type = detail.getType();
      String key = detail.getId();
      Result result = null;
      if( type == null || StringUtils.isEmpty(type.getId()) ){
        result = new Result(false,key,mapQueue.get(key)
            ,"关联业务数据["+key+"]类型为空,无法进行业务处理。");
        mapResults.put(key,result);
        continue;
      }
       
      //批处理
      result = doBatchBusiness(mapQueue.get(key),detail,mapResults);
     
      if( result == null ){
        result = new Result(false,key,mapQueue.get(key),"未实现业务处理!");
      }
     
      mapResults.put(key,result);
    }
   
View Full Code Here

    List<PlanDetail> details = planManager.listDetail(planId);
    if( details == null || details.isEmpty() )
      return false;
   
    for( PlanDetail detail:details ){
      Result result = mapResults.get( detail.getId() );
      boolean resultSuccess = (result != null) && result.isSuccess(); //执行结果成功
      exeSuccess = exeSuccess && (detail.isFinished()||resultSuccess);
    }
   
    return exeSuccess;
  }
View Full Code Here

TOP

Related Classes of com.google.code.lightssh.common.model.Result

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.