com.informatica.powercenter.sdk.mapfwk.core
Class Field

java.lang.Object
  extended by com.informatica.powercenter.sdk.mapfwk.core.Field
All Implemented Interfaces:
java.lang.Cloneable

public class Field
extends java.lang.Object
implements java.lang.Cloneable

Represents a column in a Table.

Field is used to create columns in a source, target and transformation Fields can be created in a source, target and transformation by calling Table.setFields(Vector) function in Source, Target and Transformation

Following is a code example for using Field while creating a flat file source


       // create a vector to hold the fields
       Vector fields = new Vector();
       // create a field of type of integer and add to the vector of fields
       Field field1 = new Field("EmployeeID", "EmployeeID","", DataTypeConstants.INTEGER, "10", "0",
                                                                FieldConstants.PRIMARY_KEY, Field.FIELDTYPE_SOURCE, true);
       fields.add(field1);
       // create a field of type of string and add to the vector of fields
       Field field2 = new Field("LastName", "LastName","", DataTypeConstants.STRING, "20", "0",
                                                                FieldConstants.NOT_A_KEY, Field.FIELDTYPE_SOURCE, false);
       fields.add(field2);
       // create connection info for a flat file source and set the connection
       // properties (not demonstrated in the code)
       ConnectionInfo ffConn = new ConnectionInfo( SourceTargetTypes.FLATFILE_TYPE );
       // create a Source
       Source employeeSource = new Source( "Employee", "Employee", "This is Employee Table",
                                                                                                                                         "Employee", ffConn );
       // set the fields in the Source
       employeeSource.setFields( fields );

  

Author:
nagarwal.
See Also:
CustomField, SourceTarget.setFields(Vector), SourceTarget.setFields(Vector), Table.setFields(Vector)

Field Summary
static int DATATYPE_FLAG_MODIFIED
          Constant for DATATYPE_FLAG_MODIFIED
static int DATATYPE_FLAG_NOTPRESERVE
          Constant for DATATYPE_FLAG_NOTPRESERVE
static int DATATYPE_FLAG_PRESERVE
          Constant for DATATYPE_FLAG_PRESERVE
static java.lang.String EXPRTYPE_GENERAL
          General Expression
static java.lang.String EXPRTYPE_GROUPBY
          Group By Expression
static java.lang.String EXPRTYPE_JOINER
          Joiner Field
static java.lang.String EXPRTYPE_RANKINDEX
          RANK INDEX
static java.lang.String EXPRTYPE_RANKPORT
          Rank port
static int FIELDTYPE_SOURCE
          Source field type
static int FIELDTYPE_TARGET
          Target field type
static int FIELDTYPE_TRANSFORM
          Expression field type
static int FIELDTYPE_VARIABLE
          Variable field type
static java.lang.String ISNOTSORTKEY
          To specify Sort Key for Rank
static java.lang.String ISSORTKEY
          To specify Sort Key for Rank
static java.lang.String SORT_ASCENDING
          Sort direction ascending
static java.lang.String SORT_DESCENDING
          Sort direction descending
 
Constructor Summary
Field()
          Default constructor
Field(java.lang.String name, java.lang.String busName, java.lang.String description, java.lang.String dataType, java.lang.String prec, java.lang.String scale, int keyType, int fieldType, boolean notNull)
          Initialize a Field by specifying name, business name, description,
data type, precision, scale, key type, field type, whether it can be null
 
Method Summary
 java.lang.Object clone()
          Deep clones the field object
 boolean equals(java.lang.Object obj)
          Compares the specified object with this Field for equality.
 java.lang.Object getAttribute(java.lang.Object key)
          Gets the attribute value for a given key
 java.lang.String getBusinessName()
          Gets the business name
 java.lang.String getDataType()
          Gets the data type of the field.
Returned data type is one of the constants defined in DataTypeConstants
 int getDataTypeFlag()
          Gets the datatype flag
 java.lang.String getDefaultValue()
          Gets the default value of the field
 java.lang.String getDescription()
          Gets the description of the field
 java.lang.String getExprType()
          Gets expression type
 java.util.Vector getExtensionAttrs()
          Gets a list of MetaExtension attributes
 java.util.Map getFieldAttributes()
          Gets the attributes (key, value pair) of the field
 int getFieldType()
          Gets the field type.
 java.lang.String getGroupName()
          Gets the group name
 int getKeyType()
          Gets the key type of the field.
 java.lang.String getLevel()
          Gets the level of the field.
Default is 0
 java.lang.String getName()
          Gets the name of the field
 java.lang.String getOccurs()
          Gets the number of occurance.
 java.lang.String getOffset()
          Gets the offset.
