Package org.jbpm.api

Examples of org.jbpm.api.JbpmException


    super.tearDown();
   
    if (errorMsg!=null) {
      if (exception==null) {
        throw new JbpmException(errorMsg);
      } else {
        throw new JbpmException(errorMsg, exception);
      }
    }
  }
View Full Code Here


    public void perform(OpenExecution execution) throws Exception
    {
        MessageService mule = EnvironmentImpl.getCurrent().get(MuleMessageService.class);
        if (mule == null)
        {
            throw new JbpmException("The Mule MessageService is not available from the ProcessEngine, you may need to add it to your jbpm.cfg.xml file");
        }

        if (payloadExpression == null)
        {
            payloadObject = execution.getVariable(Process.PROCESS_VARIABLE_DATA);
            if (payloadObject == null)
            {
                payloadObject = execution.getVariable(Process.PROCESS_VARIABLE_INCOMING);
            }
        }
        else
        {
            // The payloadSource may be specified using an expression (e.g.,
            // #{myObject.myStuff.myField} would first retrieve the process
            // variable "myObject" and then call .getMyStuff().getMyField()
            payloadObject = ScriptManager.getScriptManager().evaluateExpression(payloadExpression, null);
        }
        if (payloadObject == null)
        {
            throw new IllegalArgumentException("Payload for message is null.  Payload source is \""
                                               + payloadExpression + "\"");
        }

        Map props = new HashMap();

        props.put(Process.PROPERTY_PROCESS_TYPE, ((ExecutionImpl) execution).getProcessDefinition().getName());
        props.put(Process.PROPERTY_PROCESS_ID, execution.getId());
        String state = Jbpm.getState(execution.getProcessInstance());
        props.put("MULE_BPM_PROCESS_STATE", state);
        log.debug("process state: " + state);       

        // Set process vars as properties on outgoing Mule messages.
        for (Entry<String, ?> var : execution.getVariables().entrySet())
        {
            if (!var.getKey().startsWith(MuleProperties.PROPERTY_PREFIX))
            {
                log.debug("process var: " + var.getKey() + " = " + var.getValue());
                props.put(var.getKey(), var.getValue());
            }
        }

        // Just in case the endpoint itself is an expression
        endpoint = (String) ScriptManager.getScriptManager().evaluateExpression(endpoint, null);
        MuleMessage response = mule.generateMessage(endpoint, payloadObject, props, mep);

        if (mep.hasResponse() && response != null)
        {
            Object responsePayload = response.getPayload();
   
            // Validate expected response type
            if (responsePayloadClass != null)
            {
                log.debug("Validating response type = " + responsePayload.getClass() + ", expected = " + responsePayloadClass);
                if (!responsePayloadClass.isAssignableFrom(responsePayload.getClass()))
                {
                    throw new JbpmException("Response message is of type " + responsePayload.getClass() + " but expected type is " + responsePayloadClass);
                }
            }
           
            if (responseVariableName != null)
            {
View Full Code Here

        {
            String messageSource = (String) execution.getVariable(Process.PROCESS_VARIABLE_INCOMING_SOURCE);
            log.debug("Validating message source = " + messageSource + ", expected = " + endpoint);
            if (!endpoint.equalsIgnoreCase(messageSource))
            {
                throw new JbpmException("Incoming message source is " + messageSource + " but expected source is " + endpoint);
            }
        }

        // Validate expected message type
        if (payloadClass != null)
        {
            log.debug("Validating message type = " + payload.getClass() + ", expected = " + payloadClass);
            if (!payloadClass.isAssignableFrom(payload.getClass()))
            {
                throw new JbpmException("Incoming message is of type " + payload.getClass() + " but expected type is " + payloadClass);
            }
        }
       
        // Store message payload into variable
        if (variableName != null)
View Full Code Here

        : givenName : familyName;
    try {
      return new InternetAddress(user.getBusinessEmail(), personal);
    }
    catch (UnsupportedEncodingException e) {
      throw new JbpmException("invalid recipient name: " + personal);
    }
  }
View Full Code Here

  private static final Log log = Log.getLog(StandardTransactionInterceptor.class.getName());
 
  public <T> T execute(Command<T> command) {
    Environment environment = Environment.getCurrent();
    if (environment==null) {
      throw new JbpmException("no environment for managing hibernate transaction");
    }

    StandardTransaction standardTransaction = environment.get(StandardTransaction.class);
    if (standardTransaction==null) {
      throw new JbpmException("no standard-transaction in environment");
    }
   
    standardTransaction.begin();

    try {
View Full Code Here

  @SuppressWarnings("unchecked")
  public <T> T execute(Command<T> command) {
    Environment environment = Environment.getCurrent();
    if (environment == null) {
      throw new JbpmException("no environment for managing hibernate transaction");
    }

    StandardTransaction standardTransaction = environment.get(StandardTransaction.class);

    PlatformTransactionManager platformTransactionManager = environment.get(PlatformTransactionManager.class);
    if (platformTransactionManager == null) {
      throw new JbpmException("No platformTransaction manager defined.");
    }

    if (standardTransaction != null) {
      standardTransaction.begin();
    }
View Full Code Here

          transaction.enlistResource(identitySessionResource);
        }
       
    return new JBossIdmIdentitySessionImpl(identitySession);
  } catch (IdentityException e) {
    throw new JbpmException("couldn't create the identity session for realm [" + realmName + "]");
  }
  }
View Full Code Here

           
      identitySession.getAttributesManager().addAttributes(idUser, attrs.toArray(new Attribute[attrs.size()]));
      return idUser.getId();
     
    } catch (IdentityException e) {
      throw new JbpmException("couldn't create user "+userName, e);
    }

  }
View Full Code Here

      }
     
      return users;
     
    } catch (IdentityException e) {
      throw new JbpmException("couldn't get users from identity component", e);
    }
  }
View Full Code Here

    if (idUser != null) {
        return getUserInfo(idUser);
    }
    return null;
  } catch (IdentityException e) {
    throw new JbpmException("couldn't get user from id of " + userId, e);
  }
  }
View Full Code Here

TOP

Related Classes of org.jbpm.api.JbpmException

Copyright © 2018 www.massapicom. 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.