Style Intelligence v12.0

inetsoft.uql.erm
Class XPartition

java.lang.Object
  extended by inetsoft.uql.erm.XPartition
All Implemented Interfaces:
inetsoft.util.xml.XMLStorage.XMLFragment, inetsoft.util.XMLSerializable, Serializable, Cloneable

public class XPartition
extends Object
implements Cloneable, Serializable, inetsoft.util.XMLSerializable, inetsoft.util.xml.XMLStorage.XMLFragment

A partition is a group of related tables.

Since:
5.0
See Also:
Serialized Form

Nested Class Summary
 class XPartition.PartitionTables
           
 
Field Summary
static int CYCLE
          Status flag indicating that a cycle exists among the relationships of the model.
static int UNJOINED
          Status flag indicating that unjoined tables exist in the model.
static int VALID
          Status flag indicating that no problems exist with the model.
 
Constructor Summary
XPartition()
          Creates a new instance of XPartition.
XPartition(String name)
          Creates a new instance of XPartition.
XPartition(String name, XPartition base)
          Creates a new instance of XPartition.
 
Method Summary
 void addPartition(XPartition child)
          Add a child XPartition.
 void addRelationship(XRelationship relationship)
          Add a relationship to this data model.
 void addTable(String table, int type, String sql, Object catalog, Object schema)
          Adds a table or an alias to this partition.
 void addTable(String table, int type, String sql, Rectangle bounds, Object catalog, Object schema)
          Adds a table to this partition that is rendered at the specified location.
 void addTable(String table, Object catalog, Object schema)
          Adds a table or an alias to this partition.
 void addTable(String table, Rectangle bounds)
          Adds a table to this partition that is rendered at the specified location.
 void addTable(String table, Rectangle bounds, Object catalog, Object schema)
          Adds a table to this partition that is rendered at the specified location.
 XPartition applyAutoAliases()
          Create a new partition with all auto-aliases expanded.
 Object clone()
          Creates a copy of this object.
 Boolean containPartition(String name)
          Check if child XPartition exists.
 boolean containsTable(String table)
          Determines if this partition contains the specified table.
 boolean containsTable(String table, boolean fuzzy)
          Determines if this partition contains the specified table.
 boolean equals(Object obj)
          Determines if this object is equivalent to another object.
 XRelationship findRelationship(String dependentTable, String independentTable)
          Finds a join between the specified tables.
 XRelationship[] findRelationships(Set originating, Set others)
          Find all relations necessary to connect the tables in the originating set to the others set.
 XRelationship[] findRelationships(Set originating, Set others, boolean useAlias)
          Find all relations necessary to connect the tables in the originating set to the others set.
 XRelationship[] findRelationships(String dependentTable, String independentTable, Collection tables)
          Gets all the relationships required to create a join between the specified tables.
 XRelationship[] findRelationships(String dependentTable, String independentTable, Collection tables, boolean useAlias)
          Gets all the relationships required to create a join between the specified tables.
 String getAliasTable(String table)
          Get the physical table name of a table alias.
 String getAliasTable(String table, boolean recursive)
          Get the physical table name of a table alias.
 AutoAlias getAutoAlias(String table)
          Get the auto alias definition for a table.
 String getAutoAliasTable(String alias)
          Get the auto alias table which contains this table name.
 XPartition getBasePartition()
          Get the base partition.
 Rectangle getBounds(String table)
          Gets the location and size of the table.
 Rectangle getBounds(XPartition.PartitionTables table)
          Gets the location and size of the table.
 String getConnection()
          Get the partition connection.
 Set getCycleRelationships()
          Gets the relationships involved in a cycle.
 Set getCycleRelationships(boolean refresh)
          Gets the relationships involved in a cycle.
 XDataModel getDataModel()
          Get data model.
 String getDescription()
          Gets a description of this partition.
 String getName()
          Gets the name of this partition.
 XPartition getPartition(String name)
          Get child XPartition with specified name.
 XPartition getPartitionByConnection(String connection)
          Get child XPartition by specified connection.
 String[] getPartitionNames()
          Get names of the child partitions.
 XPartition.PartitionTables getPartitionTable(String name)
          Get the PartitionTable of tables in this partition.
 XRelationship getRelationship(int idx)
          Get relationship by index.
 int getRelationshipCount()
          Get the number of relationships defined in this data model.
 Enumeration getRelationships()
          Get a list of the relationships defined in this data model.
 Object getRunTimeTable(String alias, boolean recursive)
          Get the physical table name of a table alias.
 int getStatus()
          Checks the status of this physical view.
 int getTableCount()
          Get the number of tables in this partition.
 Enumeration getTables()
          Gets a list of the tables in this partition.
 Enumeration getTables(boolean self)
          Gets a list of the tables in this partition.
 String[] getUnjoinedTables()
          Checks for any unjoined tables in the view.
 boolean isAlias(String table)
          Check if a table is an alias to another table.
 boolean isBaseRelationship(XRelationship replation)
          Check this XRelationship is in the base partition.
 boolean isBaseTable(String table)
          Check this table is in the base partition.
 boolean isIncludeAllJoin()
          Check if include all join.
 boolean isRuntimeAlias(String table)
          Check if a table is a runtime alias to another table.
 void parseXML(Element tag)
          Reads the definition of this partition from an XML element.
 void removeAllAutoAliases()
          Remove all auto-alias setting.
 void removeMetaData()
           
 void removePartition(String name)
          remove a child XPartition.
 void removeRelationship(int idx)
          Remove relationship by index.
 void removeRelationship(XRelationship relationship)
          Remove a relationship from this data model.
 void removeTable(String table)
          Removes a table from this partition.
 void renameAlias(String source, String oname, String name)
          Rename a table alias.
 void renameAlias(String source, String oname, String name, int type, String sql)
          Rename a table alias.
 void renameParition(String oname, XPartition partition)
          Rename child partition
 void renamePartition(String oname, String nname)
          rename a child XPartition.
 void renameTable(String oldName, String newName)
          Renames a table.
 void setAliasTable(String alias, String table)
          Set the physical table of an alias.
 void setAutoAlias(String table, AutoAlias alias)
          Set the auto alias definition for a table.
 void setBaseParitition(XPartition base)
          Set the base partition.
 void setBounds(String table, Rectangle bounds)
          Get the location and size of the table.
 void setConnection(String connection)
          set the partition connection.
 void setDataModel(XDataModel model)
          Set data model.
 void setDescription(String description)
          Sets the description of this partition.
 void setIncludeAllJoin(boolean all)
          Set include all join property.
 void setName(String name)
          Sets the name of this partition.
 void setZoomRatio(double zoom)
          Set the value of the zoomRatio.
 String toString()
          Get the string representaion.
 void updateReference()
          Update child partition reference.
 void validate()
          Validate the data model.
 String verify()
          Verify the integrity of this physical view.
 void writeEnd(PrintWriter writer)
           
 void writeStart(PrintWriter writer)
           
 void writeXML(PrintWriter writer)
          Writes an XML representation of this partition.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VALID

