com.dbmain.jidbm
Class Mapping

java.lang.Object
  extended by com.dbmain.jidbm.Mapping

public class Mapping
extends java.lang.Object

The Mapping class manage the "MappingOID" user-defined property, for finding objects sharing the same "MappingOID" values.


Field Summary
static java.lang.String MP_MAPPING_OID
           
 
Constructor Summary
Mapping(DBMSchema sch1, DBMSchema sch2)
          Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the two schemas will be taken
Mapping(DBMSchema sch1, DBMSchema sch2, DBMSchema sch3)
          Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the three schemas will be taken
Mapping(DBMSchema sch1, DBMSchema sch2, DBMSchema sch3, DBMSchema sch4)
          Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the four schemas will be taken
Mapping(java.util.LinkedList<java.util.LinkedList<DBMGenericObject>> schl)
          Constructors initializes the MappingOID analysis structures.
Mapping(java.util.Vector<DBMSchema> lsch)
          Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the schemas from a list will be taken
 
Method Summary
static void addUnique(java.util.List<java.lang.Integer> masterOid, java.util.List<java.lang.Integer> slaveOid)
          Adds to 'masterOid' the elements of 'slaveOid' that are not presents in 'masterOid'
static boolean areMapped(DBMGenericObject o1, DBMGenericObject o2)
          Checks if two DB-MAIN objects map together
 DBMAttribute findFirstMappingAttribute(DBMGenericObject go, DBMSchema sch)
          Finds the first attribute mapped with the specified generic object in the specified schema.
 DBMDataObject findFirstMappingDataObject(DBMGenericObject go, DBMSchema sch)
          Finds the first data object mapped with the specified generic object in the specified schema.
 DBMEntityType findFirstMappingEntityType(DBMGenericObject go, DBMSchema sch)
          Finds the first entity type mapped with the specified generic object in the specified schema.
 DBMEntityType findFirstMappingEntityType(java.lang.Object[] mappingOid, DBMSchema sch)
          Finds the first entity type mapped with the specified MappingOID values in the specified schema.
 DBMGroup findFirstMappingGroup(DBMGenericObject go, DBMSchema sch)
          Finds the first group mapped with the specified generic object in the specified schema.
 DBMRelationshipType findFirstMappingRelationshipType(DBMGenericObject go, DBMSchema sch)
          Finds the first relationship type mapped with the specified generic object in the specified schema.
 DBMGenericObject[] findMapping(DBMGenericObject go)
          Finds all the generic objects mapped to the specified generic object (whatever the schema).
 DBMGenericObject[] findMapping(DBMGenericObject go, DBMSchema sch)
          Finds all the generic objects mapped to the specified object in the specified schema.
 DBMAttribute findMappingAttribute(DBMDataObject att, DBMEntityType ent)
          Finds the attribute mapped to the specified attribute in the specified entity type.
 java.util.Vector<DBMAttribute> findMappingAttribute(DBMGenericObject go, DBMSchema sch)
          Finds attributes mapped with the specified generic object in the specified schema.
 java.util.Vector<DBMAttribute> findMappingAttributeList(DBMDataObject att, DBMEntityType ent)
          Finds the attributes mapped to the specified attribute in the specified entity type.
 java.util.Vector<DBMDataObject> findMappingDataObject(DBMGenericObject go, DBMSchema sch)
          Finds data objects mapped with the specified generic object in the specified schema.
 java.util.Vector<DBMEntityType> findMappingEntityType(DBMGenericObject go, DBMSchema sch)
          Finds entity types mapped with the specified generic object in the specified schema.
 java.util.Vector<DBMGenericObject> findMappingGenericObject(DBMGenericObject go, DBMSchema sch)
          Finds all the generic objects mapped to the specified object in the specified schema.
 java.util.Vector<DBMGroup> findMappingGroup(DBMGenericObject go, DBMSchema sch)
          Finds groups mapped with the specified generic object in the specified schema.
 java.util.Vector<DBMRelationshipType> findMappingRelationshipType(DBMGenericObject go, DBMSchema sch)
          Finds relationship types mapped with the specified generic object in the specified schema.
static DBMEntityType getEntityType(DBMDataObject dO)
          Deprecated. use jidbmx.DataObjects.findEntityTypeOwner
static java.util.List<java.lang.Integer> getListMapping(DBMGenericObject go)
          Returns the "MappingOID" of 'go'
static java.lang.Object[] getMappingOID(DBMGenericObject go)
           
static boolean haveCommonMappingOid(java.lang.Object[] oid1, java.lang.Object[] oid2)
          Checks if two array of MappingOID values have a nonempty intersection.
static void initializeMapping(DBMGenericObject go)
          Initializes the "MappingOID" of 'go' with its object identifier
