Search in sources :

Example 1 with PageConfigurationDto

use of org.entando.entando.aps.system.services.page.model.PageConfigurationDto in project entando-core by entando.

the class PageConfigurationController method getPageConfiguration.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/pages/{pageCode}/configuration", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getPageConfiguration(@PathVariable String pageCode, @RequestParam(value = "status", required = false, defaultValue = IPageService.STATUS_DRAFT) String status) {
    logger.trace("requested {} configuration", pageCode);
    PageConfigurationDto pageConfiguration = this.getPageService().getPageConfiguration(pageCode, status);
    Map<String, String> metadata = new HashMap<>();
    metadata.put("status", status);
    return new ResponseEntity<>(new RestResponse(pageConfiguration, null, metadata), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) RestResponse(org.entando.entando.web.common.model.RestResponse) PageConfigurationDto(org.entando.entando.aps.system.services.page.model.PageConfigurationDto) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 2 with PageConfigurationDto

use of org.entando.entando.aps.system.services.page.model.PageConfigurationDto in project entando-core by entando.

the class PageService method getPageConfiguration.

@Override
public PageConfigurationDto getPageConfiguration(String pageCode, String status) {
    IPage page = this.loadPage(pageCode, status);
    if (null == page) {
        throw new RestRourceNotFoundException(ERRCODE_PAGE_NOT_FOUND, "page", pageCode);
    }
    PageConfigurationDto pageConfigurationDto = new PageConfigurationDto(page, status);
    return pageConfigurationDto;
}
Also used : RestRourceNotFoundException(org.entando.entando.aps.system.exception.RestRourceNotFoundException) IPage(com.agiletec.aps.system.services.page.IPage) PageConfigurationDto(org.entando.entando.aps.system.services.page.model.PageConfigurationDto)

Example 3 with PageConfigurationDto

use of org.entando.entando.aps.system.services.page.model.PageConfigurationDto in project entando-core by entando.

the class PageServiceWidgetIntegrationTest method testGetPageConfiguration.

public void testGetPageConfiguration() throws JsonProcessingException {
    IPage draftRoot = this.pageManager.getDraftRoot();
    PageConfigurationDto pageConfigurationDto = (PageConfigurationDto) this.pageService.getPageConfiguration(draftRoot.getCode(), IPageService.STATUS_DRAFT);
    ObjectMapper mapper = new ObjectMapper();
    String out = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(pageConfigurationDto);
    System.out.println(out);
}
Also used : IPage(com.agiletec.aps.system.services.page.IPage) PageConfigurationDto(org.entando.entando.aps.system.services.page.model.PageConfigurationDto) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Example 4 with PageConfigurationDto

use of org.entando.entando.aps.system.services.page.model.PageConfigurationDto in project entando-core by entando.

the class PageConfigurationController method getPageWidgets.

@RestAccessControl(permission = Permission.SUPERUSER)
@RequestMapping(value = "/pages/{pageCode}/widgets", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<?> getPageWidgets(@PathVariable String pageCode, @RequestParam(value = "status", required = false, defaultValue = IPageService.STATUS_DRAFT) String status) {
    logger.trace("requested {} widgets detail", pageCode);
    PageConfigurationDto pageConfiguration = this.getPageService().getPageConfiguration(pageCode, status);
    Map<String, String> metadata = new HashMap<>();
    metadata.put("status", status);
    return new ResponseEntity<>(new RestResponse(pageConfiguration.getWidgets(), null, metadata), HttpStatus.OK);
}
Also used : ResponseEntity(org.springframework.http.ResponseEntity) HashMap(java.util.HashMap) RestResponse(org.entando.entando.web.common.model.RestResponse) PageConfigurationDto(org.entando.entando.aps.system.services.page.model.PageConfigurationDto) RestAccessControl(org.entando.entando.web.common.annotation.RestAccessControl) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

PageConfigurationDto (org.entando.entando.aps.system.services.page.model.PageConfigurationDto)4 IPage (com.agiletec.aps.system.services.page.IPage)2 HashMap (java.util.HashMap)2 RestAccessControl (org.entando.entando.web.common.annotation.RestAccessControl)2 RestResponse (org.entando.entando.web.common.model.RestResponse)2 ResponseEntity (org.springframework.http.ResponseEntity)2 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)1