@Override
 protected ConditionInfo changeModel(Condition data) {
   ConditionInfo info = new ConditionInfo();
   if (data != null) {
     BeanUtils.copyProperties(data, info);
     if (data.getTransition() != null) {
       info.setTransitionId(data.getTransition().getId());
       info.setTransitionName(data.getTransition().getName());
       if (data.getTransition().getProcess() != null) {
         info.setProcessId(data.getTransition().getProcess().getId());
         info.setProcessName(data.getTransition().getProcess().getName());
       }
     }
     if (data.getParameter() != null) {
       info.setFromParameterId(data.getParameter().getId());
       info.setFromParameterName(data.getParameter().getName());
     }
   }
   return info;
 }
  @Override
  public ConditionInfo update(ConditionInfo info) {
    if (info != null) {
      boolean isAdded = false;

      Condition data =
          this.loadCondition(
              info.getTransitionId(), info.getFromParameterId(), info.getCompareValue());
      if (isAdded = (data == null)) {
        data = new Condition();
      }

      BeanUtils.copyProperties(info, data);

      if (info.getTransitionId() != null
          && (data.getTransition() == null
              || !data.getTransition().getId().equalsIgnoreCase(info.getTransitionId()))) {
        Transition transition = this.transitionService.loadTransition(info.getTransitionId());
        if (transition != null) {
          data.setTransition(transition);
          info.setTransitionName(transition.getName());
          if (transition.getProcess() != null) {
            info.setProcessId(transition.getProcess().getId());
            info.setProcessName(transition.getProcess().getName());
          }
        }
      }
      if (info.getFromParameterId() != null
          && (data.getParameter() == null
              || !data.getParameter().getId().equalsIgnoreCase(info.getFromParameterId()))) {
        Parameter parameter = this.parameterService.loadParameter(info.getFromParameterId());
        if (parameter != null) {
          data.setParameter(parameter);
          info.setFromParameterName(parameter.getName());
        }
      }

      if (isAdded) this.conditionDao.save(data);
    }
    return info;
  }