Open SiteSearch 4.1.1
Final

ORG.oclc.obi.util
Class Topics

java.lang.Object
  |
  +--ORG.oclc.obi.util.Topics

public class Topics
extends Object

The Topics class is a utility set of methods used to manipulate various lists of Topic Areas. Such as build a list of checkbox to add to a FORM or filter database list based on this list from a user profile.

See Also:
ZUserData, TopicEntry, TopicLoader, UserStateObject

Field Summary
protected static Hashtable dbPageHotLinks
           
 
Constructor Summary
Topics()
          Constructs a Topics object.
 
Method Summary
static String buildDatabasePageHotLinks(Vector topicList, String anchorCommand, String color, String font)
          Builds the a set of TABLE rows, each of which contains an HTML anchors for each TopicEntry the Vector.
NOTE: If topicList, matches the global vector of TopicEntry(s), then return the statically built dbPageHotLinks String.
static String buildDatabasePageHotLinks(Vector topicList, String anchorCommand, String color, String font, int numAnchorPerLine)
          Builds the a set of TABLE rows, each of which contains an HTML anchors for each TopicEntry the Vector.
NOTE: If topicList, matches the global vector of TopicEntry(s), then return the statically built dbPageHotLinks String.
static String buildDatabasePageHotLinks(Vector topicList, String anchorCommand, String color, String font, String background, int numAnchorPerLine)
          Builds the a set of TABLE rows, each of which contains an HTML anchors for each TopicEntry the Vector.
NOTE: If topicList, matches the global vector of TopicEntry(s), then return the statically built dbPageHotLinks String.
static String buildQuickSearchBoxes(UserStateObject user, String topicNames, String font)
          Create a set of HTML checkboxes for the set of "QuickSearch" TopicEntry(s).
static Vector cloneUserTopics(UserStateObject user)
          Clone the Vector of TopicEntry(s) and update the UserStateObject entity userTopics.
static Vector cloneUserTopics(UserStateObject user, boolean updateUserState)
          Clone the Vector of TopicEntry(s) and update the UserStateObject entity userTopics if the input flag indicates to do so.
static Vector cloneUserTopics(Vector allTopics, UserStateObject user, boolean updateUserState)
          Clone the complete Vector of TopicEntry(s), add the user-defined Topics and update the UserStateObject entity userTopics if the input flag indicates to do so.
static Vector filterUserTopics(UserStateObject user, String topicNames)
          Remove any TopicEntry that a user is not allowed to see.
static Vector filterUserTopics(UserStateObject user, String topicNames, boolean retainUserDefinedTopics)
          Remove any TopicEntry that a user is not allowed to see.
static TopicEntry findEntry(Vector topicAreas, String name)
          Find a TopicEntry in the list of Topics.
static TopicEntry findEntrybyLongName(Vector topicAreas, String name)
          Find a TopicEntry in the list of Topics by longname.
static String getDbCheckBoxes(UserStateObject user, String topicName)
          Retrieve the named TopicEntry's list database as a set HTML checkbox for the current user.
static String getDbCheckBoxes(UserStateObject user, String topicName, int numBoxPerLine)
          Retrieve the named TopicEntry's list database as a set HTML checkbox for the current user.
static String getDbgroupFromTopics(UserStateObject user, String topicName)
          Retrieve the named TopicEntry's database group name for the current user.
static String getDbnameFromTopics(UserStateObject user, String topicName)
          Retrieve a space seperated list of database name for the named TopicEntry for the current user.
static TopicEntry getDefaultTopicEntry()
          Retrieves the default TopicEntry.
static Vector getTopicList()
          Retrieves the default list of TopicEntry(s).
static String getTopicLongNames(UserStateObject user, String topicName, String separator)
          Retrieves a String containing a list of LongNames for the input topic name where the separator provided is used to delimit multiple topic names.
static Vector getUserTopics(UserStateObject user)
          Retrieves a user's Vector of TopicEntry(s).
static boolean isAllowed(String dbname, TopicEntry entry)
          Determines if a dbname is NOT allowed in a TopicEntry's database list
static Vector relatedTopics(Vector topicList, String dbname)
          Builds a list of related TopicEntry for a database name.
