package tut;
import java.util.Calendar;
import com.ibm.telephony.beans.media.*;
import com.ibm.telephony.wvr.Playable;
/**
*
* OrderInfo - a class that represents information returned from a database, in a form
* that can be played as voice segments.
*/
public class OrderInfo implements Playable {
// Define the category for the voice segments in this class
private static final String CATEGORY = "Tutorials";
// Create VoicesSegment objects to play the order information
private static final VoiceSegment VS_ORDER_COST = new VoiceSegment(CATEGORY, "OrderCost");
private static final VoiceSegment VS_ORDER_DATE = new VoiceSegment(CATEGORY, "OrderDate");
private static final VoiceSegment VS_ORDER_REF = new VoiceSegment(CATEGORY, "OrderRef");
// Create MediaType objects to represent the order information
AudioCurrency cost = new AudioCurrency();
AudioDate deliveryDate = new AudioDate();
AudioString callerRef = new AudioString();
// Create a media sequence that represents the caller's order
MediaType[] orderInfo = {VS_ORDER_COST, cost, VS_ORDER_DATE, deliveryDate, VS_ORDER_REF, callerRef};
// Create a Calendar object for today's date
Calendar today = Calendar.getInstance();
// Constructor method
public OrderInfo(double quantity, double prodNum) {
// Set the order information - in a real application this would involve
// extracting information from a database using the quantity and prodNum variables
cost.setValue(2.75 * quantity);