@Context HttpServletRequest request,
@PathParam("pushAppID") String id,
@PathParam("chromeAppID") String chromeAppID,
ChromePackagedAppVariant updatedChromePackagedApplication) {
ChromePackagedAppVariant chromePackagedAppVariant = (ChromePackagedAppVariant) variantService.findByVariantIDForDeveloper(chromeAppID, extractUsername(request));
if (chromePackagedAppVariant != null) {
// poor validation
//is different
if (updatedChromePackagedApplication.getClientSecret() == null) {
return Response.status(Response.Status.BAD_REQUEST).build();
}
// apply updated data:
chromePackagedAppVariant.setClientId(updatedChromePackagedApplication.getClientId());
chromePackagedAppVariant.setClientSecret(updatedChromePackagedApplication.getClientSecret());
chromePackagedAppVariant.setRefreshToken(updatedChromePackagedApplication.getRefreshToken());
chromePackagedAppVariant.setName(updatedChromePackagedApplication.getName());
chromePackagedAppVariant.setDescription(updatedChromePackagedApplication.getDescription());
variantService.updateVariant(chromePackagedAppVariant);
return Response.noContent().build();
}
return Response.status(Response.Status.NOT_FOUND).entity("Could not find requested Variant").build();