-
Notifications
You must be signed in to change notification settings - Fork 868
/
ODocumentEntry.java
118 lines (99 loc) · 3.15 KB
/
ODocumentEntry.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
/*
*
* * Copyright 2015 OrientDB LTD (info(-at-)orientdb.com)
* *
* * Licensed under the Apache License, Version 2.0 (the "License");
* * you may not use this file except in compliance with the License.
* * You may obtain a copy of the License at
* *
* * http://www.apache.org/licenses/LICENSE-2.0
* *
* * Unless required by applicable law or agreed to in writing, software
* * distributed under the License is distributed on an "AS IS" BASIS,
* * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* * See the License for the specific language governing permissions and
* * limitations under the License.
* *
* * For more information: http://orientdb.com
*
*/
package com.orientechnologies.orient.core.record.impl;
import com.orientechnologies.orient.core.db.record.OMultiValueChangeTimeLine;
import com.orientechnologies.orient.core.metadata.schema.OProperty;
import com.orientechnologies.orient.core.metadata.schema.OType;
import java.util.Map;
/**
* Document entry. Used by ODocument.
*
* @author Emanuele Tagliaferri
* @since 2.1
*/
public class ODocumentEntry {
public Object value;
public Object original;
public OType type;
public OProperty property;
public OSimpleMultiValueChangeListener<Object, Object> changeListener;
public OMultiValueChangeTimeLine<Object, Object> timeLine;
public boolean changed = false;
public boolean exist = true;
public boolean created = false;
public ODocumentEntry() {
}
public boolean isChanged() {
return changed;
}
public boolean isChangedTree(){
if (changed && exist){
return true;
}
if (value instanceof ODocument){
ODocument doc = (ODocument)value;
for (Map.Entry<String, ODocumentEntry> field : doc._fields.entrySet()){
if (field.getValue().isChangedTree()){
return true;
}
}
}
return false;
}
public boolean hasNonExistingTree(){
if (!exist){
return true;
}
if (value instanceof ODocument){
ODocument doc = (ODocument)value;
for (Map.Entry<String, ODocumentEntry> field : doc._fields.entrySet()){
if (field.getValue().hasNonExistingTree()){
return true;
}
}
}
return false;
}
public void setChanged(final boolean changed) {
this.changed = changed;
}
public boolean exist() {
return exist;
}
public void setExist(final boolean exist) {
this.exist = exist;
}
public boolean isCreated() {
return created;
}
public void setCreated(final boolean created) {
this.created = created;
}
protected ODocumentEntry clone() {
final ODocumentEntry entry = new ODocumentEntry();
entry.type = type;
entry.property = property;
entry.value = value;
entry.changed = changed;
entry.created = created;
entry.exist = exist;
return entry;
}
}