Search in sources :

Example 1 with BpelRuntimeContext

use of org.apache.ode.bpel.runtime.BpelRuntimeContext in project carbon-business-process by wso2.

the class PeopleActivity method deriveServiceEPR.

private void deriveServiceEPR(DeploymentUnitDir du, ExtensionContext extensionContext) throws FaultException {
    DeployDocument deployDocument = du.getDeploymentDescriptor();
    BpelRuntimeContext runTimeContext = extensionContext.getInternalInstance();
    // TODO neeed to extend ExtentionContext
    OProcess oProcess = runTimeContext.getProcessModel();
    TDeployment.Process hiProcess = null;
    List<TDeployment.Process> processList = deployDocument.getDeploy().getProcessList();
    for (TDeployment.Process process : processList) {
        if (process.getName().equals(oProcess.getQName())) {
            hiProcess = process;
            break;
        }
    }
    if (hiProcess == null) {
        throw new FaultException(BPEL4PeopleConstants.B4P_FAULT, "Related process: " + oProcess.getQName() + " not found");
    }
    List<TInvoke> tInvokeList = hiProcess.getInvokeList();
    for (TInvoke tInvoke : tInvokeList) {
        if (tInvoke.getPartnerLink().equals(partnerLinkName)) {
            serviceName = tInvoke.getService().getName();
            servicePort = tInvoke.getService().getPort();
            break;
        }
    }
    if (serviceName == null || servicePort == null) {
        log.error("service and port for human interaction is not found in the deploy.xml");
        throw new FaultException(BPEL4PeopleConstants.B4P_FAULT, "Service or port for human interaction is not found in the deploy.xml");
    }
    // get the callback information for the TASK
    if (activityType.equals(InteractionType.TASK)) {
        List<TProvide> tProvideList = hiProcess.getProvideList();
        for (TProvide tProvide : tProvideList) {
            if (tProvide.getPartnerLink().equals(partnerLinkName)) {
                callbackServiceName = tProvide.getService().getName();
                callbackServicePort = tProvide.getService().getPort();
                break;
            }
        }
        if (callbackServiceName == null || callbackServicePort == null) {
            throw new FaultException(BPEL4PeopleConstants.B4P_FAULT, "Service or port for human task callback is not found in the deploy.xml");
        }
    }
    hiWSDL = du.getDefinitionForService(serviceName);
    Service service = hiWSDL.getService(serviceName);
    Port port = service.getPort(servicePort);
    List extList = port.getExtensibilityElements();
    for (Object extEle : extList) {
        if (extEle instanceof SOAPAddressImpl) {
            SOAPAddressImpl soapAddress = (SOAPAddressImpl) extEle;
            serviceURI = soapAddress.getLocationURI();
            break;
        }
    }
    if (serviceURI == null) {
        throw new FaultException(BPEL4PeopleConstants.B4P_FAULT, "Service URI is not available");
    }
}
Also used : SOAPAddressImpl(com.ibm.wsdl.extensions.soap.SOAPAddressImpl) OProcess(org.apache.ode.bpel.o.OProcess) Port(javax.wsdl.Port) Service(javax.wsdl.Service) OProcess(org.apache.ode.bpel.o.OProcess) TDeployment(org.apache.ode.bpel.dd.TDeployment) TInvoke(org.apache.ode.bpel.dd.TInvoke) FaultException(org.apache.ode.bpel.common.FaultException) DeployDocument(org.apache.ode.bpel.dd.DeployDocument) BpelRuntimeContext(org.apache.ode.bpel.runtime.BpelRuntimeContext) List(java.util.List) ArrayList(java.util.ArrayList) NodeList(org.w3c.dom.NodeList) TProvide(org.apache.ode.bpel.dd.TProvide)

Example 2 with BpelRuntimeContext

use of org.apache.ode.bpel.runtime.BpelRuntimeContext in project carbon-business-process by wso2.

the class PeopleActivity method getOperation.

public Operation getOperation(ExtensionContext extensionContext) {
    BpelRuntimeContext runTimeContext = extensionContext.getInternalInstance();
    OProcess process = runTimeContext.getProcessModel();
    OPartnerLink partnerLink = process.getPartnerLink(partnerLinkName);
    return partnerLink.getPartnerRoleOperation(operation);
}
Also used : OProcess(org.apache.ode.bpel.o.OProcess) OPartnerLink(org.apache.ode.bpel.o.OPartnerLink) BpelRuntimeContext(org.apache.ode.bpel.runtime.BpelRuntimeContext)

Aggregations

OProcess (org.apache.ode.bpel.o.OProcess)2 BpelRuntimeContext (org.apache.ode.bpel.runtime.BpelRuntimeContext)2 SOAPAddressImpl (com.ibm.wsdl.extensions.soap.SOAPAddressImpl)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Port (javax.wsdl.Port)1 Service (javax.wsdl.Service)1 FaultException (org.apache.ode.bpel.common.FaultException)1 DeployDocument (org.apache.ode.bpel.dd.DeployDocument)1 TDeployment (org.apache.ode.bpel.dd.TDeployment)1 TInvoke (org.apache.ode.bpel.dd.TInvoke)1 TProvide (org.apache.ode.bpel.dd.TProvide)1 OPartnerLink (org.apache.ode.bpel.o.OPartnerLink)1 NodeList (org.w3c.dom.NodeList)1