+\r
+ /**\r
+ * Bumps the modification counter value of the event log of the specified\r
+ * events using {@link #bumpModificationCounter(WriteGraph, Resource)}.\r
+ * <p>\r
+ * The code assumes that all events are from the same log.\r
+ * \r
+ * @param graph\r
+ * @param forLogOfEvents\r
+ * @throws DatabaseException\r
+ */\r
+ public static void bumpModificationCounter(WriteGraph graph, List<Resource> forLogOfEvents) throws DatabaseException {\r
+ EventResource EVENT = EventResource.getInstance(graph);\r
+ for (Resource event : forLogOfEvents) {\r
+ Resource log = graph.syncRequest(new PossibleTypedParent(event, EVENT.EventLog));\r
+ if (log != null) {\r
+ bumpModificationCounter(graph, log);\r
+ return;\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Bumps the modification counter of the specified event log by 1.\r
+ * \r
+ * @param graph\r
+ * @param eventLog\r
+ * @return new modification counter value\r
+ * @throws DatabaseException\r
+ */\r
+ public static int bumpModificationCounter(WriteGraph graph, Resource eventLog) throws DatabaseException {\r
+ EventResource EVENT = EventResource.getInstance(graph);\r
+ Resource counter = graph.getPossibleObject(eventLog, EVENT.HasModificationCounter);\r
+ if (counter != null) {\r
+ Integer c = graph.getValue(counter, Bindings.INTEGER);\r
+ c = c == null ? 1 : c+1;\r
+ graph.claimValue(counter, c, Bindings.INTEGER);\r
+ return c;\r
+ }\r
+ return 0;\r
+ }\r
+\r