/*
   * (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 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;
  }
  @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;
  }
  /*
   * (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;
  }