Java Code Examples for org.springframework.hateoas.MediaTypes#HAL_JSON_VALUE

The following examples show how to use org.springframework.hateoas.MediaTypes#HAL_JSON_VALUE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WorkbasketController.java    From taskana with Apache License 2.0 6 votes vote down vote up
@GetMapping(path = Mapping.URL_WORKBASKET_ID_ACCESSITEMS, produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>>
    getWorkbasketAccessItems(@PathVariable(value = "workbasketId") String workbasketId)
        throws NotAuthorizedException, WorkbasketNotFoundException {
  LOGGER.debug("Entry to getWorkbasketAccessItems(workbasketId= {})", workbasketId);
  ResponseEntity<TaskanaPagedModel<WorkbasketAccessItemRepresentationModel>> result;

  List<WorkbasketAccessItem> accessItems =
      workbasketService.getWorkbasketAccessItems(workbasketId);
  result =
      ResponseEntity.ok(
          workbasketAccessItemRepresentationModelAssembler.toPageModelForSingleWorkbasket(
              workbasketId, accessItems, null));
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Exit from getWorkbasketAccessItems(), returning {}", result);
  }

  return result;
}
 
Example 2
Source File: ClassificationController.java    From taskana with Apache License 2.0 6 votes vote down vote up
@GetMapping(path = Mapping.URL_CLASSIFICATIONS_ID, produces = MediaTypes.HAL_JSON_VALUE)
@Transactional(readOnly = true, rollbackFor = Exception.class)
public ResponseEntity<ClassificationRepresentationModel> getClassification(
    @PathVariable String classificationId) throws ClassificationNotFoundException {
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Entry to getClassification(classificationId= {})", classificationId);
  }

  Classification classification = classificationService.getClassification(classificationId);
  ResponseEntity<ClassificationRepresentationModel> response =
      ResponseEntity.ok(classificationRepresentationModelAssembler.toModel(classification));
  if (LOGGER.isDebugEnabled()) {
    LOGGER.debug("Exit from getClassification(), returning {}", response);
  }

  return response;
}
 
Example 3
Source File: MgmtDistributionSetTypeRestApi.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Handles the GET request of retrieving all DistributionSetTypes.
 *
 * @param pagingOffsetParam
 *            the offset of list of modules for pagination, might not be
 *            present in the rest request then default value will be applied
 * @param pagingLimitParam
 *            the limit of the paged request, might not be present in the
 *            rest request then default value will be applied
 * @param sortParam
 *            the sorting parameter in the request URL, syntax
 *            {@code field:direction, field:direction}
 * @param rsqlParam
 *            the search parameter in the request URL, syntax
 *            {@code q=name==abc}
 *
 * @return a list of all DistributionSetType for a defined or default page
 *         request with status OK. The response is always paged. In any
 *         failure the JsonResponseExceptionHandler is handling the
 *         response.
 */
@GetMapping(produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<PagedList<MgmtDistributionSetType>> getDistributionSetTypes(
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) int pagingOffsetParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) int pagingLimitParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) String sortParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) String rsqlParam);
 
Example 4
Source File: MgmtSoftwareModuleRestApi.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Gets a paged list of meta data for a software module.
 *
 * @param softwareModuleId
 *            the ID of the software module for the meta data
 * @param pagingOffsetParam
 *            the offset of list of meta data for pagination, might not be
 *            present in the rest request then default value will be applied
 * @param pagingLimitParam
 *            the limit of the paged request, might not be present in the
 *            rest request then default value will be applied
 * @param sortParam
 *            the sorting parameter in the request URL, syntax
 *            {@code field:direction, field:direction}
 * @param rsqlParam
 *            the search parameter in the request URL, syntax
 *            {@code q=key==abc}
 * @return status OK if get request is successful with the paged list of
 *         meta data
 */
@GetMapping(value = "/{softwareModuleId}/metadata", produces = { MediaTypes.HAL_JSON_VALUE,
        MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<PagedList<MgmtSoftwareModuleMetadata>> getMetadata(
        @PathVariable("softwareModuleId") final Long softwareModuleId,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) final String rsqlParam);
 
Example 5
Source File: MgmtSoftwareModuleRestApi.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Handles the GET request of retrieving all softwaremodules.
 *
 * @param pagingOffsetParam
 *            the offset of list of modules for pagination, might not be
 *            present in the rest request then default value will be applied
 * @param pagingLimitParam
 *            the limit of the paged request, might not be present in the
 *            rest request then default value will be applied
 * @param sortParam
 *            the sorting parameter in the request URL, syntax
 *            {@code field:direction, field:direction}
 * @param rsqlParam
 *            the search parameter in the request URL, syntax
 *            {@code q=name==abc}
 *
 * @return a list of all modules for a defined or default page request with
 *         status OK. The response is always paged. In any failure the
 *         JsonResponseExceptionHandler is handling the response.
 */
@GetMapping(produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<PagedList<MgmtSoftwareModule>> getSoftwareModules(
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) final int pagingOffsetParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) final int pagingLimitParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) final String sortParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) final String rsqlParam);
 
