checkNotNull(id, "Can't modify an object with no id");
final ModificationProxy modificationProxy = ModificationProxy.handler(info);
Preconditions.checkNotNull(modificationProxy, "Not a modification proxy: ", info);
final Info oldObject = (Info) modificationProxy.getProxyObject();
cache.invalidate(id);
// get changed properties before h.commit()s
final Iterable<Property> changedProperties = dbMappings.changedProperties(oldObject, info);
// see HACK block bellow
final boolean updateResouceLayersName = info instanceof ResourceInfo
&& modificationProxy.getPropertyNames().contains("name");
modificationProxy.commit();
Map<String, ?> params;
// get the object's internal id
final Integer objectId = findObjectId(info);
final String blob;
try {
byte[] value = binding.objectToEntry(info);
blob = new String(value, "UTF-8");
} catch (UnsupportedEncodingException e) {
throw Throwables.propagate(e);
}
String updateStatement = "update object set blob = :blob where oid = :oid";
params = params("blob", blob, "oid", objectId);
logStatement(updateStatement, params);
template.update(updateStatement, params);
updateQueryableProperties(oldObject, objectId, changedProperties);
cache.invalidate(id);
Class<T> clazz = ClassMappings.fromImpl(oldObject.getClass()).getInterface();
// / <HACK>
// we're explicitly changing the resourceinfo's layer name property here because
// LayerInfo.getName() is a derived property. This can be removed once LayerInfo.name become
// a regular JavaBean property