예제 #1
0
  public void transform(ActionRequestContext pRequestContext, ModuleCallStack pCallStack) {

    ModuleCall lLastCall = pCallStack.getTopModuleCall();
    boolean lRunCallbacks = mCallbackOption == CallbackOption.CALLBACKS_NOW;

    // Get the current env DOM now before popping anything
    mModuleCallBuilder.setEnvironmentDOM(
        pRequestContext.getContextUElem().getUElem(ContextLabel.ENV));

    // Pop the first module off the top of the stack
    pCallStack.pop(pRequestContext, lRunCallbacks, true, false, false);

    if (mCallbackOption == CallbackOption.PRESERVE_CALLBACKS) {

      // Wipe out any requested callbacks and copy callbacks from the popped module call to the new
      // module call
      mModuleCallBuilder.clearCallbackHandlers();
      for (CallbackHandler lCallbackHandler : lLastCall.getCallbackHandlerList()) {
        mModuleCallBuilder.addCallbackHandler(lCallbackHandler);
      }
    } else {
      // Do not allow callbacks to be defined on this call
      mModuleCallBuilder.clearCallbackHandlers();
    }

    pCallStack.push(pRequestContext, mModuleCallBuilder);
  }
예제 #2
0
    /**
     * Deserialises a map of Facet keys to Facets from the given PersistenceContext.
     *
     * @param pPersistenceContext For deserialising the Facets.
     * @param pModuleCall ModuleCall to deserialise the Facets for.
     * @param pFacetType Type of Facet to be deserialised.
     * @param pFacetClass Marker class for providing type safety. Deserialised Facets should be
     *     castable to this class.
     * @param <T> Facet type to be returned.
     * @return Map of keys to Facets.
     */
    protected static <T extends ModuleFacet> Map<String, T> deserialiseFacets(
        PersistenceContext pPersistenceContext,
        ModuleCall pModuleCall,
        ModuleFacetType pFacetType,
        Class<T> pFacetClass) {

      Collection<T> lModuleCallFacets =
          pPersistenceContext
              .getDeserialiser()
              .getModuleCallFacets(pModuleCall.getCallId(), pFacetType, pFacetClass);

      Map lFacetMap = new HashMap<String, T>();
      for (ModuleFacet lFacet : lModuleCallFacets) {
        lFacetMap.put(lFacet.getFacetKey(), lFacet);
      }

      return lFacetMap;
    }