Example 6
Source File: MgmtTargetFilterQueryRestApi.java    From hawkbit with Eclipse Public License 1.0 3 votes vote down vote up
/**
 * Handles the GET request of retrieving all filters.
 *
 * @param pagingOffsetParam
 *            the offset of list of targets for pagination, might not be
 *            present in the rest request then default value will be applied
 * @param pagingLimitParam
 *            the limit of the paged request, might not be present in the
 *            rest request then default value will be applied
 * @param sortParam
 *            the sorting parameter in the request URL, syntax
 *            {@code field:direction, field:direction}
 * @param rsqlParam
 *            the search parameter in the request URL, syntax
 *            {@code q=name==abc}
 * @return a list of all targets for a defined or default page request with
 *         status OK. The response is always paged. In any failure the
 *         JsonResponseExceptionHandler is handling the response.
 */

@GetMapping(produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<PagedList<MgmtTargetFilterQuery>> getFilters(
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_OFFSET, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_OFFSET) int pagingOffsetParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_PAGING_LIMIT, defaultValue = MgmtRestConstants.REQUEST_PARAMETER_PAGING_DEFAULT_LIMIT) int pagingLimitParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SORTING, required = false) String sortParam,
        @RequestParam(value = MgmtRestConstants.REQUEST_PARAMETER_SEARCH, required = false) String rsqlParam);
 
Example 7
Source File: MgmtTargetRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the POST request of creating new targets. The request body must
 * always be a list of targets.
 *
 * @param targets
 *            the targets to be created.
 * @return In case all targets could successful created the ResponseEntity
 *         with status code 201 with a list of successfully created
 *         entities. In any failure the JsonResponseExceptionHandler is
 *         handling the response.
 */
