Search in sources :

Example 1 with ComponentUsage

use of org.entando.entando.web.component.ComponentUsage in project entando-core by entando.

the class WidgetController method getComponentUsage.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/widgets/{widgetCode}/usage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SimpleRestResponse<ComponentUsage>> getComponentUsage(@PathVariable String widgetCode) {
    logger.trace("get {} usage by code {}", COMPONENT_ID, widgetCode);
    ComponentUsage usage = ComponentUsage.builder().type(COMPONENT_ID).code(widgetCode).usage(widgetService.getComponentUsage(widgetCode)).build();
    return new ResponseEntity<>(new SimpleRestResponse<>(usage), HttpStatus.OK);
}
Also used : ComponentUsage(org.entando.entando.web.component.ComponentUsage) ResponseEntity(org.springframework.http.ResponseEntity) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl)

Example 2 with ComponentUsage

use of org.entando.entando.web.component.ComponentUsage in project entando-core by entando.

the class PageController method getComponentUsage.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/pages/{pageCode}/usage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SimpleRestResponse<ComponentUsage>> getComponentUsage(@PathVariable String pageCode) {
    logger.trace("get {} usage by code {}", COMPONENT_ID, pageCode);
    ComponentUsage usage = ComponentUsage.builder().type(COMPONENT_ID).code(pageCode).usage(getPageService().getComponentUsage(pageCode)).build();
    return new ResponseEntity<>(new SimpleRestResponse<>(usage), HttpStatus.OK);
}
Also used : ComponentUsage(org.entando.entando.web.component.ComponentUsage) ResponseEntity(org.springframework.http.ResponseEntity) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 3 with ComponentUsage

use of org.entando.entando.web.component.ComponentUsage in project entando-core by entando.

the class PageModelController method getComponentUsage.

@ApiOperation("Retrieve pageModel usage count")
@ApiResponses({ @ApiResponse(code = 200, message = "OK") })
@RestAccessControl(permission = Permission.MANAGE_PAGES)
@RequestMapping(value = "/{code}/usage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SimpleRestResponse<ComponentUsage>> getComponentUsage(@PathVariable String code) {
    logger.trace("get {} usage by code {}", COMPONENT_ID, code);
    ComponentUsage usage = ComponentUsage.builder().type(COMPONENT_ID).code(code).usage(pageModelService.getComponentUsage(code)).build();
    return new ResponseEntity<>(new SimpleRestResponse<>(usage), HttpStatus.OK);
}
Also used : ComponentUsage(org.entando.entando.web.component.ComponentUsage) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl)

Example 4 with ComponentUsage

use of org.entando.entando.web.component.ComponentUsage in project entando-core by entando.

the class GuiFragmentController method getComponentUsage.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/{fragmentCode}/usage", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<SimpleRestResponse<ComponentUsage>> getComponentUsage(@PathVariable String fragmentCode) {
    logger.trace("get {} usage by code {}", COMPONENT_ID, fragmentCode);
    ComponentUsage usage = ComponentUsage.builder().type(COMPONENT_ID).code(fragmentCode).usage(guiFragmentService.getComponentUsage(fragmentCode)).build();
    return new ResponseEntity<>(new SimpleRestResponse<>(usage), HttpStatus.OK);
}
Also used : ComponentUsage(org.entando.entando.web.component.ComponentUsage) ResponseEntity(org.springframework.http.ResponseEntity) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

RestAccessControl (org.entando.entando.web.common.annotation.RestAccessControl)4 ComponentUsage (org.entando.entando.web.component.ComponentUsage)4 ResponseEntity (org.springframework.http.ResponseEntity)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2