it.unimo.dbgroup.momis.odli3
Class Interface

java.lang.Object
  extended byit.unimo.dbgroup.momis.odli3.MomisObject
      extended byit.unimo.dbgroup.momis.odli3.TypeContainer
          extended byit.unimo.dbgroup.momis.odli3.Interface
All Implemented Interfaces:
OntologyAnnotableElement, java.io.Serializable, TypeInterface
Direct Known Subclasses:
GlobalInterface

public class Interface
extends TypeContainer
implements TypeInterface, java.io.Serializable, OntologyAnnotableElement

Descrive un'Interfaccia (classe o vista)

See Also:
Serialized Form

Field Summary
private  boolean _aggiornaAttributes_alreadyRun
           
private  java.util.HashMap _attributes
          lista di tutti gli attributi omonimi; e' un HashMap avente:
key nome di attributo
value Vector di attributi omonimi
private  java.util.HashMap _extentName
          estensione/i della classe, e' un HashMap di stringhe.
private  boolean _flagPersistent
          flag che indica se l'interface e' persistente o transiente:
true e' persistente
false e' transiente.
private  boolean _flagView
          flag che indica se l'interface e' classe o vista
true e' una vista
false e' una classe.
private  java.util.Vector _foreignKey
          lista delle foreign key: e' un Vector di oggetti ForeignKey.
private  java.util.Vector _inheritance
          lista delle superclassi.
private  java.util.HashMap _inheritanceMap
          lista delle superclassi in parsing.
private  java.util.HashMap _keyList
          lista delle chiavi candidate: e' una HashMap di oggetti KeyList.
private  java.lang.String _name
          nome dell'interfaccia.
private  OntologyAnnotation _ontologyAnnotation
          contain a reference to the OntologyAnnotation Object.
private  Source _source
          sorgente della classe in questione.
static java.util.Comparator COMPARE_ON_NAME
          Comparator used to Sort relationship by ordine.
 
Fields inherited from class it.unimo.dbgroup.momis.odli3.TypeContainer
_constants, _interfaces, _sources, _structs, _thesRelations
 
Fields inherited from class it.unimo.dbgroup.momis.odli3.MomisObject
mod_GenericODLParser, mod_GlobalSchema, mod_QueryManger, mod_SIDes_ARM, mod_SIDes_ARTEMIS, mod_SIDes_EXTM, mod_SIDes_JoinMap, mod_SIDes_main, mod_SIDes_SAM, mod_SIDes_SIM, mod_SIDes_SIM2, mod_SIDes_SLIM, mod_SIDes_TREdit, mod_SIDes_TUNIM
 
Constructor Summary
Interface()
          Constructor.
Interface(java.lang.String name, boolean flagIsAView, boolean flagIsPersistent)
          Constructor.
 
Method Summary
 void addExtent(java.lang.String extentName)
           
 void addForeignKey(ForeignKey fKey)
           
 void addKey(KeyList k)
          Adds a key to the list of the keys.
 void addToInheritanceMap(java.lang.String superClassName)
          Adds an inheritance class during the parsing This is used from the schema parser.
 void aggiornaAttributes()
          this method forces the generation of the attributes Map
private  void aggiornaAttributes(boolean forceExecution)
          Initialize the attributes hashmap as postprocessing operation.
 void control()
          Control and resolving routine.
 void controlForeignKeys()
          Routine for control and resolving Foreign Keys and Attributes.
 java.util.Vector getAttribute(java.lang.String an)
          restituisce un vector di attributi omonimi, appartenenti alle diverse IntBody
restituisce null se non esistono attributi con quel nome.
 java.util.Map getAttributes()
          Return a Map of attributes.
