コード例 #1
0
  /**
   * Process.
   *
   * @param indicator the indicator
   * @param persistType the persist type
   * @param request the request
   * @return the servico response
   */
  private InternalResultsResponse<Servico> processServico(
      ValidationContextIndicator indicator,
      PersistenceActionEnum persistType,
      ServicoMaintenanceRequest request) {
    InternalResultsResponse<Servico> response = null;

    // Persist
    InternalResponse internalResponse = doPersistenceServico(request.getServico(), persistType);
    if (internalResponse.isInError()) {
      response = new InternalResultsResponse<Servico>();
      response.setStatus(internalResponse.getError());
      response.addMessages(internalResponse.getMessageInfoList());
      response.addMessage(
          DEFAULT_SITE_BAC_EXCEPTION_MSG,
          MessageSeverity.Error,
          MessageLevel.Object,
          new Object[] {internalResponse.errorToString()});

      return response;
    }

    // Call maintainReurnList to see if we need to return the servico list and if so whether it
    // should be paged or
    // not
    response =
        maintainReturnListServico(
            request.getReturnList(), request.getReturnListPaged(), new Servico());

    return response;
  }
コード例 #2
0
  /*
   * (non-Javadoc)
   * @see
   * com.qat.samples.sysmgmt.bac.IServicoBAC#fetchServicoById(com.qat.samples.sysmgmt.model.request.FetchByIdRequest
   * )
   */
  @Override
  public InternalResultsResponse<Servico> fetchServicoById(FetchByIdRequest request) {
    InternalResultsResponse<Servico> response = new InternalResultsResponse<Servico>();
    // validate fetchId field
    if (ValidationUtil.isNull(request.getFetchId())) {
      response.addFieldErrorMessage(SYSMGMT_BASE_ID_REQUIRED);
      response.setStatus(SystemErrorCategory.SystemValidation);
    } else {
      response.getResultsList().add(getSiteBAR().fetchServicoById(request));
    }

    return response;
  }
コード例 #3
0
    private InternalResultsResponse<Cidade> createFetchResponse() {
      if (EXCEPTION.equals(getReturnResult())) {
        throw new RuntimeException("Boom");
      }

      InternalResultsResponse<Cidade> response = new InternalResultsResponse<Cidade>();
      if (FETCH_FAILURE.equals(getReturnResult())) {
        response.addMessage(getFailureMessageCode(), MessageSeverity.Error, MessageLevel.Other);
        response.setStatus(Status.UnspecifiedError);
        return response;
      }

      response.addResult(new Cidade());
      return response;
    }