net.datacrow.enhancers
Class AssociateNameRewriter

java.lang.Object
  extended by net.datacrow.enhancers.AssociateNameRewriter
All Implemented Interfaces:
IValueEnhancer

public class AssociateNameRewriter
extends java.lang.Object
implements IValueEnhancer

Transforms a title. Based on a word list the title will be transformed as follows:
<Word in list>,<Value without Word in list>

Author:
Robert Jan van der Waals

Field Summary
static int _FIRSTLAST
           
static int _LASTFIRST
           
 
Constructor Summary
AssociateNameRewriter()
          Creates a new instance.
AssociateNameRewriter(boolean enabled, int order)
          Creates a new instances.
 
Method Summary
 java.lang.Object apply(DcField field, java.lang.Object value)
          Apply the enhancement.
 int getField()
          The field to transform.
 int getIndex()
          Unique ID for this enhancer.
 java.lang.String getName(java.lang.String firstname, java.lang.String lastname)
           
 int getOrder()
           
 boolean isEnabled()
          Indicates if this enhancer is enabled.
 boolean isRunOnInsert()
          Indicates if the enhancement should be performed after inserting an item.
 boolean isRunOnUpdating()
          Indicates if the enhancement should be performed after updating an item.
 void parse(java.lang.String s)
          Parses a string representation.
 java.lang.String toSaveString()
          Creates a string representation which can be stored to disk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_FIRSTLAST

public static final int _FIRSTLAST
See Also:
Constant Field Values

_LASTFIRST

public static final int _LASTFIRST
See Also:
Constant Field Values
Constructor Detail

AssociateNameRewriter

public AssociateNameRewriter()
Creates a new instance.


AssociateNameRewriter

public AssociateNameRewriter(boolean enabled,
                             int order)
Creates a new instances.

Parameters:
enabled -
list - The word list. Any value starting with a word in the list will be transformed.
Method Detail

getField

public int getField()
The field to transform.

Returns:
Either DcAssociate._A_NAME

getOrder

public int getOrder()

toSaveString

public java.lang.String toSaveString()
Description copied from interface: IValueEnhancer
Creates a string representation which can be stored to disk.

Specified by:
toSaveString in interface IValueEnhancer

getIndex

public int getIndex()
Description copied from interface: IValueEnhancer
Unique ID for this enhancer.

Specified by:
getIndex in interface IValueEnhancer
Returns:

parse

public void parse(java.lang.String s)
Description copied from interface: IValueEnhancer
Parses a string representation.

Specified by:
parse in interface IValueEnhancer

getName

public java.lang.String getName(java.lang.String firstname,
                                java.lang.String lastname)

apply

public java.lang.Object apply(DcField field,
                              java.lang.Object value)
Description copied from interface: IValueEnhancer
Apply the enhancement.

Specified by:
apply in interface IValueEnhancer
Parameters:
field - The field to enhance.
value - The value.
Returns:
The result of the enhancement.

isRunOnUpdating

public boolean isRunOnUpdating()
Description copied from interface: IValueEnhancer
Indicates if the enhancement should be performed after updating an item.

Specified by:
isRunOnUpdating in interface IValueEnhancer

isRunOnInsert

public boolean isRunOnInsert()
Description copied from interface: IValueEnhancer
Indicates if the enhancement should be performed after inserting an item.

Specified by:
isRunOnInsert in interface IValueEnhancer

isEnabled

public boolean isEnabled()
Description copied from interface: IValueEnhancer
Indicates if this enhancer is enabled.

Specified by:
isEnabled in interface IValueEnhancer