Class EncryptedOrient
java.lang.Object
com.orientechnologies.orient.core.record.ORecordAbstract
com.orientechnologies.orient.core.record.impl.ODocument
org.gcube.informationsystem.resourceregistry.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 Stringprotected Stringprotected Stringstatic final Stringstatic final StringFields 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, TYPE_PROPERTYFields inherited from interface org.gcube.informationsystem.model.reference.ModelElement
EXPECTED_TYPE_PROPERTY, SUPERTYPES_PROPERTY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetValue()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) 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
- See Also:
-
VALUE
- See Also:
-
decryptedValue
-
dbEncryptedValue
-
contextEncryptedValue
-
-
Constructor Details
-
EncryptedOrient
public EncryptedOrient() -
EncryptedOrient
-
-
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
-
setEncryptedValue
-
getDecryptedValue
-
getDbEncryptedValue
-
getContextEncryptedValue
-
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
-