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