Package io.inversion

Class Chain

java.lang.Object
io.inversion.Chain

public class Chain extends Object
  • Field Details

    • engine

      protected final Engine engine
    • actions

      protected final List<io.inversion.Chain.ActionMatch> actions
    • request

      protected final Request request
    • response

      protected final Response response
    • vars

      protected final org.apache.commons.collections4.map.CaseInsensitiveMap<String,Object> vars
    • next

      protected int next
    • canceled

      protected boolean canceled
    • user

      protected User user
    • parent

      protected Chain parent
    • pathParams

      protected Map<String,String> pathParams
    • pathParamsToRemove

      protected Set<String> pathParamsToRemove
  • Method Details

    • resetAll

      public static void resetAll()
    • get

      protected static Stack<Chain> get()
    • getDepth

      public static int getDepth()
    • first

      public static Chain first()
    • top

      public static Chain top() throws ApiException
      Throws:
      ApiException
    • peek

      public static Chain peek()
    • push

      public static Chain push(Engine engine, Request req, Response res)
    • pop

      public static Chain pop()
    • getUser

      public static User getUser()
    • size

      public static int size()
    • debug

      public static void debug(Object... msgs)
    • buildLink

      public static String buildLink(Collection collection)
    • buildLink

      public static String buildLink(Collection collection, Object resourceKey, String subCollectionKey)
    • withUser

      public Chain withUser(User user)
    • getParent

      public Chain getParent()
    • setParent

      public void setParent(Chain parent)
    • put

      public void put(String key, Object value)
    • isDebug

      public boolean isDebug()
    • get

      public Object get(String key)
      Storage for chain steps to communicate with each other.
      Parameters:
      key - the name of the value to retrieve
      Returns:
      the value if it exists otherwise null
    • remove

      public Object remove(String key)
    • mergeEndpointActionParamsConfig

      public Set<String> mergeEndpointActionParamsConfig(String key)
      Returns the combined list of endpoint/action stack/request params for the supplied key

      This for example, allows you to add to but not remove from a configured "excludes" parameter

      All returned values are lower case

      Parameters:
      key - the name of the param to merge
      Returns:
      the combined list of values found for key
    • getConfig

      public Map<String,String> getConfig()
    • getConfigKeys

      public Set<String> getConfigKeys()
    • getConfig

      public int getConfig(String key, int defaultValue)
    • getConfig

      public boolean getConfig(String key, boolean defaultValue)
    • getConfig

      public String getConfig(String key)
    • getConfig

      public String getConfig(String key, String defaultValue)
    • go

      public void go() throws ApiException
      Throws:
      ApiException
    • filterPathParams

      public Chain filterPathParams(JSNode json)
      Recursively removes any url path params that appear as properties in the json
      Parameters:
      json - the json node to clean
      Returns:
      this
    • doNext

      public Chain doNext(Action... newActions)
    • skipNext

      public Chain skipNext()
    • getNext

      public Action getNext()
    • next

      public boolean next() throws ApiException
      Throws:
      ApiException
    • withPathParams

      public Chain withPathParams(Map<String,String> pathParams)
    • applyPathParams

      public void applyPathParams(Map<String,String> pathParamsToAdd, Url url, JSNode json)
    • hasNext

      public boolean hasNext()
    • isCanceled

      public boolean isCanceled()
    • cancel

      public void cancel()
    • getEngine

      public Engine getEngine()
    • getApi

      public Api getApi()
    • getEndpoint

      public Endpoint getEndpoint()
    • getActions

      public List<io.inversion.Chain.ActionMatch> getActions()
    • withActions

      public Chain withActions(List<io.inversion.Chain.ActionMatch> actions)
    • withAction

      public Chain withAction(io.inversion.Chain.ActionMatch action)
    • getRequest

      public Request getRequest()
    • getResponse

      public Response getResponse()