Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
pr_methods:getmessagevalue [2023/04/04 06:59] – removed - external edit (Unknown date) 127.0.0.1pr_methods:getmessagevalue [2023/05/03 04:32] (current) sean
Line 1: Line 1:
 +{{tag>Programmers_Reference Methods  IChannelType_Interface getMessageValues Index}}
  
 +====getMessageValues ()====
 +<code java>public DataObject getMessageValues (IchannelTypeCallback callback) </code>
 +
 +This method is called when a notification is sent to an intelligent business object. The method is supposed to return the values that are specific to the communication with this particular instance of the object – for example, an e-mail address of this instance. The method can use a callback interface to get the instance of the object and the instance of the SystemSettings object, like so:
 +
 +<code java>IEntity intelligentEntity = callback.getEntity ();
 +IEntity systemSettings = callback.getSystemSettings ();</code>
 +
 +The method is supposed to return the data object containing specific values, or null if none are required. As an example, take a look at what the e-mail channel does:
 +
 +<code java>public DataObjectgetMessageValues(IChannelTypeCallbackcallback)
 +{
 +    IEntityentity=callback.getEntity();
 +    if (entity==null)
 +        return null;
 +    try
 +    {
 +        StringemailAddr=(String)entity.getAttributeValue(CommonConstants.EMAIL_ADDRESS_ATTR);
 +        SDOTypedobType=new SDOType("EmailChannelEmailValues");
 +        dobType.addAttribute(CommonConstants.EMAIL_ADDRESS_ATTR,SDOType.STRING);
 +        DataObjectdob= new SimpleDataObject(dobType);
 +        dob.setAttributeValue(CommonConstants.EMAIL_ADDRESS_ATTR,emailAddr);
 +        return dob;
 +    }
 +    catch (Exceptione)
 +    {
 +        System.err.println("Unable to read e-mail address in object "+entity.getName());
 +    }
 +    return null;
 +}</code>