Previous | Next
WireHose Developers Guide

Adding attributes

The new resource template includes several attributes which are part of the WHTaggable and WHIndexable interface. The dateAdded attribute is common to both interfaces, and allows users to search for recently inserted resources. The indexed property and the resourceKeywords and keywords relationships provide the ability to search by keywords, while resourceTags is used to provide a to-many relationship to available tags. The affiliate attribute is an optional convention which allows partitioning WireHose resources, channel factories, tags and other objects into groups.

First you'll model the RSSFeed's title. We're calling it "name" instead of "title" because it's a convention for WireHose resources to have a name, if possible.

  1. Select the RSSFeed entity.
  2. Choose Add Attribute from the Property menu.
  3. Set its prototype to whString255.

    Note: The whString255 prototype defines a column of type CHAR(255). You can safely redefine all the whString prototypes to be VARCHAR columns of any size. See the WHEnterpriseObject reference for details.

  4. Remove the padlock icon so this attribute isn't used for locking.
  5. Set the attribute's name to name, and set its column name to NAME.

Next, you'll model the RSSFeed's link.

  1. Choose Add Attribute from the Property menu.
  2. Set its prototype to whString255.
  3. Remove the padlock icon so this attribute isn't used for locking.
  4. Set the attribute's name to link, and set its column name to LINK.

Next, you'll model the RSSFeed's description. Since "description" is a reserved word in WebObjects, it's a WireHose convention to name the attribute "textDescription".

  1. Choose Add Attribute from the Property menu.
  2. Set its prototype to whString255.
  3. Remove the padlock icon so this attribute isn't used for locking.
  4. Set the attribute's name to textDescription, and set its column name to TEXTDESC.

There are a number of other attributes defined in the RSS 2.0 specification which we are not modeling here for simplicity's sake. However, we will model some more attributes which will be used in the Hello World application.

The first is a "lastFetchDate" property, which is the date the items from a feed were last imported.

  1. Choose Add Attribute from the Property menu.
  2. Set its prototype to whTimestamp.
  3. Remove the padlock icon so this attribute isn't used for locking.
  4. Set the attribute's name to lastFetchDate, and set its column name to LASTFETCH.

Since there are several versions of RSS, some feeds may be valid but not supported by Hello World. The last attribute you'll model is a boolean indicating whether or not the feed was valid the last time we fetched, so the crawler can skip those feeds the next time.

  1. Choose Add Attribute from the Property menu.
  2. Set its prototype to whBoolean.

    Note: There is no standard way to store booleans in a database; some support BOOLEAN columns, while others may store a "Y" or "N" in a CHAR(1) column, or a zero or one in an INTEGER. WireHose provides the whBoolean prototype and several utility methods which make it easy to deal with varying definitions for boolean attributes in a transparent fashion.

  3. Remove the padlock icon so this attribute isn't used for locking.
  4. Set the attribute's name to lastFetchInvalid, and set its column name to WASINVALID.

    Note: Your Java code will actually call methods named lastFetchWasInvalid and setLastFetchWasInvalid.


Previous | Next