@Override
public void run() {
ApplicationContext ctx = ApplicationContext.getInstance();
Date date = new Date();
LOGGER.debug("Starting update process on {}...",date);
try(WriteSession session = ctx.createSession()) {
ResourceSnapshot snapshot = session.find(ResourceSnapshot.class,this.name,DynamicResourceHandler.class);
DataSet dataSet = this.handler.get(snapshot);
Individual<?,?> individual =
dataSet.
individualOfId(
ManagedIndividualId.
createId(this.name, DynamicResourceHandler.ID));
individual.
addValue(
REFRESHED_ON,
Literals.of(date).dateTime());
this.handler.update(this.name, dataSet);
session.modify(snapshot);
session.saveChanges();
} catch (Exception e) {
LOGGER.error("Could not update resource",e);
} finally {
LOGGER.debug("Finalized update process");
}
}