Previous | Next
WireHose Developers Guide

Generating SQL and Java for feeds

  1. Switch to RSSFeed.eomodeld.
  2. Select the RSSFeed, RSSFeedKeyword and RSSFeedTag entities.
  3. Choose Generate SQL... from the Property menu
  4. Turn on the Create Tables, Primary Key Constraints and Foreign Key Constraints options, and uncheck everything else.
  5. Click Execute SQL.

  6. Close the SQL Generation window.
  7. Select the RSSFeed entity
  8. Choose Generate Java Files... from the Property menu.

  9. Click Overwrite.
  10. Open RSSFeed.java in Project Builder.
  11. Add this line:
    import com.wirehose.base.*;
  12. Change the class declaration to:
    public class RSSFeed extends com.wirehose.base.WHConcreteResource
  13. Add this method so feeds are inserted into the database with a lastFetchDate in the past:
    public void awakeFromInsertion(EOEditingContext ec) {
        super.awakeFromInsertion(ec);
        setLastFetchDate(new NSTimestamp(0));
        setLastFetchWasInvalid(false);
    }
  14. To take advantage of the boolean attribute support in WireHose, add these two methods:
    public boolean lastFetchWasInvalid() {
        return WHEnterpriseObject.storedBooleanValueForKey(this, "lastFetchInvalid");
    }
       
    public void setLastFetchWasInvalid(boolean value) {
        WHEnterpriseObject.takeStoredBooleanValueForKey(this, value, "lastFetchInvalid");
    }
  15. Then change the lastFetchValid and setLastFetchValid methods so they accept and return instances of java.lang.Object:
    public Object lastFetchInvalid() {
        return storedValueForKey("lastFetchInvalid");
    }
       
    public void setLastFetchInvalid(Object value) {
        takeStoredValueForKey(value, "lastFetchInvalid");
    }
       


Previous | Next