static void resetDbList(UserStateObject user, Vector dblist)
          Resets the user's Topics after authorization.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbPageHotLinks

protected static Hashtable dbPageHotLinks
Constructor Detail

Topics

public Topics()
Constructs a Topics object.
Method Detail

filterUserTopics

public static Vector filterUserTopics(UserStateObject user,
                                      String topicNames)
Remove any TopicEntry that a user is not allowed to see. UserStateObject entity userTopics is updated to reflect the filtered list where the user created topics WILL be retained.
Parameters:
user - the current user
the - list of avaliable TopicEnty(s)

filterUserTopics

public static Vector filterUserTopics(UserStateObject user,
                                      String topicNames,
                                      boolean retainUserDefinedTopics)
Remove any TopicEntry that a user is not allowed to see. UserStateObject entity userTopics is updated to reflect the filtered list.
Parameters:
user - the current user
the - list of avaliable TopicEnty(s)
retainUserDefinedTopics - indicates whether the filtered list

resetDbList

public static void resetDbList(UserStateObject user,
                               Vector dblist)
Resets the user's Topics after authorization. Go through all the topics, getting the database list and copy only the database name(s) from the authorized list.
Parameters:
user - user State Object
dblist - the list of authorized databases

findEntry

public static TopicEntry findEntry(Vector topicAreas,
                                   String name)
Find a TopicEntry in the list of Topics.
Parameters:
topicAreas - the vector of topic areas
name - the name of the TopicEntry
Returns:
TopicEntry or null

findEntrybyLongName

public static TopicEntry findEntrybyLongName(Vector topicAreas,
                                             String name)
Find a TopicEntry in the list of Topics by longname.
Parameters:
topicAreas - the vector of topic areas
name - the longname to look for
Returns:
TopicEntry or null

cloneUserTopics

public static Vector cloneUserTopics(UserStateObject user)
Clone the Vector of TopicEntry(s) and update the UserStateObject entity userTopics.
Parameters:
Vector - Vector of TopicEntr(s) to clone
Returns:
cloned Vector of TopicEntry(s)

cloneUserTopics

public static Vector cloneUserTopics(UserStateObject user,
                                     boolean updateUserState)
Clone the Vector of TopicEntry(s) and update the UserStateObject entity userTopics if the input flag indicates to do so.
Parameters:
Vector - Vector of TopicEntr(s) to clone
updateUserState - boolean indicating whether the cloned vector should be saved as the user's topic list.
Returns:
cloned Vector of TopicEntry(s)

cloneUserTopics

public static Vector cloneUserTopics(Vector allTopics,
                                     UserStateObject user,
                                     boolean updateUserState)
Clone the complete Vector of TopicEntry(s), add the user-defined Topics and update the UserStateObject entity userTopics if the input flag indicates to do so.
Parameters:
Vector - complete list of Topics
UserStateObject - from which to get user's topics
updateUserState - boolean indicating whether the cloned vector should be saved as the user's topic list.
Returns:
cloned Vector of TopicEntry(s)

getDbCheckBoxes

public static String getDbCheckBoxes(UserStateObject user,
                                     String topicName)
Retrieve the named TopicEntry's list database as a set HTML checkbox for the current user.
Parameters:
user - the user state object
topicName - the topic area
Returns:
String the set of HTML checkbox

getDbCheckBoxes

public static String getDbCheckBoxes(UserStateObject user,
                                     String topicName,
                                     int numBoxPerLine)
Retrieve the named TopicEntry's list database as a set HTML checkbox for the current user.
Parameters:
user - the user state object
topicName - the topic area
numBoxPerLine - the number of check boxes per line
Returns:
String the set of HTML checkbox

getDbgroupFromTopics

public static String getDbgroupFromTopics(UserStateObject user,
                                          String topicName)
Retrieve the named TopicEntry's database group name for the current user.
Parameters:
user - the user state object
topicName - the topic area
Returns:
String the TopicEntry's dbGroup

getDbnameFromTopics

public static String getDbnameFromTopics(UserStateObject user,
                                         String topicName)
Retrieve a space seperated list of database name for the named TopicEntry for the current user.
Parameters:
user - the user state object
topicName - the topic area
Returns:
String space seperated list of dbnames for the current user.