Default value is 0
 java.lang.String getOrigName()
          Gets original name of the field
 java.lang.String getPhysicalLength()
          Gets the physical length.
 java.lang.String getPhysicalOffset()
          Gets the physical offset.
 java.lang.String getPrecision()
          Gets the precision of field
 java.lang.String getReferencedFieldName()
          Gets the referenced field name
 java.lang.String getReferencedSourceName()
          Gets the referenced source name
 java.lang.String getScale()
          Gets the scale of the field
 java.lang.String getXML()
          Gets the XML string
 boolean isNotNull()
          Finds if field cannot be null
 boolean isReadOnly()
          Gets the readonly flag
 boolean isVariable()
          Finds whether field of variable type
 void setAttributeValues(java.lang.Object key, java.lang.Object value)
          Sets the attribute of the field
 void setBusinessName(java.lang.String businessName)
          Sets the business name
 void setDataType(java.lang.String dataType)
          Sets the data type of the field.
 void setDataTypeFlag(int dataTypeFlag)
          Sets the datatype flag
 void setDefaultValue(java.lang.String defaultValue)
          Sets the default value of the field
 void setDescription(java.lang.String description)
          Sets the description of the field
 void setExprType(java.lang.String expr)
          Sets the expression type
 void setExtensionAttrs(java.util.Vector metaAttrs)
          Sets the collection of MetaExtension attributes
 void setFieldAttributes(java.util.Map fieldAttributes)
          Sets the attributes (key, value pair) of the field
 void setFieldType(int fieldType)
          Sets the field type.
 void setGroupName(java.lang.String groupName)
          Sets the group name
 void setKeyType(int keyType)
          Sets the key type of the field.
 void setLevel(java.lang.String level)
          Sets the level of the field.
Default is 0
 void setName(java.lang.String name)
          Sets the field name
 void setNotNull(boolean value)
          Specifies whether field cannot be null
 void setOccurs(java.lang.String occurs)
          Set the number of occurences.
Default value is 0
 void setOffset(java.lang.String offset)
          Sets the offset.
Default value is 0
 void setOrigName(java.lang.String origName)
          Sets the original name of the field
 void setPhysicalLength(java.lang.String physicalLength)
          Sets the physical length.
 void setPhysicalOffset(java.lang.String physicalOffset)
          Sets the physical offset.
 void setPrecision(java.lang.String precision)
          Sets the precision of field
 void setReferenceConstraint(java.lang.String referencedSourceName, java.lang.String referencedFieldName)
          Sets the foreign key relationship with primary key field of other source
 void setReferencedFieldName(java.lang.String referencedFieldName)
          Sets the referenced field name
 void setReferencedSourceName(java.lang.String referencedSourceName)
          Sets the referenced source name
 void setScale(java.lang.String scale)
          Sets the scale of the field
 void setVariable(boolean variable)
          Sets the field as variable
 void setXML(java.lang.String strxml)
          Sets the XML String
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FIELDTYPE_SOURCE

public static final int FIELDTYPE_SOURCE
Source field type

See Also:
Constant Field Values

FIELDTYPE_TARGET

public static final int FIELDTYPE_TARGET
Target field type

See Also:
Constant Field Values

FIELDTYPE_TRANSFORM

public static final int FIELDTYPE_TRANSFORM
Expression field type

See Also:
Constant Field Values

FIELDTYPE_VARIABLE

public static final int FIELDTYPE_VARIABLE
Variable field type

See Also:
Constant Field Values

EXPRTYPE_GENERAL

public static final java.lang.String EXPRTYPE_GENERAL
General Expression

See Also:
Constant Field Values

EXPRTYPE_GROUPBY

public static final java.lang.String EXPRTYPE_GROUPBY
Group By Expression

See Also:
Constant Field Values

EXPRTYPE_RANKPORT

public static final java.lang.String EXPRTYPE_RANKPORT
Rank port

See Also:
Constant Field Values

EXPRTYPE_RANKINDEX

public static final java.lang.String EXPRTYPE_RANKINDEX
RANK INDEX

See Also:
Constant Field Values

ISSORTKEY

public static final java.lang.String ISSORTKEY
To specify Sort Key for Rank

See Also:
Constant Field Values

ISNOTSORTKEY

public static final java.lang.String ISNOTSORTKEY
To specify Sort Key for Rank

See Also:
Constant Field Values

SORT_ASCENDING

public static final java.lang.String SORT_ASCENDING
Sort direction ascending

See Also:
Constant Field Values

SORT_DESCENDING

