jsdai.lang
Class CEntity

java.lang.Object
  extended byjsdai.lang.SdaiCommon
      extended byjsdai.lang.InverseEntity
          extended byjsdai.lang.CEntity
All Implemented Interfaces:
EEntity, SdaiEventSource
Direct Known Subclasses:
AttributeDefinition, jsdai.mapping.CConstraint, CEntityMappingBase, jsdai.mapping.CGeneric_attribute_mapping, CMappedARMEntity, DataType, GlobalRule, PopulationDependentBound, SchemaDefinition, WhereRule

public abstract class CEntity
extends InverseEntity
implements EEntity, SdaiEventSource

CEntity is a base class for all application and dictionary entity classes. This class is for internal JSDAI use only. Applications shall use EEntity instead.


Field Summary
 
Fields inherited from interface jsdai.lang.EEntity
MANDATORY_ATTRIBUTES_SET, MOST_SPECIFC_ENTITY, NO_RESTRICTIONS
 
Method Summary
 void addSdaiListener(SdaiListener listener)
          Adds SdaiListener extending java.util.EventListener to a special aggregate defined for this entity instance.
 EMappedARMEntity buildMappedInstance(SdaiContext context, jsdai.dictionary.EEntity_definition mappedInstanceType)
          Creates or returns already created mapped entity instance in context's mappedWorkingModel model.
 boolean compareValuesBoolean(EEntity inst)
          Compares this entity instance to the submitted entity instance.
 int compareValuesLogical(EEntity inst)
          Compares this entity instance to the submitted entity instance.
 EEntity copyApplicationInstance(SdaiModel target_model)
          Creates a copy of this instance in the specified SdaiModel.
 EEntity copyValuesFrom(EEntity src)
          Copies values of all attributes of the entity instance submitted through the parameter to the corresponding attributes of the current entity instance.
 Aggregate createAggregate(jsdai.dictionary.EAttribute attribute, jsdai.dictionary.EDefined_type[] select)
          Creates a new empty aggregate instance replacing the existing value (if any) of the specified explicit attribute.
 ExternalData createExternalData()
          Creates external for this entity.
 void deleteApplicationInstance()
          Deletes this entity instance.
 SdaiModel findEntityInstanceSdaiModel()
          Returns SdaiModel this entity instance belongs to.
 void findEntityInstanceUsedin(jsdai.dictionary.EAttribute role, ASdaiModel modelDomain, AEntity result)
          Searches for entity instances which reference the current instance in the role specified by an instance of EAttribute (first parameter).
 void findEntityInstanceUsers(ASdaiModel modelDomain, AEntity result)
          Searches for entity instances which reference the current instance.
 int findEntityMappings(ASdaiModel targetDomain, ASdaiModel mappingDomain, jsdai.mapping.AEntity_mapping mappings, int mode)
          Finds entity_mappings that fit with this instance.
 int findEntityMappings(jsdai.dictionary.EEntity_definition sourceEntity, ASdaiModel targetDomain, ASdaiModel mappingDomain, jsdai.mapping.AEntity_mapping mappings, int mode)
          Finds entity_mappings that fit with this instance.
 void findInstanceDataTypes(jsdai.dictionary.ANamed_type result, jsdai.dictionary.ESchema_definition schema)
          This method is not implemented in current JSDAI version.
 void findInstanceRoles(ASdaiModel modelDomain, jsdai.dictionary.AAttribute result)
          Searches for attributes by which other entity instances reference the current instance.
 EMappedARMEntity findLinkedMappedInstance(jsdai.dictionary.EEntity_definition mappedInstanceType)
          Finds already created mapped entity instance.
 AEntity findMappedUsers(jsdai.mapping.EEntity_mapping source_type, jsdai.mapping.AAttribute_mapping attribute, ASdaiModel data_domain, ASdaiModel mapping_domain, jsdai.mapping.AAttribute_mapping users, int mode)
          It finds application data instances that coresponds to mapped instaces, that references to this instance.
 jsdai.mapping.AEntity_mapping findMostSpecificMappings(ASdaiModel dataDomain, ASdaiModel mappingDomain, jsdai.mapping.AEntity_mapping baseMappings, int mode)
          Finds most specific ARM mappings for the instance.
 boolean get_boolean(jsdai.dictionary.EAttribute attribute)
          Returns the value (of type boolean) of the specified attribute.
 double get_double(jsdai.dictionary.EAttribute attribute)
          Returns the value (of type double) of the specified attribute.
 int get_int(jsdai.dictionary.EAttribute attribute)
          Returns the value (of type int) of the specified attribute.
 AEntity get_inverse(jsdai.dictionary.EInverse_attribute attribute, ASdaiModel domain)
          Returns the value (of type aggregate of entities) of the specified inverse attribute.
 java.lang.Object get_object(jsdai.dictionary.EAttribute attribute)
          Returns the value (of type Object) of the specified attribute.
 Value get(jsdai.dictionary.EAttribute attribute)
          Returns the value (wrapped in an object of type Value) of the specified attribute, which can be either explicit or derived but not inverse.
 AEntity getAllReferences()
          Returns an aggregate (of Express type LIST) whose elements are entity instances referenced by the current entity instance.
 jsdai.dictionary.EAttribute getAttributeDefinition(java.lang.String attributeName)
          Returns a specific instance of the entity "attribute" defined in "SDAI_dictionary_schema", describing EXPRESS schemas on the meta level.
 int getAttributeValueBound(jsdai.dictionary.EAttribute attribute)
          This method is not implemented in current JSDAI version.
 java.lang.String getDescription()
          Returns a human readable description of the entity instance.
 ExternalData getExternalData()
          Gets external data object.
 java.lang.Object[] getMappedAttribute(jsdai.dictionary.EAttribute sourceAttribute, ASdaiModel targetDomain, ASdaiModel mappingDomain, int mode)
          Returns value for source attribute.
 java.lang.Object getMappedAttribute(jsdai.mapping.EGeneric_attribute_mapping sourceAttribute, ASdaiModel targetDomain, ASdaiModel mappingDomain, int mode)
          Returns value of attribute following constraints defined by attribute_mapping.
 java.lang.String getPersistentLabel()
          Returns a String, which is a persistent label of this entity instance.
 java.lang.Object getTemp()
          Returns an Object where an application is allowed to store some user's data related to this entity instance.
 java.lang.Object getTemp(java.lang.Object key)
          An extension of getTemp().
 boolean hasMappedAttribute(jsdai.mapping.EEntity_mapping entityMapping, jsdai.dictionary.EAttribute attribute, ASdaiModel mappingDomain)
          Checks is attribute mapped for given entity mapping.
 boolean isInstanceOf(java.lang.Class type)
          Checks if java.lang.Class object of this entity instance coincides with the given java.lang.Class object which describes java class representing some other entity instance.
 boolean isInstanceOf(jsdai.dictionary.EEntity_definition type)
          Checks if the type (described by EEntity_definition) of this entity instance coincides with the type given by method's parameter.
 boolean isKindOf(java.lang.Class type)
          Checks if java.lang.Class object of this entity instance coincides with the given java.lang.Class object, which describes java class representing some other entity instance, or is a java.lang.Class object for the java class which is a subclass of the given class.
 boolean isKindOf(jsdai.dictionary.EEntity_definition type)
          Checks if the type (described by EEntity_definition) of this entity instance coincides with the given type (instance of EEntity_definition) or is a subtype of it.
 boolean isValid()
          Checks if java Object of type EEntity represents a valid instance of a population within SdaiSession.
 int makeUsedin(jsdai.dictionary.EEntity_definition referent_def, jsdai.dictionary.EAttribute role, ASdaiModel modelDomain, AEntity result)
          This method is for internal JSDAI use only.
 EEntity moveUsersFrom(EEntity src)
          Changes all the pointers referencing an entity instance submitted through the parameter to the pointers referencing the current entity instance.
 void removeExternalData()
          Removes external data which was attached to this entity.
 void removeSdaiListener(SdaiListener listener)
          Removes SdaiListener extending java.util.EventListener from the special aggregate defined for this entity instance.
 void set(jsdai.dictionary.EAttribute attribute, boolean value, jsdai.dictionary.EDefined_type[] select)
          Assigns a value of type boolean to the specified explicit attribute.
 void set(jsdai.dictionary.EAttribute attribute, double value, jsdai.dictionary.EDefined_type[] select)
          Assigns a value of type double to the specified explicit attribute.
 void set(jsdai.dictionary.EAttribute attribute, int value, jsdai.dictionary.EDefined_type[] select)
          Assigns a value of type int to the specified explicit attribute.
 void set(jsdai.dictionary.EAttribute attribute, java.lang.Object value, jsdai.dictionary.EDefined_type[] select)
          Assigns a value of type Object to the specified explicit attribute.
 void set(jsdai.dictionary.EExplicit_attribute attribute, Value val)
          Assigns the value wrapped in a given object of type Value to the specified explicit attribute.
 void setTemp(java.lang.Object value)
          Assigns a value to special field of type Object in which an application is allowed to store some user's data related to this entity instance.
 void setTemp(java.lang.Object key, java.lang.Object value)
          An extension of setTemp(Object value).
 int testAttribute(jsdai.dictionary.EAttribute attribute, jsdai.dictionary.EDefined_type[] select)
          Checks if the specified attribute has a value and if so, then returns an indicator showing the type of the value.
 int testAttributeFast(jsdai.dictionary.EAttribute attribute, jsdai.dictionary.EDefined_type[] select)
          Checks if the specified attribute has a value and if so, then returns an indicator showing the type of the value.
 boolean testExternalData()
          Tests if external data is attached to this entity.
 jsdai.mapping.AGeneric_attribute_mapping testMappedAttribute(jsdai.dictionary.EAttribute sourceAttribute, ASdaiModel targetDomain, ASdaiModel mappingDomain, int mode)
          Tests mapping of source attribute.
 boolean testMappedAttribute(jsdai.mapping.EGeneric_attribute_mapping sourceAttribute, ASdaiModel targetDomain, ASdaiModel mappingDomain, int mode)
          Test whether this target instance does fit to the constraints of the given attribute_mapping.
 jsdai.mapping.AEntity_mapping testMappedEntity(jsdai.dictionary.EEntity_definition sourceEntity, ASdaiModel targetDomain, ASdaiModel mappingDomain, int mode)
          Tests whether this instance of a target entity type does fit to mapping constraints of specified source entity.
 boolean testMappedEntity(jsdai.mapping.EEntity_mapping sourceEntity, ASdaiModel targetDomain, ASdaiModel mappingDomain, int mode)
          Tests whether this instance of a target entity type does fit to mapping constraints of specified source entity.
 jsdai.dictionary.AEntity_definition typeOf()
          Returns an aggregate containing definitions of all single entity data types from which the entity type of this instance consists.
 java.lang.String toString()
          Returns a String representing this entity instance including values of all its attributes.
 ComplexEntityValue toValue()
          Wraps this instance to ComplexEntityValue object and returns it.
 void unsetAttributeValue(jsdai.dictionary.EAttribute attribute)
          Changes the state of the specified explicit attribute, so that this attribute has no value longer.
 int validateAggregatesSize(jsdai.dictionary.AAttribute nonConf)
          Checks if the number of members in aggregates, or valid index values for array instances, of any attributes of this entity instance meet the constraints specified in the types of these attributes.
 boolean validateAggregatesUniqueness(jsdai.dictionary.AAttribute nonConf)
          Checks if all members are unique in any aggregate instance being a value of any attribute whose type requires uniqueness.
 boolean validateArrayNotOptional(jsdai.dictionary.AAttribute nonConf)
          Checks if arrays have values at all positions for the attributes of this entity instance where optional elements are not allowed.
 int validateBinaryWidth(jsdai.dictionary.AAttribute nonConf)
          Checks if Binary values assigned to attributes of this entity instance are of the required width.
 int validateExplicitAttributesReferences(jsdai.dictionary.AAttribute nonConf)
          Checks if all the entity instances referenced by explicit attributes of this entity instance are of valid type for those attributes.
 boolean validateInverseAttributes(jsdai.dictionary.AAttribute nonConf)
          Checks if cardinality constraints specified in the INVERSE clauses are satisfied for this entity instance.
 boolean validateInverseAttributes(jsdai.dictionary.AAttribute nonConf, ASdaiModel domain)
          Checks if cardinality constraints specified in the INVERSE clauses are satisfied for this entity instance.
 int validateRealPrecision(jsdai.dictionary.AAttribute nonConf)
          Checks if real values assigned to attributes of this entity instance are of the required minimum precision.
 boolean validateRequiredExplicitAttributesAssigned(jsdai.dictionary.AAttribute nonConf)
          Checks if all non-optional explicit attributes of this instance have values.
 int validateStringWidth(jsdai.dictionary.AAttribute nonConf)
          Checks if strings assigned, either directly or as members of aggregates, to attributes of this entity instance are of the required width.
 int validateWhereRule(jsdai.dictionary.AWhere_rule viol_rules, ASdaiModel domain)
          Checks if where rules associated with this instance are satisfied.
 int validateWhereRule(jsdai.dictionary.EWhere_rule rule, ASdaiModel domain)
          Checks if a where rule is satisfied for this instance.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jsdai.lang.EEntity
