@Path("{activation_key_id}")
@Produces(MediaType.APPLICATION_JSON)
public ActivationKey updateActivationKey(
@PathParam("activation_key_id") @Verify(ActivationKey.class) String activationKeyId,
ActivationKey key) {
ActivationKey toUpdate = activationKeyCurator.verifyAndLookupKey(activationKeyId);
if (key.getName() != null) {
toUpdate.setName(key.getName());
}
String serviceLevel = key.getServiceLevel();
if (serviceLevel != null) {
serviceLevelValidator.validate(toUpdate.getOwner(), serviceLevel);
toUpdate.setServiceLevel(serviceLevel);
}
if (key.getReleaseVer() != null) {
toUpdate.setReleaseVer(key.getReleaseVer());
}
if (key.getDescription() != null) {
toUpdate.setDescription(key.getDescription());
}
if (key.isAutoAttach() != null) {
toUpdate.setAutoAttach(key.isAutoAttach());
}
activationKeyCurator.merge(toUpdate);
return toUpdate;
}