+ public void applySelected(Session session, VirtualGraph vg) throws DatabaseException {
+ List<PropertyChange> list = new ArrayList<PropertyChange>();
+ for (PropertyChange mod : updateList.getChanges()) {
+ if (mod.selected())
+ list.add(mod);
+ }
+ apply(session, list, "Apply selected model updates", vg);
+
+ updateTree.getUpdateOps().applySelected(session, vg);
+
+ }
+
+ protected void apply(WriteGraph graph, List<PropertyChange> list, String message) throws DatabaseException {
+ Layer0Utils.addCommentMetadata(graph, message);
+ graph.markUndoPoint();
+ for (PropertyChange mod : list) {
+ mod.apply(graph);
+ }
+ }
+
+ protected void apply(Session session, List<PropertyChange> list, String message, VirtualGraph vg) throws DatabaseException {
+ if (getChunkSize() > 0) {
+ for (int s = 0; s < list.size(); ) {
+ int e = s + getChunkSize();
+ if (e > list.size())
+ e = list.size();
+ List<PropertyChange> subList = updateList.getChanges().subList(e, e);
+ if (s == 0) {
+ session.syncRequest(new WriteRequest(vg) {
+ public void perform(WriteGraph graph) throws DatabaseException {
+ Layer0Utils.addCommentMetadata(graph, message);
+ graph.markUndoPoint();
+ }
+ });
+ }
+ session.syncRequest(new WriteRequest(vg) {
+
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ for (PropertyChange mod : subList) {
+ mod.apply(graph);
+ }
+ }
+ });
+ s = e;
+ }
+ } else {
+ session.syncRequest(new WriteRequest(vg) {
+
+ @Override
+ public void perform(WriteGraph graph) throws DatabaseException {
+ Layer0Utils.addCommentMetadata(graph, message);
+ graph.markUndoPoint();
+ for (PropertyChange mod : list) {
+ mod.apply(graph);
+ }
+ }
+ });
+ }
+ }