@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Create a plan", notes = "User must have the MANAGE_PLANS permission to use this service") @ApiResponses({ @ApiResponse(code = 201, message = "Plan successfully created", response = PlanEntity.class), @ApiResponse(code = 500, message = "Internal server error")}) @Permissions({ @Permission(value = API_PLAN, acls = CREATE) }) public Response createPlan( @PathParam("api") String api, @ApiParam(name = "plan", required = true) @Valid @NotNull NewPlanEntity newPlanEntity) { newPlanEntity.setApi(api); newPlanEntity.setType(PlanType.API); PlanEntity planEntity = planService.create(newPlanEntity); return Response .created(URI.create("/apis/" + api + "/plans/" + planEntity.getId())) .entity(planEntity) .build(); }
@POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) @ApiOperation(value = "Create a plan", notes = "User must have the MANAGE_PLANS permission to use this service") @ApiResponses({ @ApiResponse(code = 201, message = "Plan successfully created", response = PlanEntity.class), @ApiResponse(code = 500, message = "Internal server error")}) @Permissions({ @Permission(value = API_PLAN, acls = CREATE) }) public Response createPlan( @PathParam("api") String api, @ApiParam(name = "plan", required = true) @Valid @NotNull NewPlanEntity newPlanEntity) { newPlanEntity.setApi(api); newPlanEntity.setType(PlanType.API); PlanEntity planEntity = planService.create(newPlanEntity); return Response .created(URI.create("/apis/" + api + "/plans/" + planEntity.getId())) .entity(planEntity) .build(); }
if (planEntities == null || planEntities.isEmpty()) { NewPlanEntity newPlanEntity = objectMapper.readValue(planNode.toString(), NewPlanEntity.class); newPlanEntity.setApi(createdOrUpdatedApiEntity.getId()); planService.create(newPlanEntity); } else if (planEntities.size() == 1) {
if (planEntities == null || planEntities.isEmpty()) { NewPlanEntity newPlanEntity = objectMapper.readValue(planNode.toString(), NewPlanEntity.class); newPlanEntity.setApi(createdOrUpdatedApiEntity.getId()); planService.create(newPlanEntity); } else if (planEntities.size() == 1) {