Package com.dotmarketing.portlets.chains.model

Examples of com.dotmarketing.portlets.chains.model.Chain


    chainFactory.deleteChainState(s);
  }
 
  public void saveChain(Chain chain, List<ChainState> states) throws DotDataException, DotCacheException, DuplicateChainStateParametersException, ChainAlreadyExistsException {

    Chain oldChain = loadChainByKey(chain.getKey());
    if(oldChain != null && oldChain.getId() != chain.getId())
      throw new ChainAlreadyExistsException("A chain with this same key = " + chain.getKey() + " already exists on the sytem.");
   
    //Checking the parameters before save
    List<ChainStateParameter> duplicatedStateParameters = new ArrayList<ChainStateParameter>();
    for(ChainState state : states) {
View Full Code Here


    return (List<ChainState>) cache.get(String.valueOf(chainId), stateGroup);
  }

  public Chain putChain(Chain chain) throws DotCacheException {
   
    Chain oldChain = getChain(chain.getId());
   
    cache.put(String.valueOf(chain.getId()), chain, chainGroup);
    cache.put(chain.getKey(), chain, chainByKeyGroup);
   
    return oldChain;
View Full Code Here

   
    return oldChainStates;
  }

  public Chain removeChain(long chainId) throws DotCacheException {
    Chain oldChain = getChain(chainId);
   
    if(oldChain != null) {
      cache.remove(String.valueOf(chainId), chainGroup);
      cache.remove(oldChain.getKey(), chainByKeyGroup);
    }
   
    return oldChain;
  }
View Full Code Here

  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);
    }

    ChainControl control = new ChainControl(chain, chain.getSuccessValue(), chain.getFailureValue());
    return executeChain(chain, control);
  }
View Full Code Here

    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);
    }

    ChainControl control = new ChainControl(request, request.getSession(), chain, chain.getSuccessValue(), chain.getFailureValue());
    return executeChain(chain, control);   
  }
View Full Code Here

  }

  public void deleteChainState(ChainState state) throws DotDataException, DotCacheException {

    ChainCache cache = CacheLocator.getChainCache();
    Chain chain = findChain(state.getChainId());
    state = findChainState(state.getId());
    HibernateUtil.delete(state);

    // Making sure the remaining states got the right order
    // Removing gaps that could happen on deleting the state
    List<ChainState> states = findChainStates(chain);
    int order = 0;
    for (ChainState stateIt : states) {
      if (stateIt.getOrder() != order) {
        stateIt.setOrder(order);
        saveChainState(stateIt);
      }
    }

    // Getting rid of the cache entries forcing to lazily load later
    try {
      cache.removeChainStates(chain.getId());
    } catch (DotCacheException e) {
      Logger.warn(this, "deleteChain: Couldn't remove the key from cache", e);
    }

  }
View Full Code Here

  }

  public Chain loadChain(long chainId) throws DotDataException, DotCacheException {
    ChainCache cache = CacheLocator.getChainCache();

    Chain ch = cache.getChain(chainId);

    // Not in cache?
    if (ch == null) {
      ch = findChain(chainId);
      cache.putChain(ch);
View Full Code Here

  }

  public Chain loadChainByKey(String chainKey) throws DotDataException, DotCacheException {
    ChainCache cache = CacheLocator.getChainCache();

    Chain ch = cache.getChainByKey(chainKey);

    // Not in cache?
    if (ch == null) {
      ch = findChainByKey(chainKey);
      if(ch != null)
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.chains.model.Chain

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.