Broker 10.15 | webMethods Broker Documentation | webMethods Broker Administration Java API Programmer’s Guide | Managing Broker Event Types | Creating and Modifying Event Type Definitions | Modifying Event Fields
 
Modifying Event Fields
You can use the BrokerAdminTypeDef.insertFieldDef method to insert a new event field in an administrative type definition.
The BrokerAdminTypeDef.orderFields method allows you to change the order of event fields within an administrative type definition.
The BrokerAdminTypeDef.clearField method and the BrokerAdminTypeDef.clearFields method allow you to remove one or more event fields from an administrative type definition.
The BrokerAdminTypeDef.renameField method allows you to rename an event field within an administrative type definition.
You can use the BrokerAdminTypeDef.setFieldDef method to set the definition of an event field in an administrative type definition. If the specified field does not exist, it will be created.
The BrokerAdminTypeDef.setFieldType method allows you to set the data type of an event field in an administrative type definition. If the specified field does not exist, it will be created.
The following example illustrates how to create or modify an event type definition:
. . .
BrokerAdminTypeDef def;
BrokerAdminTypeDef field1, field2;
BrokerAdminClient c;
try {
/* Create a Broker admin client */
c = new BrokerAdminClient(broker_host, broker_name, null,
client_group, "My Broker Monitor",null);
 
/* Create the BrokerAdminTypeDef object for the event type */
def = new BrokerAdminTypeDef(“myEventType”,
BrokerTypeDef.FIELD_TYPE_EVENT);
 
/* Set two fields in the event type definition */
field1 = new BrokerAdminTypeDef(BrokerTypeDef.FIELD_TYPE_STRING);
field2 = new BrokerAdminTypeDef(BrokerTypeDef.FIELD_TYPE_BOOLEAN);
 
/* Add the fields to the event type definition */
def.setFieldDef(“Name”, field1);
def.setFieldDef(“Active”, field2);
 
/* Set the event type definition.
* Note that if it doesn’t exist, it will be created.
* If the event type definition does exist, it will be
* replaced with the new version.
*/
c.setEventAdminTypeDef(def);
} catch (BrokerException ex) {
System.out.println("Error while creating/modifying the event type def\n"+ex);
return;
}
. . .