Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

Failures and Possible Solutions

Normal Entities

...

Failure

...

Solutions

...

Challenges

...

AMID conflict

...

  • Regenarate

...

  • Replace all objectReference

...

PK conflict (Single PK only for now)

...

  • Regenaret if UUID

  • Input from the user

...

  • Replace all FK

  • How to handle composite PK?

...

Unique conflict

...

  • Regenarate if UUID

  • Input from the user

  • Set null if nullable

...

FVP Unique conflict (Root entities only for now)

...

  • Regenarate if FVP

  • Input from the user

  • Set null if nullable

...

FK conflict (Not yet supported)

...

  • Set null if nullable

...

NULL conflict

...

  • Regenarate if UUID

  • Regenarate if FVP and root

  • Input from the user

...

Wrong type

...

  • Regenarate if UUID

  • Regenarate if FVP and root

  • Input from the user

  • Set null if nullable

...

Wrong length

...

  • Input from the user

  • Trim extra

  • Set null if nullable

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 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

...

If ignored then need to ignore the whole subtree for this row as well

...

If replaced need to replace all objectReference and FK as well

...

Table of Contents
stylenone

Conflicts

Type

Description

Solutions

Example

UNIQUE

  • An object with this value for this field already exists

  • Applicable for

    • AMID system field

    • Primary key field (Single PK for now)

    • Any other unique fields

    • Root entity fields with field value pattern

  • GENERATE

  • SET_BY_USER

  • SET_NULL

  • FAIL

There is an object of entity A with AMID 821df1d4-3ed8-463e-a9a3-ea841be60f81 in the system. When trying to import this object again or any other object of entity A with the same AMID.

There is an entity A which has a field identifier with a field value pattern. The system already has an object of entity A with identifier A-0001. When trying to import any object of entity A with the identifier A-0001 again.

FK

  • The parent object referred by this field not found

  • Applicable for fields that are used to store links to their parent objects

  • Not yet supported

  • IGNORE

  • SET_NULL

  • FAIL

Entity A has a sub-entity Entity B. Entity B then will have a field like ref_a which will store the id of its parent object of Entity A. When trying to import an object of Entity B which has a value in the ref_a field, but there is no object of Entity A with that id.

REQUIRED

  • No value present for this required field

  • Applicable for

    • AMID system field

    • Primary key fields

    • Any other non-nullable fields

  • GENERATE

  • SET_BY_USER

  • FAIL

Entity A has a primary key field id. When the import file for entity A contains an object which has no value set for the field id.

TYPE

  • Value type not compatible with the field type

  • GENERATE

  • SET_BY_USER

  • SET_NULL

  • FAIL

Entity A has a field id of type integer. When the import file for entity A contains any value for the field id which is not an integer.

LENGTH

  • Text length is longer than the limit

  • Applicable for varchar fields with a length set

  • TRIM_EXTRA

  • SET_BY_USER

  • SET_NULL

  • FAIL

Entity A has a varchar field name with length 10. When the import file for entity A contains any value for the field name with a length greater than 10.

Root System Entity UNIQUE

  • Applicable for root system entities (AKTOR, TAG, RESTRICTION)

  • IGNORE

  • REPLACE_WITH_EXISTING

The system already has an AKTOR with identifikator AKT-0001. When trying to import any data that has an AKTOR with identifikator value AKT-0001.

Solutions

Type

Description

Challenges

GENERATE

  • Generates a new value based on the field type or using the field value pattern

  • Not available for PK and UNIQUE if field type is not UUID

  • For AMID, replace all objectReference

  • For PK, replace all FK

  • How to handle composite PK?

  • Should we generate PK for other types? If so then how?

SET_BY_USER

  • Input from the user

  • Not applicable for conflicts that are gathered during import

  • Requires user interaction

SET_NULL

  • Applicable for nullable or not required fields

SET_NULL_OR_REGENERATE

  • Set null if nullable or generate a value (dummy) based on the field type

  • Applicable for conflicts that are gathered during import

TRIM_EXTRA

  • Trim the extra part

  • Applicable for varchar fields with a length set

IGNORE

  • Ignore this object and it’s descendants

  • Highest precedence

  • Ignore the whole subtree for this object as well

REPLACE_WITH_EXISTING

  • Ignore this object and it’s descendants but keep the relation objects (AKTOR_RELASJON, TAG_MAPPING, OBJECT_RESTRICTION)

  • Import relation objects but change the relation to connect to the conflicted row

  • 2nd highest precedence

  • Ignore the whole subtree for this object as well

  • Keep the relation objects but change their FK

  • Should we consider the possible new sub-entity objects?

  • Should we consider the possible changes for this subtree?

FAIL

  • Throw an error and abort

  • Applicable for conflicts that are gathered during import

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.

...

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 the 3rd step will begin.

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

...

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 type. It is also possible to pick a solution for the whole group.

Info

The current limit for gathering conflicts is 10,000.

...

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 and FK

  • Generate other types than UUID

  • Optimize using temporary table and/or files rather than the memory

  • Add more types of solutions