IBM WebSphere Multichannel Bank Transformation Toolkit, Version 7.1

Programming Examples

Following are the primary function usage examples:
  1. To create a context: context is created by a factory class ContextFactory.java:
    Context rootCtx = ContextFactory.getRoot();
    KeyedCollection keyColl = new KeyedCollection("sessionData");
    
    Context bCtxt = ContextFactory.createContext("sessionCtx", true);
    Context cCtx = ContextFactory.createContext("sessionCtx", "session", keyColl);
    Context dCtx = ContextFactory.createContext("sessionCtx", "session", rootCtx, true);
    Context eCtx = ContextFactory.createContext("sessionCtx", "session", rootCtx, keyColl);
    Context fCtx = ContextFactory.createContext("sessionCtx", "session", rootCtx, keyColl, true);
    Another API is added to ContextFactory.java:
    Context aCtxt = ContextFactory.createContext("sessionCtx");
  2. To chain a context to another context:
    Context rootCtx = ContextFactory.getRoot();
    Context session1Ctx = ContextFactory.createContext("sessionCtx",true);
    Context session2Ctx = ContextFactory.createContext("sessionCtx",false);
    session1Ctx.chainTo(rootCtx);
    session2Ctx.chainTo(rootCtx);
  3. To fetch the value of a context
    Context rootCtx = ContextFactory.getRoot();
    Context sessionCtx = ContextFactory.createContext("sessionCtx", true);
    String str= (String)sessionCtx.getValueAt("SessionId");
    KeyedCollection kColl = sessionCtx.getKeyedCollection();
    System.out.println(str);
    System.out.println(kColl);
  4. To set the value of a context
    Context rootCtx = ContextFactory.getRoot();
    Context sessionCtx = ContextFactory.createContext ("sessionCtx", true);
    sessionCtx.setValueAt("SessionId", "Bank A");
    KeyedCollection kColl = new KeyedCollection("SessionData");
  5. To commit the context
    Context rootCtx = ContextFacotry.getRoot();
    Context sessionCtx = ContexfFactory.createContext("sessionCtx", "session", rootCtx, true);
    sessionCtx.commit();
  6. To unchain a context from another context
    Context rootCtx = ContextFactory.getRoot();
    Context sessionCtx = ContextFactory.createContext("sessionCtx", true);
    sessionCtx.chainTo(rootCtx);
    sessionCtx.unchain();
  7. To remove a context:
    Context rootCtx = ContextFactory.getRoot();
    Context sessionCtx = ContextFactory.createContext("sessionCtx", true);
    sessionCtx.chainTo(rootCtx);
    sessionCtx.unchain();
    sessionCtx.prune();


Feedback