/** {@inheritDoc} */
  @Override
  @Nullable
  public String apply(@Nullable final ProfileRequestContext input) {
    if (input == null) {
      return null;
    }

    final SpringRequestContext springRequestContext =
        input.getSubcontext(SpringRequestContext.class, false);
    if (springRequestContext == null) {
      return null;
    }

    final RequestContext requestContext = springRequestContext.getRequestContext();
    if (requestContext == null) {
      return null;
    }

    final FlowExecutionContext flowExecutionContext = requestContext.getFlowExecutionContext();
    if (flowExecutionContext == null) {
      return null;
    }

    if (!flowExecutionContext.isActive()) {
      return null;
    }

    final FlowDefinition flowDefinition = requestContext.getActiveFlow();

    final String flowId = flowDefinition.getId();
    log.debug("Current flow id is '{}'", flowId);
    return flowId;
  }
 private boolean isPersistenceContext(FlowDefinition flow) {
   return flow.getAttributes().contains(PERSISTENCE_CONTEXT_ATTRIBUTE);
 }