In such Map: key: the name of the attribute value: a vector of attributes with the same name.
 Attribute[] getAttributesIncludingParents_sortByAttributeDottedName()
          Returns all Attributes defined in this interface and in all the parents of this interface, sorted by DottedName.
 java.util.Set getAttributesIncludingParents()
          Return a Set of Attributes including the one inherited from parent interfaces.
 java.util.Set getAttributeVectorsIncludingParents()
          Return a Set of Vectors of attributes including the one inherited from parent interfaces.
 java.lang.String getDottedName()
          Return the dotted name of this interface:
 java.util.HashMap getExtentName()
          Sets the HashMap of identifier for the extension.
 boolean getFlagPersistent()
           
 boolean getFlagView()
           
 java.util.Vector getForeignKeys()
           
 KeyList getKey(java.lang.String s)
          Get a key by name.
 java.lang.Object[] getKeys()
          Returns the array of all the Keys Of this Interface.
 java.lang.String getName()
          Returns the name of the interface.
 OntologyAnnotation getOntologyAnnotation()
          Retrieve the "annotation" for this element
 java.util.Vector getParents()
          Returns all Parent classes (superclasses of this one).
 Source getSource()
          Returns the source of the interface.
 java.lang.String getXmlType()
          Xml Representation.
private  void initVars()
           
 void loadFromXML(org.xml.sax.Attributes attrib)
          Load the object from an xml tag.
 void setExtentName(java.util.HashMap extentName)
          Sets the HashMap of identifier for the extension.
 void setFlagPersistent(boolean fPersistent)
           
 void setFlagView(boolean flagView)
           
 void setForeignKeys(java.util.Vector foreignKeys)
           
 void setInheritanceMap(java.util.HashMap inheritance)
          Sets the classes that this interface inherits from.
 void setName(java.lang.String name)
          sets the name of the interface.
 void setOntologyAnnotation(OntologyAnnotation ontologyAnnotation)
          sets the "annotation" for this element
 void setSource(Source s)
          Set the source container for this interface.
 void setSourceTo(Source s)
          aggiorna tutte le variabili che devono tenere traccia del sorgente
 java.lang.String toOdl()
          Restituisce la descrizione Odli3 della interface.
 java.lang.String toOlcd(TranslationMap tm)
          Returns the OLCD description for this Interface.
 java.lang.String toOlcdSimB(TranslationMap tm, java.util.Map attributeMap)
          Returns the OLCD description for the SIMB module for this Interface.
 java.lang.String toString()
          String representation for the Instance.
 
Methods inherited from class it.unimo.dbgroup.momis.odli3.TypeContainer
addConstant, addConstants, addDefined, addDefineds, addEnum, addEnums, addExtRule, addIntBodies, addIntBody, addIntBodyForceNewName, addInterface, addInterfaces, addModule, addModules, addRule, addRules, addSource, addSources, addStruct, addStructs, addThesRelation, addThesRelations, addThesRelationWithControl, addThesRelationWithControlIgnoreWeaker, addThesRelationWithControlIgnoreWeaker, addTypes, addTypesToSolve, addTypeToSolve, addUnion, addUnions, cloneAllThesRelations, delAllThesRelations, delRule, delRuleByName, delThesRelation, delThesRelationsForProducer, getConstant, getConstants, getDefined, getDefineds, getEnum, getEnums, getExtRule, getIntBodies, getIntBodiesAsCollection, getIntBodiesOrderByName, getIntBody, getInterface, getInterface, getInterfaces, getInterfacesAsCollection, getInterfacesOrderByName, getModule, getModules, getParent, getRule, getRuleByName, getRules, getSchema, getSource, getSources, getSourcesAsCollection, getSourcesOrderByName, getStruct, getStructs, getThesRelations, getTopParent, getTypesToSolve, getUnion, getUnions, retrieveAttribute, retrieveInterface, retrieveSource, setParent, solveUnsolved, solveUnsolvedForeignKeys
 
Methods inherited from class it.unimo.dbgroup.momis.odli3.MomisObject
getAdditionalInfo, getAdditionalInfos, getGenericProducerDescription, getProducerDescription, getProducerId, putAdditionalInfo, setProducerId
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_aggiornaAttributes_alreadyRun

private boolean _aggiornaAttributes_alreadyRun

COMPARE_ON_NAME

public static final java.util.Comparator COMPARE_ON_NAME
Comparator used to Sort relationship by ordine.


_attributes

private java.util.HashMap _attributes
lista di tutti gli attributi omonimi; e' un HashMap avente:
key nome di attributo
value Vector di attributi omonimi


_name

private java.lang.String _name
nome dell'interfaccia.


_inheritanceMap

private java.util.HashMap _inheritanceMap
lista delle superclassi in parsing.


