Skip to content

Package: ChangeSetFactory

ChangeSetFactory

nameinstructionbranchcomplexitylinemethod
ChangeSetFactory()
M: 6 C: 0
0%
M: 0 C: 0
100%
M: 1 C: 0
0%
M: 2 C: 0
0%
M: 1 C: 0
0%
createDeleteObjectChange(Object, Object, Descriptor)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createNewObjectChange(Object, Descriptor)
M: 0 C: 6
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createObjectChangeSet(Object, Object, Descriptor)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
createUoWChangeSet()
M: 0 C: 4
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 1
100%
M: 0 C: 1
100%

Coverage

1: /*
2: * JOPA
3: * Copyright (C) 2024 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.change;
19:
20: import cz.cvut.kbss.jopa.model.descriptors.Descriptor;
21:
22: public class ChangeSetFactory {
23:
24: private ChangeSetFactory() {
25: throw new AssertionError();
26: }
27:
28: /**
29: * Creates change set for the specified UnitOfWork.
30: *
31: * @return New change set
32: */
33: public static UnitOfWorkChangeSet createUoWChangeSet() {
34: return new UnitOfWorkChangeSet();
35: }
36:
37: /**
38: * Creates new change set for the specified original-clone pair.
39: *
40: * @param original Original object
41: * @param clone Clone
42: * @param descriptor Entity descriptor
43: * @return New object change set
44: */
45: public static ObjectChangeSet createObjectChangeSet(Object original, Object clone, Descriptor descriptor) {
46: return new ObjectChangeSet(original, clone, descriptor);
47: }
48:
49: /**
50: * Creates a change representing object deletion.
51: *
52: * @param clone Deleted object clone
53: * @param original Original of the deleted object
54: * @param descriptor Entity descriptor
55: * @return Delete object change
56: */
57: public static DeleteObjectChange createDeleteObjectChange(Object clone, Object original, Descriptor descriptor) {
58: return new DeleteObjectChange(clone, original, descriptor);
59: }
60:
61: /**
62: * Creates a change representing object persist.
63: *
64: * @param newObject Persisted object
65: * @param descriptor Entity descriptor
66: * @return New object change
67: */
68: public static NewObjectChange createNewObjectChange(Object newObject, Descriptor descriptor) {
69: return new NewObjectChange(newObject, descriptor);
70: }
71: }