public static final int VALID
Status flag indicating that no problems exist with the model.

See Also:
Constant Field Values

CYCLE

public static final int CYCLE
Status flag indicating that a cycle exists among the relationships of the model.

See Also:
Constant Field Values

UNJOINED

public static final int UNJOINED
Status flag indicating that unjoined tables exist in the model.

See Also:
Constant Field Values
Constructor Detail

XPartition

public XPartition()
Creates a new instance of XPartition. Default constructor should only be used when loading a partition from an XML file.


XPartition

public XPartition(String name)
Creates a new instance of XPartition.

Parameters:
name - the name of the partition.

XPartition

public XPartition(String name,
                  XPartition base)
Creates a new instance of XPartition.

Parameters:
name - the name of the partition.
base - the base partition.
Method Detail

addPartition

public void addPartition(XPartition child)
Add a child XPartition.


containPartition

public Boolean containPartition(String name)
Check if child XPartition exists.


getPartition

public XPartition getPartition(String name)
Get child XPartition with specified name.


getPartitionByConnection

public XPartition getPartitionByConnection(String connection)
Get child XPartition by specified connection.


renameParition

public void renameParition(String oname,
                           XPartition partition)
Rename child partition


getPartitionNames

public String[] getPartitionNames()
Get names of the child partitions.


