public class InstrumentingSchema extends SchemaWrapper implements InstrumentingSchemaI
ATT_NAME_DEFAULT_PACKAGE, INITIALDATA_LINE_ENCLOSING_CHAR, INITIALDATA_LINE_SEPARATOR_CHAR, INITIALDATA_SCHEMA_ADDITIONS_FILENAME, MD_DISABLE, MD_NON_DESTRUCTIVE, MD_RECREATE_INDEXES, NAME_MINLENGTH, RELATION_TYPE_1_N, RELATION_TYPE_N_1, RELATION_TYPE_N_M, SUFFIX_FOLDER_KEY
Modifier and Type | Method and Description |
---|---|
void |
addDefinerFuture(java.util.concurrent.Future f) |
void |
addInitFuture(java.util.concurrent.Future f) |
VirtualEntity |
addVirtualEntity(BasicEntityI baseEntity,
java.lang.String name)
Creates a new virtual sub entity to this schema and its namespace.
|
VirtualEntity |
addVirtualEntity(java.lang.String baseEntityName,
java.lang.String name)
Creates a new VirtualEntity extending the given BaseEntity and returns it.
|
AttributeI |
addVirtualProperty(electric.xml.Element el)
Adds a virtual property to this schema using an XML element.
|
AttributeI |
addVirtualProperty(electric.xml.Element el,
java.util.Map parameters)
Adds a virtual property to this schema using an XML element.
|
AttributeI |
addVirtualProperty(electric.xml.Element el,
java.util.Map parameters,
boolean ignoreError)
Adds a virtual property to this schema using an XML element definition.
|
AttributeI |
addVirtualProperty(java.util.Map def)
Creates a new virtual property using a definition from a flat map.
|
AttributeI |
addVirtualProperty(java.util.Map def,
java.util.Map parameters)
Creates a new virtual property using a definition from a flat map.
|
AttributeI |
addVirtualProperty(java.util.Map def,
java.util.Map parameters,
boolean ignoreError)
Creates a new virtual property using a definition from a flat map.
|
InstrumentingEntity |
coerceEntity(EntityI e,
java.lang.String reason)
Wraps and returns the wrapped EntityI into this InstrumentingSchemaI
|
java.util.List<EntityI> |
coerceEntityList(java.util.List<EntityI> l,
java.lang.String reason) |
java.lang.String |
describe(java.lang.Object o)
"format" an object.
|
java.lang.String |
describe(java.lang.Object o,
java.lang.String formatdef)
"format" an object.
|
java.lang.String |
describe(java.lang.Object o,
java.lang.String formatdef,
java.util.Map variables)
"format" an object.
|
java.lang.String |
describe(java.lang.Object o,
java.lang.String formatdef,
java.util.Map variables,
SchemaI onBehalfOfSchema)
"format" an object.
|
void |
flushCaches()
Iterates over all Entities and flushes caches which may contain references to
previously loaded BOs, e.g. the value cache in ScriptedAttributes.
|
java.util.List<ScriptImport> |
getDefaultImports() |
java.util.function.Consumer<SetValueEventI> |
getDefaultSetValueCallback() |
java.util.List<EntityI> |
getEntitiesForInterface(java.lang.Class clazz)
Returns a list of all entities that implement the given interface.
|
InstrumentingEntity |
getEntity(java.lang.String name) |
EntityI |
getEntityForClass(java.lang.Class<? extends BOI> clazz) |
EntityI |
getEntityForClassName(java.lang.String className) |
EntityI |
getEntityForObject(java.lang.Object o) |
java.util.List<EntityI> |
getEntityList()
Retrieves a list of all entities known and defined within this schema.
|
java.util.List<GDPRConfigurationElement> |
getGDPRConfigElements() |
static InstrumentingSchemaI |
getInstance(SchemaI schema) |
static InstrumentingSchemaI |
getInstanceForFormReload(SchemaI schema) |
static InstrumentingSchemaI |
getInstanceForTests(SchemaI schema) |
java.util.Collection<? extends SchemaInterfaceI> |
getInterfaces()
Returns a collection of all interfaces defined in the schema.
|
EntityI |
getLowestCommonDenominateEntity(BOI[] bos) |
java.util.Collection<? extends SchemaInterfaceI> |
getProjectInterfaces()
Returns a collection of all project-specific interfaces defined in the schema.
|
AbstractScript |
getScript()
Script support for instrumenting etc.
|
AbstractScript |
getScript(java.lang.String _language) |
AbstractScript |
getSubScript() |
AbstractScript |
getSubScript(java.util.List<ScriptImport> additionalImports) |
AbstractScript |
getSubScript(java.util.List<ScriptImport> additionalImports,
java.lang.Class baseClass) |
AbstractScript |
getSubScript(java.util.List<ScriptImport> additionalImports,
java.lang.Class baseClass,
java.lang.String language) |
AbstractScript |
getSubScript(java.util.List<ScriptImport> additionalImports,
java.lang.String language) |
AbstractScript |
getSubScript(java.lang.String language) |
java.util.List<EntityI> |
getVirtualSubEntityList(EntityI baseEntity) |
java.util.List<EntityI> |
getVirtualSubEntityList(java.lang.String baseEntityName) |
boolean |
hasVirtualSubEntities(EntityI baseEntity) |
boolean |
hasVirtualSubEntities(java.lang.String baseEntityName) |
void |
setDefaultSetValueCallback(java.util.function.Consumer<SetValueEventI> callback) |
java.util.List<java.lang.Throwable> |
waitForCompilationAndGetErrors() |
void |
waitForDefinerCompilation() |
addRelationObject, aggregate, aggregate, aggregate, aggregate, createFunction, createFunction, createFunction, createFunction, createFunction, createFunction, createFunctionFromXML, createFunctionFromXML, createFunctionFromXML, createFunctionFromXML, flattenToString, getAnnotatedValue, getAnnotatedValue, getAnnotatedValueAsString, getAnnotatedValueAsString, getAttribute, getAttribute, getBOForLastPathElement, getClosestAvailableAggregateAnchor, getCryptoHandler, getCurrentFolder, getCurrentModuleOrProject, getCurrentModulePackage, getDefaultPackage, getDiscriminators, getFingerprint, getFormatter, getFormatter, getFormatter, getFormatter, getFrappingAttributes, getInterface, getNonPersistentAttributes, getPackageList, getPermissionHandler, getProjectPackage, getProperty, getProperty, getRegisteredModuleProviders, getRelationObjects, getSerializationRelevantDiff, getSerialVersionUIDs, getToolTipBundleLookupPath, getType, getUsedModules, getValue, getValue, getValue, getValue, getValueAsString, getValueAsString, getValueAsString, getVersion, hasRelationObject, releaseDefinitionSource, removeRelationObject, setCryptoHandler, setPermissionHandler, setProperty, setValue, setValueAsString, setValueAsString, toString
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
addRelationObject, aggregate, aggregate, aggregate, aggregate, checkSyntacticallyValid, createFunction, createFunction, createFunction, createFunction, createFunction, createFunction, createFunctionFromXML, createFunctionFromXML, createFunctionFromXML, createFunctionFromXML, describeNE, describeNE, describeNE, describeNE, filterEntities, flattenToString, getAnnotatedValue, getAnnotatedValue, getAnnotatedValueAsString, getAnnotatedValueAsString, getAttribute, getAttribute, getBOForLastPathElement, getBundleLookupPath, getClosestAvailableAggregateAnchor, getCoreEntityList, getCryptoHandler, getCurrentFolder, getCurrentModuleOrProject, getCurrentModulePackage, getDefaultPackage, getDiscriminators, getEntity, getEntityOrAttributeNameValidationError, getFingerprint, getFormatter, getFormatter, getFormatter, getFormatter, getFrappingAttributes, getInterface, getModuleEntityList, getNonPersistentAttributes, getPackageList, getPermissionHandler, getProjectEntityList, getProjectPackage, getProperty, getProperty, getRegisteredModuleProviders, getRelationObjects, getSerializationRelevantDiff, getSerialVersionUIDs, getToolTipBundleLookupPath, getType, getUsedModules, getValue, getValue, getValue, getValue, getValueAsString, getValueAsString, getValueAsString, getVersion, hasRelationObject, isUsingModules, parseGuiTips, parseGuiTips, releaseDefinitionSource, removeRelationObject, setCryptoHandler, setPermissionHandler, setProperty, setValue, setValueAsString, setValueAsString, splitInitialDataLine
public static InstrumentingSchemaI getInstance(SchemaI schema)
public static InstrumentingSchemaI getInstanceForTests(SchemaI schema)
public static InstrumentingSchemaI getInstanceForFormReload(SchemaI schema)
public void setDefaultSetValueCallback(java.util.function.Consumer<SetValueEventI> callback)
public java.util.function.Consumer<SetValueEventI> getDefaultSetValueCallback()
getDefaultSetValueCallback
in interface InstrumentingSchemaI
public InstrumentingEntity getEntity(java.lang.String name)
getEntity
in interface SchemaI
getEntity
in class SchemaWrapper
public EntityI getEntityForClassName(java.lang.String className)
getEntityForClassName
in interface SchemaI
getEntityForClassName
in class SchemaWrapper
public EntityI getEntityForClass(java.lang.Class<? extends BOI> clazz)
getEntityForClass
in interface SchemaI
getEntityForClass
in class SchemaWrapper
public EntityI getEntityForObject(java.lang.Object o)
getEntityForObject
in interface SchemaI
getEntityForObject
in class SchemaWrapper
public java.util.List<EntityI> getEntitiesForInterface(java.lang.Class clazz)
SchemaI
This method retrieves all entities within the schema that implement the specified interface.
The provided class must represent an interface; otherwise, an IllegalArgumentException
is thrown.
getEntitiesForInterface
in interface SchemaI
getEntitiesForInterface
in class SchemaWrapper
clazz
- The interface class.public java.util.Collection<? extends SchemaInterfaceI> getInterfaces()
SchemaI
getInterfaces
in interface SchemaI
getInterfaces
in class SchemaWrapper
SchemaInterfaceI
representing all interfaces in the schema.public java.util.Collection<? extends SchemaInterfaceI> getProjectInterfaces()
SchemaI
Project-specific interfaces are those that belong to the current project's package.
getProjectInterfaces
in interface SchemaI
getProjectInterfaces
in class SchemaWrapper
SchemaInterfaceI
representing all project-specific interfaces in the schema.public java.util.List<GDPRConfigurationElement> getGDPRConfigElements()
getGDPRConfigElements
in interface SchemaI
getGDPRConfigElements
in class SchemaWrapper
public java.util.List<EntityI> getEntityList()
SchemaI
getEntityList
in interface SchemaI
getEntityList
in class SchemaWrapper
List
of all EntityI
objects. Returns an empty list if no entities are defined.public EntityI getLowestCommonDenominateEntity(BOI[] bos)
getLowestCommonDenominateEntity
in interface SchemaI
getLowestCommonDenominateEntity
in class SchemaWrapper
public InstrumentingEntity coerceEntity(EntityI e, java.lang.String reason)
InstrumentingSchemaI
coerceEntity
in interface InstrumentingSchemaI
public java.util.List<EntityI> coerceEntityList(java.util.List<EntityI> l, java.lang.String reason)
coerceEntityList
in interface InstrumentingSchemaI
public AttributeI addVirtualProperty(electric.xml.Element el)
InstrumentingSchemaI
This is a convenience method that delegates to
InstrumentingSchemaI.addVirtualProperty(Element, Map, boolean)
, using a default 'null'
for parameters and not ignoring errors.
addVirtualProperty
in interface InstrumentingSchemaI
el
- The non-null root 'virtualProperty' XML element defining the property.public AttributeI addVirtualProperty(electric.xml.Element el, java.util.Map parameters)
InstrumentingSchemaI
This is a convenience method that delegates to
InstrumentingSchemaI.addVirtualProperty(Element, Map, boolean)
, with error handling set to
not ignore errors by default.
addVirtualProperty
in interface InstrumentingSchemaI
el
- The non-null root 'virtualProperty' XML element defining the property.parameters
- A map of additional parameters.public AttributeI addVirtualProperty(electric.xml.Element el, java.util.Map parameters, boolean ignoreError)
InstrumentingSchemaI
If a virtual property with the same name already exists within the entity's context,
the existing property is returned, and the new definition is ignored. This behavior
ensures that an existing, valid property is not accidentally overwritten.
If the name is already defined by a different type of attribute (e.g. a physical database column),
a RuntimeException
may be thrown, depending on the ignoreError
flag.
addVirtualProperty
in interface InstrumentingSchemaI
el
- The non-null root 'virtualProperty' XML element defining the property.parameters
- A map of additional parameters (String -> Object) to be injected into
the property's scripts at execution time (e.g. a logger or context accessor).ignoreError
- If true
, and the virtual property cannot be constructed
(e.g. due to a naming clash or invalid script), exceptions are caught,
logged, and the method returns null
.
If false
, the exception is re-thrown.null
if the property could not be constructed and the error was ignored.ScriptedAttribute
public AttributeI addVirtualProperty(java.util.Map def)
InstrumentingSchemaI
This convenience method delegates to
InstrumentingSchemaI.addVirtualProperty(Map, Map, boolean)
, using a default 'null'
for parameters and not ignoring errors.
addVirtualProperty
in interface InstrumentingSchemaI
def
- The map containing key-value pairs that define the virtual property.public AttributeI addVirtualProperty(java.util.Map def, java.util.Map parameters)
InstrumentingSchemaI
This convenience method delegates to
InstrumentingSchemaI.addVirtualProperty(Map, Map, boolean)
, with error handling set to
not ignore errors by default.
addVirtualProperty
in interface InstrumentingSchemaI
def
- The map containing key-value pairs that define the virtual property.parameters
- A map of additional parameters.public AttributeI addVirtualProperty(java.util.Map def, java.util.Map parameters, boolean ignoreError)
InstrumentingSchemaI
This method provides a programmatic way to define a virtual property. The keys in the map correspond to the attributes of the XML element, and script values are expected to be Groovy closures.
addVirtualProperty
in interface InstrumentingSchemaI
def
- The map containing key-value pairs that define the virtual property.parameters
- A map of additional parameters to be injected into the scripts.ignoreError
- If true
, and the property cannot be constructed,
exceptions are caught and the method returns null
.null
if an error occurred
and was ignored.ScriptedAttribute
public java.lang.String describe(java.lang.Object o, java.lang.String formatdef, java.util.Map variables, SchemaI onBehalfOfSchema)
SchemaI
describe
in interface SchemaI
describe
in class SchemaWrapper
public java.lang.String describe(java.lang.Object o, java.lang.String formatdef, java.util.Map variables)
SchemaI
describe
in interface SchemaI
describe
in class SchemaWrapper
public java.lang.String describe(java.lang.Object o, java.lang.String formatdef)
SchemaI
describe
in interface SchemaI
describe
in class SchemaWrapper
public java.lang.String describe(java.lang.Object o)
SchemaI
describe
in interface SchemaI
describe
in class SchemaWrapper
public java.util.List<ScriptImport> getDefaultImports()
getDefaultImports
in interface SchemaI
getDefaultImports
in class SchemaWrapper
public AbstractScript getScript()
SchemaI
getScript
in interface SchemaI
getScript
in class SchemaWrapper
public AbstractScript getScript(java.lang.String _language)
getScript
in interface SchemaI
getScript
in class SchemaWrapper
public AbstractScript getSubScript()
getSubScript
in interface SchemaI
getSubScript
in class SchemaWrapper
public AbstractScript getSubScript(java.lang.String language)
getSubScript
in interface SchemaI
getSubScript
in class SchemaWrapper
public AbstractScript getSubScript(java.util.List<ScriptImport> additionalImports)
getSubScript
in interface SchemaI
getSubScript
in class SchemaWrapper
public AbstractScript getSubScript(java.util.List<ScriptImport> additionalImports, java.lang.String language)
getSubScript
in interface SchemaI
getSubScript
in class SchemaWrapper
public AbstractScript getSubScript(java.util.List<ScriptImport> additionalImports, java.lang.Class baseClass)
getSubScript
in interface SchemaI
getSubScript
in class SchemaWrapper
public AbstractScript getSubScript(java.util.List<ScriptImport> additionalImports, java.lang.Class baseClass, java.lang.String language)
getSubScript
in interface SchemaI
getSubScript
in class SchemaWrapper
public void flushCaches()
InstrumentingSchemaI
flushCaches
in interface InstrumentingSchemaI
public VirtualEntity addVirtualEntity(BasicEntityI baseEntity, java.lang.String name)
InstrumentingSchemaI
BOI.getEntity()
or SchemaI.getEntityForClass(java.lang.Class)
, but the virtual entity
when using SchemaI.getEntityForObject(java.lang.Object)
.
Adding virtual properties to these is allowed, e.g. to create virtual namespaces for otherwise clashing
attribute definitions.addVirtualEntity
in interface InstrumentingSchemaI
baseEntity
- a nonnull BasicEntityI instance to add the virtualEntity to.name
- the name of the VirtualEntity to create, nonnull.public VirtualEntity addVirtualEntity(java.lang.String baseEntityName, java.lang.String name)
InstrumentingSchemaI
addVirtualEntity
in interface InstrumentingSchemaI
baseEntityName
- the name of the EntityI instance to add this entity to.name
- the name of the VirtualEntity to create, nonnull.public java.util.List<EntityI> getVirtualSubEntityList(EntityI baseEntity)
getVirtualSubEntityList
in interface InstrumentingSchemaI
public java.util.List<EntityI> getVirtualSubEntityList(java.lang.String baseEntityName)
getVirtualSubEntityList
in interface InstrumentingSchemaI
public boolean hasVirtualSubEntities(EntityI baseEntity)
hasVirtualSubEntities
in interface InstrumentingSchemaI
public boolean hasVirtualSubEntities(java.lang.String baseEntityName)
hasVirtualSubEntities
in interface InstrumentingSchemaI
public void addDefinerFuture(java.util.concurrent.Future f)
addDefinerFuture
in interface InstrumentingSchemaI
public void waitForDefinerCompilation()
waitForDefinerCompilation
in interface InstrumentingSchemaI
public void addInitFuture(java.util.concurrent.Future f)
addInitFuture
in interface InstrumentingSchemaI
public java.util.List<java.lang.Throwable> waitForCompilationAndGetErrors()
waitForCompilationAndGetErrors
in interface InstrumentingSchemaI
Copyright © 2000-2025 OAshi S.à r.l. All Rights Reserved.