/*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.cbof.dac.ICommonBusinessObjectsDAC#updateCnae(com.prosperitasglobal.cbof.model.Cnae,
   * com.qat.framework.model.response.InternalResultsResponse)
   */
  @Override
  public Integer updateCnae(Cnae cnae, InternalResultsResponse<?> response) {
    Integer updateCount = 0;
    response = new InternalResultsResponse<Cnae>();
    // First update the root if necessary.
    if (!ValidationUtil.isNull(cnae.getModelAction())
        && (cnae.getModelAction() == QATModel.PersistanceActionEnum.UPDATE)) {
      updateCount =
          QATMyBatisDacHelper.doUpdate(getSqlSession(), CONTACT_STMT_UPDATE, cnae, response);

      if (updateCount == 1) {
        cnae.setModelAction(QATModel.PersistanceActionEnum.NONE);
      }
    }

    return updateCount;
  }
  /*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.cbof.dac.ICommonBusinessObjectsDAC#updateEvento(com.prosperitasglobal.cbof.model.Evento,
   * com.qat.framework.model.response.InternalResultsResponse)
   */
  @Override
  public Integer updateEvento(Eventos endereco) {
    Integer updateCount = 0;
    InternalResultsResponse<Eventos> response = new InternalResultsResponse<Eventos>();
    // First update the root if necessary.
    if (!ValidationUtil.isNull(endereco.getModelAction())
        && (endereco.getModelAction() == QATModel.PersistanceActionEnum.UPDATE)) {
      updateCount =
          QATMyBatisDacHelper.doUpdate(getSqlSession(), CONTACT_STMT_UPDATE, endereco, response);

      if (updateCount == 1) {
        endereco.setModelAction(QATModel.PersistanceActionEnum.NONE);
      }
    }

    return updateCount;
  }
  @Override
  public Integer updateExamePessoa(ExamePessoa banco, InternalResultsResponse<?> response) {
    Integer updateCount = 0;
    response = new InternalResultsResponse<ExamePessoa>();

    // First update the root if necessary.
    if (!ValidationUtil.isNull(banco.getModelAction())
        && (banco.getModelAction() == QATModel.PersistanceActionEnum.UPDATE)) {
      updateCount =
          QATMyBatisDacHelper.doUpdate(
              getSqlSession(), "ExameMap.updateExamePessoa", banco, response);
    }

    if (response.isInError()) {
      return null;
    }

    return updateCount;
  }
  /*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.sendsolv.dac.IExameDAC#updateExame(com.prosperitasglobal.sendsolv.model
   * .Exame)
   */
  @Override
  public Integer updateExame(Exame banco, InternalResultsResponse<?> response) {
    Integer updateCount = 0;
    response = new InternalResultsResponse<Exame>();

    // First update the root if necessary.
    if (!ValidationUtil.isNull(banco.getModelAction())
        && (banco.getModelAction() == QATModel.PersistanceActionEnum.UPDATE)) {
      updateCount =
          QATMyBatisDacHelper.doUpdate(getSqlSession(), EMPRESA_STMT_UPDATE, banco, response);
    }

    if (response.isInError()) {
      return null;
    }

    // Finally, if something was updated then add the Person to the result.
    // if (updateCount > 0)
    // {
    // response.addResult(banco);
    // }

    return updateCount;
  }
  @Override
  public Integer updateEventoPessoa(EventoPessoa evento) {
    Integer updateCount = 0;
    InternalResultsResponse<EventoPessoa> response = new InternalResultsResponse<EventoPessoa>();

    // First update the root if necessary.
    if (!ValidationUtil.isNull(evento.getModelAction())
        && (evento.getModelAction() == QATModel.PersistanceActionEnum.UPDATE)) {
      updateCount =
          QATMyBatisDacHelper.doUpdate(
              getSqlSession(), "EventoMap.updateEventoPessoa", evento, response);
    }

    if (response.isInError()) {
      return null;
    }

    // Finally, if something was updated then add the Person to the result.
    if (updateCount > 0) {
      response.addResult(evento);
    }

    return updateCount;
  }
  /*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.sendsolv.dac.ITelaDAC#updateTela(com.prosperitasglobal.sendsolv.model
   * .Tela)
   */
  @Override
  public InternalResultsResponse<Tela> updateTela(Tela tela) {
    Integer updateCount = 0;
    InternalResultsResponse<Tela> response = new InternalResultsResponse<Tela>();

    // First update the root if necessary.
    if (!ValidationUtil.isNull(tela.getModelAction())
        && (tela.getModelAction() == QATModel.PersistanceActionEnum.UPDATE)) {
      updateCount = QATMyBatisDacHelper.doUpdate(getSqlSession(), TELA_STMT_UPDATE, tela, response);
    }

    if (response.isInError()) {
      return response;
    }
    // Next traverse the object graph and "maintain" the associations
    updateCount += maintainTelaAssociations(tela, response);

    // Finally, if something was updated then add the Person to the result.
    if (updateCount > 0) {
      response.addResult(tela);
    }

    return response;
  }