Class EncryptedOrient
java.lang.Object
com.orientechnologies.orient.core.record.ORecordAbstract
com.orientechnologies.orient.core.record.impl.ODocument
org.gcube.informationsystem.resourceregistry.persistence.orientdb.utils.EncryptedOrient
- All Implemented Interfaces:
com.orientechnologies.orient.core.db.record.ODetachable,com.orientechnologies.orient.core.db.record.OIdentifiable,com.orientechnologies.orient.core.db.record.ORecordElement,com.orientechnologies.orient.core.record.OElement,com.orientechnologies.orient.core.record.ORecord,com.orientechnologies.orient.core.record.ORecordSchemaAware,com.orientechnologies.orient.core.serialization.OSerializableStream,Externalizable,Serializable,Comparable<com.orientechnologies.orient.core.db.record.OIdentifiable>,Iterable<Map.Entry<String,,Object>> Comparator<com.orientechnologies.orient.core.db.record.OIdentifiable>,org.gcube.informationsystem.base.reference.Element,org.gcube.informationsystem.base.reference.properties.PropertyElement,org.gcube.informationsystem.base.reference.SchemaMixedElement,org.gcube.informationsystem.model.reference.ModelElement,org.gcube.informationsystem.model.reference.properties.Encrypted,org.gcube.informationsystem.model.reference.properties.Property
public class EncryptedOrient
extends com.orientechnologies.orient.core.record.impl.ODocument
implements org.gcube.informationsystem.model.reference.properties.Encrypted
The EncryptedOrient class extends ODocument and implements the Encrypted interface.
It provides functionality for handling encrypted values within an OrientDB document.
This class includes methods for setting and getting encrypted and decrypted values, as well as methods for encrypting values using database and context keys.
Fields:
NAME- The name of the encrypted document type.VALUE- The field name for the encrypted value.decryptedValue- The decrypted value of the document.dbEncryptedValue- The value encrypted with the database key.contextEncryptedValue- The value encrypted with the context key.
Constructors:
EncryptedOrient()- Default constructor initializing the document with the encrypted type name.EncryptedOrient(String iClassName)- Protected constructor initializing the document with a specified class name.
Methods:
getTypeName()- Returns the type name of the class.getSupertypes()- Returns a list of super types for the class.getExpectedType()- Returns the expected type (currently returns null).getEncryptedValue()- Returns the encrypted value from the document field.setEncryptedValue(String encryptedValue)- Sets the encrypted value in the document field.getDecryptedValue()- Returns the decrypted value.getDbEncryptedValue()- Returns the value encrypted with the database key.getContextEncryptedValue()- Returns the value encrypted with the context key.setDecryptedValue(String decryptedValue, boolean setEncryptedForContext)- Sets the decrypted value and encrypts it using both database and context keys. Optionally sets the encrypted value for the context.getAdditionalProperties()- Returns additional properties (currently returns null).setAdditionalProperties(Map<String, Object> additionalProperties)- Sets additional properties (currently does nothing).getAdditionalProperty(String key)- Returns an additional property by key (currently returns null).setAdditionalProperty(String key, Object value)- Sets an additional property by key (currently does nothing).getValue()- Returns the encrypted value.setValue(String value)- Sets the encrypted value.toJSON(String iFormat)- Converts the document to a JSON string and replaces the type using OrientDBUtility.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement
com.orientechnologies.orient.core.db.record.ORecordElement.STATUS -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected StringThe value encrypted using the context-specific key.protected StringThe value encrypted using the database symmetric key.protected StringThe decrypted plain text value.static final StringThe schema type name of the encrypted property vertex.static final StringThe database field property name containing the encrypted value string.Fields inherited from class com.orientechnologies.orient.core.record.impl.ODocument
_allowChainedAccess, _fields, _fieldSize, _lazyLoad, _ordered, _owners, _schema, _trackingChanges, EMPTY_STRINGS, RECORD_TYPEFields inherited from class com.orientechnologies.orient.core.record.ORecordAbstract
_contentChanged, _dirty, _dirtyManager, _listeners, _recordFormat, _recordId, _recordVersion, _size, _source, _statusFields inherited from interface org.gcube.informationsystem.base.reference.Element
DATETIME_PATTERN, REDACTED, TYPE_PROPERTY, UNKNOWN_USERFields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY -
Constructor Summary
ConstructorsModifierConstructorDescriptionDefault constructor initializing the document with the encrypted type class name.protectedEncryptedOrient(String iClassName) Protected constructor initializing the document with a specified class name. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value encrypted using the context-specific key.Returns the value encrypted using the database symmetric key.Returns the decrypted plain text value.Returns the encrypted value from the document.getValue()voidsetAdditionalProperties(Map<String, Object> additionalProperties) voidsetAdditionalProperty(String key, Object value) voidsetDecryptedValue(String decryptedValue, boolean setEncryptedForContext) Sets the decrypted value and encrypts it using both the database key and the context key.voidsetEncryptedValue(String encryptedValue) Sets the encrypted value in the document.voidMethods inherited from class com.orientechnologies.orient.core.record.impl.ODocument
addOwner, asEdge, asVertex, autoConvertFieldsToClass, autoConvertValues, checkClass, checkFieldName, checkForFields, clear, clearSource, clearTrackData, containsField, convertAllMultiValuesToTrackedVersions, copy, copyTo, deserializeFields, detach, equals, eval, eval, field, field, field, field, field, fieldNames, fields, fields, fields, fieldType, fieldValues, fill, fill, fillClassIfNeed, fromJSON, fromJSON, fromJSON, fromJSON, fromMap, fromStream, fromString, getClassName, getCollectionTimeLine, getDirtyFields, getGlobalPropertyById, getImmutableSchemaClass, getImmutableSchemaClass, getOrCreate, getOriginalValue, getOwner, getOwners, getProperty, getPropertyNames, getRawEntries, getRawProperty, getRecordType, getSchemaClass, getSchemaType, hashCode, hasOwners, hasSameContentOf, internalReset, isAllowChainedAccess, isEdge, isEmbedded, isEmpty, isLazyLoad, isOrdered, isTrackingChanges, isVertex, iterator, load, load, load, merge, merge, mergeMap, placeholder, rawContainsField, rawField, rawField, readExternal, reload, removeField, removeOwner, removeProperty, reset, save, save, save, setAllowChainedAccess, setClass, setClassName, setClassNameIfExists, setDirty, setDirtyNoChanged, setFieldType, setLazyLoad, setOrdered, setProperty, setProperty, setTrackingChanges, setup, toMap, toStream, toStream, toString, toString, track, undo, undo, unload, unTrack, validate, validateEmbedded, validateField, validateLink, validateLinkCollection, validateType, writeExternalMethods inherited from class com.orientechnologies.orient.core.record.ORecordAbstract
addIdentityChangeListener, addListener, checkForLoading, compare, compareTo, delete, flatCopy, getDatabase, getDatabaseIfDefined, getDatabaseIfDefinedInternal, getDatabaseInternal, getDirtyManager, getIdentity, getInternalStatus, getRecord, getSize, getVersion, invokeListenerEvent, isContentChanged, isDirty, isLocked, load, lock, lockingStrategy, onAfterIdentityChanged, onBeforeIdentityChanged, reload, reload, reload, removeIdentityChangeListener, removeListener, save, setContentChanged, setDirtyManager, setIdentity, setIdentity, setInternalStatus, setVersion, toJSON, toJSON, toJSON, unlock, unsetDirtyMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Comparable
compareToMethods inherited from interface java.util.Comparator
compare, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface com.orientechnologies.orient.core.db.record.OIdentifiable
getRecord, isLocked, lock, lockingStrategy, unlockMethods inherited from interface com.orientechnologies.orient.core.record.ORecord
delete, getDatabase, getIdentity, getSize, getVersion, isDirty, load, reload, reload, save, toJSONMethods inherited from interface com.orientechnologies.orient.core.db.record.ORecordElement
getInternalStatus, setInternalStatus
-
Field Details
-
NAME
The schema type name of the encrypted property vertex.- See Also:
-
VALUE
The database field property name containing the encrypted value string.- See Also:
-
decryptedValue
The decrypted plain text value. -
dbEncryptedValue
The value encrypted using the database symmetric key. -
contextEncryptedValue
The value encrypted using the context-specific key.
-
-
Constructor Details
-
EncryptedOrient
public EncryptedOrient()Default constructor initializing the document with the encrypted type class name. -
EncryptedOrient
Protected constructor initializing the document with a specified class name.- Parameters:
iClassName- the OrientDB class name
-
-
Method Details
-
getTypeName
- Specified by:
getTypeNamein interfaceorg.gcube.informationsystem.base.reference.Element
-
getSupertypes
- Specified by:
getSupertypesin interfaceorg.gcube.informationsystem.model.reference.ModelElement
-
getExpectedType
- Specified by:
getExpectedTypein interfaceorg.gcube.informationsystem.model.reference.ModelElement
-
getEncryptedValue
Returns the encrypted value from the document.- Returns:
- the encrypted value string
-
setEncryptedValue
Sets the encrypted value in the document.- Parameters:
encryptedValue- the encrypted value string to set
-
getDecryptedValue
Returns the decrypted plain text value.- Returns:
- the decrypted plain text string
-
getDbEncryptedValue
Returns the value encrypted using the database symmetric key.- Returns:
- the database-encrypted value string
-
getContextEncryptedValue
Returns the value encrypted using the context-specific key.- Returns:
- the context-encrypted value string
-
setDecryptedValue
public void setDecryptedValue(String decryptedValue, boolean setEncryptedForContext) throws Exception Sets the decrypted value and encrypts it using both the database key and the context key. Depending on the value of the setEncryptedForContext parameter, it sets the encrypted value to either the context-encrypted value or the database-encrypted value.- Parameters:
decryptedValue- the decrypted value to be set and encryptedsetEncryptedForContext- if true, sets the encrypted value to the context-encrypted value; otherwise, sets it to the database-encrypted value- Throws:
Exception- if an error occurs during encryption
-
getAdditionalProperties
- Specified by:
getAdditionalPropertiesin interfaceorg.gcube.informationsystem.model.reference.properties.Property- Specified by:
getAdditionalPropertiesin interfaceorg.gcube.informationsystem.base.reference.SchemaMixedElement
-
setAdditionalProperties
- Specified by:
setAdditionalPropertiesin interfaceorg.gcube.informationsystem.model.reference.properties.Property- Specified by:
setAdditionalPropertiesin interfaceorg.gcube.informationsystem.base.reference.SchemaMixedElement
-
getAdditionalProperty
- Specified by:
getAdditionalPropertyin interfaceorg.gcube.informationsystem.model.reference.properties.Property- Specified by:
getAdditionalPropertyin interfaceorg.gcube.informationsystem.base.reference.SchemaMixedElement
-
setAdditionalProperty
- Specified by:
setAdditionalPropertyin interfaceorg.gcube.informationsystem.model.reference.properties.Property- Specified by:
setAdditionalPropertyin interfaceorg.gcube.informationsystem.base.reference.SchemaMixedElement
-
getValue
- Specified by:
getValuein interfaceorg.gcube.informationsystem.model.reference.properties.Encrypted
-
setValue
- Specified by:
setValuein interfaceorg.gcube.informationsystem.model.reference.properties.Encrypted
-
toJSON
- Specified by:
toJSONin interfacecom.orientechnologies.orient.core.record.ORecord- Overrides:
toJSONin classcom.orientechnologies.orient.core.record.ORecordAbstract
-