static void setMapping(DBMGenericObject go, java.lang.Object[] mappingOid)
          Sets the value list of "MappingOID" of the 'go' to 'mappingOid'.
static void updateMapping(DBMGenericObject masterGo, DBMGenericObject slaveGo)
          Adds to 'masterGo' the 'MappingOID' of 'slaveGo' that are not presents in 'masterGo'
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MP_MAPPING_OID

public static final java.lang.String MP_MAPPING_OID
See Also:
Constant Field Values
Constructor Detail

Mapping

public Mapping(java.util.LinkedList<java.util.LinkedList<DBMGenericObject>> schl)
Constructors initializes the MappingOID analysis structures. According to the number of elements provided in the parameter, this constructor might require some pretty long time to perform.

Parameters:
schl - the objects of the repository to take into account in the mapping. This is a LinkedList the elements of which must also be LinkedList, corresponding to all the schemas to map. Each schema LinkedList must be composed of all the objects of the schema, starting by the schema itself.
schl ---+---sch1---obj1,1---obj1,2---...---obj1,k
        |
        +---sch2---obj2,1-- -obj2,2---...---obj2,l
        |
        ...
        +---schn---objn,1-- -objn,2---...---objn,m

Mapping

public Mapping(DBMSchema sch1,
               DBMSchema sch2)
Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the two schemas will be taken

Parameters:
sch1 - the first schema to map
sch2 - the second schema to map

Mapping

public Mapping(DBMSchema sch1,
               DBMSchema sch2,
               DBMSchema sch3)
Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the three schemas will be taken

Parameters:
sch1 - the first schema to map
sch2 - the second schema to map
sch3 - the third schema to map

Mapping

public Mapping(DBMSchema sch1,
               DBMSchema sch2,
               DBMSchema sch3,
               DBMSchema sch4)
Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the four schemas will be taken

Parameters:
sch1 - the first schema to map
sch2 - the second schema to map
sch3 - the third schema to map
sch4 - the fourth schema to map

Mapping

public Mapping(java.util.Vector<DBMSchema> lsch)
Simplified constructor: all the components (collections, entity types, relationship types, attributes, roles, groups, processing units) of the schemas from a list will be taken

Parameters:
lsch - the schema list
Method Detail

findMapping

public DBMGenericObject[] findMapping(DBMGenericObject go)
Finds all the generic objects mapped to the specified generic object (whatever the schema).

Parameters:
go - the generic object for which we want to find the mapped objects.
Returns:
an array of generic objects mapped to go. It contains also the generic object go itself.

findMapping

public DBMGenericObject[] findMapping(DBMGenericObject go,
                                      DBMSchema sch)
Finds all the generic objects mapped to the specified object in the specified schema.

Parameters:
go - the generic object for which we want to find the mapped objects.
sch - the schema where to find the mapped object.
Returns:
an array of generic objects mapped to the specified generic object.

findMappingGenericObject

public java.util.Vector<DBMGenericObject> findMappingGenericObject(DBMGenericObject go,
                                                                   DBMSchema sch)
Finds all the generic objects mapped to the specified object in the specified schema.

Parameters:
go - the generic object for which we want to find the mapped objects.
sch - the schema where to find the mapped object.
Returns:
a list of generic objects mapped to the specified object.

findMappingAttribute

public DBMAttribute findMappingAttribute(DBMDataObject att,
                                         DBMEntityType ent)
Finds the attribute mapped to the specified attribute in the specified entity type.

Parameters:
att - the attribute for which we want to find the mapped attribute.
ent - the entity type where to find the mapped attribute.
Returns:
an attribute mapped to the specified attribute.

findMappingAttributeList

public java.util.Vector<DBMAttribute> findMappingAttributeList(DBMDataObject att,
                                                               DBMEntityType ent)
Finds the attributes mapped to the specified attribute in the specified entity type.

Parameters:
att - the attribute for which we want to find the mapped attributes.
ent - the entity type where to find the mapped attributes.
Returns:
a list of attributes mapped to the specified attribute.

getEntityType

public static DBMEntityType getEntityType(DBMDataObject dO)
Deprecated. use jidbmx.DataObjects.findEntityTypeOwner

Finds the entity type owner of the specified data object.

Parameters:
dO - the data object for which we want to find the owner.
Returns:
the entity type owner of the specified data object.

findFirstMappingDataObject

public DBMDataObject findFirstMappingDataObject(DBMGenericObject go,
                                                DBMSchema sch)
Finds the first data object mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the first mapped data object.
sch - the schema where to find the mapped data object.
Returns:
the first data object mapped to the specified generic object.

findMappingAttribute

public java.util.Vector<DBMAttribute> findMappingAttribute(DBMGenericObject go,
                                                           DBMSchema sch)
