Skip to contentPackage: ObjectChangeSet
ObjectChangeSet
Coverage
1: /**
2: * Copyright (C) 2022 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 cz.cvut.kbss.jopa.model.descriptors.Descriptor;
18:
19: import java.net.URI;
20: import java.util.Set;
21:
22: public interface ObjectChangeSet {
23:
24: /**
25: * Adds a new change record to this change set.
26: * <p>
27: * If there was a change for attribute represented by the new record, it will be overwritten.
28: *
29: * @param record The record to add
30: */
31: void addChangeRecord(ChangeRecord record);
32:
33: /**
34: * Gets type of the changed object.
35: *
36: * @return Object type
37: */
38: Class<?> getObjectClass();
39:
40: /**
41: * Gets changes held in this change set.
42: *
43: * @return Set of changes
44: */
45: Set<ChangeRecord> getChanges();
46:
47: /**
48: * Whether this change set contains an changes.
49: *
50: * @return {@code true} if there are any changes in this change set, {@code false} otherwise
51: */
52: boolean hasChanges();
53:
54: /**
55: * Specifies whether this change set represents a new object.
56: *
57: * @param isNew Whether this is a new object's change set
58: */
59: void setNew(boolean isNew);
60:
61: /**
62: * Whether this is a new object's change set.
63: *
64: * @return Whether target object is new
65: */
66: boolean isNew();
67:
68: /**
69: * Gets the clone with changes.
70: *
71: * @return Clone
72: */
73: Object getCloneObject();
74:
75: /**
76: * Gets the original object.
77: *
78: * @return Original
79: */
80: Object getChangedObject();
81:
82: /**
83: * Gets descriptor of the changed object.
84: *
85: * @return Instance descriptor
86: */
87: Descriptor getEntityDescriptor();
88:
89: /**
90: * Gets ontology context URI, to which the changed object belongs.
91: *
92: * @return context URI
93: */
94: URI getEntityContext();
95: }