public static final java.lang.String SORT_DESCENDING
Sort direction descending

See Also:
Constant Field Values

EXPRTYPE_JOINER

public static final java.lang.String EXPRTYPE_JOINER
Joiner Field

See Also:
Constant Field Values

DATATYPE_FLAG_NOTPRESERVE

public static final int DATATYPE_FLAG_NOTPRESERVE
Constant for DATATYPE_FLAG_NOTPRESERVE

See Also:
Constant Field Values

DATATYPE_FLAG_PRESERVE

public static final int DATATYPE_FLAG_PRESERVE
Constant for DATATYPE_FLAG_PRESERVE

See Also:
Constant Field Values

DATATYPE_FLAG_MODIFIED

public static final int DATATYPE_FLAG_MODIFIED
Constant for DATATYPE_FLAG_MODIFIED

See Also:
Constant Field Values
Constructor Detail

Field

public Field()
Default constructor


Field

public Field(java.lang.String name,
             java.lang.String busName,
             java.lang.String description,
             java.lang.String dataType,
             java.lang.String prec,
             java.lang.String scale,
             int keyType,
             int fieldType,
             boolean notNull)
Initialize a Field by specifying name, business name, description,
data type, precision, scale, key type, field type, whether it can be null

Key Type specified whether field is a primary key, foreign key etc.
Field type specifies whether is belongs to Source
or a Target

Parameters:
name - field name
busName - business name
description - field descripton
dataType - data type. Use data types defined in DataTypeConstants
prec - precision
scale - scale
keyType - key type. Use constants defined in FieldConstants
fieldType - type of the field. Use constants with prefix FIELDTYPE_defined in Field
notNull - whether field can be null or not
See Also:
for data type definitions, for key type definitions
Method Detail

isVariable

public boolean isVariable()
Finds whether field of variable type

Returns:
true if the field is variable.

setVariable

public void setVariable(boolean variable)
Sets the field as variable

Parameters:
variable - value to be set.

getExtensionAttrs

public java.util.Vector getExtensionAttrs()
Gets a list of MetaExtension attributes

Returns:
collection of extension attributes.

setExtensionAttrs

public void setExtensionAttrs(java.util.Vector metaAttrs)
Sets the collection of MetaExtension attributes

Parameters:
metaAttrs - collection of MetaExtension

getBusinessName

public java.lang.String getBusinessName()
Gets the business name

Returns:
the business name.

setBusinessName

public void setBusinessName(java.lang.String businessName)
Sets the business name

Parameters:
businessName - business name

getDataType

public java.lang.String getDataType()
Gets the data type of the field.
Returned data type is one of the constants defined in DataTypeConstants

Returns:
data type of the field

setDataType

public void setDataType(java.lang.String dataType)
Sets the data type of the field.
Use the data type constants defined in DataTypeConstants

Parameters:
dataType - data type of the field.

getKeyType

public int getKeyType()
Gets the key type of the field.
Returned key type is one of the constants defined in FieldConstants

Returns:
key type of the field.

setKeyType

public void setKeyType(int keyType)
Sets the key type of the field. Use constants defined in FieldConstants

Parameters:
keyType - key type of the field

getName

public java.lang.String getName()
Gets the name of the field

Returns:
field name

setName

public void setName(java.lang.String name)
Sets the field name

Parameters:
name - field name.

getPrecision

public java.lang.String getPrecision()
Gets the precision of field

Returns:
precision of field

setPrecision

public void setPrecision(java.lang.String precision)
Sets the precision of field

Parameters:
precision - precision of the field

getScale

public java.lang.String getScale()
Gets the scale of the field

Returns:
scale of the field

setScale

public void setScale(java.lang.String scale)
Sets the scale of the field

Parameters:
scale - scale of the field

getXML

public java.lang.String getXML()
Gets the XML string

Returns:
Returns the XML.

setXML

public void setXML(java.lang.String strxml)
Sets the XML String

Parameters:
strxml - The strXML to set.

equals

public boolean equals(java.lang.Object obj)
Compares the specified object with this Field for equality.
Returns true if and only if the specified Object is also a Field
and has the same name

Overrides:
equals in class java.lang.Object
Parameters:
obj - field to be compared for equality

getFieldType

public int getFieldType()
Gets the field type.
Returned type constants with prefix FIELDTYPE_defined in Field

Returns:
field type.

setFieldType

public void setFieldType(int fieldType)
Sets the field type.
Use constants with prefix FIELDTYPE_defined in Field

Parameters:
fieldType - field type.

isNotNull

public boolean isNotNull()
Finds if field cannot be null