getInstanceType
 

Method Detail

isValid

public boolean isValid()
Description copied from interface: EEntity
Checks if java Object of type EEntity represents a valid instance of a population within SdaiSession.

Specified by:
isValid in interface EEntity
Returns:
true if the current instance is valid, false otherwise.
Since:
3.6.0

get_inverse

public AEntity get_inverse(jsdai.dictionary.EInverse_attribute attribute,
                           ASdaiModel domain)
                    throws SdaiException
Description copied from interface: EEntity
Returns the value (of type aggregate of entities) of the specified inverse attribute. This method implements a specialized late-binding version of the "Get Attribute" operation for the inverse attribute case. The resulting aggregate consists of entity instances which are of type specified in the definition of the inverse attribute and reference the current instance by the attribute (called inverted attribute) also specified there. The search area for such entity instances is restricted to those SdaiModels which belong to the set given by the second parameter. In the case when the second parameter is null, the search is restricted to the model which is the owner of the current instance (can be found using findEntityInstanceSdaiModel).

The method throws SdaiException AT_NVLD if the passed attribute is either not inverse one or not from this entity.

Example:

    EComposite_curve_segment segment = ...;
    ASdaiModel domain = ...;
    EInverse_attribute inv_attr = (EInverse_attribute)segment.getAttributeDefinition("using_curves");
    AEntity inv_aggr = segment.get_inverse(inv_attr, domain);

Specified by:
get_inverse in interface EEntity
Parameters:
attribute - the inverse attribute which value is needed.
domain - the list of SdaiModels that defines the area where to search for entity instances referencing the current entity instance in the way specified by the given inverse attribute.
Returns:
value (of type non-persistent list of entities) of the attribute.
Throws:
SdaiException - AT_NDEF, attribute not defined.
See Also:
get_object, get_int, get_double, get_boolean, getAttributeDefinition, "10303-22::10.10.1 Get attribute"

get_object

public java.lang.Object get_object(jsdai.dictionary.EAttribute attribute)
                            throws SdaiException
Description copied from interface: EEntity
Returns the value (of type Object) of the specified attribute. This method implements a specialized late-binding version of the "Get Attribute" operation for the case when the attribute is of some object type like EEntity, Aggregate, String, Binary, BigDecimal, or BigInteger (BigDecimal and BigInteger are not supported in this version of JSDAI).

All the early-binding and late-binding methods implementing "Get Attribute" operation behave as follows. In the case when the value of the attribute is unset, SdaiException VA_NSET is thrown. If in the express specification the attribute is defined as OPTIONAL, the user should first invoke the testAttribute method to check whether the attribute is set (has value) and only after this invoke appropriate method implementing "Get Attribute" operation. In the case when in the express the attribute is not defined to be OPTIONAL, the user can directly apply one of such methods. Thus, SdaiException VA_NSET is thrown only in the case when population of instances is invalid. This leads to application programs with a clear structure.

In the case when the attribute is of EEntity type, the behaviour of the methods implementing "Get Attribute" depends on which SdaiModel and SdaiRepository the referenced instance belongs to. If the SdaiModel of the instance is already in read-only or read-write access mode, e.g. because this instance and the referencing one are in the same SdaiModel, then the instance is returned immediately. If the SdaiModel has access mode unset, but belongs to an open SdaiRepository, then first the read-only access for this model is started and only then the instance is returned. If, however, the SdaiRepository is closed, SdaiException RP_NOPN is thrown.

The method throws SdaiException FN_NAVL if attribute whose value is asked is inverse or derived. In the former case, get_inverse method shall be used.

Example:

    EVector vect = ...;
    EAttribute attr = vect.getAttributeDefinition("orientation");
    // access the attribute as a general entity, that is, EEntity
    EEntity inst = (EEntity)vect.get_object(attr);
    // access the attribute as a specific entity
    EDirection dir = (EDirection)vect.get_object(attr);
    attr = vect.getAttributeDefinition("name");
    // access a String attribute
    String name = (String)vect.get_object(attr);

Specified by:
get_object in interface EEntity
Parameters:
attribute - the attribute which value is needed.
Returns:
value (of type Object) of the attribute.
Throws:
SdaiException - AT_NDEF, attribute not defined.
See Also:
get_int, get_double, get_boolean, get_inverse, getAttributeDefinition, testAttribute, "10303-22::10.10.1 Get attribute"

get_int

public int get_int(jsdai.dictionary.EAttribute attribute)
            throws SdaiException
Description copied from interface: EEntity
Returns the value (of type int) of the specified attribute. This method is a specialization of the general "Get Attribute" operation for the case when the attribute is of an integer type.

The method throws SdaiException AT_NVLD if the passed attribute is not from this entity, SdaiException VT_NVLD if the attribute type is different than integer, and SdaiException FN_NAVL if attribute whose value is asked is a derived one. For more details see method get_object.

Example:

    ACalendar_date date_list = ...;
    ECalendar_date date = date_list.getByIndex(1);
    EAttribute attr = date.getAttributeDefinition("year_component");
    int year = date.get_int(attr);

Specified by:
get_int in interface EEntity
Parameters:
attribute - the attribute which value is needed.
Returns:
value (of type int) of the attribute.
Throws:
SdaiException - EI_NEXS, entity instance does not exist.
See Also:
get_object, get_double, get_boolean, getAttributeDefinition, testAttribute, "ISO 10303-22::10.10.1 Get attribute"

get_double

public double get_double(jsdai.dictionary.EAttribute attribute)
                  throws SdaiException
Description copied from interface: EEntity
Returns the value (of type double) of the specified attribute. This method is a specialization of the general "Get Attribute" operation for the case when the attribute is of the double type.

The method throws SdaiException AT_NVLD if the passed attribute is not from this entity, SdaiException VT_NVLD if the attribute type is different than double, and SdaiException FN_NAVL if attribute whose value is asked is a derived one. For more details see method get_object.

Example:

    Vector vector_list = ...;
    EVector vect = vector_list.getByIndex(1);
    EAttribute attr = vect.getAttributeDefinition("magnitude");
    double magn = vect.get_double(attr);

Specified by:
get_double in interface EEntity
Parameters:
attribute - the attribute which value is needed.
Returns:
value (of type double) of the attribute.
Throws:
SdaiException - VT_NVLD, value type invalid.
See Also:
get_object, get_int, get_boolean, getAttributeDefinition, testAttribute, "ISO 10303-22::10.10.1 Get attribute"

get_boolean

public boolean get_boolean(jsdai.dictionary.EAttribute attribute)
                    throws SdaiException
Description copied from interface: EEntity
Returns the value (of type boolean) of the specified attribute. This method is a specialization of the general "Get Attribute" operation for the case when the attribute is of the boolean type.

The method throws SdaiException AT_NVLD if the passed attribute is not from this entity, SdaiException VT_NVLD if the attribute type is different than boolean, and SdaiException FN_NAVL if attribute whose value is asked is a derived one. For more details see method get_object.

Example:

    ETrimmed_curve curve = ...;
    EAttribute attr = curve.getAttributeDefinition("sense_agreement");
    boolean agreement = curve.get_boolean(attr);

Specified by:
get_boolean in interface EEntity
Parameters:
attribute - the attribute which value is needed.
Returns:
value (of type boolean) of the attribute.
Throws:
SdaiException - EI_NEXS, entity instance does not exist.
See Also:
get_object, get_int, get_double, getAttributeDefinition, testAttribute, "ISO 10303-22::10.10.1 Get attribute"

testAttribute

public int testAttribute(jsdai.dictionary.EAttribute attribute,
                         jsdai.dictionary.EDefined_type[] select)
                  throws SdaiException
Description copied from interface: EEntity
Checks if the specified attribute has a value and if so, then returns an indicator showing the type of the value. More precisely, this method fulfills the following three purposes:
  1. checks whether the attribute has a value or is unset. If unset, the return value is 0.
  2. retrieves the type of the value (if set). The numbering of the types is as follows:
    • 1 for object (EEntity, Aggregate, String, Binary, BigDecimal, BigInteger);
    • 2 for integer;
    • 3 for double;
    • 4 for boolean.
    The case of return value 2 encompasses the cases when the attribute value is of EXPRESS type INTEGER, ENUMERATION and LOGICAL. For the same value each of the methods testAttribute, Aggregate.testByIndex and Aggregate.testCurrentMember returns the same type indicator.
  3. retrieves the select path corresponding to the actual value of the attribute in the case when this attribute is of the select type. Select path is a sequence of defined data types needed to specify a value of a select data type (as defined in Technical corrigendum of ISO 10303-21:11.1.8). This sequence, in fact, defines some path in some rooted acyclic graph with vertices corresponding to select data types, defined data types, and specific data types (integer, double, String, enumeration, aggregation etc.). The path in this graph is from the root to some its leaf. The leaves of the graph describe specific data types. This graph, in general, is not a tree because select data types can be nested, and two such types may have the same selection item. Fortunately, in most cases we have a simple(non-nested) select type, and in these cases the graph reduces to a tree. The array of defined types needed to store the select path must be allocated before invocation of the method. If this array is too small, then SdaiException SY_ERR with some adjoined explanatory text is thrown.
The attribute to be tested is given by the first method's parameter, so this is a late-binding method. There exist for attribute testing also early-binding methods in which the attribute name constitutes a part of the method name. All these methods are various implementations of the general Test Attribute operation (ISO 10303-22:10.10.2).

