public abstract class OrientElement extends Object implements com.tinkerpop.blueprints.Element, OSerializableStream, Externalizable, OIdentifiable
Modifier and Type | Field and Description |
---|---|
protected boolean |
classicDetachMode |
static Object |
DEF_ORIGINAL_ID_FIELDNAME |
static String |
LABEL_FIELD_NAME |
protected OIdentifiable |
rawElement |
protected OrientConfigurableGraph.Settings |
settings |
Modifier | Constructor and Description |
---|---|
protected |
OrientElement(OrientBaseGraph rawGraph,
OIdentifiable iRawElement) |
Modifier and Type | Method and Description |
---|---|
OrientElement |
attach(OrientBaseGraph iNewGraph)
(Blueprints Extension) Replaces current graph instance with new one on @detach -ed elements.
|
protected void |
checkClass() |
protected boolean |
checkDeletedInTx() |
protected String |
checkForClassInSchema(String className)
Check if a class already exists, otherwise create it at the fly.
|
protected OrientBaseGraph |
checkIfAttached() |
int |
compare(OIdentifiable iFirst,
OIdentifiable iSecond) |
int |
compareTo(OIdentifiable iOther) |
protected void |
copyTo(OrientElement iCopy) |
OrientElement |
detach()
(Blueprints Extension) Removes the reference to the current graph instance to let working
offline.
|
boolean |
equals(Object object) |
OSerializableStream |
fromStream(byte[] stream)
(Blueprints Extension) Fills the Element from a byte[]
|
abstract String |
getBaseClassName() |
abstract String |
getElementType()
(Blueprints Extension) Returns the element type in form of String between "Vertex" and "Edge".
|
OrientBaseGraph |
getGraph()
(Blueprints Extension) Returns the Graph instance associated to the current element.
|
Object |
getId()
Returns the Element Id assuring to save it if it's transient yet.
|
ORID |
getIdentity()
(Blueprints Extension) Returns the record's identity.
|
abstract String |
getLabel() |
abstract Map<String,Object> |
getProperties()
(Blueprints Extension) Gets all the properties from a Vertex or Edge in one shot.
|
<T> T |
getProperty(String key)
Returns a Property value.
|
ODocument |
getRecord()
(Blueprints Extension) Returns the underlying record.
|
int |
hashCode() |
boolean |
isDetached()
(Blueprints Extension) Tells if the current element has been @detach ed.
|
boolean |
isLocked()
(Blueprints Extension) Checks if an Element is locked
|
void |
lock(boolean iExclusive)
(Blueprints Extension) Locks current Element to prevent concurrent access.
|
OStorage.LOCKING_STRATEGY |
lockingStrategy() |
void |
readExternal(ObjectInput in) |
void |
reload() |
<T> T |
removeProperty(String key)
Removes a Property.
|
void |
save()
(Blueprints Extension) Saves current element.
|
void |
save(String iClusterName)
(Blueprints Extension) Saves current element to a particular cluster.
|
protected OrientBaseGraph |
setCurrentGraphInThreadLocal() |
<T extends OrientElement> |
setProperties(Object... fields)
(Blueprints Extension) Sets multiple properties in one shot against Vertices and Edges.
|
protected <T extends OrientElement> |
setPropertiesInternal(Object... fields)
(Blueprints Extension) Sets multiple properties in one shot against Vertices and Edges without
saving the element.
|
void |
setProperty(String key,
Object value)
Sets a Property value.
|
void |
setProperty(String key,
Object value,
OType iType)
Sets a Property value specifying a type.
|
protected void |
setPropertyInternal(com.tinkerpop.blueprints.Element element,
ODocument doc,
String key,
Object value) |
void |
switchToAutoAttachmentMode()
Switches to auto attachment mode, when graph element is automatically attached to currently
open graph instance.
|
void |
switchToManualAttachmentMode(OrientBaseGraph iNewGraph)
Behavior is the same as for
attach(OrientBaseGraph) method. |
byte[] |
toStream()
(Blueprints Extension) Serializes the Element as byte[]
|
void |
unlock()
(Blueprints Extension) Unlocks previous acquired @lock against the Element.
|
void |
validateProperty(com.tinkerpop.blueprints.Element element,
String key,
Object value)
(Blueprints Extension) Validates an Element property.
|
void |
writeExternal(ObjectOutput out) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public static final String LABEL_FIELD_NAME
public static final Object DEF_ORIGINAL_ID_FIELDNAME
protected boolean classicDetachMode
protected transient OrientConfigurableGraph.Settings settings
protected OIdentifiable rawElement
protected OrientElement(OrientBaseGraph rawGraph, OIdentifiable iRawElement)
public abstract String getLabel()
public abstract String getBaseClassName()
public abstract String getElementType()
public abstract Map<String,Object> getProperties()
protected boolean checkDeletedInTx()
public <T extends OrientElement> T setProperties(Object... fields)
vertex.setProperties( "name", "Jill", "age", 33, "city", "Rome", "born", "Victoria, TX" );
You can also pass a Map of values as first argument. In this case all the map entries
will be set as element properties:
Map
fields
- Odd number of fields to set as repeating pairs of key, value, or if one parameter
is received and it's a Map, the Map entries are used as field key/value pairs.public void setProperty(String key, Object value)
setProperty
in interface com.tinkerpop.blueprints.Element
key
- Property namevalue
- Property valuepublic void setProperty(String key, Object value, OType iType)
key
- Property namevalue
- Property valueiType
- Type to setpublic <T> T removeProperty(String key)
removeProperty
in interface com.tinkerpop.blueprints.Element
key
- Property namepublic <T> T getProperty(String key)
getProperty
in interface com.tinkerpop.blueprints.Element
key
- Property namepublic Object getId()
getId
in interface com.tinkerpop.blueprints.Element
public void save()
public void save(String iClusterName)
iClusterName
- Cluster name or null to use the default "E"public byte[] toStream() throws OSerializationException
toStream
in interface OSerializableStream
OSerializationException
- if the marshalling does not succeedOSerializableStream.fromStream(byte[])
public OSerializableStream fromStream(byte[] stream) throws OSerializationException
fromStream
in interface OSerializableStream
stream
- byte array representation of the objectOSerializationException
- if the unmarshalling does not succeedpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void lock(boolean iExclusive)
lock
in interface OIdentifiable
iExclusive
- True = Exclusive Lock, False = Shared Locklock(boolean)
public boolean isLocked()
isLocked
in interface OIdentifiable
public OStorage.LOCKING_STRATEGY lockingStrategy()
lockingStrategy
in interface OIdentifiable
public void unlock()
unlock
in interface OIdentifiable
lock(boolean)
public ORID getIdentity()
getIdentity
in interface OIdentifiable
public ODocument getRecord()
getRecord
in interface OIdentifiable
public OrientElement detach()
This methods works only in "classic detach/attach mode" when dettachment/attachment is done manually, by default it is done automatically, and currently active graph connection will be used as graph elements owner.
#attach(OrientBaseGraph), #isDetached
public void switchToAutoAttachmentMode()
public void switchToManualAttachmentMode(OrientBaseGraph iNewGraph)
attach(OrientBaseGraph)
method.public OrientElement attach(OrientBaseGraph iNewGraph)
This methods works only in "classic detach/attach mode" when detachment/attachment is done manually, by default it is done automatically, and currently active graph connection will be used as graph elements owner.
To set "classic detach/attach mode" please set custom database parameter
classicDetachMode
to true
.
iNewGraph
- The new Graph instance to use.#detach(), #isDetached
public boolean isDetached()
This methods works only in "classic detach/attach mode" when detachment/attachment is done manually, by default it is done automatically, and currently active graph connection will be used as graph elements owner.
To set "classic detach/attach mode" please set custom database parameter
classicDetachMode
to true
.
#attach(OrientBaseGraph), #detach
public boolean equals(Object object)
equals
in interface Comparator<OIdentifiable>
equals
in class Object
public int compare(OIdentifiable iFirst, OIdentifiable iSecond)
compare
in interface Comparator<OIdentifiable>
public int compareTo(OIdentifiable iOther)
compareTo
in interface Comparable<OIdentifiable>
public OrientBaseGraph getGraph()
public final void validateProperty(com.tinkerpop.blueprints.Element element, String key, Object value) throws IllegalArgumentException
element
- Element instancekey
- Property namevalue
- property valueIllegalArgumentException
public void reload()
protected void copyTo(OrientElement iCopy)
protected void checkClass()
protected String checkForClassInSchema(String className)
className
- Class's nameprotected void setPropertyInternal(com.tinkerpop.blueprints.Element element, ODocument doc, String key, Object value)
protected OrientBaseGraph setCurrentGraphInThreadLocal()
protected OrientBaseGraph checkIfAttached()
protected <T extends OrientElement> T setPropertiesInternal(Object... fields)
vertex.setProperties( "name", "Jill", "age", 33, "city", "Rome", "born", "Victoria, TX" );
You can also pass a Map of values as first argument. In this case all the map entries
will be set as element properties:
Map
fields
- Odd number of fields to set as repeating pairs of key, value, or if one parameter
is received and it's a Map, the Map entries are used as field key/value pairs.Copyright © 2009–2020 OrientDB. All rights reserved.