Search in sources :

Example 1 with GuiFragmentDtoSmall

use of org.entando.entando.aps.system.services.guifragment.model.GuiFragmentDtoSmall in project entando-core by entando.

the class GuiFragmentController method getGuiFragments.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<RestResponse> getGuiFragments(RestListRequest requestList) throws JsonProcessingException {
    this.getGuiFragmentValidator().validateRestListRequest(requestList);
    PagedMetadata<GuiFragmentDtoSmall> result = this.getGuiFragmentService().getGuiFragments(requestList);
    this.getGuiFragmentValidator().validateRestListResult(requestList, result);
    logger.debug("Main Response -> {}", result);
    return new ResponseEntity<>(new RestResponse(result.getBody(), null, result), HttpStatus.OK);
}
Also used : GuiFragmentDtoSmall(org.entando.entando.aps.system.services.guifragment.model.GuiFragmentDtoSmall) ResponseEntity(org.springframework.http.ResponseEntity) RestResponse(org.entando.entando.web.common.model.RestResponse) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with GuiFragmentDtoSmall

use of org.entando.entando.aps.system.services.guifragment.model.GuiFragmentDtoSmall in project entando-core by entando.

the class GuiFragmentService method getGuiFragments.

@Override
public PagedMetadata<GuiFragmentDtoSmall> getGuiFragments(RestListRequest restListReq) {
    PagedMetadata<GuiFragmentDtoSmall> pagedMetadata = null;
    try {
        SearcherDaoPaginatedResult<GuiFragment> fragments = this.getGuiFragmentManager().getGuiFragments(restListReq.buildFieldSearchFilters());
        List<GuiFragmentDtoSmall> dtoList = this.getDtoSmallBuilder().convert(fragments.getList());
        pagedMetadata = new PagedMetadata<>(restListReq, fragments);
        pagedMetadata.setBody(dtoList);
    } catch (Throwable t) {
        logger.error("error in search fragments", t);
        throw new RestServerError("error in search fragments", t);
    }
    return pagedMetadata;
}
Also used : GuiFragmentDtoSmall(org.entando.entando.aps.system.services.guifragment.model.GuiFragmentDtoSmall) RestServerError(org.entando.entando.aps.system.exception.RestServerError)

Aggregations

GuiFragmentDtoSmall (org.entando.entando.aps.system.services.guifragment.model.GuiFragmentDtoSmall)2 RestServerError (org.entando.entando.aps.system.exception.RestServerError)1 RestAccessControl (org.entando.entando.web.common.annotation.RestAccessControl)1 RestResponse (org.entando.entando.web.common.model.RestResponse)1 ResponseEntity (org.springframework.http.ResponseEntity)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1