|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jsdai.lang.MappingUtil
This class is a superclass of all mapping early binding
classes known as M classes.
Here is an example how derived classes can be used:
import jsdai.MAp214.*; import jsdai.lang.*; import jsdai.dictionary.*; import jsdai.mapping.*; public static final void main (String args[]) throws SdaiException, Exception { System.out.println("Test application of Item"); //Session is opened already by initializing static members. SdaiSession session = SdaiSession.getSession(); //Transaction is already started by initializing static members. //SdaiTransaction trx = session.startTransactionReadWriteAccess(); SdaiRepository repo = session.linkRepository(args[0],null); repo.openRepository(); ASdaiModel domain = repo.getModels(); SdaiModel model = domain.getByIndex(1); model.startReadWriteAccess(); AEntity instances = MItem.findInstances(domain, null); int no_of_instances = instances.getMemberCount(); System.out.println("Number of received instances is "+no_of_instances); System.out.println(instances); int expectedRetType = -1; for (int i=1;i<=no_of_instances;i++) { EEntity instance = (EEntity) instances.getByIndexEntity(i); System.out.println(""); System.out.println("instance is "+instance); expectedRetType = MItem.testId(domain, instance); switch (expectedRetType) { case MItem.ID__STRING: //put appropriate call to getXX method here. break; default: System.out.println("Value not set!"); } expectedRetType = MItem.testName(domain, instance); switch (expectedRetType) { case MItem.NAME__STRING: //put appropriate call to getXX method here. String result = MItem.getName(domain, instance, (String) null); System.out.println("result for name is"+result); if (result.equalsIgnoreCase("nba")) { result = "LKL"; System.out.println("setting new value for name"); MItem.setName(domain, instance, result, (String) null); session.getActiveTransaction().commit(); } break; default: System.out.println("Value not set!"); } expectedRetType = MItem.testDescription(domain, instance); switch (expectedRetType) { case MItem.DESCRIPTION__STRING: //put appropriate call to getXX method here. break; default: System.out.println("Value not set!"); } } }
Field Summary | |
static java.lang.String |
getErrorString1
This error string is used to create and throw SdaiException and indicates that user called a getXX method that accepts EEntity instance as parameter, but user has passed to this method an instance, which was of incorrect type. |
static java.lang.String |
setErrorString1
The error string to be used to inform user about attempt to use setXX method improperly. |
static java.lang.String |
testErrorString1
The error string to be used to construct SdaiException, when early binding class detects that type of actually returned value is unexpected and there is no static constant to be returned from testXX method. |
static int |
VA_NSET
Value used to return from testXX methods to indicate: a) attribute is not set b) call to getXX would result in SdaiException. |
Method Summary | |
static void |
changeMappingModeTo(int newMappingMode)
Method allows to change value of protected static member, which is taken when derived classes needs to access mapping operation, and mapping mode (or severity level) is required for passing to mapping operation. |
static void |
copyEntities(AEntity to,
AEntity from)
A helper method for findInstances method in generated classes. |
static jsdai.dictionary.EAttribute |
findArmAttribute(jsdai.dictionary.EEntity_definition entity,
java.lang.String attributeName)
|
static jsdai.mapping.EGeneric_attribute_mapping |
findAttributeMapping(jsdai.mapping.EEntity_mapping em,
jsdai.dictionary.EAttribute attribute,
java.lang.String dataTypeName,
ASdaiModel mappingDomain)
|
static jsdai.mapping.EEntity_mapping |
findEntityMapping(jsdai.dictionary.EEntity_definition mappedEntity,
java.lang.String aimName,
ASdaiModel mappingDomain)
|
static ASdaiModel |
findMetaDomain(SdaiModel mp)
|
static jsdai.mapping.ESchema_mapping |
findSchemaMapping(SdaiModel modelMAP)
|
static SdaiModel |
findSystemModel(java.lang.String name)
|
static jsdai.dictionary.ENamed_type |
findType(java.lang.String name,
jsdai.dictionary.ANamed_type types)
|
static jsdai.dictionary.ANamed_type |
getNamedTypes(jsdai.dictionary.ESchema_definition schema,
ASdaiModel metaDomain)
|
static jsdai.dictionary.ESchema_definition |
getSource(jsdai.mapping.ESchema_mapping sm)
|
static jsdai.dictionary.ESchema_definition |
getTarget(jsdai.mapping.ESchema_mapping sm)
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String setErrorString1
public static final java.lang.String testErrorString1
public static final java.lang.String getErrorString1
public static final int VA_NSET
Method Detail |
public static void changeMappingModeTo(int newMappingMode)
newMappingMode
- new mapping mode, can be one of values, defined in
EEntity class (NO_RESTRICTIONS, etc.)public static SdaiModel findSystemModel(java.lang.String name)
public static jsdai.mapping.ESchema_mapping findSchemaMapping(SdaiModel modelMAP)
public static ASdaiModel findMetaDomain(SdaiModel mp)
public static jsdai.dictionary.ESchema_definition getSource(jsdai.mapping.ESchema_mapping sm)
public static jsdai.dictionary.ESchema_definition getTarget(jsdai.mapping.ESchema_mapping sm)
public static jsdai.dictionary.ANamed_type getNamedTypes(jsdai.dictionary.ESchema_definition schema, ASdaiModel metaDomain)
public static jsdai.dictionary.ENamed_type findType(java.lang.String name, jsdai.dictionary.ANamed_type types)
public static jsdai.mapping.EEntity_mapping findEntityMapping(jsdai.dictionary.EEntity_definition mappedEntity, java.lang.String aimName, ASdaiModel mappingDomain)
public static jsdai.dictionary.EAttribute findArmAttribute(jsdai.dictionary.EEntity_definition entity, java.lang.String attributeName)
public static jsdai.mapping.EGeneric_attribute_mapping findAttributeMapping(jsdai.mapping.EEntity_mapping em, jsdai.dictionary.EAttribute attribute, java.lang.String dataTypeName, ASdaiModel mappingDomain)
em
- Entity mapping, that is related with desired to find
attribute mapping.attribute
- Attribute, whose mapping is searched.dataTypeName
- In some cases entity_mapping can have several
alternatives for mapping given attribute. Then,
each attribute_mapping contains a string value that
allows to distinguish attribute_mappings between
each other. This parameter indicates what string
value is contained in desired attribute_mapping.mappingDomain
- Model(s), where desired attribute_mapping should be
searched.public static void copyEntities(AEntity to, AEntity from) throws SdaiException
SdaiException
|
Copyright © LKSoftWare GmbH, 1999-2008 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |