use of me.zhanghai.android.douya.network.api.info.apiv2.Image in project openstack4j by ContainX.
the class ImageServiceImpl method update.
/**
* {@inheritDoc}
*/
@Override
public Image update(Image image) {
checkNotNull(image);
ObjectMapper objectMapper = new ObjectMapper();
Image origImage = get(image.getId());
ObjectNode origJson;
ObjectNode newJson;
try {
String oImg = objectMapper.writeValueAsString(origImage);
origJson = (ObjectNode) objectMapper.readTree(oImg);
String img = objectMapper.writeValueAsString(image);
newJson = (ObjectNode) objectMapper.readTree(img);
JsonNode jsonDiff = JsonDiff.asJson(origJson, newJson);
GlanceImageUpdate giu = new GlanceImageUpdate(jsonDiff);
return update(image.getId(), giu);
} catch (IOException e) {
e.printStackTrace();
return null;
}
}
Aggregations