Skip to contentPackage: ObjectChangeSet
ObjectChangeSet
Coverage
1: /*
2: * JOPA
3: * Copyright (C) 2023 Czech Technical University in Prague
4: *
5: * This library is free software; you can redistribute it and/or
6: * modify it under the terms of the GNU Lesser General Public
7: * License as published by the Free Software Foundation; either
8: * version 3.0 of the License, or (at your option) any later version.
9: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library.
17: */
18: package cz.cvut.kbss.jopa.sessions;
19:
20: import cz.cvut.kbss.jopa.model.descriptors.Descriptor;
21:
22: import java.net.URI;
23: import java.util.Set;
24:
25: public interface ObjectChangeSet {
26:
27: /**
28: * Adds a new change record to this change set.
29: * <p>
30: * If there was a change for attribute represented by the new record, it will be overwritten.
31: *
32: * @param record The record to add
33: */
34: void addChangeRecord(ChangeRecord record);
35:
36: /**
37: * Gets type of the changed object.
38: *
39: * @return Object type
40: */
41: Class<?> getObjectClass();
42:
43: /**
44: * Gets changes held in this change set.
45: *
46: * @return Set of changes
47: */
48: Set<ChangeRecord> getChanges();
49:
50: /**
51: * Whether this change set contains an changes.
52: *
53: * @return {@code true} if there are any changes in this change set, {@code false} otherwise
54: */
55: boolean hasChanges();
56:
57: /**
58: * Specifies whether this change set represents a new object.
59: *
60: * @param isNew Whether this is a new object's change set
61: */
62: void setNew(boolean isNew);
63:
64: /**
65: * Whether this is a new object's change set.
66: *
67: * @return Whether target object is new
68: */
69: boolean isNew();
70:
71: /**
72: * Gets the clone with changes.
73: *
74: * @return Clone
75: */
76: Object getCloneObject();
77:
78: /**
79: * Gets the original object.
80: *
81: * @return Original
82: */
83: Object getChangedObject();
84:
85: /**
86: * Gets descriptor of the changed object.
87: *
88: * @return Instance descriptor
89: */
90: Descriptor getEntityDescriptor();
91:
92: /**
93: * Gets ontology context URI, to which the changed object belongs.
94: *
95: * @return context URI
96: */
97: URI getEntityContext();
98: }