Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

FDM PreProcessor not getting invoked

Avatar

Avatar
Springboard
Level 1
rsadhenetibalai
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

1 solution
Top badges earned
Springboard
Establish
Applaud 5
Give Back
Ignite 1
View profile

Avatar
Springboard
Level 1
rsadhenetibalai
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

1 solution
Top badges earned
Springboard
Establish
Applaud 5
Give Back
Ignite 1
View profile
rsadhenetibalai
Level 1

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
Springboard
Level 1
rsadhenetibalai
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

1 solution
Top badges earned
Springboard
Establish
Applaud 5
Give Back
Ignite 1
View profile

Avatar
Springboard
Level 1
rsadhenetibalai
Level 1

Likes

0 likes

Total Posts

9 posts

Correct Reply

1 solution
Top badges earned
Springboard
Establish
Applaud 5
Give Back
Ignite 1
View profile
rsadhenetibalai
Level 1

14-11-2019

I've tried it before and there was no difference. It doesn't work.

I tried it again now and still the same.

However, the question is, how would it identify if the service is a PreProcessor or PostProcessor if you are registering it as IProcessor?

I would assume IPreProcessor would be the right service to register it as (so it can call the preprocess method in all preprocessors).

I could be wrong though.