_inheritance

private java.util.Vector _inheritance
lista delle superclassi.


_source

private Source _source
sorgente della classe in questione.


_extentName

private java.util.HashMap _extentName
estensione/i della classe, e' un HashMap di stringhe.


_keyList

private java.util.HashMap _keyList
lista delle chiavi candidate: e' una HashMap di oggetti KeyList.


_foreignKey

private java.util.Vector _foreignKey
lista delle foreign key: e' un Vector di oggetti ForeignKey.


_flagView

private boolean _flagView
flag che indica se l'interface e' classe o vista
true e' una vista
false e' una classe.


_flagPersistent

private boolean _flagPersistent
flag che indica se l'interface e' persistente o transiente:
true e' persistente
false e' transiente.


_ontologyAnnotation

private OntologyAnnotation _ontologyAnnotation
contain a reference to the OntologyAnnotation Object.

Constructor Detail

Interface

public Interface(java.lang.String name,
                 boolean flagIsAView,
                 boolean flagIsPersistent)
Constructor. Creates a new Interface.


Interface

public Interface()
Constructor. Creates a new Interface with the following defaults: Crea una interface nuova

Method Detail

initVars

private void initVars()

getName

public java.lang.String getName()
Returns the name of the interface.

Overrides:
getName in class TypeContainer

setName

public void setName(java.lang.String name)
sets the name of the interface.


getDottedName

public java.lang.String getDottedName()
Return the dotted name of this interface:
SourceName.ClassName


getAttributes

public java.util.Map getAttributes()
Return a Map of attributes.
In such Map:


getAttributeVectorsIncludingParents

public java.util.Set getAttributeVectorsIncludingParents()
Return a Set of Vectors of attributes including the one inherited from parent interfaces.


getAttributesIncludingParents

public java.util.Set getAttributesIncludingParents()
Return a Set of Attributes including the one inherited from parent interfaces.


getAttributesIncludingParents_sortByAttributeDottedName

public Attribute[] getAttributesIncludingParents_sortByAttributeDottedName()
Returns all Attributes defined in this interface and in all the parents of this interface, sorted by DottedName.


getSource

public Source getSource()
Returns the source of the interface.


getParents

public java.util.Vector getParents()
Returns all Parent classes (superclasses of this one).


setInheritanceMap

public void setInheritanceMap(java.util.HashMap inheritance)
Sets the classes that this interface inherits from.
This is used only from the schema parser the post processing elaboration (the "control" method) will map this map in a plain inheritance vector


addToInheritanceMap

public void addToInheritanceMap(java.lang.String superClassName)
Adds an inheritance class during the parsing This is used from the schema parser. Il metdodo control() invocato dal metodo TypeContainer.solveUnsolved() provvedera' a sistemare il Value della hashmap


setExtentName

public void setExtentName(java.util.HashMap extentName)
Sets the HashMap of identifier for the extension.
An extension identifies the list of all instance for "this" interface.


getExtentName

public java.util.HashMap getExtentName()
Sets the HashMap of identifier for the extension.
An extension identifies the list of all instance for "this" interface.


getKey

public KeyList getKey(java.lang.String s)
Get a key by name. "PrimaryKey" is the name for the primary key.


getKeys

public java.lang.Object[] getKeys()
Returns the array of all the Keys Of this Interface. "PrimaryKey" is the name for the primary key. Correct way to read the list of Keys.
 	   int i;
 	   Object[] c = interface.getKeys();
 	   for (i=0; i<c.length; i++) {
 	      if (c[i] instanceof KeyList) {
 		 KeyList kl = ((KeyList)c[i]);
 		 //
 		 // Here goes your code
 		 //
 	      } else {
 		 // Strage case!
 	      }
 	   }
  


addKey

public void addKey(KeyList k)
            throws OdlException
Adds a key to the list of the keys. "PrimaryKey" is the name for the primary key.

Throws:
OdlException

aggiornaAttributes

private void aggiornaAttributes(boolean forceExecution)
Initialize the attributes hashmap as postprocessing operation.
Sometime I use the getAttribute during parsing (before running the post-processing routine) so, I have to initialize the hashmap. The privete variable _aggiornaAttributes_alreadyRun tries to optimize the execution time buiding once the map.
Anyway, the "control" routine will force the execution!


