wt.fc.collections
Class RefreshHelper.RoleARefresh

java.lang.Object
  extended bywt.fc.collections.RefreshHelper.LinkRefresh
      extended bywt.fc.collections.RefreshHelper.RoleARefresh
Enclosing class:
RefreshHelper

static final class RefreshHelper.RoleARefresh
extends RefreshHelper.LinkRefresh

Concrete LinkRefresh used when only Role A is to be refreshed


Nested Class Summary
(package private) static class RefreshHelper.LinkRefresh.LinkData
          Utility class to collect information selected about a link and its roles
 
Field Summary
(package private)  Set cachedLinks
          The set of links that were in the refresh cache
(package private)  Map linkClassesToReferences
          Mapping of BinaryLink subclasses to the Set of WTReferences that refer to instances of them
(package private)  RefreshHelper.Refresh refresh
          The refresh this LinkRefresh was constructed with.
(package private)  List roleReferences
          The list of role references created by this refresh
 
Constructor Summary
(package private) RefreshHelper.RoleARefresh(RefreshHelper.Refresh r)
           
 
Method Summary
(package private)  void add(WTReference r)
          Add the reference to linkClassesToReferences
(package private)  void appendAdditionalCriteria(QuerySpec qs, Class c, int link_idx)
          Add criteria to select the roles based on the link type and link action
(package private)  void appendSelectVersionRoleA(QuerySpec qs, int link_idx, LinkInfo info)
          Utility method to add criteria for a version-based role a to the QuerySpec
(package private)  void appendSelectVersionRoleB(QuerySpec qs, int link_idx, LinkInfo info)
          Utility method to add criteria for a version-based role b to the QuerySpec
(package private)  RefreshHelper.RoleReference createRoleAReference(WTReference ref, RefreshHelper.LinkRefresh.LinkData data, Persistable inflated_role)
          Create a role a reference for the given data.
(package private)  RefreshHelper.RoleReference createRoleBReference(WTReference ref, RefreshHelper.LinkRefresh.LinkData data, Persistable inflated_role)
          Create a role b reference for the given data.
(package private)  void doFirstPass()
          Do the first pass of the refresh algorithm on the links and their inflated roles
(package private)  void doSecondPass()
          Inflate the objects in roleReferences
(package private)  RefreshHelper.LinkRefresh.LinkData getLinkData(Object[] columns, Class link_class)
          Create a LinkData based on the given result columns and link_class
(package private)  RefreshHelper.LinkRefresh.LinkData getLinkDataForCachedObject(WTReference r)
           
(package private)  StatementSpec getSpec(Class link_class, Set refs)
          Get a StatementSpec that finds the link oids and the requested roles
(package private)  void log()
          Print debug information to the log
(package private)  void processLink(WTReference ref, RefreshHelper.LinkRefresh.LinkData data)
          Figure out what to do with the given link reference given its corresponding LinkData.
(package private)  void processRoleA(WTReference ref, RefreshHelper.LinkRefresh.LinkData data)
          Determines if a given link's role a needs to be refreshed based on the given LinkData.
(package private)  void processRoleB(WTReference ref, RefreshHelper.LinkRefresh.LinkData data)
          Determines if a given link's role b needs to be refreshed based on the given LinkData.
(package private)  void processUninflatedRoleA(WTReference ref, RefreshHelper.LinkRefresh.LinkData data)
          Called when the link does not have an inflated role a object
(package private)  void processUninflatedRoleB(WTReference ref, RefreshHelper.LinkRefresh.LinkData data)
          Called when the link does not have an inflated role b object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

refresh

final RefreshHelper.Refresh refresh
The refresh this LinkRefresh was constructed with.


linkClassesToReferences

Map linkClassesToReferences
Mapping of BinaryLink subclasses to the Set of WTReferences that refer to instances of them


cachedLinks

Set cachedLinks
The set of links that were in the refresh cache


roleReferences

List roleReferences
The list of role references created by this refresh

Constructor Detail

RefreshHelper.RoleARefresh

RefreshHelper.RoleARefresh(RefreshHelper.Refresh r)
Method Detail

appendAdditionalCriteria

void appendAdditionalCriteria(QuerySpec qs,
                              Class c,
                              int link_idx)
                        throws WTException
Description copied from class: RefreshHelper.LinkRefresh
Add criteria to select the roles based on the link type and link action

Specified by:
appendAdditionalCriteria in class RefreshHelper.LinkRefresh
Parameters:
qs -
c -
link_idx -
Throws:
WTException

getLinkData

RefreshHelper.LinkRefresh.LinkData getLinkData(Object[] columns,
                                               Class link_class)
                                         throws WTException