Example 1 showing how to use testAttribute as a late binding operation:

    EDefined_type [] selection = new EDefined_type[3];
    EAttribute attr = ...;
    EEntity instance= ...;
    int type = instance.testAttribute(attr, selection);
    switch (type) {
    case 0: // unset
        // skip
        break;
    case 1: // object
        Object oValue = instance.get_object(attr);
        if (oValue instanceof EEntity) {
            ...
        } else if (oValue instanceof Aggregate) {
            ...
        } else if (oValue instanceof String) {
            ...
        }
        break;
    case 2: // integer
        int iValue = instance.get_int(attr);
        break;
    case 3: // double
        double rValue = instance.get_double(attr);
        EDefined_type areaMeasureType = ...;
        EDefined_type lengthMeasureType = ...;
        if (selection(0) == areaMeasureType) {
            double area = rValue;
        } else if (selection(0) == lengthMeasureType) {
            double length = rValue;
        break;
    case 4: // boolean
        boolean bValue = instance.get_boolean(attr);
        break;
    }

Example 2 illustrating early binding usage of the "Test Attribute" operation:

    EMeasure_with_unit instance = ...;
    int iSelection = instance.testValue_component(null);
    switch (iSelection) {
    case EMeasure_with_unit.sValue_componentArea_measure:
        double area = instance.getValue_component((EArea_measure) null);
        break;
    case EMeasure_with_unit.sValue_componentLength_measure:
        double length = instance.getValue_component((ELength_measure) null);
        break;
    ...;
    }

Specified by:
testAttribute in interface EEntity
Parameters:
attribute - the attribute which value is tested.
select - the array of defined types used to store the select path corresponding to the actual value of the attribute.
Returns:
type of the value (0 if the attribute has no value).
Throws:
SdaiException - SY_ERR, underlying system error.
See Also:
get_object, get_int, get_double, get_boolean, getAttributeDefinition, "ISO 10303-22::10.10.2 Test attribute"

testAttributeFast

public int testAttributeFast(jsdai.dictionary.EAttribute attribute,
                             jsdai.dictionary.EDefined_type[] select)
                      throws SdaiException
Checks if the specified attribute has a value and if so, then returns an indicator showing the type of the value. This method performs the same task as testAttribute(EAttribute attribute, EDefined_type[] select) but in the case attribute does not belong to this entity value of -1 is returned.

Parameters:
attribute - the attribute which value is tested.
select - the array of defined types used to store the select path corresponding to the actual value of the attribute.
Returns:
Type of the value (0 if the attribute has no value and -1 if the attribute does not belong to this entity).
Throws:
SdaiException - RP_NOPN, repository is not open.
SdaiException - TR_NAVL, transaction currently not available.
SdaiException - TR_EAB, transaction ended abnormally.
SdaiException - EI_NEXS, entity instance does not exist.
SdaiException - AT_NDEF, attribute not defined.
SdaiException - SY_ERR, underlying system error.
See Also:
testAttribute(EAttribute attribute, EDefined_type[] select)

getAttributeDefinition

public jsdai.dictionary.EAttribute getAttributeDefinition(java.lang.String attributeName)
                                                   throws SdaiException
Description copied from interface: EEntity
Returns a specific instance of the entity "attribute" defined in "SDAI_dictionary_schema", describing EXPRESS schemas on the meta level. While submitting the parameter to the method the following rule shall be considered. If the required attribute is unique within the entity data type of the current instance, then the parameter is the name of that attribute. Otherwise, the parameter is of the form "en.an" where 'an' and 'en' denote attribute name and, respectively, the name of the simple entity that is the owner of the required attribute. For example, complex entity definition of the instance #43296=(CHARACTERIZED_OBJECT('spotting point','design feature')FEATURE_DEFINITION()GENERAL_FEATURE()INSTANCED_FEATURE()SHAPE_ASPECT('RPPunkt_H_1480_L_9841K0_813_111','H_1480_L_984',#43307,.U.)) has two attributes with the name 'description': the owner of one of them is simple entity data type 'characterized_object' and the owner of another is 'shape_aspect'. To get definition of the first attribute, method shall be invoked with the string "characterized_object.description". To get the second attribute, "shape_aspect.description" shall be supplied.

This method is an extension of JSDAI, which is not a part of the standard.

Example:

    EVector vect = ...;
    EAttribute attr = vect.getAttributeDefinition("magnitude");

Specified by:
getAttributeDefinition in interface EEntity
Parameters:
attributeName - the name of the entity attribute, possibly, with the simple entity name as a prefix.
Returns:
instance of the entity describing entity attribute.
Throws:
SdaiException - EI_NEXS, entity instance does not exist.
See Also:
get_object, get_int, get_double, get_boolean, get_inverse, findEntityInstanceUsedin, getAttributeValueBound, set, unsetAttributeValue, createAggregate

findEntityInstanceSdaiModel

public SdaiModel findEntityInstanceSdaiModel()
                                      throws SdaiException
Description copied from interface: EEntity
Returns SdaiModel this entity instance belongs to. Every entity instance does belong to exactly one SdaiModel. The entity instances of an SdaiModel are only available when this model is either in read-only or read-write access mode. If the access mode is unset, all the entity instances of this SdaiModel become forbidden for the applications. In fact, invocation of most methods for such an instance causes SdaiException EI_NEXS to be thrown.

Don't be irritated by the word "find" in the name of the method. This method is fast because JSDAI has this information available explicitly.

Example:

    EEntity inst = ...;
    SdaiModel owner = inst.findEntityInstanceSdaiModel();

Specified by:
findEntityInstanceSdaiModel in interface EEntity
Returns:
SdaiModel that contains this entity instance.
Throws:
SdaiException - TR_EAB, transaction ended abnormally.
See Also:
"ISO 10303-22::10.10.3 Find entity instance SDAI-model"

isInstanceOf

public boolean isInstanceOf(jsdai.dictionary.EEntity_definition type)
                     throws SdaiException
Description copied from interface: EEntity
Checks if the type (described by EEntity_definition) of this entity instance coincides with the type given by method's parameter. The answer is obtained, contrary to isInstanceOf(Class), solely on the basis of "SDAI_dictionary_schema" information. If null is passed to the method's parameter, then SdaiException ED_NDEF is thrown.

Example:

    EEntity inst = ...;
    EEntity another_inst = ...;
    EEntity_definition def = another_inst.getInstanceType();
    boolean is_of_def = inst.isInstanceOf(def);

Specified by:
isInstanceOf in interface EEntity
Parameters:
type - the given type (instance of EEntity_definition).
Returns:
true if the type (EEntity_definition) of the instance coincides with the given type; false, otherwise.
Throws:
SdaiException - SY_ERR, underlying system error.
See Also:
isInstanceOf(Class), isKindOf(EEntity_definition), isKindOf(Class), "ISO 10303-22::10.10.5 Is instance of"

isInstanceOf

public boolean isInstanceOf(java.lang.Class type)
                     throws SdaiException
Description copied from interface: EEntity
Checks if java.lang.Class object of this entity instance coincides with the given java.lang.Class object which describes java class representing some other entity instance. Contrary to isInstanceOf(EEntity_definition) method, no "SDAI_dictionary_schema" information is used.

Example:

    EEntity inst = ...;
    EEntity another_inst = ...;
    Class cl = another_inst.getClass();
    boolean is_of_cl = inst.isInstanceOf(cl);

Specified by:
isInstanceOf in interface EEntity
Parameters:
type - java.lang.Class object which describes java class representing some entity instance.
Returns:
true if java.lang.Class object of this entity instance coincides with the given java.lang.Class object; false, otherwise.
Throws:
SdaiException - EI_NEXS, entity instance does not exist.
See Also:
isInstanceOf(EEntity_definition), isKindOf(EEntity_definition), isKindOf(Class), "ISO 10303-22::10.10.5 Is instance of"

isKindOf

public boolean isKindOf(jsdai.dictionary.EEntity_definition type)
                 throws SdaiException
Description copied from interface: EEntity
Checks if the type (described by EEntity_definition) of this entity instance coincides with the given type (instance of EEntity_definition) or is a subtype of it. The answer is obtained, contrary to isKindOf(Class) method, solely on the basis of "SDAI_dictionary_schema" information. If null is passed to the method's parameter, then SdaiException ED_NDEF is thrown.

Example:

    EVector vect = ...;
    ERepresentation_item item = ...;
    EEntity_definition def = item.getInstanceType();
    boolean is_vect_an_item = vect.isKindOf(def);

Specified by:
isKindOf in interface EEntity
Parameters:
type - the given type (instance of EEntity_definition).
Returns:
true if the type (EEntity_definition) of this instance coincides with the given type or is a subtype of it; false, otherwise.
Throws:
SdaiException - ED_NDEF, entity definition not defined.
See Also:
isInstanceOf(EEntity_definition), isInstanceOf(Class), isKindOf(Class), "ISO 10303-22::10.10.6 Is kind of"

isKindOf

public boolean isKindOf(java.lang.Class type)
                 throws SdaiException
Description copied from interface: EEntity
Checks if java.lang.Class object of this entity instance coincides with the given java.lang.Class object, which describes java class representing some other entity instance, or is a java.lang.Class object for the java class which is a subclass of the given class. Contrary to isKindOf(EEntity_definition) method, no "SDAI_dictionary_schema" information is used. If null value is passed to the method's parameter, then SdaiException VA_NSET is thrown.

Example:

    EVector vect = ...;
    boolean is_vect_an_item = vect.isKindOf(ERepresentation_item.class);

Specified by:
isKindOf in interface EEntity
Parameters:
type - java.lang.Class object which describes java class representing some entity instance.
Returns:
true if java.lang.Class object of this entity instance coincides with the given java.lang.Class object or is a java.lang.Class object for the java class which is a subclass of the given class; false, otherwise.
Throws:
SdaiException - SY_ERR, underlying system error.
See Also:
isInstanceOf(EEntity_definition), isInstanceOf(Class), isKindOf(EEntity_definition), "ISO 10303-22::10.10.6 Is kind of"

findEntityInstanceUsers

public final void findEntityInstanceUsers(ASdaiModel modelDomain,
                                          AEntity result)
                                   throws SdaiException
Description copied from interface: EEntity
Searches for entity instances which reference the current instance. The search area for such entity instances is restricted to those SdaiModels which belong to the set given by the first method's parameter. In the case when the first parameter is null, the search is restricted to the model which is the owner of the current instance (can be found using findEntityInstanceSdaiModel). If the value of the first parameter is an empty array of type ASdaiModel, then no restriction is imposed on the search area, that is, referencing instances from all SdaiModels, which have either read-only or read-write access, are considered as being relevant. Referencing instances are stored into a non-persistent list passed to the method through the second parameter. Usually this list is created with operator new. A referencing instance is put into this list as many times as it references the current instance. If null value is passed to the method's second parameter, then SdaiException AI_NEXS is thrown.

Example:

    EProduct pro = ...;
    EDirection dir = ...;
    AEntity general_list = new AEntity();
    pro.findEntityInstanceUsers(null, general_list);
    ASdaiModel domain = ...;
    ADirection dir_list = new ADirection();
    dir.findEntityInstanceUsers(domain, dir_list);

Specified by:
findEntityInstanceUsers in interface EEntity
Parameters:
modelDomain - the list of SdaiModels specifying the area where to search for entity instances referencing the current entity instance.
result - the submitted non-persistent list to which all entity instances referencing this instance are appended.
Throws:
SdaiException - SY_ERR, underlying system error.
See Also:
findEntityInstanceUsedin, findInstanceRoles, "ISO 10303-22::10.10.8 Find entity instance users"

findEntityInstanceUsedin

public void findEntityInstanceUsedin(jsdai.dictionary.EAttribute role,
                                     ASdaiModel modelDomain,
                                     AEntity result)
                              throws SdaiException
Description copied from interface: EEntity
Searches for entity instances which reference the current instance in the role specified by an instance of EAttribute (first parameter). The search area for such entity instances is restricted to those SdaiModels which belong to the set given by the second method's parameter. In the case when the second parameter is null, the search is restricted to the model which is the owner of the current instance (can be found using findEntityInstanceSdaiModel method). If the value of the second parameter is an empty array of type ASdaiModel, then no restriction is imposed on the search area, that is, referencing instances from all SdaiModels, which have either read-only or read-write access, are considered as being relevant. Referencing instances are stored into a non-persistent list submitted to the method through the third parameter. Usually this list is created with operator new. A referencing instance is put into this list as many times as it references the current instance in the specified role. The list of cases when SdaiException is thrown contains the following items:

In EXPRESS, a relation between two entities is defined and stored in only one entity of the pair, but it always exists in both directions. For some attributes of one entity, an inverse attribute on the other entity is defined. This is usually done to restrict the cardinality of the relation. But independently of the explicit specification of an inverse attribute there is an implicit inverse relation for every explicit one. The current JSDAI implementation of findEntityInstanceUsedin allows fast access to every inverse attribute. This method is fast because JSDAI explicitly stores all inverse pointers.

Example 1 illustrating late binding alternative:

    EProduct product = ...;
    EAttribute attrib = CProduct_definition_formation.attributeOf_product(null);
    AProduct_definition_formation formations = new AProduct_definition_formation();
    product.findEntityInstanceUsedin(attrib, null, formations);

Example 2 illustrating early binding alternative:

    EProduct product = ...;
    AProduct_definition_formation formations = new AProduct_definition_formation();
    CProduct_definition_formation.usedinOf_product(null, product, null, formations);

Specified by:
findEntityInstanceUsedin in interface EEntity
Parameters:
role - the attribute by which this entity instance is accessed. Note that any attribute always belongs to exactly one entity definition.
modelDomain - the list of SdaiModels specifying the area where to search for entity instances referencing the current entity instance in the specified role.
result - the submitted non-persistent list to which all entity instances referencing this instance in the specified role (first parameter) are appended.
Throws:
SdaiException - AT_NDEF, attribute not defined.
See Also:
findEntityInstanceUsers, findInstanceRoles, "ISO 10303-22::10.10.9 Find entity instance usedin"

getAttributeValueBound

public int getAttributeValueBound(jsdai.dictionary.EAttribute attribute)
                           throws SdaiException
Description copied from interface: EEntity
This method is not implemented in current JSDAI version.

SdaiException FN_NAVL will be thrown if this method is invoked.

Specified by:
getAttributeValueBound in interface EEntity
Parameters:
attribute - the attribute for which value bound is to be computed.
Returns:
value of population dependent bound for double, string or binary type for the value of the specified attribute.
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.10.10 Get attribute value bound"

findInstanceRoles

public void findInstanceRoles(ASdaiModel modelDomain,
                              jsdai.dictionary.AAttribute result)
                       throws SdaiException
Description copied from interface: EEntity
Searches for attributes by which other entity instances reference the current instance. The search area for such attributes is restricted to entity instances in those SdaiModels which belong to the set given by the first method's parameter. In the case when the first parameter is null, the search is restricted to the model which is the owner of the current instance (can be found using findEntityInstanceSdaiModel method). Referencing attributes are stored into a non-persistent list submitted to the method through the second parameter. Usually this list is created with operator new. If null value is passed to the method's second parameter, then SdaiException AI_NEXS is thrown.

This method bears some similarity to findEntityInstanceUsers method. However, the result is not the referencing instances but the list containing entity attributes by which the current instance from other instances is referenced. Each attribute is represented by an instance of the class CAttribute of the SDAI dictionary. Having an instance of CAttribute it is possible to get entity definition containing it by simply applying getParent_entity method.

Example:

    EProduct pro = ...;
    EDirection dir = ...;
    AEntity general_list = new AEntity();
    pro.findInstanceRoles(null, general_list);
    ASdaiModel domain = ...;
    ADirection dir_list = new ADirection();
    dir.findInstanceRoles(domain, dir_list);

Specified by:
findInstanceRoles in interface EEntity
Parameters:
modelDomain - the list of SdaiModels specifying the area where to search for attributes by which other entity instances reference the current instance.
result - the submitted non-persistent list to which all attributes that reference this entity instance are appended.
Throws:
SdaiException - TR_NAVL, transaction currently not available.
See Also:
findEntityInstanceUsers, findEntityInstanceUsedin, "ISO 10303-22::10.10.11 Find instance roles"

findInstanceDataTypes

public void findInstanceDataTypes(jsdai.dictionary.ANamed_type result,
                                  jsdai.dictionary.ESchema_definition schema)
                           throws SdaiException
Description copied from interface: EEntity
This method is not implemented in current JSDAI version.

SdaiException FN_NAVL will be thrown if this method is invoked.

Specified by:
findInstanceDataTypes in interface EEntity
Parameters:
result - the submitted non-persistent list to which all named types of which this entity instance is a member are appended.
schema - defines the scope where to search for the named types for which this instance is a member of. If the value is null, then the underlying schema of the model to which this instance belongs is taken.
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.10.12 Find instance data types"

copyApplicationInstance

public EEntity copyApplicationInstance(SdaiModel target_model)
                                throws SdaiException
Description copied from interface: EEntity
Creates a copy of this instance in the specified SdaiModel. All attribute values from this instance are copied to the new one. If some attribute is of aggregation type, then in the new instance for this attribute a new aggregate is created and either filled with values taken from this instance (if the aggregation type describes non-nested aggregate) or this rule is applied recursively (if the aggregation type describes nested aggregate). If this and new instances belong to the same repository, then persistent labels for these instances will be different.

A target SdaiModel to which the current instance is copied must be in read-write access mode. If, however, no target model is submitted to the method (through its parameter), then SdaiException MO_NEXS is thrown. This method is applicable to instances of entities which are encountered in the EXPRESS schema whose definition is underlying for the target model. Otherwise, that is, if entity is not known for this schema, SdaiException ED_NVLD is thrown.

Specified by:
copyApplicationInstance in interface EEntity
Parameters:
target_model - the SdaiModel this application instance to be copied to.
Returns:
the new copy of this application instance.
Throws:
SdaiException - TR_NRW, transaction not read-write.
See Also:
"ISO 10303-22::10.11.1 Copy application instance"

deleteApplicationInstance

public void deleteApplicationInstance()
                               throws SdaiException
Description copied from interface: EEntity
Deletes this entity instance. All references from other entity instances to this instance are unset. After invoking of this method the Java object representing this instance becomes invalid and is no longer referenced within JSDAI.

Specified by:
deleteApplicationInstance in interface EEntity
Throws:
SdaiException - TR_NRW, transaction not read-write.
See Also:
"ISO 10303-22::10.11.2 Delete application instance"

set

public void set(jsdai.dictionary.EAttribute attribute,
                java.lang.Object value,
                jsdai.dictionary.EDefined_type[] select)
         throws SdaiException
Description copied from interface: EEntity
Assigns a value of type Object to the specified explicit attribute. This method is applicable for values of type EEntity, String, and Binary. If the base type of the attribute is select type and the set of possible leaf types is not a subset of the set of entity data types, then the select path corresponding to the value to be assigned needs to be submitted (through the third method's parameter). Otherwise, null to the third parameter can be passed.

Select path is a sequence of defined data types needed to specify a value of a select data type (as defined in ISO 10303-21:11.1.8). In fact, for a select data type a value of which is asked to be set, a certain oriented acyclic graph G = (V,A) can be constructed. The vertices of this graph correspond to defined data types and select data types. An arc goes from the vertex representing defined data type to a vertex representing select data type if the latter is the value of the attribute "domain" of the former. Further, an arc connects vertex of the select data type to a vertex of the defined data type if this latter type belongs to the SET assigned to the attribute "selections" of the select data type.

Example. Suppose the following data types are given (here Express language notation is used):

TYPE chi = LIST [1:3] OF REAL;
END_TYPE;

TYPE xi = INTEGER;
END_TYPE;

TYPE tau = ENUMERATION OF
        (stigma,
         digamma,
         koppa,
         sampi);
END_TYPE;

TYPE rho = SELECT
        (nu,
         omicron,
         upsilon);
END_TYPE;

TYPE nu = SELECT
        (chi,
         xi,
         tau);
END_TYPE;

TYPE omicron = lambda;
END_TYPE;

TYPE lambda = nu;
END_TYPE;

TYPE upsilon = SET [0:3] OF nu;
END_TYPE;
For these Express definitions the following data dictionary instances are created by JSDAI:

#2=DEFINED_TYPE('chi',(),$,#94);
#94=LIST_TYPE(#93,#91,#92,.F.);
#91=INTEGER_BOUND(1);
#92=INTEGER_BOUND(3);
#93=REAL_TYPE($);
#10=DEFINED_TYPE('xi',(),$,#99);
#99=INTEGER_TYPE();
#16=DEFINED_TYPE('tau',(),$,#103);
#103=ENUMERATION_TYPE(('stigma','digamma','koppa','sampi'));
#20=DEFINED_TYPE('rho',(),$,#105);
#105=SELECT_TYPE((#4,#14,#18));
#4=DEFINED_TYPE('nu',(),$,#104);
#104=SELECT_TYPE((#2,#10,#16));
#14=DEFINED_TYPE('omicron',(),$,#15);
#15=DEFINED_TYPE('lambda',(),$,#4);
#18=DEFINED_TYPE('upsilon',(),$,#102);
#102=SET_TYPE(#4,#100,#92);
#100=INTEGER_BOUND(0);
Then, for example, for the select data type "rho" the oriented graph G can be constructed whose vertex set V = {#20,#105,#4,#14,#18,#104,#15,#2,#10,#16} and the arc set A = {(#20,#105), (#105,#4), (#105,#14), (#105,#18), (#4,#104), (#14,#15), (#15,#4), (#104,#2), (#104,#10), (#104,#16)}.

The root of the graph corresponds to the select data type inducing the graph, whereas the types of the values which can be assigned to an attribute of this select data type are represented by the vertices of this graph having no outcoming arcs (leaves of the graph). These vertices are called value vertices. In the example given above, the root #20 is for "rho" and the vertices #2,#10,#16,#18 represent 'LIST [1:3] OF REAL', INTEGER, 'ENUMERATION OF (stigma,digamma,koppa,sampi)', and 'SET [0:3] OF nu', respectively. When setting a value to an attribute, the needed path from the root of the graph to one of its value vertices shall be identified. To unambiguously describe such a path, it is sufficient to list only vertices of G corresponding to defined data types. Even more, not all such vertices following from the root to a value vertex are taken. The following two rules shall be applied:

  1. Each defined type whose "domain" is a select data type is excluded from the path.
  2. If in the path there is a subpath of length at least 4 whose both endvertices represent select data types and the internal vertices represent defined data types, then only the first of the internal vertices is left, while the others are removed.
Such a sequence of vertices obtained by taking only defined data types and applying the two rules stated above is called a shrinked select path or just a select path.

Example (continued). For value of type 'SET [0:3] OF nu' the full path is #20,#105,#18, whereas the corresponding shrinked select path is #18, that is, consists of a single vertex. For value of type INTEGER there is full path #20,#105,#4,#104,#10 and its shrinked select path is #10. However, for INTEGER there exists also another path #20,#105,#14,#15,#4,#104,#10. Its shrinked select path is #14,#10. This means that the same integer value can be set to the same attribute in two slightly different contexts.

When trying to set a value for a given attribute whose base type is select data type and in the graph describing it there is the corresponding value vertex, then it is required to provide the shrinked select path to this value vertex by submitting a nonempty array of EDefined_type as the third parameter of this method. To prepare this array, getDefinedType method can be used.

Example (continued). To set an integer to an attribute of type "rho" the following statements can be adopted.

        EEpsilon inst = ...
        EAttribute attr = inst.getAttributeDefinition("e5");
        ESchema_definition schema = inst.findEntityInstanceSdaiModel().getUnderlyingSchema();
        EDefined_type[] sel = new EDefined_type[5];
        sel[0] = schema.getDefinedType("xi"); // the shrinked select path consists of the defined type with the name 'xi'
        inst.set(attr, 99, sel);
After exporting the repository containing 'inst' to an exchange structure, this value will be written as XI(99). If the above excerpt from an Express schema was modified slightly by taking 'TYPE upsilon = INTEGER;' instead of 'TYPE upsilon = SET [0:3] OF nu;', then the following assignment of the same value to 'attr' is classified as being different from that given before:

        sel[0] = schema.getDefinedType("upsilon"); // the shrinked select path consists of the defined type with the name 'upsilon'
        sel[1] = null;
        inst.set(attr, 99, sel);
In an exchange structure the value will be given as UPSILON(99).

The number of defined data types in the array "select" giving the select path is either specified by the position of the first null value in this array or is equal to the length of this array if it contains no null value.

The list of cases when SdaiException is thrown contains the following items:

This method is a late binding implementation of the "put attribute" operation.

Specified by:
set in interface EEntity
Parameters:
attribute - the explicit attribute to be assigned a value.
value - the value to be assigned to the attribute.
select - select path corresponding to the value submitted.
Throws:
SdaiException - TR_NAVL, transaction currently not available.
See Also:
EEntity.set(EAttribute, int, EDefined_type[]), EEntity.set(EAttribute, double, EDefined_type[]), EEntity.set(EAttribute, boolean, EDefined_type[]), "ISO 10303-22::10.11.3 put attribute"

set

public void set(jsdai.dictionary.EAttribute attribute,
                int value,
                jsdai.dictionary.EDefined_type[] select)
         throws SdaiException
Description copied from interface: EEntity
Assigns a value of type int to the specified explicit attribute. This method is applicable for values of EXPRESS data types INTEGER, BOOLEAN, LOGICAL, ENUMERATION and REAL. If the base type of the attribute is select type, then the select path corresponding to the value to be assigned needs to be submitted (through the third method's parameter). Otherwise, null to the third parameter can be passed. Select path is a sequence of defined data types needed to specify a value of a select data type (as defined in ISO 10303-21:11.1.8). The number of defined data types in the array "select" giving the select path is either specified by the position of the first null value in this array or is equal to the length of this array if it contains no null value. For a definition of the select path and a detailed example see set(EAttribute, Object, EDefined_type[])

The list of cases when SdaiException is thrown contains the following items:

This method is a late binding implementation of the "put attribute" operation.

Example:

    ETrimmed_curve curve = ...;
    EAttribute attr = curve.getAttributeDefinition("master_representation");
    curve.set(attr, 15, null);

Specified by:
set in interface EEntity
Parameters:
attribute - the explicit attribute to be assigned a value.
value - the value to be assigned to the attribute.
select - select path corresponding to the value submitted.
Throws:
SdaiException - VA_NSET, value not set.
See Also:
EEntity.set(EAttribute, Object, EDefined_type[]), EEntity.set(EAttribute, double, EDefined_type[]), EEntity.set(EAttribute, boolean, EDefined_type[]), "ISO 10303-22::10.11.3 put attribute"

set

public void set(jsdai.dictionary.EAttribute attribute,
                double value,
                jsdai.dictionary.EDefined_type[] select)
         throws SdaiException
Description copied from interface: EEntity
Assigns a value of type double to the specified explicit attribute. This method is applicable for values of EXPRESS data types REAL, and NUMBER. If the base type of the attribute is select type, then the select path corresponding to the value to be assigned needs to be submitted (through the third method's parameter). Otherwise, null to the third parameter can be passed. Select path is a sequence of defined data types needed to specify a value of a select data type (as defined in ISO 10303-21:11.1.8). The number of defined data types in the array "select" giving the select path is either specified by the position of the first null value in this array or is equal to the length of this array if it contains no null value. For a definition of the select path and a detailed example see set(EAttribute, Object, EDefined_type[])

The list of cases when SdaiException is thrown contains the following items:

This method is a late binding implementation of the "put attribute" operation.

Example:

    EVector vect = ...;
    EAttribute attr = vect.getAttributeDefinition("magnitude");
    vect.set(attr, 9.99, null);

Specified by:
set in interface EEntity
Parameters:
attribute - the explicit attribute to be assigned a value.
value - the value to be assigned to the attribute.
select - select path corresponding to the value submitted.
Throws:
SdaiException - VT_NVLD, value type invalid.
See Also:
EEntity.set(EAttribute, Object, EDefined_type[]), EEntity.set(EAttribute, int, EDefined_type[]), EEntity.set(EAttribute, boolean, EDefined_type[]), "ISO 10303-22::10.11.3 put attribute"

set

public void set(jsdai.dictionary.EAttribute attribute,
                boolean value,
                jsdai.dictionary.EDefined_type[] select)
         throws SdaiException
Description copied from interface: EEntity
Assigns a value of type boolean to the specified explicit attribute. This method is applicable for values of EXPRESS data type BOOLEAN. If the base type of the attribute is select type, then the select path corresponding to the value to be assigned needs to be submitted (through the third method's parameter). Otherwise, null to the third parameter can be passed. Select path is a sequence of defined data types needed to specify a value of a select data type (as defined in ISO 10303-21:11.1.8). The number of defined data types in the array "select" giving the select path is either specified by the position of the first null value in this array or is equal to the length of this array if it contains no null value. For a definition of the select path and a detailed example see set(EAttribute, Object, EDefined_type[])

The list of cases when SdaiException is thrown contains the following items:

This method is a late binding implementation of the "put attribute" operation.

Example:

    EOriented_edge edge = ...;
    EAttribute attr = edge.getAttributeDefinition("orientation");
    edge.set(attr, true, null);

Specified by:
set in interface EEntity
Parameters:
attribute - the explicit attribute to be assigned a value.
value - the value to be assigned to the attribute.
select - select path corresponding to the value submitted.
Throws:
SdaiException - AT_NVLD, attribute invalid.
See Also:
EEntity.set(EAttribute, Object, EDefined_type[]), EEntity.set(EAttribute, int, EDefined_type[]), EEntity.set(EAttribute, double, EDefined_type[]), "ISO 10303-22::10.11.3 put attribute"

unsetAttributeValue

public void unsetAttributeValue(jsdai.dictionary.EAttribute attribute)
                         throws SdaiException
Description copied from interface: EEntity
Changes the state of the specified explicit attribute, so that this attribute has no value longer. If no attribute is submitted or, respectively, the attribute submitted is either not explicit one or not from this entity, then SdaiException AT_NDEF and, respectively, AT_NVLD is thrown.

This method is a late binding implementation of the "unset attribute value" operation.

Specified by:
unsetAttributeValue in interface EEntity
Parameters:
attribute - the explicit attribute whose value is to be unset.
Throws:
SdaiException - AT_NVLD, attribute invalid.
See Also:
"ISO 10303-22::10.11.4 Unset attribute value"

createAggregate

public Aggregate createAggregate(jsdai.dictionary.EAttribute attribute,
                                 jsdai.dictionary.EDefined_type[] select)
                          throws SdaiException
Description copied from interface: EEntity
Creates a new empty aggregate instance replacing the existing value (if any) of the specified explicit attribute. If the base type of the attribute is select type, then the select path specifying the type of the aggregate to be assigned needs to be submitted (through the third method's parameter). Otherwise, null to the third parameter can be passed. Select path is a sequence of defined data types needed to specify a value of a select data type (as defined in ISO 10303-21:11.1.8). The number of defined data types in the array "select" giving the select path is either specified by the position of the first null value in this array or is equal to the length of this array if it contains no null value. For a definition of the select path and a detailed example see set(EAttribute, Object, EDefined_type[])

The list of cases when SdaiException is thrown contains the following items:

This method is a late binding implementation of the "create aggregate instance" operation.

Example:

    ETrimmed_curve curve = ...;
    EAttribute attr = curve.getAttributeDefinition("trim_1");
    ATrimming_select aggr = curve.createAggregate(attr, null);

Specified by:
createAggregate in interface EEntity
Parameters:
attribute - the explicit attribute whose value is to be set with a new aggregate instance.
select - select path specifying the type of the aggregate to be assigned.
Returns:
the aggregate instance that has been created.
Throws:
SdaiException - VA_NVLD, value invalid.
See Also:
"ISO 10303-22::10.11.5 Create aggregate instance"

getPersistentLabel

public java.lang.String getPersistentLabel()
                                    throws SdaiException
Description copied from interface: EEntity
Returns a String, which is a persistent label of this entity instance. This label is assigned to the instance by JSDAI at the time when this instance is created, and does not change later - it is persistent. The label is unique within the repository containing the instance. The label is defined both for application and dictionary instances.

JSDAI chooses the persistent label in such a way that it satisfies the requirements imposed on the instance names in the clear text encoding of the exchange structure (ISO 10303-21::7.3.4 Entity instance names).

Example:

    EEntity inst = ...;
    String ident = inst.getPersistentLabel();
    The value of ident will be like this:
    #2618

Specified by:
getPersistentLabel in interface EEntity
Returns:
persistent label.
Throws:
SdaiException - TR_NEXS, transaction does not exist.
See Also:
SdaiRepository.getSessionIdentifier(java.lang.String), "ISO 10303-22::10.11.6 Get persistent label"

getDescription

public java.lang.String getDescription()
                                throws SdaiException
Description copied from interface: EEntity
Returns a human readable description of the entity instance. This description is in the form of two strings separated by one space. The first string is entity instance name (see ISO 10303-21::7.3.4 Entity instance names), while the second is the name of the file containing this instance.

Specified by:
getDescription in interface EEntity
Returns:
the description for the entity instance.
Throws:
SdaiException - TR_NEXS, transaction does not exist.
See Also:
"ISO 10303-22::10.11.8 Get description"

validateWhereRule

public int validateWhereRule(jsdai.dictionary.EWhere_rule rule,
                             ASdaiModel domain)
                      throws SdaiException
Description copied from interface: EEntity
Checks if a where rule is satisfied for this instance. If the first parameter delivering a rule is null, then all where rules found in the entity definition of this instance are checked. If the second parameter is null, then the domain is only the actual SdaiModel of the current instance.

Specified by:
validateWhereRule in interface EEntity
Parameters:
rule - the where rule.
domain - the list of SdaiModels specifying the area in which to perform the validation of where rules.
Returns:
number 2 if rule is satisfied, number 1 if it is violated, and number 3 if evaluation value is indeterminate.
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.11.9 Validate where rule", EEntity.validateWhereRule(AWhere_rule, ASdaiModel)

validateWhereRule

public int validateWhereRule(jsdai.dictionary.AWhere_rule viol_rules,
                             ASdaiModel domain)
                      throws SdaiException
Description copied from interface: EEntity
Checks if where rules associated with this instance are satisfied. The rules validated include both those which are declared directly as part of the entity definition upon which this instance is based and those which are declared in defined types that serve as domains for the attributes of this entity definition. If the second parameter is null, then the domain is only the actual SdaiModel of the current instance.

Specified by:
validateWhereRule in interface EEntity
Parameters:
viol_rules - the non-persistent list to which violated where rules are appended.
domain - the list of SdaiModels specifying the area in which to perform the validation of where rules.
Returns:
number 2 if rule is satisfied, number 1 if it is violated, and number 3 if evaluation value is indeterminate.
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.11.9 Validate where rule", EEntity.validateWhereRule(EWhere_rule, ASdaiModel)

validateRequiredExplicitAttributesAssigned

public boolean validateRequiredExplicitAttributesAssigned(jsdai.dictionary.AAttribute nonConf)
                                                   throws SdaiException
Description copied from interface: EEntity
Checks if all non-optional explicit attributes of this instance have values. Redeclaring explicit attributes are considered as well.

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateRequiredExplicitAttributesAssigned in interface EEntity
Parameters:
nonConf - the non-persistent list to which non-optional attributes without values are appended.
Returns:
true if all non-optional attributes have values or all attributes are optional, false otherwise.
Throws:
SdaiException - SY_ERR, an underlying system error occurred.
See Also:
"ISO 10303-22::10.11.10 Validate required explicit attributes assigned"

validateInverseAttributes

public boolean validateInverseAttributes(jsdai.dictionary.AAttribute nonConf)
                                  throws SdaiException
Description copied from interface: EEntity
Checks if cardinality constraints specified in the INVERSE clauses are satisfied for this entity instance.

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateInverseAttributes in interface EEntity
Parameters:
nonConf - the non-persistent list to which the inverse attributes violating the constraints are appended.
Returns:
true if all inverse attribute constraints are satisfied or if this entity does not have inverse attributes, false otherwise.
Throws:
SdaiException - SY_ERR, an underlying system error occurred.
See Also:
"ISO 10303-22::10.11.11 Validate inverse attributes"

validateInverseAttributes

public boolean validateInverseAttributes(jsdai.dictionary.AAttribute nonConf,
                                         ASdaiModel domain)
                                  throws SdaiException
Description copied from interface: EEntity
Checks if cardinality constraints specified in the INVERSE clauses are satisfied for this entity instance.

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateInverseAttributes in interface EEntity
Parameters:
nonConf - the non-persistent list to which the inverse attributes violating the constraints are appended.
domain - the list of SdaiModels specifying the area inverse attributes in which shall be validated.
Returns:
true if all inverse attribute constraints are satisfied or if this entity does not have inverse attributes, false otherwise.
Throws:
SdaiException - SY_ERR, an underlying system error occurred.
See Also:
"ISO 10303-22::10.11.11 Validate inverse attributes"

validateExplicitAttributesReferences

public int validateExplicitAttributesReferences(jsdai.dictionary.AAttribute nonConf)
                                         throws SdaiException
Description copied from interface: EEntity
Checks if all the entity instances referenced by explicit attributes of this entity instance are of valid type for those attributes.

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateExplicitAttributesReferences in interface EEntity
Parameters:
nonConf - the non-persistent list to which the attributes referencing entity instances of wrong type are appended.
Returns:
number 2 if all attributes referencing entity instances have correct values or this instance has no such attributes, number 1 if any attribute has value that is an instance of incorrect type, and number 3 if any non-optional explicit attribute, which could reference an entity instance, is unset.
Throws:
SdaiException - SY_ERR, an underlying system error occurred.
See Also:
"ISO 10303-22::10.11.12 Validate explicit attributes references"

validateAggregatesSize

public int validateAggregatesSize(jsdai.dictionary.AAttribute nonConf)
                           throws SdaiException
Description copied from interface: EEntity
Checks if the number of members in aggregates, or valid index values for array instances, of any attributes of this entity instance meet the constraints specified in the types of these attributes.

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateAggregatesSize in interface EEntity
Parameters:
nonConf - the non-persistent list to which the attributes having as values aggregates of sizes violating the constraints are appended.
Returns:
number 2 if all aggregate size constraints for this entity instance are satisfied, number 1 if at least one size constraint is violated, and number 3 if evaluation value is indeterminate.
Throws:
SdaiException - SY_ERR, an underlying system error occurred.
See Also:
"ISO 10303-22::10.11.13 Validate aggregates size"

validateAggregatesUniqueness

public boolean validateAggregatesUniqueness(jsdai.dictionary.AAttribute nonConf)
                                     throws SdaiException
Description copied from interface: EEntity
Checks if all members are unique in any aggregate instance being a value of any attribute whose type requires uniqueness. This validation is performed for all attributes of this instance. Entity instances in aggregates are checked for uniqueness by comparing their names (see ISO 10303-21::7.3.4 Entity instance names).

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateAggregatesUniqueness in interface EEntity
Parameters:
nonConf - the non-persistent list to which the attributes with value violating the aggregate uniqueness requirement are appended.
Returns:
true if all uniqueness constraints are satisfied or this entity instance has no aggregates as attribute values, false if at least one aggregate uniqueness constraint is violated.
Throws:
SdaiException - TR_NAVL, transaction currently not available.
See Also:
"ISO 10303-22::10.11.14 Validate aggregates uniqueness"

validateArrayNotOptional

public boolean validateArrayNotOptional(jsdai.dictionary.AAttribute nonConf)
                                 throws SdaiException
Description copied from interface: EEntity
Checks if arrays have values at all positions for the attributes of this entity instance where optional elements are not allowed.

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateArrayNotOptional in interface EEntity
Parameters:
nonConf - the non-persistent list to which the attributes with value of type array violating the requirement to have no unset elements are appended.
Returns:
true if all arrays, in which optional elements are not allowed, have values at all index positions, or all arrays are declared to contain optional elements, or this entity instance has not attributes with array values, false if at least one array, that is not declared to have elements at all positions, is missing at least one element, or if the array bounds conflict with array type declaration.
Throws:
SdaiException - TR_NEXS, transaction does not exist.
See Also:
"ISO 10303-22::10.11.15 Validate array not optional"

validateStringWidth

public int validateStringWidth(jsdai.dictionary.AAttribute nonConf)
                        throws SdaiException
Description copied from interface: EEntity
Checks if strings assigned, either directly or as members of aggregates, to attributes of this entity instance are of the required width. This validation is performed for all attributes of the instance.

If null is passed to the method's parameter, then SdaiException AI_NEXS is thrown.

Specified by:
validateStringWidth in interface EEntity
Parameters:
nonConf - the non-persistant list to which the attributes whose value is string having invalid width are appended.
Returns:
number 2 if all string values assigned to attributes are of the correct width, number 1 if for at least one string value the declared width is violated, and number 3 if derived attribute value expression does not evaluate to a determinate value.
Throws:
SdaiException - EI_NEXS, entity instance does not exist.
See Also:
"ISO 10303-22::10.11.16 Validate string width"

validateBinaryWidth

public int validateBinaryWidth(jsdai.dictionary.AAttribute nonConf)
                        throws SdaiException
Description copied from interface: EEntity
Checks if Binary values assigned to attributes of this entity instance are of the required width. This method is not implemented in current JSDAI version.

SdaiException FN_NAVL will be thrown if this method is invoked.

Specified by:
validateBinaryWidth in interface EEntity
Parameters:
nonConf - the non-persistant list to which the attributes whose value is Binary having invalid width are appended.
Returns:
number 2 if all Binary values assigned to attributes are of the correct width, number 1 if for at least one Binary value the declared width is violated, and number 3 if derived attribute value expression does not evaluate to a determinate value.
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.11.17 Validate binary width"

validateRealPrecision

public int validateRealPrecision(jsdai.dictionary.AAttribute nonConf)
                          throws SdaiException
Description copied from interface: EEntity
Checks if real values assigned to attributes of this entity instance are of the required minimum precision. This method is not implemented in current JSDAI version.

SdaiException FN_NAVL will be thrown if this method is invoked.

Specified by:
validateRealPrecision in interface EEntity
Parameters:
nonConf - the non-persistant list to which the attributes with real value violating the declared precision are appended.
Returns:
number 2 if all real values assigned to attributes are of the declared precision, number 1 if at least one real value violates the declared precision, and number 3 if derived attribute value expression does not evaluate to a determinate value.
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-22::10.11.18 Validate real precision"

toString

public java.lang.String toString()
Description copied from interface: EEntity
Returns a String representing this entity instance including values of all its attributes. This representation adheres all mapping rules defined in "ISO 10303-21: Clear text encoding of the exchange structure". The entity name may appear either in long form or in short form. For example, for entity cartesian_point any of the following cases can be chosen: To select one of these alternatives, repository method shortNameSupport should be used. Selecting the short form can give the desired result only if the short name of the entity is defined in the data dictionary (provided by an Express compiler). If method fails to identify this name, then the full entity name is used instead of.

Example:

    EVector vect = ...;
    System.out.println("instance: " + vect);
    The string printed will be like this:
    instance: #55=VECTOR('vec5',#1008,7.0);

Specified by:
toString in interface EEntity

typeOf

public jsdai.dictionary.AEntity_definition typeOf()
                                           throws SdaiException
Description copied from interface: EEntity
Returns an aggregate containing definitions of all single entity data types from which the entity type of this instance consists. The entity types in the aggregate are given in the alphabetical order of their names.

Example:

    SdaiRepository repo = ...;
    EEntity inst2265 = repo.getSessionIdentifier("#2265");
    AEntity_definition types2265 = inst2265.typeOf();
    for (int i = 1; i <= types2265.getMemberCount(); i++) {
       System.out.println("type: " + types2265.getByIndex(i).getName(null));
    }
    For an instance of the entity "dimension_text_associativity" in the schema "aic_associative_draughting_elements" the output will be as follows:
    type: dimension_text_associativity
    type: geometric_representation_item
    type: mapped_item
    type: representation_item
    type: text_literal

Specified by:
typeOf in interface EEntity
Returns:
the aggregate consisting of single entity data types for this entity instance.
Throws:
SdaiException - EI_NEXS, entity instance does not exist.
See Also:
"ISO 10303-11::15.25 TypeOf - general function"

setTemp

public void setTemp(java.lang.Object key,
                    java.lang.Object value)
Description copied from interface: EEntity
An extension of EEntity.setTemp(Object value). Allows to store more than one user data object with this entity. Object is identified by a key. Later the same key can be used to retrieve the stored data object using EEntity.getTemp(Object key). The rest of the functionality is identical to EEntity.setTemp(Object value).

Specified by:
setTemp in interface EEntity
Parameters:
key - a key which identifies the user data object.
value - the used data value to store.
See Also:
EEntity.getTemp(), EEntity.getTemp(Object key), EEntity.setTemp(Object key)

setTemp

public void setTemp(java.lang.Object value)
Description copied from interface: EEntity
Assigns a value to special field of type Object in which an application is allowed to store some user's data related to this entity instance. This Object field is not persistent. Its value is lost when the read-only or read-write access to the owning SdaiModel is ended or when the transaction is aborted.

Specified by:
setTemp in interface EEntity
Parameters:
value - the value for the special Object field to be set.
See Also:
EEntity.getTemp(), EEntity.getTemp(Object key), EEntity.setTemp(Object key, Object value)

getTemp

public java.lang.Object getTemp(java.lang.Object key)
Description copied from interface: EEntity
An extension of EEntity.getTemp(). Allows to retrieve more than one user data object previously stored with this entity using EEntity.setTemp(Object key, Object value). Object is identified by a key which has to be the same as it was provided for method EEntity.setTemp(Object key, Object value). The rest of the functionality is identical to EEntity.getTemp().

Specified by:
getTemp in interface EEntity
Parameters:
key - a key which identifies the user data object.
Returns:
the value of user defined data.
See Also:
EEntity.getTemp(), EEntity.setTemp(Object key), EEntity.setTemp(Object key, Object value)

getTemp

public java.lang.Object getTemp()
Description copied from interface: EEntity
Returns an Object where an application is allowed to store some user's data related to this entity instance. This Object field is not persistent. Its value is lost when the read-only or read-write access to the owning SdaiModel is ended or when the transaction is aborted.

Specified by:
getTemp in interface EEntity
Returns:
the current value of the special field of typeObject.
See Also:
EEntity.getTemp(Object key), EEntity.setTemp(Object key), EEntity.setTemp(Object key, Object value)

compareValuesBoolean

public boolean compareValuesBoolean(EEntity inst)
                             throws SdaiException
Description copied from interface: EEntity
Compares this entity instance to the submitted entity instance. Both instances must be based on the same entity definition. If not, then SdaiException ED_NDEQ is thrown. When executing this method, values of all attributes in these two instances are compared.

Passing null value to the method's parameter results in SdaiException VA_NSET.

This method is an extension of JSDAI, which is not a part of the standard.

Example:

    EVector vect1 = ...;
    EVector vect2 = ...;
    boolean equal = vect1.compareValuesBoolean(vect2);

Specified by:
compareValuesBoolean in interface EEntity
Parameters:
inst - the entity instance submitted to compare against this entity instance.
Returns:
true if values of the same attributes of the instances are equal, false otherwise.
Throws:
SdaiException - VA_NSET, value not set.
See Also:
EEntity.compareValuesLogical(jsdai.lang.EEntity)

compareValuesLogical

public int compareValuesLogical(EEntity inst)
                         throws SdaiException
Description copied from interface: EEntity
Compares this entity instance to the submitted entity instance. This method is not implemented in current JSDAI version.

SdaiException FN_NAVL will be thrown if this method is invoked.

This method is an extension of JSDAI, which is not a part of the standard.

Specified by:
compareValuesLogical in interface EEntity
Parameters:
inst - the entity instance submitted to compare against this entity instance.
Returns:
number 2 if values of the same attributes of the instances are equal, number 1 if values for at least one attribute are different, and number 3 if a comparison result for at least one attribute is unknown.
Throws:
SdaiException - FN_NAVL, function not available.
See Also:
"ISO 10303-11::12.2.1.7 Entity value comparison"

makeUsedin

public int makeUsedin(jsdai.dictionary.EEntity_definition referent_def,
                      jsdai.dictionary.EAttribute role,
                      ASdaiModel modelDomain,
                      AEntity result)
               throws SdaiException
This method is for internal JSDAI use only. Applications shall not use it. The method is invoked from the static early binding usedin methods in the application entity classes. Returns the count of instances added to the resulting list.

Throws:
SdaiException

addSdaiListener

public void addSdaiListener(SdaiListener listener)
Adds SdaiListener extending java.util.EventListener to a special aggregate defined for this entity instance.

Specified by:
addSdaiListener in interface SdaiEventSource
Parameters:
listener - a SdaiListener to be added.
See Also:
removeSdaiListener(jsdai.lang.SdaiListener)

removeSdaiListener

public void removeSdaiListener(SdaiListener listener)
Removes SdaiListener extending java.util.EventListener from the special aggregate defined for this entity instance.

Specified by:
removeSdaiListener in interface SdaiEventSource
Parameters:
listener - SdaiListener to be removed.
See Also:
addSdaiListener(jsdai.lang.SdaiListener)

testMappedEntity

public jsdai.mapping.AEntity_mapping testMappedEntity(jsdai.dictionary.EEntity_definition sourceEntity,
                                                      ASdaiModel targetDomain,
                                                      ASdaiModel mappingDomain,
                                                      int mode)
                                               throws SdaiException
Description copied from interface: EEntity
Tests whether this instance of a target entity type does fit to mapping constraints of specified source entity. It returns an aggregate containing all the mating entity_mappings for the specified source entity. If there is no mappings for which constraints are met it returns null.

Example:

    EEntity instance = ...;  // instance that we want to check
    SdaiModel sourceModel = LangUtils.findDictionaryModel("my_mapping_schema"); // usualy name of mapping model is the same as it is for source schema
    sourceModel.startReadOnlyAccess();
    armSchema = LangUtils.findSchema(sourceModel);
    EEntity_definition sourceEntity = LangUtils.findEntityDefinition("my_source_entity", schema);
    AEntity_mapping mappings = m.testSourceEntity(sourceEntity, session.getDataDictionary(), session.getDataMapping());
    SdaiIterator i = mappings.createIterator();
    System.out.println("The instance " + instance + " is mapping of:");
    while (i.next()) {
        System.out.print(" " + mappings.getCurrentMember(i).getSource(null).getName(null));
    }

Specified by:
testMappedEntity in interface EEntity
Parameters:
sourceEntity - an entity which mapping is tested
targetDomain - a target instances domain where to search instances to satisfy mapping constraints. It may be null. Then owning model of target instance will be used as domain.
mappingDomain - a domain for mapping constraints, target and source schemas.
mode - sets level of cheking for mapped entity. EEntity.NO_RESTRICTIONS - only the mapping constraints for specified entity mapping are tested EEntity.MANDATORY_ATTRIBUTES_SET - all explicit mandatory ARM attributes of every entity mapping are tested. If at least one these attributes is unset, then this entity mapping is not included in the returned set of entity mappings.
Returns:
an aggregate of mapping_entities that may be mapping to target entity, null if there is no mappings of this target instance for specified target. This returned aggregate contains at least one matting entity_mapping. If there are several mapping alternatives the returned aggregate may contain several instances.
Throws:
SdaiException
See Also:
testMappedEntity, EEntity.findEntityMappings(ASdaiModel, ASdaiModel, AEntity_mapping, int), testMappedAttribute, getMappedAttribute, JSDAI Mapping Extension

testMappedEntity

public boolean testMappedEntity(jsdai.mapping.EEntity_mapping sourceEntity,
                                ASdaiModel targetDomain,
                                ASdaiModel mappingDomain,
                                int mode)
                         throws SdaiException
Description copied from interface: EEntity
Tests whether this instance of a target entity type does fit to mapping constraints of specified source entity. It returns an aggregate containing all the mating entity_mappings for the specified source entity. If there is no mappings for which constraints are met it returns null.

Example:

    EEntity instance = ...;  // instance that we want to check
    SdaiModel sourceModel = LangUtils.findDictionaryModel("my_mapping_schema"); // usualy name of mapping model is the same as it is for source schema
    sourceModel.startReadOnlyAccess();
    armSchema = LangUtils.findSchema(sourceModel);
    EEntity_definition sourceEntity = LangUtils.findEntityDefinition("my_source_entity", schema);
    AEntity_mapping mappings = m.testSourceEntity(sourceEntity, session.getDataDictionary(), session.getDataMapping());
    SdaiIterator i = mappings.createIterator();
    System.out.println("The instance " + instance + " is mapping of:");
    while (i.next()) {
        System.out.print(" " + mappings.getCurrentMember(i).getSource(null).getName(null));
    }

Specified by:
testMappedEntity in interface EEntity
Parameters:
sourceEntity - an entity which mapping is tested
targetDomain - a target instances domain where to search instances to satisfy mapping constraints. It may be null. Then owning model of target instance will be used as domain.
mappingDomain - a domain for mapping constraints, target and source schemas.
mode - sets level of cheking for mapped entity. EEntity.NO_RESTRICTIONS - only the mapping constraints for specified entity mapping are tested EEntity.MANDATORY_ATTRIBUTES_SET - all explicit mandatory ARM attributes of every entity mapping are tested. If at least one these attributes is unset, then this function returns false.
Returns:
an aggregate of mapping_entities that may be mapping to target entity, null if there is no mappings of this target instance for specified target. This returned aggregate contains at least one matting entity_mapping. If there are several mapping alternatives the returned aggregate may contain several instances.
Throws:
SdaiException
See Also:
testMappedEntity, EEntity.findEntityMappings(ASdaiModel, ASdaiModel, AEntity_mapping, int), testMappedAttribute, getMappedAttribute, JSDAI Mapping Extension

testMappedAttribute

public jsdai.mapping.AGeneric_attribute_mapping testMappedAttribute(jsdai.dictionary.EAttribute sourceAttribute,
                                                                    ASdaiModel targetDomain,
                                                                    ASdaiModel mappingDomain,
                                                                    int mode)
                                                             throws SdaiException
Description copied from interface: EEntity
Tests mapping of source attribute. Specified target instance should be mapping of sourceAttribute parent entity. It returns attribute_mappings for which reference path is satisfied. If there is no attribute_mappings which reference path is satisfied, then method returns null.

Specified by:
testMappedAttribute in interface EEntity
Parameters:
sourceAttribute - source attribute which mapping is tested.
targetDomain - a domain where to search instances to satisfy mapping constraints. It may be null. Then owning model of target instance will be used as domain.
mode - sets level of cheking for mapped attribute. EEntity.NO_RESTRICTIONS - only the mapping constraints for specified attribute are tested EEntity.MOST_SPECIFC_ENTITY - if ARM type of attribute is enity data type, then the mapping constraints for this entity data type are checked, EEntity.MANDATORY_ATTRIBUTES_SET - in addition all explicit mandatory ARM attributes of every entity mapping are tested.
mappingDomain - a domain for mapping constraints, target and source schemas.
Returns:
aggregate of attribute mappings that are mappings of source attribute and has values set. It returns null if no attribute mappings found.
Throws:
SdaiException
See Also:
testMappedEntity, testMappedAttribute, getMappedAttribute, JSDAI Mapping Extension

testMappedAttribute

public boolean testMappedAttribute(jsdai.mapping.EGeneric_attribute_mapping sourceAttribute,
                                   ASdaiModel targetDomain,
                                   ASdaiModel mappingDomain,
                                   int mode)
                            throws SdaiException
Description copied from interface: EEntity
Test whether this target instance does fit to the constraints of the given attribute_mapping.

Specified by:
testMappedAttribute in interface EEntity
Parameters:
sourceAttribute - source attribute which mapping is tested.
targetDomain - a target instances domain where to search instances to satisfy mapping constraints. It may be null. Then owning model of target instance will be used as domain.
mappingDomain - a domain for mapping constraints, target and source schemas. It may be null. Then owning model of sourceAttribute will be used as domain.
mode - sets level of cheking for mapped attribute. EEntity.NO_RESTRICTIONS - only the mapping constraints for specified attribute are tested EEntity.MOST_SPECIFC_ENTITY - if ARM type of attribute is enity data type, then the mapping constraints for this entity data type are checked, EEntity.MANDATORY_ATTRIBUTES_SET - in addition all explicit mandatory ARM attributes of every entity mapping are tested.
Returns:
true if this target instance has mapping of specified attribute mapping, false otherwise.
Throws:
SdaiException
See Also:
testSourceEntity, testMappedAttribute, getMappedAttribute, JSDAI Mapping Extension

getMappedAttribute

public java.lang.Object[] getMappedAttribute(jsdai.dictionary.EAttribute sourceAttribute,
                                             ASdaiModel targetDomain,
                                             ASdaiModel mappingDomain,
                                             int mode)
                                      throws SdaiException
Description copied from interface: EEntity
Returns value for source attribute. If there is only one value then value is returned as object. If there is more than one value then Java array Object[] is returned. If there is no value set, then this method returns null. There can be several reasons why there is more than one return value. The type of source attribute has no direct affect on the cardinality of values returned by this method. Simple types like int, float, double and boolean are converted to corresponding Java objects.

Example:

    EEntity_definition armEntity = ....
    ArrayList attributes = new ArrayList();
    LangUtils.findExplicitAttributes(armEntity, attributes);
    // Iterate through all explicit attributes of ARM entity.
    for (int i = 0; i < attributes.size(); i++) {
    armAttribute = (EAttribute)attributes.get(i);
    try {
        // Test if ARM attribute is set.
        System.out.print(armAttribute.getName(null));
        boolean f = instance.testSourceAttribute(armAttribute, dataSi, mappingSi) != null;
        // If ARM attribute is set, then take and print a value of it.
        if (f) {
            Object o[] = instance.getSourceAttribute(armAttribute, dataSi, mappingSi);
            if (o.length > 0) {
                if (o[0] instanceof String) {
                    System.out.print(" = '" + o[0] + "'");
                } else {
                    System.out.print(" = " + o[0]);
                }
                for (int k = 1; k < o.length; k++) {
                    if (o[k] instanceof String) {
                        System.out.print(" | '" + o[k] + "'");
                    } else {
                        System.out.print(" | " + o[k]);
                    }
                }
            } else {
                System.out.print(" = ?");
            }
        }
        System.out.println();
    } catch (Exception e) {
    }

Specified by:
getMappedAttribute in interface EEntity
Parameters:
sourceAttribute - source attribute which mappings are returned.
targetDomain - a target instances domain where to search instances to satisfy mapping constraints. It may be null. Then owning model of target instance will be used as domain.
mappingDomain - a domain for mapping constraints, target and source schemas. It may be null. Then owning model of sourceAttribute will be used as domain.
mode - sets level of cheking for mapped attribute. EEntity.NO_RESTRICTIONS - only the mapping constraints for specified attribute are tested EEntity.MOST_SPECIFC_ENTITY - if ARM type of attribute is enity data type, then the mapping constraints for this entity data type are checked, EEntity.MANDATORY_ATTRIBUTES_SET - in addition all explicit mandatory ARM attributes of every entity mapping are tested.
Returns:
aggregate of sourceAttribute values.
Throws:
SdaiException
See Also:
testMappedEntity, testMappedAttribute, testMappedAttribute, JSDAI Mapping Extension

getMappedAttribute

public java.lang.Object getMappedAttribute(jsdai.mapping.EGeneric_attribute_mapping sourceAttribute,
                                           ASdaiModel targetDomain,
                                           ASdaiModel mappingDomain,
                                           int mode)
                                    throws SdaiException
Description copied from interface: EEntity
Returns value of attribute following constraints defined by attribute_mapping. The target_instance must be mapping of entity_mapping of which attribute_mapping is get. If mapping of attribute_mapping is not met it returns null.

Specified by:
getMappedAttribute in interface EEntity
Parameters:
sourceAttribute - attribute which mapping is tested.
targetDomain - a domain where to search instances to satisfy mapping constraints. It may be null. Then owning model of target instance will be used as domain.
mappingDomain - a domain for mapping constraints, target and source schemas. It may be null. Then owning model of sourceAttribute will be used as domain.
mode - sets level of cheking for mapped attribute. EEntity.NO_RESTRICTIONS - only the mapping constraints for specified attribute are tested EEntity.MOST_SPECIFC_ENTITY - if ARM type of attribute is enity data type, then the mapping constraints for this entity data type are checked, EEntity.MANDATORY_ATTRIBUTES_SET - in addition all explicit mandatory ARM attributes of every entity mapping are tested.
Returns:
value of source attribute, null if attribute_mapping reference path is not met. If there are several values it returns jsdai.Aggregate.
Throws:
SdaiException
See Also:
testSourceEntity, testMappedAttribute, testMappedAttribute, JSDAI Mapping Extension

findEntityMappings

public int findEntityMappings(jsdai.dictionary.EEntity_definition sourceEntity,
                              ASdaiModel targetDomain,
                              ASdaiModel mappingDomain,
                              jsdai.mapping.AEntity_mapping mappings,
                              int mode)
                       throws SdaiException
Description copied from interface: EEntity
Finds entity_mappings that fit with this instance. If sourceEntity is specified then the search is restricted to entity_mappings for the specified entity_definition and its subtypes. Resulting mappings may be restricted to not include mappings for abstract types and mappings where there are mappings of subtypes. Having entity_mapping an application can directly access the corresponding source entities.

Specified by:
findEntityMappings in interface EEntity
Parameters:
sourceEntity - only mappings of this entity or its subtypes can be included in returned set. If it is null, then this function works the same as EEntity.findEntityMappings(ASdaiModel, ASdaiModel, AEntity_mapping, int).
targetDomain - a domain of the target instance and instances related to it. It may be null. Then owning model of target instance will be used as domain.
mappingDomain - a domain for mapping constraints, target and source schemas.
mappings - the mappings that was found. This parameter is for read/write access. The mappings that will be found will be added to this aggregate.
mode - NO_RESTRICTIONS - no restrictions, MOST_SPECIFC_ENTITY - retured mappings are restricted to most specific. If there is mapping of subtype entity then mapping of supertype entity is not included. Entities that can not be instanciated are also not included.
Returns:
number of entity mappings that meet constraints.
Throws:
SdaiException
See Also:
testMappedEntity, EEntity.findEntityMappings(ASdaiModel, ASdaiModel, AEntity_mapping, int), JSDAI Mapping Extension

findEntityMappings

public int findEntityMappings(ASdaiModel targetDomain,
                              ASdaiModel mappingDomain,
                              jsdai.mapping.AEntity_mapping mappings,
                              int mode)
                       throws SdaiException
Description copied from interface: EEntity
Finds entity_mappings that fit with this instance.

Specified by:
findEntityMappings in interface EEntity
Throws:
SdaiException
See Also:
findEntityMappings}., JSDAI Mapping Extension

findMostSpecificMappings

public jsdai.mapping.AEntity_mapping findMostSpecificMappings(ASdaiModel dataDomain,
                                                              ASdaiModel mappingDomain,
                                                              jsdai.mapping.AEntity_mapping baseMappings,
                                                              int mode)
                                                       throws SdaiException
Finds most specific ARM mappings for the instance. This is ARM (mapping) operations support method. Most specific mapping can be viewed as means to define of which ARM type the AIM entity really is.

Specified by:
findMostSpecificMappings in interface EEntity
Parameters:
mappingDomain - is domain for mapping constraints.
dataDomain - is domain which defines where to search instances that satisfy mapping constraints. In the case it is null owning model of target instance will be used as data domain.
baseMappings - is an aggregate of mapings which define where to start looking for most specific mappings. The mappings returned will be mappings for subtypes of source enitity of base mappings.
mode - is mode for mapping operations. It can be one of: EEntity.NO_RESTRICTIONS EEntity.MOST_SPECIFC_ENTITY EEntity.MANDATORY_ATTRIBUTES_SET
Returns:
it returns an aggregate of entity_mappings that represent most specific mappings. Usualy resulting aggregate contains only one member. But in some cases instance can have more than one most specific mapping and then all mappings are returned.
Throws:
SdaiException - All variety of SdaiExceptions can be thrown.
See Also:
JSDAI Mapping Extension

buildMappedInstance

public EMappedARMEntity buildMappedInstance(SdaiContext context,
                                            jsdai.dictionary.EEntity_definition mappedInstanceType)
                                     throws SdaiException
Description copied from interface: EEntity
Creates or returns already created mapped entity instance in context's mappedWorkingModel model. If mapped entity is created it is in ATTRIBUTES_UNKNOWN state.

Specified by:
buildMappedInstance in interface EEntity
Parameters:
context - context where the mapped instance should be created.
mappedInstanceType - mapped entity instance expected type or null if application is unable to specify expected type.
Returns:
mapped entity instance possibly created in context.mappedWorkingModel.
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations
See Also:
EEntity.findLinkedMappedInstance(EEntity_definition mappedInstanceType), JSDAI Mapping Extension

findLinkedMappedInstance

public EMappedARMEntity findLinkedMappedInstance(jsdai.dictionary.EEntity_definition mappedInstanceType)
                                          throws SdaiException
Description copied from interface: EEntity
Finds already created mapped entity instance.

Specified by:
findLinkedMappedInstance in interface EEntity
Parameters:
mappedInstanceType - mapped entity instance expected type or null if application is unable to specify expected type
Returns:
mapped entity instance possibly created in context.mappedWorkingModel
Throws:
SdaiException - if an error occurs during the operation or in underlying JSDAI operations
See Also:
EEntity.buildMappedInstance(SdaiContext context, EEntity_definition mappedInstanceType), JSDAI Mapping Extension

findMappedUsers

public AEntity findMappedUsers(jsdai.mapping.EEntity_mapping source_type,
                               jsdai.mapping.AAttribute_mapping attribute,
                               ASdaiModel data_domain,
                               ASdaiModel mapping_domain,
                               jsdai.mapping.AAttribute_mapping users,
                               int mode)
                        throws SdaiException
Description copied from interface: EEntity
It finds application data instances that coresponds to mapped instaces, that references to this instance.

Specified by:
findMappedUsers in interface EEntity
Parameters:
source_type - mapping of entity data type, which mapping constraints this entity satisfies.
attribute - mappings of attributes, for which inverses will be searched. The specified attributes must reference to source_type. If it is not specified, then all attributes that references source_type will be in result set.
data_domain - a domain where to search instances to satisfy mapping constraints. It may be null. Then owning model of target instance will be used as domain.
mapping_domain - a domain for mapping constraints, target and source schemas.
users - for attribute mappings, that uses this instance. It can be null. It is synchronized with return value.
mode - sets level of cheking for mapped attribute. EEntity.NO_RESTRICTIONS - only the mapping constraints for specified attribute are tested EEntity.MOST_SPECIFC_ENTITY - if ARM type of attribute is enity data type, then the mapping constraints for this entity data type are checked, EEntity.MANDATORY_ATTRIBUTES_SET - in addition all explicit mandatory ARM attributes of every entity mapping are tested.
Returns:
set of instances that satisfies requirements to reference to this instance throgh the mapping.
Throws:
SdaiException
See Also:
JSDAI Mapping Extension

hasMappedAttribute

public boolean hasMappedAttribute(jsdai.mapping.EEntity_mapping entityMapping,
                                  jsdai.dictionary.EAttribute attribute,
                                  ASdaiModel mappingDomain)
                           throws SdaiException
Description copied from interface: EEntity
Checks is attribute mapped for given entity mapping. If entity mapping is not specified then check is attribute mapped at all.

Specified by:
hasMappedAttribute in interface EEntity
Throws:
SdaiException
See Also:
JSDAI Mapping Extension

set

public void set(jsdai.dictionary.EExplicit_attribute attribute,
                Value val)
         throws SdaiException
Description copied from interface: EEntity
Assigns the value wrapped in a given object of type Value to the specified explicit attribute. Particularly, it is allowed for the value to be an aggregate. Also this method can be used to unset the attribute.

The list of cases when SdaiException is thrown contains the following items:

Example:

    EData_type dt = SdaiSession.findDataType("myStringType", jsdai.SMy_schema.SMy_schema.class);
    Value val = Value.alloc(dt).set("LKSoft");
    EAttribute attr = ...;
    EEntity inst = ...;
    inst.set(attr, val);

Specified by:
set in interface EEntity
Parameters:
attribute - the explicit attribute to be assigned a value.
val - the value to be assigned to the attribute.
Throws:
SdaiException - AT_NVLD, attribute invalid.

get

public Value get(jsdai.dictionary.EAttribute attribute)
          throws SdaiException
Description copied from interface: EEntity
Returns the value (wrapped in an object of type Value) of the specified attribute, which can be either explicit or derived but not inverse. This method returns meaningfull information even in the case when the attribute is unset.

In the case when the attribute is of EEntity type and references an instance whose owning SdaiModel has access mode unset, then Value contains some data describing this reference but not the referenced instance itself.

Example:

    EVector vect = ...;
    EAttribute attr = vect.getAttributeDefinition("orientation");
    // access the attribute getting an instance of Value
    Value val = vect.get(attr);
    // retrieve an entity instance from Value
    EDirection dir = (EDirection)val.getInstance();

Specified by:
get in interface EEntity
Parameters:
attribute - the attribute which value is needed.
Returns:
value (of type Value) of the attribute.
Throws:
SdaiException - RP_NOPN, repository is not open.

toValue

public ComplexEntityValue toValue()
                           throws SdaiException
Wraps this instance to ComplexEntityValue object and returns it.

Returns:
ComplexEntityValue which wraps this instance
Throws:
SdaiException - if an error occurs in underlying JSDAI operations

getAllReferences

public AEntity getAllReferences()
                         throws SdaiException
Description copied from interface: EEntity
Returns an aggregate (of Express type LIST) whose elements are entity instances referenced by the current entity instance. In the case when an instance is referenced multiple times, this instance will appear in the aggregate once for each reference.

Specified by:
getAllReferences in interface EEntity
Returns:
the list of referenced entity instances.
Throws:
SdaiException - EI_NEXS, entity instance does not exist.

moveUsersFrom

public EEntity moveUsersFrom(EEntity src)
                      throws SdaiException
Description copied from interface: EEntity
Changes all the pointers referencing an entity instance submitted through the parameter to the pointers referencing the current entity instance. Only references from instances in SdaiModels with started read-write access mode are considered. In the case of a reference from an instance in an SdaiModel existing in the read-only mode SdaiException MX_NRW is thrown. If the submitted instance is referenced by an instance in an SdaiModel whose access is ended, then such a reference is left intact.

This method is available only when the entity data type of the current instance is the same as that of the submitted instance or a subtype of it (in other words, this.isKindOf(src.getInstanceType()) returns true).

Example:

    SdaiRepository repo = ...;
    EEntity inst40 = repo.getSessionIdentifier("#40");
    EEntity inst4055 = repo.getSessionIdentifier("#4055");
    EEntity move = inst4055.moveUsersFrom(inst40);
    // move and inst4055 point to the same entity instance 

Specified by:
moveUsersFrom in interface EEntity
Parameters:
src - an entity instance the references to which are moved to this entity instance
Returns:
this entity instance
Throws:
SdaiException - MX_NRW, SDAI-model access not read-write.
Since:
3.6.0

copyValuesFrom

public EEntity copyValuesFrom(EEntity src)
                       throws SdaiException
Description copied from interface: EEntity
Copies values of all attributes of the entity instance submitted through the parameter to the corresponding attributes of the current entity instance. The SdaiModel owning the current instance shall be in read-write access mode. The source instance retain the values of the attributes.

This method is available only when the entity data types of the current instance and the submitted instance are the same.

Example:

    SdaiRepository repo = ...;
    EEntity inst2241 = repo.getSessionIdentifier("#2241");
    EEntity inst2243 = repo.getSessionIdentifier("#2243");
    EEntity copy = inst2241.copyValuesFrom(inst2243);
    // copy and inst2241 point to the same entity instance 

Specified by:
copyValuesFrom in interface EEntity
Parameters:
src - an entity instance the attribute values of which are copied to this entity instance
Returns:
this entity instance
Throws:
SdaiException - FN_NAVL, function not available.
Since:
3.6.0

createExternalData

public ExternalData createExternalData()
                                throws SdaiException
Description copied from interface: EEntity
Creates external for this entity. External data is the data outside express which can be stored within the entity. The entity can have zero or one ExternalData object. This method works in the context of jsdai transactions.

Specified by:
createExternalData in interface EEntity
Returns:
ExternalData object which holds newly created entity external data
Throws:
SdaiException - there can be other cases when exception it thrown
See Also:
EEntity.getExternalData(), EEntity.testExternalData(), EEntity.removeExternalData()

getExternalData

public ExternalData getExternalData()
                             throws SdaiException
Description copied from interface: EEntity
Gets external data object. This method works in the context of jsdai transactions.

Specified by:
getExternalData in interface EEntity
Returns:
ExternalData object which holds this entity external data
Throws:
SdaiException - there can be other cases when exception it thrown
See Also:
EEntity.createExternalData(), EEntity.testExternalData(), EEntity.removeExternalData()

testExternalData

public boolean testExternalData()
                         throws SdaiException
Description copied from interface: EEntity
Tests if external data is attached to this entity.

Specified by:
testExternalData in interface EEntity
Returns:
true if the entity has external data attached
Throws:
SdaiException
See Also:
EEntity.createExternalData(), EEntity.getExternalData(), EEntity.removeExternalData()

removeExternalData

public void removeExternalData()
                        throws SdaiException
Description copied from interface: EEntity
Removes external data which was attached to this entity. If application has obtained ExternalData object it becomes invalid. If the entity has no external data this method does nothing.

Specified by:
removeExternalData in interface EEntity
Throws:
SdaiException
See Also:
EEntity.createExternalData(), EEntity.getExternalData(), EEntity.testExternalData()

Copyright © LKSoftWare GmbH, 1999-2008