Package com.arcadedb.graph
Class MutableVertex
- java.lang.Object
-
- com.arcadedb.database.BaseRecord
-
- com.arcadedb.database.BaseDocument
-
- com.arcadedb.database.MutableDocument
-
- com.arcadedb.graph.MutableVertex
-
- All Implemented Interfaces:
Document
,Identifiable
,Record
,RecordInternal
,Vertex
,VertexInternal
,Externalizable
,Serializable
public class MutableVertex extends MutableDocument implements VertexInternal
Mutable vertex that supports updates. After any changes, call the methodsave()
to mark the record as dirty in the current transaction, so the changes will be persistent atTransaction.commit()
time.- Author:
- Luca Garulli ([email protected])
- See Also:
ImmutableVertex
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.arcadedb.graph.Vertex
Vertex.DIRECTION
-
-
Field Summary
-
Fields inherited from class com.arcadedb.database.MutableDocument
dirty, map
-
Fields inherited from class com.arcadedb.database.BaseDocument
propertiesStartingPosition, type
-
Fields inherited from class com.arcadedb.database.BaseRecord
buffer, database, rid
-
Fields inherited from interface com.arcadedb.database.Document
RECORD_TYPE
-
Fields inherited from interface com.arcadedb.graph.Vertex
RECORD_TYPE
-
-
Constructor Summary
Constructors Constructor Description MutableVertex(Database graph, VertexType type, RID rid)
Creation constructor.MutableVertex(Database graph, VertexType type, RID rid, Binary buffer)
Copy constructor from ImmutableVertex.modify().
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vertex
asVertex()
Returns the vertex record.Vertex
asVertex(boolean loadContent)
Returns the vertex record.long
countEdges(Vertex.DIRECTION direction, String edgeType)
MutableVertex
fromJSON(JSONObject json)
MutableVertex
fromMap(Map<String,Object> map)
Iterable<Edge>
getEdges()
Iterable<Edge>
getEdges(Vertex.DIRECTION direction, String... edgeTypes)
RID
getInEdgesHeadChunk()
RID
getOutEdgesHeadChunk()
byte
getRecordType()
Iterable<Vertex>
getVertices()
Returns all the connected vertices, both directions, any edge type.Iterable<Vertex>
getVertices(Vertex.DIRECTION direction, String... edgeTypes)
Returns the connected vertices.boolean
isConnectedTo(Identifiable toVertex)
boolean
isConnectedTo(Identifiable toVertex, Vertex.DIRECTION direction)
boolean
isConnectedTo(Identifiable toVertex, Vertex.DIRECTION direction, String edgeTypes)
MutableVertex
modify()
MutableEdge
newEdge(String edgeType, Identifiable toVertex, boolean bidirectional, Object... properties)
ImmutableLightEdge
newLightEdge(String edgeType, Identifiable toVertex, boolean bidirectional)
void
reload()
MutableVertex
save()
MutableVertex
save(String bucketName)
MutableVertex
set(Object... properties)
Sets the property values in the document.MutableVertex
set(String name, Object value)
Sets the property value in the document.void
setBuffer(Binary buffer)
void
setInEdgesHeadChunk(RID inEdges)
void
setOutEdgesHeadChunk(RID outEdges)
JSONObject
toJSON(boolean includeMetadata)
Map<String,Object>
toMap(boolean includeMetadata)
Returns a map containing the document properties.-
Methods inherited from class com.arcadedb.database.MutableDocument
checkForLazyLoadingProperties, convertValueToSchemaType, get, getPropertyNames, has, isDirty, merge, newEmbeddedDocument, newEmbeddedDocument, newEmbeddedDocument, propertiesAsMap, remove, set, setIdentity, toString, unsetDirty, validate
-
Methods inherited from class com.arcadedb.database.BaseDocument
asDocument, asDocument, detach, getBinary, getBoolean, getByte, getCalendar, getDate, getDecimal, getDouble, getEmbedded, getFloat, getInstant, getInteger, getList, getLocalDate, getLocalDateTime, getLong, getMap, getShort, getString, getType, getTypeName, getZonedDateTime, readExternal, writeExternal
-
Methods inherited from class com.arcadedb.database.BaseRecord
asEdge, asEdge, delete, equals, getBuffer, getDatabase, getIdentity, getRecord, getRecord, hashCode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.arcadedb.database.Document
asDocument, asDocument, detach, get, getBinary, getBoolean, getByte, getCalendar, getDate, getDecimal, getDouble, getEmbedded, getFloat, getInstant, getInteger, getList, getLocalDate, getLocalDateTime, getLong, getMap, getPropertyNames, getShort, getString, getType, getTypeName, getZonedDateTime, has, propertiesAsMap, toMap
-
Methods inherited from interface com.arcadedb.database.Identifiable
asEdge, asEdge, getRecord, getRecord
-
Methods inherited from interface com.arcadedb.database.Record
delete, getDatabase, getIdentity, toJSON
-
Methods inherited from interface com.arcadedb.database.RecordInternal
getBuffer
-
-
-
-
Constructor Detail
-
MutableVertex
public MutableVertex(Database graph, VertexType type, RID rid)
Creation constructor.
-
MutableVertex
public MutableVertex(Database graph, VertexType type, RID rid, Binary buffer)
Copy constructor from ImmutableVertex.modify().
-
-
Method Detail
-
save
public MutableVertex save()
- Overrides:
save
in classMutableDocument
-
save
public MutableVertex save(String bucketName)
- Overrides:
save
in classMutableDocument
-
reload
public void reload()
- Specified by:
reload
in interfaceRecord
- Overrides:
reload
in classMutableDocument
-
fromMap
public MutableVertex fromMap(Map<String,Object> map)
- Overrides:
fromMap
in classMutableDocument
-
fromJSON
public MutableVertex fromJSON(JSONObject json)
- Overrides:
fromJSON
in classMutableDocument
-
set
public MutableVertex set(String name, Object value)
Description copied from class:MutableDocument
Sets the property value in the document. If the property has been defined in the schema, the value is converted according to the property type.- Overrides:
set
in classMutableDocument
-
set
public MutableVertex set(Object... properties)
Description copied from class:MutableDocument
Sets the property values in the document. If any properties has been defined in the schema, the value is converted according to the property type.- Overrides:
set
in classMutableDocument
- Parameters:
properties
- Array containing pairs of name (String) and value (Object)
-
setBuffer
public void setBuffer(Binary buffer)
- Specified by:
setBuffer
in interfaceRecordInternal
- Overrides:
setBuffer
in classMutableDocument
-
modify
public MutableVertex modify()
-
getOutEdgesHeadChunk
public RID getOutEdgesHeadChunk()
- Specified by:
getOutEdgesHeadChunk
in interfaceVertexInternal
-
getInEdgesHeadChunk
public RID getInEdgesHeadChunk()
- Specified by:
getInEdgesHeadChunk
in interfaceVertexInternal
-
setOutEdgesHeadChunk
public void setOutEdgesHeadChunk(RID outEdges)
- Specified by:
setOutEdgesHeadChunk
in interfaceVertexInternal
-
setInEdgesHeadChunk
public void setInEdgesHeadChunk(RID inEdges)
- Specified by:
setInEdgesHeadChunk
in interfaceVertexInternal
-
getRecordType
public byte getRecordType()
- Specified by:
getRecordType
in interfaceRecord
- Overrides:
getRecordType
in classBaseDocument
-
newEdge
public MutableEdge newEdge(String edgeType, Identifiable toVertex, boolean bidirectional, Object... properties)
-
newLightEdge
public ImmutableLightEdge newLightEdge(String edgeType, Identifiable toVertex, boolean bidirectional)
- Specified by:
newLightEdge
in interfaceVertex
-
countEdges
public long countEdges(Vertex.DIRECTION direction, String edgeType)
- Specified by:
countEdges
in interfaceVertex
-
getEdges
public Iterable<Edge> getEdges(Vertex.DIRECTION direction, String... edgeTypes)
-
getVertices
public Iterable<Vertex> getVertices()
Description copied from interface:Vertex
Returns all the connected vertices, both directions, any edge type.- Specified by:
getVertices
in interfaceVertex
- Returns:
- An iterator of PIndexCursorEntry entries
-
getVertices
public Iterable<Vertex> getVertices(Vertex.DIRECTION direction, String... edgeTypes)
Description copied from interface:Vertex
Returns the connected vertices.- Specified by:
getVertices
in interfaceVertex
- Parameters:
direction
- Direction between OUT, IN or BOTH- Returns:
- An iterator of PIndexCursorEntry entries
-
isConnectedTo
public boolean isConnectedTo(Identifiable toVertex)
- Specified by:
isConnectedTo
in interfaceVertex
-
isConnectedTo
public boolean isConnectedTo(Identifiable toVertex, Vertex.DIRECTION direction)
- Specified by:
isConnectedTo
in interfaceVertex
-
isConnectedTo
public boolean isConnectedTo(Identifiable toVertex, Vertex.DIRECTION direction, String edgeTypes)
- Specified by:
isConnectedTo
in interfaceVertex
-
asVertex
public Vertex asVertex()
Description copied from interface:Identifiable
Returns the vertex record. If the record is not a vertex, a UnsupportedOperationException exception is thrown.- Specified by:
asVertex
in interfaceIdentifiable
- Specified by:
asVertex
in interfaceVertex
- Overrides:
asVertex
in classBaseRecord
- Returns:
- the
Vertex
-
asVertex
public Vertex asVertex(boolean loadContent)
Description copied from interface:Identifiable
Returns the vertex record. If the record is not a vertex, a UnsupportedOperationException exception is thrown.- Specified by:
asVertex
in interfaceIdentifiable
- Specified by:
asVertex
in interfaceVertex
- Overrides:
asVertex
in classBaseRecord
- Parameters:
loadContent
- specifies if pre-load the record content- Returns:
- the
Vertex
-
toMap
public Map<String,Object> toMap(boolean includeMetadata)
Description copied from interface:Document
Returns a map containing the document properties.- Specified by:
toMap
in interfaceDocument
- Overrides:
toMap
in classMutableDocument
- Parameters:
includeMetadata
- true to include metadata such as `@rid`, `@type` and `@cat`, otherwise only the document properties
-
toJSON
public JSONObject toJSON(boolean includeMetadata)
- Specified by:
toJSON
in interfaceRecord
- Overrides:
toJSON
in classMutableDocument
-
-