Package org.jboss.mobicents.seam

Source Code of org.jboss.mobicents.seam.AfterShippingAction

package org.jboss.mobicents.seam;

import java.math.BigDecimal;

import javax.naming.InitialContext;
import javax.slee.EventTypeID;
import javax.slee.connection.ExternalActivityHandle;
import javax.slee.connection.SleeConnection;
import javax.slee.connection.SleeConnectionFactory;
import javax.naming.*;
import javax.slee.*;
import javax.slee.connection.*;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;

import org.mobicents.slee.connector.server.RemoteSleeService;
import org.mobicents.slee.service.events.CustomEvent;

/**
* An example of a Seam component used to handle a jBPM transition event.
*
* @author Amit Bhayani
*/
@Name("afterShipping")
public class AfterShippingAction {
  @In
  String customerfullname;

  @In
  String cutomerphone;

  @In
  BigDecimal amount;

  @In
  Long orderId;

  public void orderShipped() {
    System.out
        .println("*************** Fire ORDER_SHIPPED  ***************************");
    System.out.println("First Name = " + customerfullname);
    System.out.println("Phone = " + cutomerphone);
    System.out.println("orderId = " + orderId);

    try {

      InitialContext ic = new InitialContext();

      SleeConnectionFactory factory = (SleeConnectionFactory) ic
          .lookup("java:/MobicentsConnectionFactory");

      SleeConnection conn1 = null;
      conn1 = factory.getConnection();

      ExternalActivityHandle handle = conn1.createActivityHandle();

      EventTypeID requestType = conn1.getEventTypeID(
          "org.mobicents.slee.service.dvddemo.ORDER_SHIPPED",
          "org.mobicents", "1.0");
      CustomEvent customEvent = new CustomEvent(orderId, amount,
          customerfullname, cutomerphone);

      conn1.fireEvent(customEvent, requestType, handle, null);
      conn1.close();

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
TOP

Related Classes of org.jboss.mobicents.seam.AfterShippingAction

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.