Exemplo n.º 1
0
  @GET
  @Consumes({MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_JSON})
  public String retrieveCurrencies(@Context final UriInfo uriInfo) {

    context.authenticatedUser().validateHasReadPermission(resourceNameForPermissions);

    final Set<String> responseParameters =
        ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
    final boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());

    final ConfigurationData configurationData =
        this.readPlatformService.retrieveCurrencyConfiguration();

    return this.apiJsonSerializerService.serializeConfigurationDataToJson(
        prettyPrint, responseParameters, configurationData);
  }
  /**
   * @param uriInfo
   * @param entityType
   * @param entityId
   * @return
   */
  @GET
  @Consumes({MediaType.APPLICATION_JSON})
  @Produces({MediaType.APPLICATION_JSON})
  public String retreiveAllDocuments(
      @Context final UriInfo uriInfo,
      @PathParam("entityType") String entityType,
      @PathParam("entityId") Long entityId) {

    Set<String> responseParameters =
        ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
    if (responseParameters.isEmpty()) {
      responseParameters.addAll(typicalResponseParameters);
    }
    boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());

    Collection<DocumentData> documentDatas =
        this.documentReadPlatformService.retrieveAllDocuments(entityType, entityId);

    return this.apiJsonSerializerService.serializeDocumentDataToJson(
        prettyPrint, responseParameters, documentDatas);
  }