}
}
private void validateUpdate(Entity oldEntity, Entity newEntity) throws IvoryException {
if (oldEntity.getEntityType() != newEntity.getEntityType() || !oldEntity.equals(newEntity))
throw new IvoryException(oldEntity.toShortString() + " can't be updated with " + newEntity.toShortString());
if (oldEntity.getEntityType() == EntityType.CLUSTER)
throw new IvoryException("Update not supported for clusters");
String[] props = oldEntity.getEntityType().getImmutableProperties();
for (String prop : props) {
Object oldProp, newProp;
try {
oldProp = PropertyUtils.getProperty(oldEntity, prop);
newProp = PropertyUtils.getProperty(newEntity, prop);
} catch (Exception e) {
throw new IvoryException(e);
}
if (!ObjectUtils.equals(oldProp, newProp))
throw new ValidationException(oldEntity.toShortString() + ": " + prop + " can't be changed");
}
}