@Test void testGetEntityTypes() { int page = 2; int size = 1; Sort sort = mock(Sort.class); Query query = mock(Query.class); ReadEntityTypesRequest readEntityTypesRequest = new ReadEntityTypesRequest(); readEntityTypesRequest.setPage(page); readEntityTypesRequest.setSize(size); readEntityTypesRequest.setSort(sort); readEntityTypesRequest.setQ(query); EntityTypes entityTypes = mock(EntityTypes.class); when(metadataApiService.findEntityTypes(query, sort, size, page)).thenReturn(entityTypes); EntityTypesResponse entityTypesResponse = mock(EntityTypesResponse.class); when(entityTypeResponseMapper.toEntityTypesResponse(entityTypes, size, page)) .thenReturn(entityTypesResponse); assertEquals(entityTypesResponse, metadataApiController.getEntityTypes(readEntityTypesRequest)); }
@Transactional(readOnly = true) @GetMapping public EntityTypesResponse getEntityTypes(@Valid ReadEntityTypesRequest entitiesRequest) { int size = entitiesRequest.getSize(); int page = entitiesRequest.getPage(); Sort sort = entitiesRequest.getSort(); EntityTypes entityTypes = metadataApiService.findEntityTypes(entitiesRequest.getQ().orElse(null), sort, size, page); return entityTypeResponseMapper.toEntityTypesResponse(entityTypes, size, page); }
MetadataApiController extends ApiController { @Transactional(readOnly = true) @GetMapping public EntityTypesResponse getEntityTypes(@Valid ReadEntityTypesRequest entitiesRequest) { int size = entitiesRequest.getSize(); int page = entitiesRequest.getPage(); Sort sort = entitiesRequest.getSort(); EntityTypes entityTypes = metadataApiService.findEntityTypes(entitiesRequest.getQ().orElse(null), sort, size, page); return entityTypeResponseMapper.toEntityTypesResponse(entityTypes, size, page); } }
MetadataApiController extends ApiController { @Transactional(readOnly = true) @GetMapping public EntityTypesResponse getEntityTypes(@Valid ReadEntityTypesRequest entitiesRequest) { int size = entitiesRequest.getSize(); int page = entitiesRequest.getPage(); Sort sort = entitiesRequest.getSort(); EntityTypes entityTypes = metadataApiService.findEntityTypes(entitiesRequest.getQ().orElse(null), sort, size, page); return entityTypeResponseMapper.toEntityTypesResponse(entityTypes, size, page); } MetadataApiController(
      MetadataApiService metadataApiService,
      EntityTypeResponseMapper entityTypeResponseMapper,
      EntityTypeRequestMapper entityTypeRequestMapper,
      AttributeResponseMapper attributeResponseMapper,
      AttributeRequestMapper attributeRequestMapper); }
MetadataApiController extends ApiController { @Transactional(readOnly = true) @GetMapping public EntityTypesResponse getEntityTypes(@Valid ReadEntityTypesRequest entitiesRequest) { int size = entitiesRequest.getSize(); int page = entitiesRequest.getPage(); Sort sort = entitiesRequest.getSort(); EntityTypes entityTypes = metadataApiService.findEntityTypes(entitiesRequest.getQ().orElse(null), sort, size, page); return entityTypeResponseMapper.toEntityTypesResponse(entityTypes, size, page); } MetadataApiController(
      MetadataApiService metadataApiService,
      EntityTypeResponseMapper entityTypeResponseMapper,
      EntityTypeRequestMapper entityTypeRequestMapper,
      AttributeResponseMapper attributeResponseMapper,
      AttributeRequestMapper attributeRequestMapper); @Transactional(readOnly = true) @GetMapping EntityTypesResponse getEntityTypes(@Valid ReadEntityTypesRequest entitiesRequest); @Transactional(readOnly = true) @GetMapping("/{entityTypeId}") EntityTypeResponse getEntityType(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid ReadEntityTypeRequest readEntityTypeRequest); @Transactional(readOnly = true) @GetMapping("/{entityTypeId}/attributes/{attributeId}") AttributeResponse getAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId); @Transactional @PostMapping ResponseEntity<Void> createEntityType(
      @Valid @RequestBody CreateEntityTypeRequest createEntityTypeRequest); @Transactional(readOnly = true) @GetMapping("/{entityTypeId}/attributes") AttributesResponse getAttributes(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid ReadAttributesRequest readAttributesRequest); @Transactional @PostMapping("/{entityTypeId}/attributes") ResponseEntity<Void> createAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid @RequestBody CreateAttributeRequest createAttributeRequest); @Transactional @DeleteMapping("/{entityTypeId}/attributes/{attributeId}") ResponseEntity<Void> deleteAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId); @Transactional @DeleteMapping("/{entityTypeId}/attributes") ResponseEntity<Void> deleteAttributes(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid DeleteAttributesRequest deleteAttributesRequest); @Transactional @PutMapping("/{entityTypeId}") ResponseEntity<Void> updateEntityType(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid @RequestBody CreateEntityTypeRequest createEntityTypeRequest); @Transactional @PutMapping("/{entityTypeId}/attributes/{attributeId}") ResponseEntity<Void> updateAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId,
      @Valid @RequestBody CreateAttributeRequest createAttributeRequest); @Transactional @PatchMapping("/{entityTypeId}/attributes/{attributeId}") ResponseEntity<Void> updatePartialAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId,
      @RequestBody Map<String, Object> attributeValues); @Transactional @PatchMapping("/{entityTypeId}") ResponseEntity<Void> updatePartialEntityType(
      @PathVariable("entityTypeId") String entityTypeId,
      @RequestBody Map<String, Object> entityTypeValues); @Transactional @DeleteMapping("/{entityTypeId}") ResponseEntity<Void> deleteEntityType(@PathVariable("entityTypeId") String entityTypeId); @Transactional @DeleteMapping ResponseEntity<Void> deleteEntityTypes(
      @Valid DeleteEntityTypesRequest deleteEntityTypesRequest); }
