We can encounter several failures while importing content/data in Asta7 for several reasons. So far our approach for handling failures has been to throw an exception and abort the import. But this approach is not user-friendly as most of the failures are recoverable.
...
Info |
---|
This tool will be used only for the Single Archive and Excel import from Asta7 |
Table of Contents | ||
---|---|---|
|
Failures and Possible Solutions
...
Failure | Solutions | Challenges |
---|---|---|
AMID conflict | Regenarate Genarate |
|
PK conflict (Single PK only for now) | Regenaret Genarate if UUID Input from the user |
|
Input from the user |
| |
Unique conflict | Regenarate Genarate if UUID |
|
Input from the user |
| |
Set | ||
FVP Unique conflict (Root entities only for now) | Regenarate if FVP Genarate | |
Input from the user |
| |
Set | ||
FK conflict (Not yet supported) | Set | |
NULL conflict | Genarate |
|
Input from the user |
| |
Wrong type | Genarate |
|
Input from the user |
| |
Set | ||
Wrong length | Trim extra | |
Input from the user |
| |
Set |
System Entities
For this section, we need to consider the system root entities like AKTOR, TAG, etc. and ignore AMID/PK
conflicts for all sub-entities. We should add some have added options for handling AMID/PK/Unique/FVP Unique conflicts for the system root entities.
Failure | Solutions | Challenges |
---|---|---|
AMID/PK/Unique/FVP Unique conflict | Ignore |
|
Replace with the conflicted row |
| |
Replace with a chosen row (Maybe later) |
Implementation
We can divide the implementation into four key steps.
...
As before we will try to import the data without any changes. In case of an exception, we will analyze the exception to check if it is a resolvable exception (AMID/PK conflict, NULL conflict, etc.). If resolvable then the import job dialog will show a button to start the resolving process.
...
Clicking the Resolve button will start the 2nd step.
...
Conflict Resolution Options
After clicking the Resolve button a new tab will be opened. The tab will start a background job In the tab, there will be options to choose how do you want to proceed. There will be options present per conflict type. Either you can gather the conflicts beforehand, or gather and solve them while importing, and the third option is to mix both, meaning gather some types beforehand but resolve the rest while importing.
Conflict Type | Default Solutions (Used while importing) |
---|---|
AMID | Generate |
Fail (Throw exception) | |
PK | Generate (Available if all are UUID) |
Fail (Throw exception) | |
UNIQUE | Generate (Available if all are UUID) |
Fail (Throw exception) | |
FVP_UNIQUE | Generate |
Fail (Throw exception) | |
FK (Not supported yet) | Set |
Fail (Throw exception) | |
REQUIRED | Generate a dummy value |
Fail (Throw exception) | |
TYPE | Set |
Fail (Throw exception) | |
LENGTH | Trim the extra part |
Fail (Throw exception) | |
SYSTEM ENTITY | Generate (Generate new UUID or FVP) |
Ignore | |
Replace with the conflicted row | |
Fail (Throw exception) |
If all the types are set to resolve at import time then the Resolve and Import
button will be shown. In this case, the 3rd step is not needed anymore. Otherwise, you can proceed to the 3rd step by clicking the Gather Conflicts
button.
Gather and Show Conflicts with Possible Solutions
After clicking the Gather Conflicts
button a background job will be started, which will go through the import file and gather all the resolvable conflicts for the chosen types. After gathering all the conflict they will be shown in a table with possible solutions to choose from. The conflicts will be grouped by the entity name and the conflict the 3rd step will begintype. It is also possible to pick a solution for the whole group.
Info |
---|
The current limit for gathering conflicts is 100010,000. |
Show Conflicts and Possible Solutions
Once the conflict-gathering job is done the tab will show all the conflicts in a table.
...
The table contains the following columns
...
Column
...
Description
...
Entity Name
...
Resolve and Import
Clicking the Resolve and Import
button will begin the 4th and final step. In this step, the import will run again. All the conflicts gathered beforehand and conflicts gathered while running will be resolved based on the chosen solution.
Things To Do
Support Excel import
Support Composite PK
Support FK conflict
Generate other types than UUID
Optimize using temporary table and/or files rather than the memory
Add more types of solutions