/*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.sendsolv.dac.ITelaDAC#deleteTela(com.prosperitasglobal.sendsolv.model
   * .Tela)
   */
  @Override
  public InternalResponse deleteTela(Tela tela) {
    InternalResponse response = new InternalResponse();
    QATMyBatisDacHelper.doRemove(getSqlSession(), TELA_STMT_DELETE, tela, response);

    return response;
  }
 /*
  * (non-Javadoc)
  * @see com.prosperitasglobal.sendsolv.dac.IExameDAC#fetchExameById(FetchByIdRequest)
  */
 @Override
 public InternalResultsResponse<Exame> fetchExameById(FetchByIdRequest request) {
   InternalResultsResponse<Exame> response = new InternalResultsResponse<Exame>();
   QATMyBatisDacHelper.doQueryForList(
       getSqlSession(), EMPRESA_STMT_FETCH_BY_ID, request, response);
   return response;
 }
  /*
   * (non-Javadoc)
   * @see com.prosperitasglobal.cbof.dac.ICommonBusinessObjectsDAC#fetchCnaeById(java.lang.Integer)
   */
  @Override
  public InternalResultsResponse<Cnae> fetchCnaeById(Integer id) {
    InternalResultsResponse<Cnae> response = new InternalResultsResponse<Cnae>();

    QATMyBatisDacHelper.doQueryForList(getSqlSession(), CONTACT_STMT_FETCH_BY_ID, id, response);

    return response;
  }
 /*
  * (non-Javadoc)
  * @see
  * com.prosperitasglobal.sendsolv.dac.IExameDAC#deleteExame(com.prosperitasglobal.sendsolv.model
  * .Exame)
  */
 @Override
 public Integer deleteExame(Exame banco, InternalResultsResponse<?> response) {
   QATMyBatisDacHelper.doRemove(getSqlSession(), EMPRESA_STMT_DELETE, banco, response);
   if (response.isInError()) {
     return null;
   } else {
     return 1;
   }
 }
  @Override
  public Integer deleteExamePessoa(ExamePessoa banco, InternalResultsResponse<?> response) {

    QATMyBatisDacHelper.doRemove(getSqlSession(), "ExameMap.deleteExamePessoa", banco, response);
    if (response.isInError()) {
      return null;
    } else {
      return 1;
    }
  }
  /*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.cbof.dac.ICommonBusinessObjectsDAC#insertEvento(com.prosperitasglobal.cbof.model.Evento,
   * java.lang.String, com.qat.framework.model.response.InternalResultsResponse)
   */
  @Override
  public Integer insertEvento(Eventos endereco) {
    Integer insertCount = 0;
    InternalResultsResponse<Eventos> response = new InternalResultsResponse<Eventos>();
    // First insert the root endereco data
    insertCount =
        QATMyBatisDacHelper.doInsert(getSqlSession(), CONTACT_STMT_INSERT, endereco, response);

    return insertCount;
  }
  /*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.cbof.dac.ICommonBusinessObjectsDAC#insertCnae(com.prosperitasglobal.cbof.model.Cnae,
   * java.lang.String, com.qat.framework.model.response.InternalResultsResponse)
   */
  @Override
  public Integer insertCnae(Cnae cnae, String statementName, InternalResultsResponse<?> response) {
    response = new InternalResultsResponse<Cnae>();
    Integer insertCount = 0;
    // First insert the root cnae data
    insertCount =
        QATMyBatisDacHelper.doInsert(getSqlSession(), CONTACT_STMT_INSERT, cnae, response);

    return insertCount;
  }
  @Override
  public Integer insertCnaeEmpresa(
      CnaeEmpresa cnae, String statementName, InternalResultsResponse<?> response) {
    Integer insertCount = 0;
    response = new InternalResultsResponse<CnaeEmpresa>();
    // First insert the root cnae data
    insertCount =
        QATMyBatisDacHelper.doInsert(getSqlSession(), CNAE_EMPRESA_STMT_INSERT, cnae, response);

    return insertCount;
  }
 @Override
 public Integer deleteEventoPessoa(EventoPessoa evento) {
   InternalResponse response = new InternalResponse();
   QATMyBatisDacHelper.doRemove(
       getSqlSession(), "EventoMap.deleteEventoPessoaById", evento, response);
   if (response.isInError()) {
     return null;
   } else {
     return 1;
   }
 }
  @Override
  public Integer insertExamePessoa(
      ExamePessoa banco, String string, InternalResultsResponse<?> response) {
    Integer insertCount = 0;
    response = new InternalResultsResponse<ExamePessoa>();

    // First insert the root
    // Is successful the unique-id will be populated back into the object.
    insertCount =
        QATMyBatisDacHelper.doInsert(
            getSqlSession(), "ExameMap.insertExame", banco.getExame(), response);

    // First insert the root
    // Is successful the unique-id will be populated back into the object.
    insertCount =
        QATMyBatisDacHelper.doInsert(
            getSqlSession(), "ExameMap.insertExamePessoa", banco, response);

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

    return insertCount;
  }
  /*
   * (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;
  }
  /*
   * (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;
  }
  @Override
  public Integer insertEventoPessoa(EventoPessoa evento) {
    Integer insertCount = 0;
    InternalResultsResponse<EventoPessoa> response = new InternalResultsResponse<EventoPessoa>();

    // First insert the root
    // Is successful the unique-id will be populated back into the object.
    insertCount =
        QATMyBatisDacHelper.doInsert(
            getSqlSession(), "EventoMap.insertEventoPessoa", evento, response);

    // Finally, if something was inserted then add the Beneficios to the result.
    if (insertCount > 0) {
      response.addResult(evento);
    }

    return insertCount;
  }
  @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#insertExame(com.prosperitasglobal.sendsolv.model
   * .Exame)
   */
  @Override
  public Integer insertExame(Exame banco, String string, InternalResultsResponse<?> response1) {
    Integer insertCount = 0;
    InternalResultsResponse<Exame> response = new InternalResultsResponse<Exame>();

    // First insert the root
    // Is successful the unique-id will be populated back into the object.
    insertCount =
        QATMyBatisDacHelper.doInsert(getSqlSession(), EMPRESA_STMT_INSERT, banco, response);

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

    // Finally, if something was inserted then add the Exame to the result.
    if (insertCount > 0) {
      response.addResult(banco);
    }
    response1 = response;
    return insertCount;
  }
  /*
   * (non-Javadoc)
   * @see
   * com.prosperitasglobal.sendsolv.dac.ITelaDAC#insertTela(com.prosperitasglobal.sendsolv.model
   * .Tela)
   */
  @Override
  public InternalResultsResponse<Tela> insertTela(Tela tela) {
    Integer insertCount = 0;
    InternalResultsResponse<Tela> response = new InternalResultsResponse<Tela>();

    // First insert the root
    // Is successful the unique-id will be populated back into the object.
    insertCount = QATMyBatisDacHelper.doInsert(getSqlSession(), TELA_STMT_INSERT, tela, response);

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

    // Finally, if something was inserted then add the Tela to the result.
    if (insertCount > 0) {
      response.addResult(tela);
    }

    return response;
  }
  @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.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;
  }
  /*
   * (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;
  }
 /*
  * (non-Javadoc)
  * @see
  * com.prosperitasglobal.cbof.dac.ICnaeDAC#deleteBusinessCnae(com.prosperitasglobal.cbof.model.Cnae,
  * com.qat.framework.model.response.InternalResultsResponse)
  */
 @Override
 public Integer deleteCnae(Cnae cnae, InternalResultsResponse<?> response) {
   return QATMyBatisDacHelper.doRemove(
       getSqlSession(), CONTACT_STMT_DELETE_BUSINESS_CONTACT, cnae, response);
 }
 /*
  * (non-Javadoc)
  * @see
  * com.prosperitasglobal.cbof.dac.ICnaeDAC#deleteBusinessCnae(com.prosperitasglobal.cbof.model.Cnae,
  * com.qat.framework.model.response.InternalResultsResponse)
  */
 @Override
 public Integer deleteCnaeEmpresa(CnaeEmpresa cnae, InternalResultsResponse<?> response) {
   return QATMyBatisDacHelper.doRemove(getSqlSession(), CNAE_EMPRESA_STMT_DELETE, cnae, response);
 }
 @Override
 public Integer deleteEvento(Eventos evento) {
   InternalResponse response = new InternalResponse();
   return QATMyBatisDacHelper.doRemove(
       getSqlSession(), CONTACT_STMT_DELETE_BUSINESS_CONTACT, evento, response);
 }