MetadataApiController extends ApiController { @Transactional(readOnly = true) @GetMapping public EntityTypesResponse getEntityTypes(@Valid ReadEntityTypesRequest entitiesRequest) { int size = entitiesRequest.getSize(); int page = entitiesRequest.getPage(); Sort sort = entitiesRequest.getSort(); EntityTypes entityTypes = metadataApiService.findEntityTypes(entitiesRequest.getQ().orElse(null), sort, size, page); return entityTypeResponseMapper.toEntityTypesResponse(entityTypes, size, page); } MetadataApiController(
      MetadataApiService metadataApiService,
      EntityTypeResponseMapper entityTypeResponseMapper,
      EntityTypeRequestMapper entityTypeRequestMapper,
      AttributeResponseMapper attributeResponseMapper,
      AttributeRequestMapper attributeRequestMapper); @Transactional(readOnly = true) @GetMapping EntityTypesResponse getEntityTypes(@Valid ReadEntityTypesRequest entitiesRequest); @Transactional(readOnly = true) @GetMapping("/{entityTypeId}") EntityTypeResponse getEntityType(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid ReadEntityTypeRequest readEntityTypeRequest); @Transactional(readOnly = true) @GetMapping("/{entityTypeId}/attributes/{attributeId}") AttributeResponse getAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId); @Transactional @PostMapping ResponseEntity<Void> createEntityType(
      @Valid @RequestBody CreateEntityTypeRequest createEntityTypeRequest); @Transactional(readOnly = true) @GetMapping("/{entityTypeId}/attributes") AttributesResponse getAttributes(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid ReadAttributesRequest readAttributesRequest); @Transactional @PostMapping("/{entityTypeId}/attributes") ResponseEntity<Void> createAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid @RequestBody CreateAttributeRequest createAttributeRequest); @Transactional @DeleteMapping("/{entityTypeId}/attributes/{attributeId}") ResponseEntity<Void> deleteAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId); @Transactional @DeleteMapping("/{entityTypeId}/attributes") ResponseEntity<Void> deleteAttributes(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid DeleteAttributesRequest deleteAttributesRequest); @Transactional @PutMapping("/{entityTypeId}") ResponseEntity<Void> updateEntityType(
      @PathVariable("entityTypeId") String entityTypeId,
      @Valid @RequestBody CreateEntityTypeRequest createEntityTypeRequest); @Transactional @PutMapping("/{entityTypeId}/attributes/{attributeId}") ResponseEntity<Void> updateAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId,
      @Valid @RequestBody CreateAttributeRequest createAttributeRequest); @Transactional @PatchMapping("/{entityTypeId}/attributes/{attributeId}") ResponseEntity<Void> updatePartialAttribute(
      @PathVariable("entityTypeId") String entityTypeId,
      @PathVariable("attributeId") String attributeId,
      @RequestBody Map<String, Object> attributeValues); @Transactional @PatchMapping("/{entityTypeId}") ResponseEntity<Void> updatePartialEntityType(
      @PathVariable("entityTypeId") String entityTypeId,
      @RequestBody Map<String, Object> entityTypeValues); @Transactional @DeleteMapping("/{entityTypeId}") ResponseEntity<Void> deleteEntityType(@PathVariable("entityTypeId") String entityTypeId); @Transactional @DeleteMapping ResponseEntity<Void> deleteEntityTypes(
      @Valid DeleteEntityTypesRequest deleteEntityTypesRequest);  }