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();
}
Aggregations