org.norther.tammi.root.rt.util
Class VariableTransporter

java.lang.Object
  extended by org.norther.tammi.root.rt.util.VariableTransporter
All Implemented Interfaces:
Serializable, AttributeExporter, AttributeImporter
Direct Known Subclasses:
KeyValueSetupImporter, UserAccountImporter

public class VariableTransporter
extends Object
implements AttributeImporter, AttributeExporter, Serializable

An attribute transporter for persistent variables.

Author:
Ilkka Priha
See Also:
Serialized Form

Constructor Summary
VariableTransporter()
          Constructs a new transporter.
VariableTransporter(boolean foreign)
          Constructs a new transporter with a foreign option.
 
Method Summary
 AttributeList exportAttributes(Variable var, Identity id, Object source, boolean foreign)
          Exports attribute values to another variable identified by the specified identity.
 AttributeList exportAttributes(Variable var, Variable other, Object source, boolean foreign)
          Exports attribute values to another variable.
 String getEnumerationKey(Variable var, Variable e, String pkField, String enumField, Persister persister)
          Gets the enumeration key.
 Object getEnumerationValue(Variable var, Variable e, String pkField, String enumField, Persister persister)
          Gets the enumeration value.
 AttributeFilter getExportFilter()
          Gets the export filter.
 AttributeFilter getImportFilter()
          Gets the import filter.
 AttributeList importAttributes(Variable var, Identity id, Object source, boolean foreign)
          Imports attribute values from another variable identified by the specified identity.
 AttributeList importAttributes(Variable var, Variable other, Object source, boolean foreign)
          Imports attribute values from another variable.
 boolean isForeign()
          Checks foreign imports.
 List transportEnumeration(Variable var, String name, String type, String enumField, boolean nullable, Persister persister)
          Transports the specified enumeration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableTransporter

public VariableTransporter()
Constructs a new transporter.


VariableTransporter

public VariableTransporter(boolean foreign)
Constructs a new transporter with a foreign option.

Foreign transporters transport attributes from identities that are not of the same type as the target variable.

Parameters:
foreign - true for foreign transports, false otherwise.
Method Detail

importAttributes

public AttributeList importAttributes(Variable var,
                                      Identity id,
                                      Object source,
                                      boolean foreign)
Description copied from interface: AttributeImporter
Imports attribute values from another variable identified by the specified identity.

Specified by:
importAttributes in interface AttributeImporter
Parameters:
var - this variable.
id - the identity.
source - the source object.
foreign - true for a foreign import, false otherwise.
Returns:
a list of imported attributes.

importAttributes

public AttributeList importAttributes(Variable var,
                                      Variable other,
                                      Object source,
                                      boolean foreign)
Description copied from interface: AttributeImporter
Imports attribute values from another variable.

Specified by:
importAttributes in interface AttributeImporter
Parameters:
var - this variable.
other - the other variable.
source - the source object.
foreign - true for a foreign import, false otherwise.
Returns:
a list of imported attributes.

exportAttributes

public AttributeList exportAttributes(Variable var,
                                      Identity id,
                                      Object source,
                                      boolean foreign)
Description copied from interface: AttributeExporter
Exports attribute values to another variable identified by the specified identity.

Specified by:
exportAttributes in interface AttributeExporter
Parameters:
var - this variable.
id - the identity.
source - the source object.
foreign - true for a foreign export, false otherwise.
Returns:
a list of exported attributes.

exportAttributes

public AttributeList exportAttributes(Variable var,
                                      Variable other,
                                      Object source,
                                      boolean foreign)
Description copied from interface: AttributeExporter
Exports attribute values to another variable.

Specified by:
exportAttributes in interface AttributeExporter
Parameters:
var - this variable.
other - the other variable.
source - the source object.
foreign - true for a foreign export, false otherwise.
Returns:
a list of exported attributes.

isForeign

public boolean isForeign()
Checks foreign imports.

Returns:
true for foreign imports, false otherwise.

getImportFilter

public AttributeFilter getImportFilter()
Gets the import filter.

Returns:
the filter or null.

getExportFilter

public AttributeFilter getExportFilter()
Gets the export filter.

Returns:
the filter or null.

transportEnumeration

public List transportEnumeration(Variable var,
                                 String name,
                                 String type,
                                 String enumField,
                                 boolean nullable,
                                 Persister persister)
                          throws AttributeNotFoundException,
                                 PersisterException
Transports the specified enumeration.

Parameters:
var - the target variable.
name - the enumeration attribute.
type - the enumeration type.
enumField - the enumeration field.
nullable - true if nullable, false otherwise.
persister - the persister to apply.
Returns:
the enumeration.
Throws:
AttributeNotFoundException - for missing attributes.
PersisterException - if a persister operation fails.

getEnumerationKey

public String getEnumerationKey(Variable var,
                                Variable e,
                                String pkField,
                                String enumField,
                                Persister persister)
                         throws AttributeNotFoundException
Gets the enumeration key.

Parameters:
var - this variable.
e - the enumeration variable.
pkField - the primary key field.
enumField - the enumeration field.
persister - the persister to apply.
Returns:
the enumeration key.
Throws:
AttributeNotFoundException - for missing attributes.

getEnumerationValue

public Object getEnumerationValue(Variable var,
                                  Variable e,
                                  String pkField,
                                  String enumField,
                                  Persister persister)
                           throws AttributeNotFoundException
Gets the enumeration value.

Parameters:
var - this variable.
e - the enumeration variable.
pkField - the primary key field.
enumField - the enumeration field.
persister - the persister to apply.
Returns:
the enumeration key.
Throws:
AttributeNotFoundException - for missing attributes.


Copyright © 2004 The Norther Organization. All rights reserved.