uk.ac.ic.doc.automed.reps
Class Statement

java.lang.Object
  |
  +--uk.ac.ic.doc.automed.reps.Statement

public class Statement
extends java.lang.Object

The class to create statements that can be used in a template transformation's program.

See Also:

This class enables the creation of new statements and the definition of their arguments.


Constructor Summary
Statement(java.lang.String name)
          Constructs a new Statement without any StatementArgumentDefinition objects.
 
Method Summary
 StatementArgumentDefinition createArgumentDefinition(int position, java.lang.String tablename, java.lang.String fieldname, java.lang.String description)
          Defines an argument for this Statement.
 StatementArgumentDefinition getArgumentDefinitionAt(int position)
          Returns a particular StatementArgumentDefinition in the Statements's argument definition list.
 StatementArgumentDefinition[] getArgumentDefinitions()
          Returns an array of all the StatementArgumentDefinition objects of this Statement.
 java.lang.String getName()
          Returns the name of this Statement.
protected static Statement getStatement(int stId)
          Returns a reference to a Statement.
static Statement getStatement(java.lang.String name)
          Returns a reference to a Statement.
static Statement[] getStatements()
          Returns an array of all Statement objects.
 int getStId()
          Returns the ID of this Statement.
 void print()
           
 void remove()
          Removes this Statement
 void removeArgumentDefinition(int position)
          Removes a particular argument definition from this Statements's argument definition list.
static void removeStatement(java.lang.String name)
          Removes a Statement
 void setName(java.lang.String name)
          Sets this Statement's name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Statement

public Statement(java.lang.String name)
          throws TemplateTransformationSyntaxRepositoryException,
                 RepositoryAccessException
Constructs a new Statement without any StatementArgumentDefinition objects.

Parameters:
name - name of the statement.
Throws:
TemplateTransformationSyntaxRepositoryException - see TemplateTransformationSyntaxRepository.createStatement(String)
RepositoryAccessException - if the repositories cannot be accessed
Method Detail

removeStatement

public static void removeStatement(java.lang.String name)
                            throws TemplateTransformationSyntaxRepositoryException,
                                   RepositoryAccessException
Removes a Statement

Parameters:
name - name of statement to remove.
Throws:
TemplateTransformationSyntaxRepositoryException - see TemplateTransformationSyntaxRepository.getStatementByName(String) and TemplateTransformationSyntaxRepository.removeStatement(int) and remove()
RepositoryAccessException - if the repositories cannot be accessed

remove

public void remove()
            throws TemplateTransformationSyntaxRepositoryException,
                   RepositoryAccessException
Removes this Statement

Throws:
TemplateTransformationSyntaxRepositoryException - see StatementArgumentDefinition.remove() and TemplateTransformationSyntaxRepository.removeStatement(int)
RepositoryAccessException - if the repositories cannot be accessed

getStatements

public static Statement[] getStatements()
                                 throws RepositoryAccessException
Returns an array of all Statement objects. Return null if no statements exists in the TTSR.

Returns:
an array of all Statement objects.
Throws:
RepositoryAccessException - if the repositories cannot be accessed

getStatement

public static Statement getStatement(java.lang.String name)
                              throws RepositoryAccessException,
                                     TemplateTransformationSyntaxRepositoryException
Returns a reference to a Statement. Returns null if no records of a statement with the specifieds name exist in the TTSR.

Parameters:
name - name of the Statement to return.
Returns:
the reference to the statement with the given name.
Throws:
TemplateTransformationSyntaxRepositoryException - see TemplateTransformationSyntaxRepository.getStatementByName(String)
RepositoryAccessException - if the repositories cannot be accessed

getStatement

protected static Statement getStatement(int stId)
                                 throws RepositoryAccessException,
                                        TemplateTransformationSyntaxRepositoryException
Returns a reference to a Statement. Returns null if no records of a statement with the specifieds stId exist in the TTSR.

Parameters:
stId - the Statement's identifier
Returns:
the reference to the Statement with the given identifier
Throws:
TemplateTransformationSyntaxRepositoryException - see TemplateTransformationSyntaxRepository.getStatementName(int) and getStatement(String)
RepositoryAccessException - if the repositories cannot be accessed

getName

public java.lang.String getName()
                         throws TemplateTransformationSyntaxRepositoryException,
                                RepositoryAccessException
Returns the name of this Statement.

Returns:
name of Statement.
Throws:
TemplateTransformationSyntaxRepositoryException - see TemplateTransformationSyntaxRepository.getStatementName(int)
RepositoryAccessException - if the repositories cannot be accessed

getStId

public int getStId()
Returns the ID of this Statement.

Returns:
ID of Statement.

setName

public void setName(java.lang.String name)
             throws TemplateTransformationSyntaxRepositoryException,
                    RepositoryAccessException
Sets this Statement's name.

Parameters:
name - new name of Statement.
Throws:
TemplateTransformationSyntaxRepositoryException - see TemplateTransformationSyntaxRepository.setStatementName(int, String)
RepositoryAccessException - if the repositories cannot be accessed

getArgumentDefinitions

public StatementArgumentDefinition[] getArgumentDefinitions()
Returns an array of all the StatementArgumentDefinition objects of this Statement.

Returns:
an array of all the StatementArgumentDefinition objects of this Statement.

createArgumentDefinition

public StatementArgumentDefinition createArgumentDefinition(int position,
                                                            java.lang.String tablename,
                                                            java.lang.String fieldname,
                                                            java.lang.String description)
                                                     throws TemplateTransformationSyntaxRepositoryException,
                                                            RepositoryAccessException
Defines an argument for this Statement. Method constructs a new StatementArgumentDefinition and adds it to this Statement's argument definitions. The defined argument holds position position in this Statement object's arguments. tablename, fieldname and description are used to describe the specific argument.

Parameters:
position - the position in the statement's arguments
tablename - name of the table referenced by this argument.
fieldname - name of the table's field referenced by this argument.
description - description of this argument.
Returns:
the new StatementArgumentDefinition
Throws:
TemplateTransformationSyntaxRepositoryException - see StatementArgumentDefinition.StatementArgumentDefinition(int, int, String, String, String)
RepositoryAccessException - if the repositories cannot be accessed

getArgumentDefinitionAt

public StatementArgumentDefinition getArgumentDefinitionAt(int position)
                                                    throws AutoRepException
Returns a particular StatementArgumentDefinition in the Statements's argument definition list.

Parameters:
position - the position in the statement's arguments.
Returns:
the StatementArgumentDefinition specified by the given position
Throws:
AutoRepException - if the specified position doesn't exist in this Statement's argument definition list

removeArgumentDefinition

public void removeArgumentDefinition(int position)
                              throws TemplateTransformationSyntaxRepositoryException,
                                     AutoRepException,
                                     RepositoryAccessException
Removes a particular argument definition from this Statements's argument definition list.

Parameters:
position - the position to be removed from the statement's argument definitions
Throws:
AutoRepException - see getArgumentDefinitionAt(int)
TemplateTransformationSyntaxRepositoryException - see StatementArgumentDefinition.remove()
RepositoryAccessException - if the repositories cannot be accessed

print

public void print()
           throws TemplateTransformationSyntaxRepositoryException,
                  RepositoryAccessException
TemplateTransformationSyntaxRepositoryException
RepositoryAccessException