Description copied from class: RefreshHelper.LinkRefresh
Create a LinkData based on the given result columns and link_class

Specified by:
getLinkData in class RefreshHelper.LinkRefresh
Parameters:
columns -
link_class -
Returns:
LinkData
Throws:
WTException

processUninflatedRoleB

void processUninflatedRoleB(WTReference ref,
                            RefreshHelper.LinkRefresh.LinkData data)
                      throws WTException
Description copied from class: RefreshHelper.LinkRefresh
Called when the link does not have an inflated role b object

Overrides:
processUninflatedRoleB in class RefreshHelper.LinkRefresh
Parameters:
ref -
data -
Throws:
WTException

processRoleB

void processRoleB(WTReference ref,
                  RefreshHelper.LinkRefresh.LinkData data)
            throws WTException
Description copied from class: RefreshHelper.LinkRefresh
Determines if a given link's role b needs to be refreshed based on the given LinkData. Adds the link and the role to the refresh's staleObjects collection if necessary.

Overrides:
processRoleB in class RefreshHelper.LinkRefresh
Parameters:
ref -
data -
Throws:
WTException

add

void add(WTReference r)
   throws WTException
Add the reference to linkClassesToReferences

Parameters:
r -
Throws:
WTException

doFirstPass

void doFirstPass()
           throws WTException
Do the first pass of the refresh algorithm on the links and their inflated roles

Throws:
WTException

getLinkDataForCachedObject

RefreshHelper.LinkRefresh.LinkData getLinkDataForCachedObject(WTReference r)
                                                        throws WTException
Throws:
WTException

getSpec

StatementSpec getSpec(Class link_class,
                      Set refs)
                throws WTException
Get a StatementSpec that finds the link oids and the requested roles

Parameters:
link_class -
refs -
Returns:
StatementSpec
Throws:
WTException

appendSelectVersionRoleA

void appendSelectVersionRoleA(QuerySpec qs,
                              int link_idx,
                              LinkInfo info)
                        throws WTException
Utility method to add criteria for a version-based role a to the QuerySpec

Parameters:
qs -
link_idx -
info -
Throws:
WTException

appendSelectVersionRoleB

void appendSelectVersionRoleB(QuerySpec qs,
                              int link_idx,
                              LinkInfo info)
                        throws WTException
Utility method to add criteria for a version-based role b to the QuerySpec

Parameters:
qs -
link_idx -
info -
Throws:
WTException

processLink

void processLink(WTReference ref,
                 RefreshHelper.LinkRefresh.LinkData data)
           throws WTException
Figure out what to do with the given link reference given its corresponding LinkData. If the link needs to be refreshed, then add it to secondPassOids. Stale links are roles are added to the refresh's staleObjects collection

Parameters:
ref -
data -
Throws:
WTException

processUninflatedRoleA

void processUninflatedRoleA(WTReference ref,
                            RefreshHelper.LinkRefresh.LinkData data)
                      throws WTException
Called when the link does not have an inflated role a object

Parameters:
ref -
data -
Throws:
WTException

processRoleA

void processRoleA(WTReference ref,
                  RefreshHelper.LinkRefresh.LinkData data)
            throws WTException
Determines if a given link's role a needs to be refreshed based on the given LinkData. Adds the link and the role to the refresh's staleObjects collection if necessary.

Parameters:
ref -
data -
Throws:
WTException

createRoleAReference

RefreshHelper.RoleReference createRoleAReference(WTReference ref,
                                                 RefreshHelper.LinkRefresh.LinkData data,
                                                 Persistable inflated_role)
                                           throws WTException
Create a role a reference for the given data. If possible, attempt to match the type of reference returned (Object or Version ref) with the key type of the original collection.

Parameters:
ref - A reference to the BinaryLink that the role is a member of
data -
inflated_role - If the reference had an inflated role object, it is supplied here. Otherwise this argument is null.
Returns:
RoleReference
Throws:
WTException

createRoleBReference

RefreshHelper.RoleReference createRoleBReference(WTReference ref,
                                                 RefreshHelper.LinkRefresh.LinkData data,
                                                 Persistable inflated_role)
                                           throws WTException
Create a role b reference for the given data. If possible, attempt to match the type of reference returned (Object or Version ref) with the key type of the original collection.

Parameters:
ref - A reference to the BinaryLink that the role is a member of
data -
inflated_role - If the reference had an inflated role object, it is supplied here. Otherwise this argument is null.
Returns:
RoleReference
Throws:
WTException

doSecondPass

void doSecondPass()
            throws WTException
Inflate the objects in roleReferences

Throws:
WTException

log

void log()
Print debug information to the log