ch.interlis.iom_j.itf
Class ModelUtilities

java.lang.Object
  extended by ch.interlis.iom_j.itf.ModelUtilities

public class ModelUtilities
extends java.lang.Object

Utilities related to ITF files.

Version:
$Revision: 1.0 $ $Date: 27.07.2006 $
Author:
ce

Method Summary
static void buildEnumList(java.util.List accu, java.lang.String prefix1, ch.interlis.ili2c.metamodel.Enumeration enumer)
          Builds a list of elements of an enumeration.
static java.lang.String code2string(int code)
          Translates a ITF character code to a JAVA String.
static java.util.HashSet getEnumTypes(ch.interlis.ili2c.metamodel.TransferDescription td)
          Builds set of enumeration types.
static java.lang.String getHelperTableGeomAttrName(ch.interlis.ili2c.metamodel.AttributeDef attr)
           
static java.lang.String getHelperTableMainTableRef(ch.interlis.ili2c.metamodel.AttributeDef attr)
           
static java.util.ArrayList getIli1AttrList(ch.interlis.ili2c.metamodel.AbstractClassDef table)
          Builds list of attributes and keep Ili1 source ordering.
static java.util.ArrayList getItfTables(ch.interlis.ili2c.metamodel.TransferDescription td, java.lang.String modelName, java.lang.String topicName)
          Gets list of ITF tables of a given topic.
static java.util.ArrayList getPolylineAttrs(ch.interlis.ili2c.metamodel.AbstractClassDef table)
          Gets list of POLYLINE attributes.
static java.util.HashMap getTagMap(ch.interlis.ili2c.metamodel.TransferDescription td)
          Gets list of mappings from transfer-table name to model-table or model-attribute.
static boolean isPureRefAssoc(ch.interlis.ili2c.metamodel.Viewable v)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getTagMap

public static java.util.HashMap getTagMap(ch.interlis.ili2c.metamodel.TransferDescription td)
Gets list of mappings from transfer-table name to model-table or model-attribute.

Parameters:
td - model as read by the compiler (ili2c)
Returns:
list of mappings. map<String iliQName,Viewable|AttributeDef modelele>

getItfTables

public static java.util.ArrayList getItfTables(ch.interlis.ili2c.metamodel.TransferDescription td,
                                               java.lang.String modelName,
                                               java.lang.String topicName)
Gets list of ITF tables of a given topic.

Parameters:
td - model as read by the compiler (ili2c)
modelName - name of ili model
topicName - name of ili topic
Returns:
list of tables. array<Viewable|AttributeDef modelele>

getPolylineAttrs

public static java.util.ArrayList getPolylineAttrs(ch.interlis.ili2c.metamodel.AbstractClassDef table)
Gets list of POLYLINE attributes. TODO move to compiler


getIli1AttrList

public static java.util.ArrayList getIli1AttrList(ch.interlis.ili2c.metamodel.AbstractClassDef table)
Builds list of attributes and keep Ili1 source ordering. TODO move to compiler

Returns:
list

getEnumTypes

public static java.util.HashSet getEnumTypes(ch.interlis.ili2c.metamodel.TransferDescription td)
Builds set of enumeration types. TODO move to compiler

Parameters:
td - model as read by the compiler (ili2c)
Returns:
set of enumeration types. set<DomainDef|AttributeDef modelele>

code2string

public static java.lang.String code2string(int code)
                                    throws java.io.UnsupportedEncodingException
Translates a ITF character code to a JAVA String.

Throws:
java.io.UnsupportedEncodingException

buildEnumList

public static void buildEnumList(java.util.List accu,
                                 java.lang.String prefix1,
                                 ch.interlis.ili2c.metamodel.Enumeration enumer)
Builds a list of elements of an enumeration.

    java.util.ArrayList ev=new java.util.ArrayList();
    ModelUtilities.buildEnumList(ev,"",type.getConsolidatedEnumeration());
  
The resulting list contains the element names, so that the first entry represents ITF code 0 of the given enumeration.

Parameters:
accu - list to populate
prefix1 - prefix to add in front of each element
enumer - enumeration to collect elements of.

getHelperTableMainTableRef

public static java.lang.String getHelperTableMainTableRef(ch.interlis.ili2c.metamodel.AttributeDef attr)

getHelperTableGeomAttrName

public static java.lang.String getHelperTableGeomAttrName(ch.interlis.ili2c.metamodel.AttributeDef attr)

isPureRefAssoc

public static boolean isPureRefAssoc(ch.interlis.ili2c.metamodel.Viewable v)