net.datacrow.enhancers
Class TitleRewriter

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

public class TitleRewriter
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

Constructor Summary
TitleRewriter()
          Creates a new instance.
TitleRewriter(boolean enabled, java.lang.String list)
          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 getWordList()
           
 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
 

Constructor Detail

TitleRewriter

public TitleRewriter()
Creates a new instance.


TitleRewriter

public TitleRewriter(boolean enabled,
                     java.lang.String list)
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:
DcMediaObject._A_TITLE

getWordList

public java.lang.String getWordList()

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

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