Finds attributes mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the entity types.
sch - the schema where to find the mapped entity types.
Returns:
the list of attributes mapped to the specified generic object.

findFirstMappingAttribute

public DBMAttribute findFirstMappingAttribute(DBMGenericObject go,
                                              DBMSchema sch)
Finds the first attribute mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the first mapped attribute.
sch - the schema where to find the mapped attribute.
Returns:
the first attribute mapped to the specified generic object.

findMappingRelationshipType

public java.util.Vector<DBMRelationshipType> findMappingRelationshipType(DBMGenericObject go,
                                                                         DBMSchema sch)
Finds relationship types mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the entity types.
sch - the schema where to find the mapped entity types.
Returns:
the list of relationship types mapped to the specified generic object.

findFirstMappingRelationshipType

public DBMRelationshipType findFirstMappingRelationshipType(DBMGenericObject go,
                                                            DBMSchema sch)
Finds the first relationship type mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the first mapped relationship type.
sch - the schema where to find the mapped relationship type.
Returns:
the first relationship type mapped to the specified generic object.

findFirstMappingGroup

public DBMGroup findFirstMappingGroup(DBMGenericObject go,
                                      DBMSchema sch)
Finds the first group mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the first mapped group.
sch - the schema where to find the mapped relationship type.
Returns:
the first group mapped to the specified generic object.

findFirstMappingEntityType

public DBMEntityType findFirstMappingEntityType(DBMGenericObject go,
                                                DBMSchema sch)
Finds the first entity type mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the first mapped entity type.
sch - the schema where to find the mapped entity type.
Returns:
the first entity type mapped to the specified generic object.

findMappingDataObject

public java.util.Vector<DBMDataObject> findMappingDataObject(DBMGenericObject go,
                                                             DBMSchema sch)
Finds data objects mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the data objects.
sch - the schema where to find the mapped data objects.
Returns:
the list of data objects mapped to the specified generic object.

findMappingEntityType

public java.util.Vector<DBMEntityType> findMappingEntityType(DBMGenericObject go,
                                                             DBMSchema sch)
Finds entity types mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the entity types.
sch - the schema where to find the mapped entity types.
Returns:
the list of entity types mapped to the specified generic object.

findFirstMappingEntityType

public DBMEntityType findFirstMappingEntityType(java.lang.Object[] mappingOid,
                                                DBMSchema sch)
Finds the first entity type mapped with the specified MappingOID values in the specified schema.

Parameters:
mappingOid - the MappingOID value for which we want to find the first mapped entity type.
sch - the schema where to find the mapped entity types.
Returns:
the list of entity types mapped to the specified MappingOID values.

findMappingGroup

public java.util.Vector<DBMGroup> findMappingGroup(DBMGenericObject go,
                                                   DBMSchema sch)
Finds groups mapped with the specified generic object in the specified schema.

Parameters:
go - the generic object for which we want to find the mapped groups.
sch - the schema where to find the mapped groups.
Returns:
the list of groups mapped to the specified generic object.

areMapped

public static boolean areMapped(DBMGenericObject o1,
                                DBMGenericObject o2)
Checks if two DB-MAIN objects map together

Parameters:
o1 - the first object
o2 - the second object
Returns:
true if o1 and o2 have a common MappingOID value

haveCommonMappingOid

public static boolean haveCommonMappingOid(java.lang.Object[] oid1,
                                           java.lang.Object[] oid2)
Checks if two array of MappingOID values have a nonempty intersection.

Parameters:
oid1 - the first MappingOID value array.
oid2 - the second MappingOID value array.
Returns:
true if oid1 and oid2 have common MappingOID values.

getMappingOID

public static java.lang.Object[] getMappingOID(DBMGenericObject go)

getListMapping

public static java.util.List<java.lang.Integer> getListMapping(DBMGenericObject go)
Returns the "MappingOID" of 'go'

Parameters:
go -
Returns:

setMapping

public static void setMapping(DBMGenericObject go,
                              java.lang.Object[] mappingOid)
Sets the value list of "MappingOID" of the 'go' to 'mappingOid'.

Parameters:
go -
mappingOid -

initializeMapping

public static void initializeMapping(DBMGenericObject go)
Initializes the "MappingOID" of 'go' with its object identifier

Parameters:
go -

updateMapping

public static void updateMapping(DBMGenericObject masterGo,
                                 DBMGenericObject slaveGo)
Adds to 'masterGo' the 'MappingOID' of 'slaveGo' that are not presents in 'masterGo'

Parameters:
rel -
fk -

addUnique

public static void addUnique(java.util.List<java.lang.Integer> masterOid,
                             java.util.List<java.lang.Integer> slaveOid)
Adds to 'masterOid' the elements of 'slaveOid' that are not presents in 'masterOid'

Parameters:
masterOid -
slaveOid -