The root cause is that ENOVIA’s bulk import tool behavior differs fundamentally from interactive UI operations, and your trigger registration needs to account for batch contexts. Let me address all three focus areas: bulk import tool behavior, trigger registration, and batch post-processing.
First, understand the bulk import tool behavior. The standard part import utility uses ENOVIA’s LoadFromFile or similar batch loading APIs that deliberately suppress event triggers for performance. When importing hundreds of parts, firing individual triggers for each part would create massive overhead. The tool batches database operations and commits them in chunks, bypassing the normal object lifecycle that fires your postCreate trigger.
Second, fix your trigger registration for batch operations. The standard trigger approach won’t work here. Instead, implement an EventSubscriber that explicitly handles batch contexts:
public class PartBatchSubscriber implements EventSubscriber {
public void notify(Event event) {
if (event instanceof PartCreationEvent) {
processPartCreation((PartCreationEvent) event);
}
}
}
Register this subscriber with batch scope enabled in your eventSubscriber.xml configuration. The key difference is that EventSubscribers can be configured to fire during batch operations by setting the batchEnabled attribute to true, whereas standard triggers are suppressed.
Third, implement robust batch post-processing. Even with EventSubscribers, you’ll want a safety net for bulk operations. Create a scheduled job that runs after imports to catch any parts that didn’t get processed:
// Query parts created recently without post-processing
QuerySpec qs = new QuerySpec(WTPart.class);
qs.appendWhere(new SearchCondition(
WTPart.class, "createStamp", ">=", yesterday));
This scheduled job should check for parts missing the expected related documents or calculated attributes, then apply your post-processing logic. This handles both the immediate batch import case and any edge cases where processing failed.
The most reliable solution combines two approaches:
- Immediate processing: Implement a custom ImportListener that hooks directly into the bulk import tool’s workflow. ENOVIA R2021x supports the
wt.load.LoadListener interface. Create a class implementing this interface and register it in your site.xconf:
<Service name="com.custom.PartImportListener"
class="com.custom.PartImportListener">
<Option cardinality="singleton"/>
</Service>
Your ImportListener gets called for each batch of parts during import, allowing you to apply post-processing logic in real-time without the performance hit of individual triggers.
- Deferred processing: Schedule a background job that runs 15 minutes after typical import windows to catch any missed parts. This job queries for recently created parts lacking the expected artifacts and processes them in batches.
For your specific case with document generation and attribute calculations, the ImportListener approach is ideal because it maintains data consistency immediately during the import process. The listener can access the full part context and apply your existing PartPostProcessor logic within the batch transaction, ensuring that related documents and attributes are created atomically with the parts themselves.
Implementing this solution requires refactoring your PartPostProcessor into a shared service that both the EventSubscriber (for UI operations) and ImportListener (for batch operations) can call. This ensures consistent behavior across all part creation paths while respecting the performance requirements of bulk operations.
This draft is based on general ENOVIA knowledge. It has not been verified against your specific version and environment. Practitioners: verify the steps and share your experience below.