Skip to contentPackage: UnitOfWorkChangeSet
UnitOfWorkChangeSet
Coverage
1: /**
2: * Copyright (C) 2016 Czech Technical University in Prague
3: *
4: * This program is free software: you can redistribute it and/or modify it under
5: * the terms of the GNU General Public License as published by the Free Software
6: * Foundation, either version 3 of the License, or (at your option) any
7: * later version.
8: *
9: * This program is distributed in the hope that it will be useful, but WITHOUT
10: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12: * details. You should have received a copy of the GNU General Public License
13: * along with this program. If not, see <http://www.gnu.org/licenses/>.
14: */
15: package cz.cvut.kbss.jopa.sessions;
16:
17: import java.util.Collection;
18: import java.util.Set;
19:
20: public interface UnitOfWorkChangeSet {
21: /**
22: * Add new ObjectChangeSet to this changeSet.
23: *
24: * @param objectChangeSet ObjectChangeSet
25: */
26: void addObjectChangeSet(ObjectChangeSet objectChangeSet);
27:
28: /**
29: * Add a change set for newly created object. These changes are held in
30: * separate attribute and get special treatment when merged into shared
31: * session cache.
32: *
33: * @param newObject ObjectChangeSet
34: */
35: void addNewObjectChangeSet(ObjectChangeSet newObject);
36:
37: /**
38: * Adds a change set for deleted object.
39: *
40: * @param deletedObject The change set to add
41: */
42: void addDeletedObjectChangeSet(ObjectChangeSet deletedObject);
43:
44: /**
45: * Returns change sets for existing modified objects.
46: * <p/>
47: * New object and deleted object change sets are not included.
48: *
49: * @return Collection of change sets
50: */
51: Collection<ObjectChangeSet> getExistingObjectsChanges();
52:
53: /**
54: * Gets changes for the specified original object (if there are any).
55: *
56: * @param original The object for which changes should be found
57: * @return Object change set or null, if the object has no changes
58: */
59: ObjectChangeSet getExistingObjectChanges(Object original);
60:
61: /**
62: * Returns the collection of deleted objects.
63: *
64: * @return Set of change sets
65: */
66: Set<ObjectChangeSet> getDeletedObjects();
67:
68: /**
69: * Returns the collection of change sets for newly created objects.
70: *
71: * @return Set of change sets
72: */
73: Set<ObjectChangeSet> getNewObjects();
74:
75: /**
76: * Returns true if there are deleted objects in this change set.
77: *
78: * @return boolean
79: */
80: boolean hasDeleted();
81:
82: /**
83: * Returns true if this changeSet has any changes.
84: *
85: * @return boolean
86: */
87: boolean hasChanges();
88:
89: /**
90: * Are there any new objects in the change set?
91: *
92: * @return boolean
93: */
94: boolean hasNew();
95: }