getTopicLongNames

public static String getTopicLongNames(UserStateObject user,
                                       String topicName,
                                       String separator)
Retrieves a String containing a list of LongNames for the input topic name where the separator provided is used to delimit multiple topic names.
Parameters:
user - the user state object
topicName - the topic area
Returns:
String containing all the longnames for the input topic areas.

relatedTopics

public static Vector relatedTopics(Vector topicList,
                                   String dbname)
Builds a list of related TopicEntry for a database name. For example Database "A" is a member of Topic "X" and "Y".
Parameters:
topicList - the Vector TopicEntry(s) to check
dbname - the database name to locate related TopicEntry(s) for
Returns:
Vector of related TopicEntry(s)

buildQuickSearchBoxes

public static String buildQuickSearchBoxes(UserStateObject user,
                                           String topicNames,
                                           String font)
Create a set of HTML checkboxes for the set of "QuickSearch" TopicEntry(s). The NAME attribute INPUT tag is TopicArea. The VALUE attribute INPUT tag is the TopicEntry's topicName.
Parameters:
topicName - the list of "QuickSearch" TopicEntry(s)
font - the open font tag to use
Returns:
String set QuickSearch TopicEntry(s) as HTML checkboxes

buildDatabasePageHotLinks

public static String buildDatabasePageHotLinks(Vector topicList,
                                               String anchorCommand,
                                               String color,
                                               String font)
Builds the a set of TABLE rows, each of which contains an HTML anchors for each TopicEntry the Vector.
NOTE: If topicList, matches the global vector of TopicEntry(s), then return the statically built dbPageHotLinks String.
Parameters:
topicList - the Vector of TopicEntry(s)
linkType - the URL to use in the anchor
color - the color to make TABLE cell
font - the font to use
Returns:
String set anchors as a set HTML TABLE rows

buildDatabasePageHotLinks

public static String buildDatabasePageHotLinks(Vector topicList,
                                               String anchorCommand,
                                               String color,
                                               String font,
                                               int numAnchorPerLine)
Builds the a set of TABLE rows, each of which contains an HTML anchors for each TopicEntry the Vector.
NOTE: If topicList, matches the global vector of TopicEntry(s), then return the statically built dbPageHotLinks String.
Parameters:
topicList - the Vector of TopicEntry(s)
linkType - the URL to use in the anchor
color - the color to make TABLE cell
font - the font to use
numAnchorPerLine - the number of anchors boxes per line
Returns:
String set anchors as a set HTML TABLE rows

buildDatabasePageHotLinks

public static String buildDatabasePageHotLinks(Vector topicList,
                                               String anchorCommand,
                                               String color,
                                               String font,
                                               String background,
                                               int numAnchorPerLine)
Builds the a set of TABLE rows, each of which contains an HTML anchors for each TopicEntry the Vector.
NOTE: If topicList, matches the global vector of TopicEntry(s), then return the statically built dbPageHotLinks String.
Parameters:
topicList - the Vector of TopicEntry(s)
linkType - the URL to use in the anchor
color - the color to make TABLE cell
background - the background gif to use in the TABLE cell
font - the font to use
numAnchorPerLine - the number of anchors boxes per line
Returns:
String set anchors as a set HTML TABLE rows

isAllowed

public static boolean isAllowed(String dbname,
                                TopicEntry entry)
Determines if a dbname is NOT allowed in a TopicEntry's database list
Parameters:
dbname - - name to check
entry - - the TopicEntry's allowed database list to check
Returns:
true if the dbname is not on the list false if it is.

getDefaultTopicEntry

public static TopicEntry getDefaultTopicEntry()
Retrieves the default TopicEntry.
Returns:
TopicEntry the defauly Topic Area

getTopicList

public static Vector getTopicList()
Retrieves the default list of TopicEntry(s).
Returns:
Vector the default list of TopicEntry(s)

getUserTopics

public static Vector getUserTopics(UserStateObject user)
Retrieves a user's Vector of TopicEntry(s). The Vector is stored as the UserStateEntity userTopics. If one does not exsist for a the current user on is created.
Parameters:
user - the User State Object
Returns:
Vector the topic list

Open SiteSearch 4.1.1
Final