@Context HttpServletRequest request,
@PathParam("pushAppID") String id,
@PathParam("simplePushID") String simplePushID,
SimplePushVariant updatedSimplePushApplication) {
SimplePushVariant spVariant = (SimplePushVariant) variantService.findByVariantIDForDeveloper(simplePushID, extractUsername(request));
if (spVariant != null) {
// some validation
try {
validateModelClass(updatedSimplePushApplication);
} catch (ConstraintViolationException cve) {
// Build and return the 400 (Bad Request) response
ResponseBuilder builder = createBadRequestResponse(cve.getConstraintViolations());
return builder.build();
}
// apply updated data:
spVariant.setName(updatedSimplePushApplication.getName());
spVariant.setDescription(updatedSimplePushApplication.getDescription());
variantService.updateVariant(spVariant);
return Response.noContent().build();
}
return Response.status(Status.NOT_FOUND).entity("Could not find requested Variant").build();