aggiornaAttributes

public void aggiornaAttributes()
this method forces the generation of the attributes Map


setSourceTo

public void setSourceTo(Source s)
                 throws OdlException
aggiorna tutte le variabili che devono tenere traccia del sorgente

Parameters:
s - sorgente.
Throws:
OdlException

setSource

public void setSource(Source s)
Set the source container for this interface.

Overrides:
setSource in class TypeContainer
Parameters:
s - sorgente.

getAttribute

public java.util.Vector getAttribute(java.lang.String an)
restituisce un vector di attributi omonimi, appartenenti alle diverse IntBody
restituisce null se non esistono attributi con quel nome.

Parameters:
an - nome dell'attributo/i da cercare
Returns:
Vector di attributi oppure null

control

public void control()
             throws OdlException
Control and resolving routine. Controlla la coerenza di tutto cio' che riguarda l'interface, dalle superclassi all'esistenza degli attributi dichiarati nelle chiavi e nelle foreign key.
IMPORTANT:
This routine does:

Throws:
OdlException

controlForeignKeys

public void controlForeignKeys()
                        throws OdlException
Routine for control and resolving Foreign Keys and Attributes. This routine does:

Throws:
OdlException

toString

public java.lang.String toString()
String representation for the Instance.

Overrides:
toString in class TypeContainer

toOdl

public java.lang.String toOdl()
Restituisce la descrizione Odli3 della interface.

Overrides:
toOdl in class TypeContainer

toOlcd

public java.lang.String toOlcd(TranslationMap tm)
Returns the OLCD description for this Interface.

Overrides:
toOlcd in class TypeContainer

toOlcdSimB

public java.lang.String toOlcdSimB(TranslationMap tm,
                                   java.util.Map attributeMap)
Returns the OLCD description for the SIMB module for this Interface.

Overrides:
toOlcdSimB in class TypeContainer
Parameters:
tm - Translation Map
attributeMap - Attribute Map, describes how to sobstitute attribute definition according to thesaurus relations. This method will return a virtual Interface derived from the current one that is part of the virtual schema described in OLCD to be passed to ODB-Tools for Thesaurus Relationships validation and inference.

Main feature of this routine is that Thesaurus Relationships contribute in Interface definition.
NT relationships cause the Interface to inherit from the Broader Interface
RT interface cause the definition of dummy attributes that links to the related interface.
SYN relationships cause the Interface to be grouped in a set of Synonym Interface. Such interface share the same definition in terms of Parent Interfaces and attributes. The parent Interfaces of each of the synonym Interfaces is given by the union of the Interface each Interface inherits from or take part of a NT or BT relation. The set of attribute is given by the union of the attributes each interface inherits from. RT relationship that give rise to the RT dummy attributes is given by the union of the RT relationship that involves at least one Interface in the SYN group.

addExtent

public void addExtent(java.lang.String extentName)

getForeignKeys

public java.util.Vector getForeignKeys()

setForeignKeys

public void setForeignKeys(java.util.Vector foreignKeys)

addForeignKey

public void addForeignKey(ForeignKey fKey)

getFlagView

public boolean getFlagView()

setFlagView

public void setFlagView(boolean flagView)

getFlagPersistent

public boolean getFlagPersistent()

setFlagPersistent

public void setFlagPersistent(boolean fPersistent)

loadFromXML

public void loadFromXML(org.xml.sax.Attributes attrib)
                 throws java.lang.Exception
Load the object from an xml tag.

Throws:
java.lang.Exception

getXmlType

public java.lang.String getXmlType()
Xml Representation.

Specified by:
getXmlType in interface TypeInterface

getOntologyAnnotation

public OntologyAnnotation getOntologyAnnotation()
Retrieve the "annotation" for this element

Specified by:
getOntologyAnnotation in interface OntologyAnnotableElement

setOntologyAnnotation

public void setOntologyAnnotation(OntologyAnnotation ontologyAnnotation)
sets the "annotation" for this element

Specified by:
setOntologyAnnotation in interface OntologyAnnotableElement


Universita' di Modena e Reggio Emilia