FDM PreProcessor not getting invoked

Avatar

Avatar

rsadhenetibalai

Avatar

rsadhenetibalai

rsadhenetibalai

23-10-2019

Hi all,

I was going through the AEM Forms Java Docs and came across the class IPreProcessor (AEM Forms API).

The description reads

IPreProcessor is a service that is called directly before executing any operation. This can be used to do some pre-processing like authorization or request modification before the invocation of the operation

I have a form data model which uses the OOB Microsoft Odata Connector to connect to Microsft Dynamics CRM and fetch some data.

I configured an adaptive form and in one of the fields, I configured a rule to invoke the above FDM service to fetch some data.

My assumption was that if we implement the interface and register a preprocessor, it would be called before invoking the actual connector.

However, there appears to be no difference with or without a preprocessor. My registered PreProcessor doesn't seem to get called anytime.

@Component((immediate = true))
@Service((IPreProcessor.class))
public class MyPreProcessor implements IPreProcessor {

   private static final Logger LOG = LoggerFactory.getLogger(MyPreProcessor.class);

   @Override
   public void preprocess(ExecutionContext executionContext) throws DermisException {
       LOG.info("Preprocessing requested");
       LOG.info("Execution Context {}", executionContext);
       LOG.info("Execution Context arguments {}", executionContext.getArguments());
       LOG.info("Execution Context arguments valuemap {}", executionContext.getArgumentsValueMap());
       LOG.info("Execution Context auth details {}", executionContext.getAuthDetails());
       LOG.info("Execution Context configuration {}", executionContext.getConfiguration());
       LOG.info("Execution Context configuration id {}", executionContext.getConfigurationId());
       LOG.info("Execution Context entity id {}", executionContext.getEntityId());
       LOG.info("Execution Context operation id {}", executionContext.getOperationId());
       LOG.info("Execution Context query {}", executionContext.getQuery());
       LOG.info("Execution Context schema name {}", executionContext.getSchemaName());
   }

   @Override
   public boolean isSupported(String connectorName, ExecutionContext executionContext) {
   LOG.info("Checking if the preprocessing is supported");
   try {
       LOG.info("Connector Name received {}", connectorName);
       LOG.info("Execution Context {}", executionContext);
       LOG.info("Execution Context arguments {}", executionContext.getArguments());
       LOG.info("Execution Context arguments valuemap {}", executionContext.getArgumentsValueMap());
       LOG.info("Execution Context auth details {}", executionContext.getAuthDetails());
       LOG.info("Execution Context configuration {}", executionContext.getConfiguration());
       LOG.info("Execution Context configuration id {}", executionContext.getConfigurationId());
       LOG.info("Execution Context entity id {}", executionContext.getEntityId());
       LOG.info("Execution Context operation id {}", executionContext.getOperationId());
       LOG.info("Execution Context query {}", executionContext.getQuery());
       LOG.info("Execution Context schema name {}", executionContext.getSchemaName());
   } catch (DermisException e) {
       LOG.error(e.getMessage(), e);
   }
   return true;
   }

}

What is the purpose of the PreProcessor then or how do I invoke custom code before the FDM operation is performed. There appears to be no documentation anywhere.

View Entire Topic

Avatar

Avatar

user2062153

Avatar

user2062153

user2062153

07-11-2019

Can you please send the screenshot of component status in system console?