|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwt.index.IndexDelegate
This is the class that extracts textual information out of Business Objects
and write it to the indexed search collection. Note that you should
not call or instantiate the IndexDelegate directly, but rely on the queing
mechanism of the IndexService to execute the methods when appropriate.
Note that if you override this class, you will need to update the service.properties
file to put your new IndexDelegate into affect.
Supported API: true
Extendable: true
Field Summary | |
private static String |
CLASSNAME
|
static long |
EXTERNALIZATION_VERSION_UID
|
private static String |
GENERIC_ICON
|
protected static long |
OLD_FORMAT_VERSION_UID
|
private static String |
RESOURCE
|
(package private) static long |
serialVersionUID
|
protected String |
SYSTEM_ID
|
private Index |
theIndex
|
private Indexable |
theIndexable
|
private WTReference |
theWTReference
|
private boolean |
VERBOSE_EXECUTION
|
Constructor Summary | |
IndexDelegate()
Instantiate a new IndexDelegate. |
Method Summary | |
protected String |
createIndexKey()
This method creates the key that the object will be indexed as. |
Void |
delete()
This methods deletes an object out of the indexed collection. |
Index |
getIndex()
Gets the object for the association that plays role: theIndex. |
Indexable |
getIndexable()
Gets the object for the association that plays role: theIndexable. |
protected IndexAccessor |
getIndexAccessor(IndexAccessorConnection iaccConn)
Returns an IndexAccessor that uses the IndexAccessorConnection iaccConn. |
protected String |
getIndexObjectType()
This method is in place to be overidden for the case when someone wants to use an object other than "WindchillBusinessObject" from the formats.cfg file. |
WTReference |
getWTReference()
Gets the object for the association that plays role: theWTReference. |
Void |
index()
This method is what is called by the IndexService to do indexing. |
protected void |
indexInstanceAttributes(Object businessObj,
IndexAccessor iacc)
Indexes attribute names and values of Instance Based Attributes. |
protected void |
indexPlugin(IndexAccessor iacc)
This function is a place keeper for additional indexing capability defined by the user. |
private void |
Log(String line)
|
void |
outputInstanceAttributes(Object businessObj)
This method outputs the instance attributes for the IBA Holder pointed to by Object o. |
void |
readExternal(ObjectInput input)
Reads the non-transient fields of this class from an external source. |
private boolean |
readOldVersion(ObjectInput input,
long readSerialVersionUID,
boolean passThrough,
boolean superDone)
Reads the non-transient fields of this class from an external source, which is not the current version. |
protected boolean |
readVersion(IndexDelegate thisObject,
ObjectInput input,
long readSerialVersionUID,
boolean passThrough,
boolean superDone)
Reads the non-transient fields of this class from an external source. |
private String |
sanitize(String str)
|
private void |
sendAttributeToIndex(Indexable obj,
ClassInfo objInfo,
PropertyDescriptor prop,
String contentSearchField,
IndexAccessor iacc)
|
private void |
sendAttributeToIndex(Indexable obj,
ClassInfo objInfo,
String propertyName,
IndexAccessor iacc)
|
protected void |
sendAttributeToIndex(String indexField,
String value,
IndexAccessor iacc)
This method is used to place the string "value", in the field "indexField" in the index. |
void |
setIndex(Index a_Index)
Sets the object for the association that plays role: theIndex. |
void |
setIndexable(Indexable a_Indexable)
Sets the object for the association that plays role: theIndexable. |
void |
setWTReference(WTReference a_WTReference)
Sets the object for the association that plays role: theWTReference. |
private void |
theIndexValidate(Index a_Index)
|
private void |
theWTReferenceValidate(WTReference a_WTReference)
|
void |
writeExternal(ObjectOutput output)
Writes the non-transient fields of this class to an external source. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final String RESOURCE
private static final String CLASSNAME
private Index theIndex
private Indexable theIndexable
private WTReference theWTReference
static final long serialVersionUID
public static final long EXTERNALIZATION_VERSION_UID
protected static final long OLD_FORMAT_VERSION_UID
private boolean VERBOSE_EXECUTION
protected String SYSTEM_ID
private static final String GENERIC_ICON
Constructor Detail |
public IndexDelegate() throws IOException
IOException
Method Detail |
public void writeExternal(ObjectOutput output) throws IOException
writeExternal
in interface Externalizable
output
-
IOException
public void readExternal(ObjectInput input) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
input
-
IOException
ClassNotFoundException
protected boolean readVersion(IndexDelegate thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone) throws IOException, ClassNotFoundException
thisObject
- input
- readSerialVersionUID
- passThrough
- superDone
-
IOException
ClassNotFoundException
private boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone) throws IOException, ClassNotFoundException
input
- readSerialVersionUID
- passThrough
- superDone
-
IOException
ClassNotFoundException
public Index getIndex()
public void setIndex(Index a_Index) throws WTPropertyVetoException
a_Index
-
WTPropertyVetoException
private void theIndexValidate(Index a_Index) throws WTPropertyVetoException
a_Index
-
WTPropertyVetoException
public Indexable getIndexable()
public void setIndexable(Indexable a_Indexable) throws WTPropertyVetoException
a_Indexable
-
WTPropertyVetoException
public WTReference getWTReference()
public void setWTReference(WTReference a_WTReference) throws WTPropertyVetoException
a_WTReference
-
WTPropertyVetoException
private void theWTReferenceValidate(WTReference a_WTReference) throws WTPropertyVetoException
a_WTReference
-
WTPropertyVetoException
public Void index() throws IndexingException, WTException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException, PropertyVetoException, IOException
method can be overriden to index text to an indexed collection in a
non-default way. The following is an example of what your code
might look like to override this method.
IndexAccessor iacc = null;
IndexAccessorConnection iaccConn = null;
iaccConn = IndexAccessorConnectionFactory.createAccessor( getIndex( ) );
iacc = getIndexAccessor(iaccConn);
iacc.writeHeader( );
iacc.beginIndex();
iacc.writeType( "MyCrObject" ); // this maps to a type defined in formats.cfg
MyChangeRequest cr = (MyChangeRequest)getIndexable( );
// note - identity and customerSite need to be defined in the formats.cfg
iacc.writeItem( "identity", cr.getIdentity( ) );
iacc.writeItem( "customerSite", cr.getSite ( ) .getDisplay( WTContext.getContext().getLocale( ) ));
iacc.endIndex();
// Wait for the status to come back indicating that indexing is complete.
String accStatus = iaccConn.getStatus();
if (!( accStatus.equals(IndexEntryToRware.SUCCESS_STATUS))) {
Object args[] = { identity };
throw new IndexingException( RESOURCE,
indexResource.INDEX_FAILURE,
args );} }
finally {
iaccConn.closeConnection( );
}
Supported API: true
IndexingException
WTException
IllegalAccessException
InvocationTargetException
ClassNotFoundException
InstantiationException
PropertyVetoException
IOException
IndexAccessorConnectionFactory
,
IndexAccessorConnection
,
IndexAccessor
public Void delete() throws WTException, IllegalAccessException, ClassNotFoundException, InstantiationException, IOException
WTException
IllegalAccessException
ClassNotFoundException
InstantiationException
IOException
protected String createIndexKey() throws WTException
WTException
protected IndexAccessor getIndexAccessor(IndexAccessorConnection iaccConn) throws IndexingException, WTException, IllegalAccessException, InvocationTargetException, ClassNotFoundException, InstantiationException, PropertyVetoException, IOException
iaccConn
- IndexAccessorConnection object for which an IndexAccessor is requested.
IndexingException
WTException
IllegalAccessException
InvocationTargetException
ClassNotFoundException
InstantiationException
PropertyVetoException
IOException
protected void indexPlugin(IndexAccessor iacc) throws WTException, IllegalAccessException, InvocationTargetException
iacc
- IndexAccessor that is being used for the current indexing transaction. Is passed in by the index() method.
WTException
IllegalAccessException
InvocationTargetException
protected void sendAttributeToIndex(String indexField, String value, IndexAccessor iacc) throws WTException, IllegalAccessException, InvocationTargetException
indexField
- The indexed collection field name that the string "value" is to be written to.value
- A string that is placed in the index field "indexField".iacc
- The IndexAccessor that is associated with the IndexAccessorConnection for this transaction.
WTException
IllegalAccessException
InvocationTargetException
protected String getIndexObjectType()
protected void indexInstanceAttributes(Object businessObj, IndexAccessor iacc) throws WTException, IllegalAccessException, InvocationTargetException
businessObj
- iacc
-
WTException
IllegalAccessException
InvocationTargetException
private void sendAttributeToIndex(Indexable obj, ClassInfo objInfo, PropertyDescriptor prop, String contentSearchField, IndexAccessor iacc) throws WTException, IllegalAccessException, InvocationTargetException
WTException
IllegalAccessException
InvocationTargetException
private void sendAttributeToIndex(Indexable obj, ClassInfo objInfo, String propertyName, IndexAccessor iacc) throws WTException, IllegalAccessException, InvocationTargetException
WTException
IllegalAccessException
InvocationTargetException
public void outputInstanceAttributes(Object businessObj)
private void Log(String line)
private String sanitize(String str)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |