Examples of ChainAPI


Examples of com.dotmarketing.portlets.chains.business.ChainAPI

  public String getKey() {
    return key;
  }

  public List<ChainState> getStates() {
    ChainAPI api = APILocator.getChainAPI();
    try {
      return api.getChainStates(this);
    } catch (DotDataException e) {
      throw new DotRuntimeException("Unable to retrieve the given chain state, chain key = " + this.key);
    } catch (DotCacheException e) {
      throw new DotRuntimeException("Unable to retrieve the given chain state, chain key = " + this.key);
    }
View Full Code Here

Examples of com.dotmarketing.portlets.chains.business.ChainAPI

  public void setParameters(List<ChainStateParameter> parameters) {
    this.parameters = parameters;
  }
  public List<ChainStateParameter> getParameters() {
    if(parameters == null) {
      ChainAPI api = APILocator.getChainAPI();

      try {
        parameters = api.loadChainStateParameters(this);
      } catch (DotDataException e) {
        throw new DotRuntimeException(e.getMessage(), e);
      } catch (DotCacheException e) {
        throw new DotRuntimeException(e.getMessage(), e);
      }
View Full Code Here

Examples of com.dotmarketing.portlets.chains.business.ChainAPI

     
    return parameters;
  }
 
  public ChainLink getChainLink () throws DotRuntimeException, DotDataException, DotCacheException, ChainLinkCodeCompilationException {
    ChainAPI api = APILocator.getChainAPI();
    if(linkCodeId > 0)
      return api.instanciateChainLink(linkCodeId);
    else
      return null;
  }
View Full Code Here

Examples of com.dotmarketing.portlets.chains.business.ChainAPI

public class ChainsProcessor {

  private static Pattern variablesPattern = Pattern.compile("\\{([A-Za-z0-9_-]+)\\}");
 
  public static ChainControl executeChain(String chainKey) throws DotDataException, DotCacheException, DotRuntimeException, ChainLinkCodeCompilationException {
    ChainAPI api = APILocator.getChainAPI();
    Chain chain = api.loadChainByKey(chainKey);

    if (chain == null) {
      throw new DotRuntimeException("Couldn't find a suitable chain to execute with the key name = " + chainKey);
    }
View Full Code Here

Examples of com.dotmarketing.portlets.chains.business.ChainAPI

    ChainControl control = new ChainControl(chain, chain.getSuccessValue(), chain.getFailureValue());
    return executeChain(chain, control);
  }
 
  public static ChainControl executeChain (String chainKey, HttpServletRequest request) throws DotDataException, DotCacheException, DotRuntimeException, ChainLinkCodeCompilationException {
    ChainAPI api = APILocator.getChainAPI();
    Chain chain = api.loadChainByKey(chainKey);

    if (chain == null) {
      throw new DotRuntimeException("Couldn't find a suitable chain to execute with the key name = " + chainKey);
    }
View Full Code Here

Examples of com.dotmarketing.portlets.chains.business.ChainAPI

  @SuppressWarnings("unchecked")
  public static ChainControl executeChain (Chain chain, ChainControl control) throws DotDataException, DotRuntimeException, DotCacheException, ChainLinkCodeCompilationException {
   
    try {
     
           ChainAPI api = APILocator.getChainAPI();
     
      if(chain == null || control == null) {
        throw new DotRuntimeException("Unable to execute a null chain/control");
      }
               
            List<ChainState> states = chain.getStates();
            HibernateUtil.startTransaction();

            boolean exceptionOcurred = false;
          boolean lastLinkResult = true;

          if(control.getRequest() != null) {
            HttpServletRequest req = control.getRequest();
            Enumeration<String> parameterNames = req.getParameterNames();
            while(parameterNames.hasMoreElements()) {
                String e = parameterNames.nextElement();
              control.putChainProperty(e, req.getParameter(e));
            }
          }
         
          for (ChainState state : states) {
           
            //Resetting default control properties
            control.putChainProperty(ChainControl.ROLLBACK_ON_ERROR, true);
            control.putChainProperty(ChainControl.ROLLBACK_ONLY, false);
            control.putChainProperty(ChainControl.CONTINUE_ON_EXCEPTION, false);
            control.putChainProperty(ChainControl.CONTINUE_ON_FAILURE, false);
            control.putChainProperty(ChainControl.RESTART_TRANS, false);
           
              ChainLink link = api.instanciateChainLink(state.getLinkCodeId());
                List<ChainStateParameter> params = state.getParameters();
                for(ChainStateParameter p : params) {
                 
                  //Pattern substitution of variables block
                  //If a chain state parameter contains a variable value like myEmail={emailAddress}
View Full Code Here
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.