use of org.hisp.dhis.common.VersionedObject in project dhis2-core by dhis2.
the class VersionedObjectObjectBundleHook method preUpdate.
@Override
public <T extends IdentifiableObject> void preUpdate(T object, T persistedObject, ObjectBundle bundle) {
if (VersionedObject.class.isInstance(object)) {
VersionedObject versionedObject = (VersionedObject) object;
versionedObject.increaseVersion();
}
}
use of org.hisp.dhis.common.VersionedObject in project dhis2-core by dhis2.
the class VersionedObjectObjectBundleHook method postCreate.
@Override
public <T extends IdentifiableObject> void postCreate(T persistedObject, ObjectBundle bundle) {
VersionedObject versionedObject = null;
if (Section.class.isInstance(persistedObject)) {
versionedObject = ((Section) persistedObject).getDataSet();
} else if (Option.class.isInstance(persistedObject)) {
versionedObject = ((Option) persistedObject).getOptionSet();
}
if (versionedObject != null) {
versionedObject.increaseVersion();
sessionFactory.getCurrentSession().save(versionedObject);
}
}
Aggregations