removePartition

public void removePartition(String name)
remove a child XPartition.


renamePartition

public void renamePartition(String oname,
                            String nname)
rename a child XPartition.


getConnection

public String getConnection()
Get the partition connection.


setConnection

public void setConnection(String connection)
set the partition connection.


getBasePartition

public XPartition getBasePartition()
Get the base partition.


isBaseTable

public boolean isBaseTable(String table)
Check this table is in the base partition.


isBaseRelationship

public boolean isBaseRelationship(XRelationship replation)
Check this XRelationship is in the base partition.


getName

public String getName()
Gets the name of this partition.

Returns:
the name of this partition.

setName

public void setName(String name)
Sets the name of this partition.

Parameters:
name - the name of this partition.

setIncludeAllJoin

public void setIncludeAllJoin(boolean all)
Set include all join property. If include all join is true, then all the joins in the partition will be added to query, no matter how many partition tables is used.


isIncludeAllJoin

public boolean isIncludeAllJoin()
Check if include all join.


getDescription

public String getDescription()
Gets a description of this partition.

Returns:
a description of this partition.

setDescription

public void setDescription(String description)
Sets the description of this partition.

Parameters:
description - a description of this partition.

getDataModel

public XDataModel getDataModel()
Get data model.


setDataModel

public void setDataModel(XDataModel model)
Set data model.


getTables

public Enumeration getTables()
Gets a list of the tables in this partition.

Returns:
an Iterator of table names.

getTables

public Enumeration getTables(boolean self)
Gets a list of the tables in this partition.

Returns:
an Iterator of tables.

getTableCount

public int getTableCount()
Get the number of tables in this partition.

Returns:
the number of tables in this partition.

getPartitionTable

public XPartition.PartitionTables getPartitionTable(String name)
Get the PartitionTable of tables in this partition.

Parameters:
name - the name of PartitionTable.
Returns:
the PartitionTables.

addTable

public void addTable(String table,
                     Object catalog,
                     Object schema)
Adds a table or an alias to this partition. If the name is an alias, the getAliasTable(table) will return the real physical table name.

Parameters:
table - the name of the table or alias.

addTable

public void addTable(String table,
                     int type,
                     String sql,
                     Object catalog,
                     Object schema)
Adds a table or an alias to this partition. If the name is an alias, the getAliasTable(table) will return the real physical table name.

Parameters:
table - the name of the table or alias.

addTable

public void addTable(String table,
                     Rectangle bounds)
Adds a table to this partition that is rendered at the specified location.

Parameters:
table - the name of the table.
bounds - position and size of the table.

addTable

public void addTable(String table,
                     Rectangle bounds,
                     Object catalog,
                     Object schema)
Adds a table to this partition that is rendered at the specified location.

Parameters:
table - the name of the table.
bounds - position and size of the table.

addTable

public void addTable(String table,
                     int type,
                     String sql,
                     Rectangle bounds,
                     Object catalog,
                     Object schema)
Adds a table to this partition that is rendered at the specified location.

Parameters:
table - the name of the table.
bounds - position and size of the table.

isAlias

public boolean isAlias(String table)
Check if a table is an alias to another table.


renameTable

public void renameTable(String oldName,
                        String newName)
Renames a table.

Parameters:
oldName - the old table name.
newName - the new table name.

removeTable

public void removeTable(String table)
Removes a table from this partition.

Parameters:
table - the name of the table.

containsTable

public boolean containsTable(String table)
Determines if this partition contains the specified table.

Parameters:
table - the name of the table.
Returns:
true if the table is in this partition.

containsTable

public boolean containsTable(String table,
                             boolean fuzzy)
Determines if this partition contains the specified table.

Parameters:
table - the name of the table.
fuzzy - true to check if in all containers, false to check if an existent table only.
Returns:
true if the table is in this partition.

getBounds

public Rectangle getBounds(String table)
Gets the location and size of the table.

Parameters:
table - the name of the table.
Returns:
the bounds of the table.

