Skip to content

Package: JenaLists

JenaLists

nameinstructionbranchcomplexitylinemethod
JenaLists(JenaAdapter, Procedure, Procedure)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 5
100%
M: 0 C: 1
100%
executeBeforeCallbackAndVerifyArgument(ListDescriptor)
M: 0 C: 7
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
loadReferencedList(ReferencedListDescriptor)
M: 0 C: 9
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 2
100%
M: 0 C: 1
100%
loadSimpleList(SimpleListDescriptor)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 3
100%
M: 0 C: 1
100%
persistReferencedList(ReferencedListValueDescriptor)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
persistSimpleList(SimpleListValueDescriptor)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
updateReferencedList(ReferencedListValueDescriptor)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%
updateSimpleList(SimpleListValueDescriptor)
M: 0 C: 12
100%
M: 0 C: 0
100%
M: 0 C: 1
100%
M: 0 C: 4
100%
M: 0 C: 1
100%

Coverage

1: package cz.cvut.kbss.ontodriver.jena.list;
2:
3: import cz.cvut.kbss.ontodriver.Lists;
4: import cz.cvut.kbss.ontodriver.descriptor.*;
5: import cz.cvut.kbss.ontodriver.exception.OntoDriverException;
6: import cz.cvut.kbss.ontodriver.jena.JenaAdapter;
7: import cz.cvut.kbss.ontodriver.jena.util.Procedure;
8: import cz.cvut.kbss.ontodriver.model.Axiom;
9: import cz.cvut.kbss.ontodriver.model.NamedResource;
10:
11: import java.util.List;
12: import java.util.Objects;
13:
14: public class JenaLists implements Lists {
15:
16: private final JenaAdapter adapter;
17:
18: private final Procedure beforeCallback;
19: private final Procedure afterChangeCallback;
20:
21: public JenaLists(JenaAdapter adapter, Procedure beforeCallback, Procedure afterChangeCallback) {
22: this.adapter = adapter;
23: this.beforeCallback = beforeCallback;
24: this.afterChangeCallback = afterChangeCallback;
25: }
26:
27: @Override
28: public List<Axiom<NamedResource>> loadSimpleList(SimpleListDescriptor descriptor) throws OntoDriverException {
29: executeBeforeCallbackAndVerifyArgument(descriptor);
30: Objects.requireNonNull(descriptor);
31: return adapter.simpleListHandler().loadList(descriptor);
32: }
33:
34: private void executeBeforeCallbackAndVerifyArgument(ListDescriptor descriptor) throws OntoDriverException {
35: beforeCallback.execute();
36: Objects.requireNonNull(descriptor);
37: }
38:
39: @Override
40: public void persistSimpleList(SimpleListValueDescriptor descriptor) throws OntoDriverException {
41: executeBeforeCallbackAndVerifyArgument(descriptor);
42: adapter.simpleListHandler().persistList(descriptor);
43: afterChangeCallback.execute();
44: }
45:
46: @Override
47: public void updateSimpleList(SimpleListValueDescriptor descriptor) throws OntoDriverException {
48: executeBeforeCallbackAndVerifyArgument(descriptor);
49: adapter.simpleListHandler().updateList(descriptor);
50: afterChangeCallback.execute();
51: }
52:
53: @Override
54: public List<Axiom<NamedResource>> loadReferencedList(ReferencedListDescriptor descriptor)
55: throws OntoDriverException {
56: executeBeforeCallbackAndVerifyArgument(descriptor);
57: return adapter.referencedListHandler().loadList(descriptor);
58: }
59:
60: @Override
61: public void persistReferencedList(ReferencedListValueDescriptor descriptor) throws OntoDriverException {
62: executeBeforeCallbackAndVerifyArgument(descriptor);
63: adapter.referencedListHandler().persistList(descriptor);
64: afterChangeCallback.execute();
65: }
66:
67: @Override
68: public void updateReferencedList(ReferencedListValueDescriptor descriptor) throws OntoDriverException {
69: executeBeforeCallbackAndVerifyArgument(descriptor);
70: adapter.referencedListHandler().updateList(descriptor);
71: afterChangeCallback.execute();
72: }
73: }