public abstract boolean isAdd();
public abstract boolean isDelete();
+ public boolean isChange() {
+ return isAdd() || isDelete();
+ }
+
+ /**
+ * Is parent operation applied before this.
+ * @return
+ */
public abstract boolean requiresParentOps();
+ /**
+ * Is child operation applied before this.
+ * @return
+ */
public abstract boolean requiresSubOps();
+ /**
+ * Is parent operation selected when this is selected
+ * @return
+ */
+ public boolean selectParentOps() {
+ return requiresParentOps();
+ }
+
+ /**
+ * Is child operation selected when this is selected
+ * @return
+ */
+ public boolean selectSubOps() {
+ return requiresSubOps();
+ }
+
public boolean select(boolean select) {
boolean b = _select(select);
if (b)
private boolean _select(boolean select) {
if (select == selected)
return true;
+ if (applied)
+ return false;
if (select) {
- if (requiresParentOps()) {
+ if (selectParentOps()) {
for (UpdateOp op : parentOps)
op._select(true);
}
selected = true;
manualSelection = false;
- if (requiresSubOps()) {
+ if (selectSubOps()) {
for (UpdateOp op : subOps)
op._select(true);
}
selected = false;
manualSelection = false;
for (UpdateOp op : subOps) {
- if (op.requiresParentOps())
+ if (op.selectParentOps())
op._select(false);
else if (!op.manualSelection)
op._select(false);
}
for (UpdateOp op : parentOps)
- if (op.requiresSubOps())
+ if (op.selectSubOps())
op._select(false);
return true;
}
}
+ /**
+ * Applies the changes into the database.
+ *
+ * @param g
+ * @throws DatabaseException
+ */
protected abstract void _apply(WriteGraph g) throws DatabaseException;
/**