Package de.elo.ix.client.plugin
Interface ImportCallback<T extends Serializable>
- Type Parameters:
T- The type of the items being imported. It must extend Serializable.
public interface ImportCallback<T extends Serializable>
This interface defines a callback that is invoked during the import process. It allows for custom actions to be
performed for each item being imported.
- Since:
- 25.00.000.002
-
Method Summary
Modifier and TypeMethodDescriptionvoidonImport(T entity, ImportInfo importInfo) The `onImport` method is a callback invoked during the import process for each item being imported.
-
Method Details
-
onImport
The `onImport` method is a callback invoked during the import process for each item being imported. It is specifically called for plugins that handle custom import logic and allows for modifications to the imported entities before they are finalized in the system.
This method enables plugins to adjust or update the properties of entities being imported. For example, if aSordis being imported, the `onImport` method can be used to change the name of theSordor make other modifications to fit the target system's requirements.
While the method leverages the existingIdMappingto ensure that any identifiers are correctly updated, its primary function is to provide a point where additional modifications or custom processing can be applied to the imported entities.
Key Workflow:- Import Request: When an entity (e.g., a
Sord,SordType, or another object) is being imported, the import process begins. - Loading Import Implementations: During the import process, the system loads the appropriate import implementations registered by the plugin.
- Invocation of 'onImport': The `onImport` method is invoked for each entity, allowing the plugin to modify the entity's properties as needed. This could include updating names, adjusting values, or configuring additional settings.
- Dependency Handling: The `IdMapping` is utilized to update entity identifiers, ensuring that any references to other objects are correctly resolved.
- Completion: Once all modifications are applied and the entity is processed, the import for that entity is finalized.
Suppose aSordis being imported from an external system. The `onImport` method can be used to update the name of theSordto match the naming conventions of the target system. Additionally, other properties or configurations can be adjusted as needed:public void onImport(Sord entity, ImportInfo importInfo) { try { // Example modification: Update the Sord's name String newName = "Updated Name"; entity.setName(newName); // Perform additional modifications if needed adjustAdditionalProperties(entity, importInfo.getIdMapping()); } catch (Exception e) { log.debug("Error during onImport: " + e.getMessage(), e); } }In this example, the `onImport` method changes the name of the importedSordand applies any other necessary updates before the import is completed.
The `onImport` method provides a critical extension point for plugins to adapt imported entities to fit the requirements of the target system. This includes making necessary changes to properties, handling dependencies, and ensuring that all relevant data is correctly processed.
Dependencies and Import Considerations:
The method leverages the existingIdMappingto update entity references. Proper handling of dependencies is crucial, especially when imported entities have references to other objects. Ensuring that these references are correctly updated maintains the integrity of the data and relationships in the target system.
If an error occurs during the import process, such as a failure to modify an entity, the error should be logged, and the import process should continue with other entities. This ensures that a single failure does not disrupt the entire import operation.
Package vs. Archive Import/Export:
Master data must be imported using the package Import, as the Archive Import does not include them. An exception to this are ConfigRecords, which are transported for Workspaces via the Archive Import. Other data types, such as UserInfo and TranslateTerms, that do qualify as master data must also be managed via the Package Import.
- Parameters:
entity- The entity being imported, such as aSord,SordType, or another object that was added to the export dataset.importInfo- Information related to the import process, encapsulating details such as theIdMapping, which provides the old-to-new ID mappings and additional context for the import process.
- Import Request: When an entity (e.g., a
-