SOLUTION Configured operation needs to know enabledisable

Here’s my solution for an adapter configured operation that will publish a single document at a specific point in time. For example, daily at 09:00 and 15:00. The key is to keep a running calculation of when the next time to publish a document is. Then this is reset anytime the integration component or configured operation is saved (create, change, or enable). The publishDaily() method contains the decision logic.

import COM.activesw.adapter.devkit.AdapterDescriptor;
import COM.activesw.adapter.devkit.AdapterDescriptorFiller;
import COM.activesw.adapter.devkit.AdapterException;
import COM.activesw.adapter.devkit.AdapterScript01;
import COM.activesw.adapter.devkit.AdapterScriptAccess;
import COM.activesw.adapter.devkit.AdapterScriptLifecycle;
import COM.activesw.adapter.devkit.AdapterTransaction;
import COM.activesw.API.client.BrokerEvent;
import COM.activesw.API.client.BrokerException;
import COM.activesw.API.client.BrokerTypeDef;
import java.util.Calendar;

public final class Notification
implements AdapterScript01, AdapterDescriptorFiller, AdapterScriptLifecycle

{
/**
* script access variable for debugging
*/
private AdapterScriptAccess access;

/** 
 * Calendar array of times to publish document 
 */ 

private Calendar nextDailyRuns;

/** 
 * String array of daily times in hours 
 */ 

private String dailyHours;

/** 
 * String array of daily times in minutes  
 */ 

private String dailyMinutes;

/* constructor */
public Notification()
{
}

/**
* Sets information about this operation
*
* @param d the descriptor to populate with custom information
* @exception AdapterException something went wrong
*/
public void fillAdapterDescriptor( AdapterDescriptor d ) throws AdapterException
{
// don’t localize this setting
d.setDisplayName( “Point Notification” );

// create the control tab
d.createGroup( “Daily”, new String { “dailyHours”, “dailyMinutes” } );

// create the table for defining command to execute and arguments
d.createFieldMap( new String { “dailyHours”, “dailyMinutes” }, true );

// allow only predefined hour values
d.setNamespace( “dailyHours”, “dailyHours”, null );

// allow only predefined minute values
d.setNamespace( “dailyMinutes”, “dailyMinutes”, null );

}

/** 
 * Executes the operation. 
 * 
 * @param adapterAccess access to the adapter 
 * @param transaction transaction context 
 * @param input the single input event 
 * @return the output event 
 * @exception    AdapterException something went wrong 
 * @exception    BrokerException something went wrong 
 */ 

public BrokerEvent scriptInvoke( AdapterScriptAccess access, AdapterTransaction transaction )
throws BrokerException, AdapterException
{

// determine according to daily calculations
boolean publish = publishDaily();

// define the output event
BrokerEvent output = null;

// if to publish then instantiate the output document
if( publish )
// create the output event
output = access.newOutputEvent( transaction );

// return the event 
return output; 
}     
 
 
/** 
 * Called immediate