Like what you see? Have a play with our trial version.

Error rendering macro 'rw-search'

null

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Return a ScheduleDefinition for when the background task should run for this connector. A ScheduleDefinition is instantiated with: 

Code Block
languagejava
public ScheduleDefinition(FrequencyTypeCode frequencyTypeCode, String frequencyCode, Integer frequencyUnit);
 

 

Each frequencyTypeCode is defined below. For any type that requires n, that value is defined in the frequencyUnit

 

frequencyUnit 

Description 

MINUTES 

Run every n minutes. 

DAILY 

Run every day. 

WEEKLY 

Run once a week, on the nth day of the week. 

FORTNIGHTLY 

Run once a fortnight, where frequencyCode is ONE or TWO, specifying the week in the fortnight, and the nth day of that week. 

MONTHLY 

Run once a month on the nth day of the month. 

ENDOFMONTH 

Run at the end of the month. 

QUARTERLY 

Run once a quarter, where frequencyCode is ONE, TWO, or THREE, specifying the month within the quarter, and the nth day of the month. 

BIANNUAL 

Run once every six months, where frequencyCode is ONE, TWO, THREE, FOUR, FIVE, or SIX, specifying the month within the half year, and the nth day of that month. 

ANNUAL 

Run once a quarter, where frequencyCode is JANUARY, FEBRUARY, MARCH, APRIL, MAY, JUNE, JULY, AUGUST, SEPTEMBER, OCTOBER, NOVEMBER, DECEMBER, specifying the month of the year, and the nth day of the month. 

 

For example, to create a schedule for running background tasks once a week on Sunday: 

Code Block
languagejava
public ScheduleDefinition getScheduleDefinition() { 

		return new ScheduleDefinition("WEEKLY", null, 1); 

} 

 

To create a schedule for running background tasks every hour: 

Code Block
languagejava
public ScheduleDefinition getScheduleDefinition() { 

		return new ScheduleDefinition("MINUTES", null, 60); 

} 

 

 

public boolean autoRun(); 

autoRun is the called to perform any background tasks. This function is called based on the getScheduleDefinition(). This could be used to download and cache data locally. 

 

protected final byte[] loadBlob(String key); 

loadBlob() will load a blob (byte[]) that was previously saved by the connector, usually in a background task. The parameter key is a unique identifier for the data to load. Blobs can only be loaded on data sources that have been saved. areBlobsAvailable() can be used to see if blob access is available. 

 

protected final boolean saveBlob(String key, byte[] data); 

saveBlob() allows for saving a blob (byte[]) for later use. This is a way of saving data from background tasks for later use. The parameter key is the unique identifier for the data to be saved. data is the byte[] to be associated with that key. Writing null to data will delete the saved data for the specified key. Blobs can only be loaded on data sources that have been saved. areBlobsAvailable() can be used to see if blob access is available. 

 

protected final boolean areBlobsAvailable(); 

Blobs can only be loaded on data sources that have been saved. areBlobsAvailable() can be used to see if blob access is available. Blob access will not be available if a connector is tested prior to being saved. 

 

public final Object getAttribute(String key); 

getAttribute() allows for fetching attributes from the connection meta-data. For example, a Username may be specified for the connection through the Yellowfin UI. Using the key of the parameter, the contents of the Username meta-data field can be fetched for use when retrieving data from external APIs. 

 

public final Integer getSourceId(); 

getSourceId() can be used to fetch the unique internal id of source that this connector is associated with. This may be helpful for segregating data by connection in some kind of external cache or database.