Configuring an Email Control

When you add an Email control to your business process, you can use an existing Email control extension file (.jcx) or create a new one. Depending on the data type of the message body you select, the .jcx file includes one of the following sendEmail utility methods. (Note the different body types in the two methods.) You can specify the values for the fields as class annotations in the .jcx file.

/**
 * @jc:send-email to="{to}"
 *                cc="{cc}"
 *                bcc="{bcc}"
 *                subject="{subject}"
 *                body="{body}"
 *                attachments="{attachments}"
 *                content-type="text/plain"
 */
void sendEmail(String to, String cc, String bcc, String subject,
               String body, String attachments); 

/**
 * @jc:send-email to="{to}"  
 *                cc="{cc}"
 *                bcc="{bcc}"
 *                subject="{subject}"
 *                body="{body}"
 *                attachments="{attachments}"  
 *                content-type="text/xml"
 */
void sendEmail(String to, String cc, String bcc, String subject, 
               XmlObject body, String attachments); 

Customizing an Email Control

Depending on the needs of your application, you can customize the base control. When extending the base control, you can add a method that specifies e-mail transmission properties in the annotation. The customized method does not require the user to supply as many parameters.

/*
 * A custom Email control.             
 * @jc:email 
 *         smtp-address = "smtp.myorg.com:25"
 *         from-address = "joe.user@myorg.com" 
 *         from-name = "Joe User"
 *         reply-to-address = "reply@myorg.com"
 *         reply-to-name = "Customer Service"
 *         header-encoding=""
 *         username=""
 *         password=""
 */
public interface MyEmailControl extends EmailControl,com.bea.control.ControlExtension 
{
    /**
     * @jc:send-email to="{to}"
     *                subject="Thanks for your order"
     *                body="{body}" 
     *                attachments="/weblogic/samples/order.txt"
     * 
     */
    public void sendOrderConfirmation(String to,   
                                String body);
} 

Using Dynamic Properties for an Email Control

You can override class-level annotations for an Email control by using dynamic properties. To use dynamic properties, pass an XML variable that conforms to the control's dynamic-property schema to the control's setProperties() method. You can retrieve the current property settings using the getProperties() method.

The setProperties() method accepts an EmailControlPropertiesDocument parameter. The EmailControlPropertiesDocument type is an XML Beans class that is generated out of the corresponding schema element defined in DynamicProperties.xsd. The DynamicProperties.xsd file is located in the system folder of New Process Applications or in the system folder of the Schemas project.

The following is an example of an XML variable used to set dynamic properties:

<EmailControlProperties>
    <smtp-address>myorg.mymailserver.com:25</smtp-address>
    <from-name>Joe User</from-name>
    <from-address>joe.user@myorg.com</from-address>
    <reply-to-address>reply@myorg.com</reply-to-address>
    <reply-to-name>Joe User</reply-to-name>
</EmailControlProperties> 

Related Topics

EmailControl Interface

Email Control Annotations

Previous Document Next Document