getBounds

public Rectangle getBounds(XPartition.PartitionTables table)
Gets the location and size of the table.

Parameters:
table - the name of the table.
Returns:
the bounds of the table.

setBounds

public void setBounds(String table,
                      Rectangle bounds)
Get the location and size of the table.

Parameters:
table - the name of the table.
bounds - the bounds of the table.

getAutoAlias

public AutoAlias getAutoAlias(String table)
Get the auto alias definition for a table.


getAutoAliasTable

public String getAutoAliasTable(String alias)
Get the auto alias table which contains this table name.

Parameters:
alias - the alias name.

setAutoAlias

public void setAutoAlias(String table,
                         AutoAlias alias)
Set the auto alias definition for a table.


removeAllAutoAliases

public void removeAllAutoAliases()
Remove all auto-alias setting.


getAliasTable

public String getAliasTable(String table)
Get the physical table name of a table alias.

Parameters:
table - name of a table alias.

getAliasTable

public String getAliasTable(String table,
                            boolean recursive)
Get the physical table name of a table alias.

Parameters:
table - name of a table alias.

isRuntimeAlias

public boolean isRuntimeAlias(String table)
Check if a table is a runtime alias to another table.


getRunTimeTable

public Object getRunTimeTable(String alias,
                              boolean recursive)
Get the physical table name of a table alias.

Parameters:
alias - name of a table alias.

setAliasTable

public void setAliasTable(String alias,
                          String table)
Set the physical table of an alias.


renameAlias

public void renameAlias(String source,
                        String oname,
                        String name)
Rename a table alias.


renameAlias

public void renameAlias(String source,
                        String oname,
                        String name,
                        int type,
                        String sql)
Rename a table alias.


addRelationship

public void addRelationship(XRelationship relationship)
Add a relationship to this data model.

Parameters:
relationship - the relationship to add.

getRelationships

public Enumeration getRelationships()
Get a list of the relationships defined in this data model.

Returns:
an Enumeration containing all the relationships in this data model.

getRelationshipCount

public int getRelationshipCount()
Get the number of relationships defined in this data model.

Returns:
the number of relationships defined in this data model.

getRelationship

public XRelationship getRelationship(int idx)
Get relationship by index.


removeRelationship

public void removeRelationship(int idx)
Remove relationship by index.


findRelationship

public XRelationship findRelationship(String dependentTable,
                                      String independentTable)
Finds a join between the specified tables.

Parameters:
dependentTable - the dependent table in the relationship.
independentTable - the independent table in the relationship.
Returns:
a relationship between the two tables or null if no such relationship between the tables has been defined.

getStatus

public int getStatus()
Checks the status of this physical view. This method checks for cycles and unjoined tables.

Returns:
one of VALID, CYCLE, or UNJOINED.
Since:
8.0

verify

