Search in sources :

Example 1 with NewPageEntity

use of io.gravitee.management.model.NewPageEntity in project gravitee-management-rest-api by gravitee-io.

the class PortalPagesResource method createPage.

@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value = "Create a page", notes = "User must be ADMIN to use this service")
@ApiResponses({ @ApiResponse(code = 201, message = "Page successfully created", response = PageEntity.class), @ApiResponse(code = 500, message = "Internal server error") })
@Permissions({ @Permission(value = RolePermission.PORTAL_DOCUMENTATION, acls = RolePermissionAction.CREATE) })
public Response createPage(@ApiParam(name = "page", required = true) @Valid @NotNull NewPageEntity newPageEntity) {
    int order = pageService.findMaxPortalPageOrder() + 1;
    newPageEntity.setOrder(order);
    newPageEntity.setLastContributor(getAuthenticatedUser());
    PageEntity newPage = pageService.createPortalPage(newPageEntity);
    if (newPage != null) {
        return Response.created(URI.create("/portal/pages/" + newPage.getId())).entity(newPage).build();
    }
    return Response.serverError().build();
}
Also used : UpdatePageEntity(io.gravitee.management.model.UpdatePageEntity) NewPageEntity(io.gravitee.management.model.NewPageEntity) PageEntity(io.gravitee.management.model.PageEntity) Permissions(io.gravitee.management.rest.security.Permissions)

Aggregations

NewPageEntity (io.gravitee.management.model.NewPageEntity)1 PageEntity (io.gravitee.management.model.PageEntity)1 UpdatePageEntity (io.gravitee.management.model.UpdatePageEntity)1 Permissions (io.gravitee.management.rest.security.Permissions)1