private InternalResponse createInternalResponse(Cidade cidade) { if (EXCEPTION.equals(getReturnResult())) { throw new RuntimeException("Boom"); } InternalResponse response = new InternalResponse(); if (FAILURE.equals(getReturnResult())) { response.addMessage(getFailureMessageCode(), MessageSeverity.Error, MessageLevel.Other); response.setStatus(Status.UnspecifiedError); } return response; }
/* * (non-Javadoc) * @see * com.qat.samples.sysmgmt.base.bac.ICountyBAC#deleteCounty(com.qat.samples.sysmgmt.base.model.County) */ @Override public InternalResponse deleteCounty(County county) { InternalResponse internalResponse = getCountyDAC().deleteCountyById(county); // Check for error because in business case all non-success returns are failures (removal of // zero rows) according to the business if (internalResponse.getStatus() != Status.OperationSuccess) { internalResponse.addMessage( DEFAULT_COUNTY_BAC_EXCEPTION_MSG, Message.MessageSeverity.Error, Message.MessageLevel.Object, new Object[] {internalResponse.getStatus().toString()}); } return internalResponse; }
/* * (non-Javadoc) * @see * com.qat.samples.sysmgmt.base.bac.IListaComprasBAC#deleteListaCompras(com.qat.samples.sysmgmt.base.model. * ListaCompras) */ @Override public InternalResponse deleteListaCompras(ListaCompras cidade) { InternalResponse internalResponse = getListaComprasDAC().deleteListaCompras(cidade); // Check for error because in business case all non-success returns are failures (removal of // zero rows) // according to the business if (internalResponse.getStatus() != Status.OperationSuccess) { internalResponse.addMessage( DEFAULT_PROCEDURE_BAC_EXCEPTION_MSG, Message.MessageSeverity.Error, Message.MessageLevel.Object, new Object[] {internalResponse.getStatus().toString()}); } return internalResponse; }
/* * (non-Javadoc) * @see * com.qat.samples.sysmgmt.base.bac.IListaComprasBAC#updateListaCompras(com.qat.samples.sysmgmt.base.model. * ListaCompras) */ @Override public InternalResponse updateListaCompras(ListaCompras cidade) { // cidade.setPrice(ListaComprasBAD.calculatePrice(UPDATE_SEED)); InternalResponse internalResponse = getListaComprasDAC().updateListaCompras(cidade); // Check for error because in business case all non-success returns are failures (updating of // zero rows or // optimistic locking error) according to the business if (internalResponse.getStatus() != Status.OperationSuccess) { internalResponse.addMessage( DEFAULT_PROCEDURE_BAC_EXCEPTION_MSG, Message.MessageSeverity.Error, Message.MessageLevel.Object, new Object[] {internalResponse.getStatus().toString()}); } return internalResponse; }