public String verify()
Verify the integrity of this physical view. The following conditions are checked:
  • Determine if all the specified tables are joined together.
  • Determine if any cycle exists in the join graph.
  • Determine if there are more than one weak join in a join path.
  • Returns:
    null if verification is successful. Otherwise the error message if verification failed.

    getUnjoinedTables

    public String[] getUnjoinedTables()
    Checks for any unjoined tables in the view. Returns the first pair of unjoined tables that are found.

    Returns:
    the names of the unjoined tables or null if no unjoined tables are found.
    Since:
    8.0

    getCycleRelationships

    public Set getCycleRelationships()
    Gets the relationships involved in a cycle.

    Returns:
    a Set of XRelationship objects that are involved in a cycle or null if no cycle exists.
    Since:
    8.0

    getCycleRelationships

    public Set getCycleRelationships(boolean refresh)
    Gets the relationships involved in a cycle.

    Returns:
    a Set of XRelationship objects that are involved in a cycle or null if no cycle exists.
    Since:
    8.0

    findRelationships

    public XRelationship[] findRelationships(String dependentTable,
                                             String independentTable,
                                             Collection tables)
    Gets all the relationships required to create a join between the specified tables. This methods handles weak joins in the model. The tables parameter should include all tables that are in the query. It is necessary for correctly handling weak joins.

    Parameters:
    dependentTable - the dependent table in the join.
    independentTable - the independent table in the join.
    tables - all tables that are already included in the query.
    Returns:
    an array of relationships containing all the relationships required to create the join, or null if no join is possible between the two tables.

    findRelationships

    public XRelationship[] findRelationships(String dependentTable,
                                             String independentTable,
                                             Collection tables,
                                             boolean useAlias)
    Gets all the relationships required to create a join between the specified tables. This methods handles weak joins in the model. The tables parameter should include all tables that are in the query. It is necessary for correctly handling weak joins.

    Parameters:
    dependentTable - the dependent table in the join.
    independentTable - the independent table in the join.
    tables - all tables that are already included in the query.
    useAlias - true if use alias.
    Returns:
    an array of relationships containing all the relationships required to create the join, or null if no join is possible between the two tables.

    findRelationships

    public XRelationship[] findRelationships(Set originating,
                                             Set others)
    Find all relations necessary to connect the tables in the originating set to the others set. All tables in the originating should already be connected. All tables in the others should be disjoint. This function ensures the shortest path is used for all table pairs with regard to weak joins. The originating and others sets are modified on return. If all tables are joined, the others set should be empty.

    Parameters:
    originating - set of table names (string).
    others - set of table names (string).
    Returns:
    an array of relationships containing all the relationships required to create the join.

    findRelationships

    public XRelationship[] findRelationships(Set originating,
                                             Set others,
                                             boolean useAlias)
    Find all relations necessary to connect the tables in the originating set to the others set. All tables in the originating should already be connected. All tables in the others should be disjoint. This function ensures the shortest path is used for all table pairs with regard to weak joins. The originating and others sets are modified on return. If all tables are joined, the others set should be empty.

    Parameters:
    originating - set of table names (string).
    others - set of table names (string).
    useAlias - true if use alias.
    Returns:
    an array of relationships containing all the relationships required to create the join.

    removeRelationship

    public void removeRelationship(XRelationship relationship)
    Remove a relationship from this data model.

    Parameters:
    relationship - the relationship to remove.

    applyAutoAliases

    public XPartition applyAutoAliases()
    Create a new partition with all auto-aliases expanded. Each alias appears as a regular table alias, and all relationships are added.


    validate

    public void validate()
    Validate the data model.


    updateReference

    public void updateReference()
    Update child partition reference.


    clone

    public Object clone()
    Creates a copy of this object.

    Overrides:
    clone in class Object
    Returns:
    a copy of this instance.

    equals

    public boolean equals(Object obj)
    Determines if this object is equivalent to another object.

    Overrides:
    equals in class Object
    Parameters:
    obj - the reference object with which to compare.
    Returns:
    true if the objects are are equivalent, false otherwise.

    writeStart

    public void writeStart(PrintWriter writer)
    Specified by:
    writeStart in interface inetsoft.util.xml.XMLStorage.XMLFragment

    writeEnd

    public void writeEnd(PrintWriter writer)
    Specified by:
    writeEnd in interface inetsoft.util.xml.XMLStorage.XMLFragment

    writeXML

    public void writeXML(PrintWriter writer)
    Writes an XML representation of this partition.

    Specified by:
    writeXML in interface inetsoft.util.XMLSerializable
    Parameters:
    writer - the output stream to which to write the XML representation.

    parseXML

    public void parseXML(Element tag)
                  throws DOMException
    Reads the definition of this partition from an XML element.

    Specified by:
    parseXML in interface inetsoft.util.XMLSerializable
    Parameters:
    tag - the XML element that represents this partition.
    Throws:
    DOMException - if an error occurs while parsing the XML element.

    setZoomRatio

    public void setZoomRatio(double zoom)
    Set the value of the zoomRatio.


    toString

    public String toString()
    Get the string representaion.

    Overrides:
    toString in class Object
    Returns:
    the string representation.

    setBaseParitition

    public void setBaseParitition(XPartition base)
    Set the base partition.


    removeMetaData

    public void removeMetaData()

    Copyright © 1996-2014 InetSoft Technology Corp. All Rights Reserved.