Returns:
true or false

setNotNull

public void setNotNull(boolean value)
Specifies whether field cannot be null

Parameters:
value - true or false

getDescription

public java.lang.String getDescription()
Gets the description of the field

Returns:
field description

setDescription

public void setDescription(java.lang.String description)
Sets the description of the field

Parameters:
description - field descriptiom

getExprType

public java.lang.String getExprType()
Gets expression type

Returns:
expression type.

setExprType

public void setExprType(java.lang.String expr)
Sets the expression type

Parameters:
expr - expression type

clone

public java.lang.Object clone()
Deep clones the field object

Overrides:
clone in class java.lang.Object
Returns:
Deep cloned field object

getOrigName

public java.lang.String getOrigName()
Gets original name of the field

Returns:
original name of the field

setOrigName

public void setOrigName(java.lang.String origName)
Sets the original name of the field

Parameters:
origName - original name of the field.

getDefaultValue

public java.lang.String getDefaultValue()
Gets the default value of the field

Returns:
default value of the field

setDefaultValue

public void setDefaultValue(java.lang.String defaultValue)
Sets the default value of the field

Parameters:
defaultValue - default value of the field

getReferencedFieldName

public java.lang.String getReferencedFieldName()
Gets the referenced field name

Returns:
referenced field name

setReferencedFieldName

public void setReferencedFieldName(java.lang.String referencedFieldName)
Sets the referenced field name

Parameters:
referencedFieldName - sreferenced field name

getReferencedSourceName

public java.lang.String getReferencedSourceName()
Gets the referenced source name

Returns:
referenced source name

setReferencedSourceName

public void setReferencedSourceName(java.lang.String referencedSourceName)
Sets the referenced source name

Parameters:
referencedSourceName - referenced source name

setReferenceConstraint

public void setReferenceConstraint(java.lang.String referencedSourceName,
                                   java.lang.String referencedFieldName)
Sets the foreign key relationship with primary key field of other source

Parameters:
referencedSourceName - source name
referencedFieldName - field Name

getFieldAttributes

public java.util.Map getFieldAttributes()
Gets the attributes (key, value pair) of the field

Returns:
map of field attributes

setFieldAttributes

public void setFieldAttributes(java.util.Map fieldAttributes)
Sets the attributes (key, value pair) of the field

Parameters:
fieldAttributes - map of field attributes

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)
Gets the attribute value for a given key

Parameters:
key - field attribute key
Returns:
object filed attribute value

setAttributeValues

public void setAttributeValues(java.lang.Object key,
                               java.lang.Object value)
Sets the attribute of the field

Parameters:
key - field attribute key
value - field attribute value

getDataTypeFlag

public int getDataTypeFlag()
Gets the datatype flag

Returns:
datatype flag

setDataTypeFlag

public void setDataTypeFlag(int dataTypeFlag)
Sets the datatype flag

Parameters:
dataTypeFlag - datatype flag

isReadOnly

public boolean isReadOnly()
Gets the readonly flag

Returns:
value of readonly flag

getLevel

public java.lang.String getLevel()
Gets the level of the field.
Default is 0

Returns:
String field level

setLevel

public void setLevel(java.lang.String level)
Sets the level of the field.
Default is 0

Parameters:
level - field level

getOccurs

public java.lang.String getOccurs()
Gets the number of occurance.
Default value is 0

Returns:
String number of occurance

setOccurs

public void setOccurs(java.lang.String occurs)
Set the number of occurences.
Default value is 0

Parameters:
occurs - number of occurances

getOffset

public java.lang.String getOffset()
Gets the offset.
Default value is 0

Returns:
String offset

setOffset

public void setOffset(java.lang.String offset)
Sets the offset.
Default value is 0

Parameters:
offset - offset

getPhysicalLength

public java.lang.String getPhysicalLength()
Gets the physical length.
Default value is equal to precision

Returns:
String physical length

setPhysicalLength

public void setPhysicalLength(java.lang.String physicalLength)
Sets the physical length.
Default value is equal to precision

Parameters:
physicalLength - physical length

getPhysicalOffset

public java.lang.String getPhysicalOffset()
Gets the physical offset.
Default value is 0

Returns:
String physical offsets

setPhysicalOffset

public void setPhysicalOffset(java.lang.String physicalOffset)
Sets the physical offset.
Default value is 0

Parameters:
physicalOffset - physical offset

getGroupName

public java.lang.String getGroupName()
Gets the group name

Returns:
String group name

setGroupName

public void setGroupName(java.lang.String groupName)
Sets the group name

Parameters:
group - name