@PostMapping(consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE }, produces = {
        MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<List<MgmtTarget>> createTargets(List<MgmtTargetRequestBody> targets);
 
Example 8
Source File: MgmtDistributionSetTagRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request of retrieving all assigned distribution sets by
 * the given tag id.
 *
 * @param distributionsetTagId
 *            the ID of the distribution set tag
 *
 * @return the list of assigned distribution sets.
 * 
 * @deprecated please use
 *             {@link #getAssignedDistributionSets(Long, int, int, String, String)}
 *             instead as this variant does not include paging and as result
 *             returns only a limited list of distributionsets
 */
@Deprecated
@GetMapping(value = MgmtRestConstants.DEPRECATED_DISTRIBUTIONSET_TAG_DISTRIBUTIONSETS_REQUEST_MAPPING, produces = {
        MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<List<MgmtDistributionSet>> getAssignedDistributionSets(
        @PathVariable("distributionsetTagId") Long distributionsetTagId);
 
Example 9
Source File: MgmtDistributionSetRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the UPDATE request for a single DistributionSet .
 *
 * @param distributionSetId
 *            the ID of the DistributionSet to delete
 * @param toUpdate
 *            with the data that needs updating
 *
 * @return status OK if update as successful with updated content.
 *
 */
@PutMapping(value = "/{distributionSetId}", consumes = { MediaTypes.HAL_JSON_VALUE,
        MediaType.APPLICATION_JSON_VALUE }, produces = { MediaType.APPLICATION_JSON_VALUE,
                MediaTypes.HAL_JSON_VALUE })
ResponseEntity<MgmtDistributionSet> updateDistributionSet(@PathVariable("distributionSetId") Long distributionSetId,
        MgmtDistributionSetRequestBodyPut toUpdate);
 
Example 10
Source File: MgmtSoftwareModuleRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the POST request of creating new softwaremodules. The request
 * body must always be a list of modules.
 *
 * @param softwareModules
 *            the modules to be created.
 * @return In case all modules could successful created the ResponseEntity
 *         with status code 201 - Created but without ResponseBody. In any
 *         failure the JsonResponseExceptionHandler is handling the
 *         response.
 */
@PostMapping(consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE }, produces = {
        MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<List<MgmtSoftwareModule>> createSoftwareModules(
        final List<MgmtSoftwareModuleRequestBodyPost> softwareModules);
 
Example 11
Source File: MgmtTargetRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request of retrieving a specific Actions of a specific
 * Target.
 *
 * @param targetId
 *            to load the action for
 * @param actionId
 *            to load
 * @return the action
 */
@GetMapping(value = "/{targetId}/actions/{actionId}", produces = { MediaTypes.HAL_JSON_VALUE,
        MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtAction> getAction(@PathVariable("targetId") String targetId,
        @PathVariable("actionId") Long actionId);
 
Example 12
Source File: MgmtTargetRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request of retrieving the assigned distribution set of an
 * specific target.
 *
 * @param targetId
 *            the ID of the target to retrieve the assigned distribution
 * 
 * @return the assigned distribution set with status OK, if none is assigned
 *         than {@code null} content (e.g. "{}")
 */
@GetMapping(value = "/{targetId}/assignedDS", produces = { MediaTypes.HAL_JSON_VALUE,
        MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtDistributionSet> getAssignedDistributionSet(@PathVariable("targetId") String targetId);
 
Example 13
Source File: MgmtDistributionSetTypeRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request of retrieving the single optional software module
 * type in that distribution set type.
 *
 * @param distributionSetTypeId
 *            of the DistributionSetType.
 * @param softwareModuleTypeId
 *            of SoftwareModuleType.
 * @return Unpaged list of module types and OK in case of success.
 */
@GetMapping(value = "/{distributionSetTypeId}/" + MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_OPTIONAL_MODULE_TYPES
        + "/{softwareModuleTypeId}", produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtSoftwareModuleType> getOptionalModule(
        @PathVariable("distributionSetTypeId") Long distributionSetTypeId,
        @PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
 
Example 14
Source File: MgmtDistributionSetTypeRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the POST request for adding a mandatory software module type to a
 * distribution set type.
 *
 * @param distributionSetTypeId
 *            of the DistributionSetType.
 * @param smtId
 *            of the SoftwareModuleType to add
 *
 * @return OK if the request was successful
 */
@PostMapping(value = "/{distributionSetTypeId}/"
        + MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES, consumes = { MediaTypes.HAL_JSON_VALUE,
                MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<Void> addMandatoryModule(@PathVariable("distributionSetTypeId") Long distributionSetTypeId,
        MgmtId smtId);
 
Example 15
Source File: MgmtTargetFilterQueryRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the PUT request of updating a target filter. The ID is within the
 * URL path of the request. A given ID in the request body is ignored. It's
 * not possible to set fields to {@code null} values.
 *
 * @param filterId
 *            the path parameter which contains the ID of the target filter
 * @param targetFilterRest
 *            the request body which contains the fields which should be
 *            updated, fields which are not given are ignored for the
 *            update.
 * @return the updated target filter response which contains all fields
 *         including fields which have not been updated
 */
@PutMapping(value = "/{filterId}", consumes = { MediaTypes.HAL_JSON_VALUE,
        MediaType.APPLICATION_JSON_VALUE }, produces = { MediaTypes.HAL_JSON_VALUE,
                MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtTargetFilterQuery> updateFilter(@PathVariable("filterId") Long filterId,
        @RequestBody MgmtTargetFilterQueryRequestBody targetFilterRest);
 
Example 16
Source File: MgmtTargetFilterQueryRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the POST request of creating new target filters. The request body
 * must always be a list of target filters.
 *
 * @param filter
 *            the filters to be created.
 * @return In case all filters were successfully created the ResponseEntity
 *         with status code 201 with a list of successfully created entities
 *         is returned. In any failure the JsonResponseExceptionHandler is
 *         handling the response.
 */
@PostMapping(consumes = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE }, produces = {
        MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtTargetFilterQuery> createFilter(@RequestBody MgmtTargetFilterQueryRequestBody filter);
 
Example 17
Source File: MgmtDistributionSetTypeRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request of retrieving the single mandatory software
 * module type in that distribution set type.
 *
 * @param distributionSetTypeId
 *            of the DistributionSetType.
 * @param softwareModuleTypeId
 *            of SoftwareModuleType.
 * @return Unpaged list of module types and OK in case of success.
 */
@GetMapping(value = "/{distributionSetTypeId}/" + MgmtRestConstants.DISTRIBUTIONSETTYPE_V1_MANDATORY_MODULE_TYPES
        + "/{softwareModuleTypeId}", produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtSoftwareModuleType> getMandatoryModule(
        @PathVariable("distributionSetTypeId") Long distributionSetTypeId,
        @PathVariable("softwareModuleTypeId") Long softwareModuleTypeId);
 
Example 18
Source File: MgmtTargetTagRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request of retrieving all assigned targets by the given
 * tag id.
 *
 * @param targetTagId
 *            the ID of the target tag to retrieve
 *
 * @return the list of assigned targets.
 * 
 * @deprecated please use
 *             {@link #getAssignedTargets(Long, int, int, String, String)}
 *             instead as this variant does not include paging and as result
 *             returns only a limited list of targets
 */
@Deprecated
@GetMapping(value = MgmtRestConstants.DEPRECATAED_TARGET_TAG_TARGETS_REQUEST_MAPPING, produces = {
        MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<List<MgmtTarget>> getAssignedTargets(@PathVariable("targetTagId") Long targetTagId);
 
Example 19
Source File: MgmtTenantManagementRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request for receiving all tenant specific configuration
 * values.
 * 
 * @return a map of all configuration values.
 */
@GetMapping(value = "/configs", produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<Map<String, MgmtSystemTenantConfigurationValue>> getTenantConfiguration();
 
Example 20
Source File: MgmtTargetTagRestApi.java    From hawkbit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Handles the GET request of retrieving a single target tag.
 *
 * @param targetTagId
 *            the ID of the target tag to retrieve
 *
 * @return a single target tag with status OK.
 */
@GetMapping(value = "/{targetTagId}", produces = { MediaTypes.HAL_JSON_VALUE, MediaType.APPLICATION_JSON_VALUE })
ResponseEntity<MgmtTag> getTargetTag(@PathVariable("targetTagId") Long targetTagId);