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. So far, our approach for handling failures has been to throw an exception and abort the import. But However, this approach is not user-friendly, as most of the failures are recoverable.

...

Table of Contents
stylenone

Conflicts

...

Type

...

Description

...

Solutions

...

AMID

...

  • An object with this AMID already exists

...

  • GENERATE

  • FAIL

...

PK

...

  • An object with this primary key already exists

  • Single PK only for now

...

  • GENERATE

  • SET_BY_USER

  • FAIL

...

UNIQUE

...

  • An object with this value for this field already exists

...

  • GENERATE

  • SET_BY_USER

  • SET_NULL

  • FAIL

...

FVP_UNIQUE

...

Applicable for fields with field value pattern

...

An object with this value for this field already exists

...

The conflicts can be divided into several categories. They are as follows

UNIQUE

Most of the conflicts can be put into this category. This conflict can happen for fields in entities that are marked as UNIQUE. In most cases, this conflict will happen if you try to import an already existing object. An entity can have the following types of unique fields

AMID

Every entity implicitly has a system field called AMID (_amid). This field uniquely identifies an object of a particular entity and project. This field is of type UUID.

Primary Keys

Every entity should have one or more user-defined unique identifiers as well. These fields are marked as primary keys in the entity. These fields can be of any type.

Info

We are considering a single primary key for now

Unique

Entities can have other fields as well which are marked as unique by the user. These can be of any type as well.

FVP Unique

Root entity fields that have a Field Value Pattern associated with them are considered UNIQUE as well.

Example

There is an object of entity A with AMID 821df1d4-3ed8-463e-a9a3-ea841be60f81 in the system. If you try to import this object again or any other object of entity A with the same AMID, this conflict will arise.

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. If you try to import any object of entity A with the identifier A-0001 again, this conflict will arise.

Solutions

  • GENERATE

  • SET_BY_USER

  • SET_NULL

  • FAIL

FK

...

The parent object referred by this field not found

...

Entities can have fields that are used to store links to their parent objects. These fields are called foreign key fields. If any foreign key field contains a link to a parent object that does not exist this conflict will trigger.

Info

Not yet supported

Example

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. In case you are 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, then this conflict will arise.

Solutions

  • SET_NULL

  • FAIL

REQUIRED

...

Entities can have fields that are marked as required, meaning there must be a value present for that field. In case an import does not contain any value for any required field this conflict will happen. AMID and primary key fields are implicitly required.

Example

Entity A has a primary key field id. If the import file for entity A contains an object which has no value set for the field id then this conflict will arise.

Solutions

  • GENERATE

  • SET_BY_USER

  • FAIL

TYPE

...

  • Value type not compatible with the field type

Each field in an entity has a type (UUID, TEXT, etc.). If the provided value type of a field in the import does not match the field type then this conflict will happen.

Example

Entity A has a field id of type integer. if the import file for entity A contains any value for the field id which is not an integer then this conflict will arise.

Solutions

  • GENERATE

  • SET_BY_USER

  • SET_NULL

  • FAIL

LENGTH

...

Applicable for varchar fields with a length set

...

VARCHAR fields can have an optional length property set. This property dictates how long the text value can be. If any value exceeds the length then this conflict will happen.

Example

Entity A has a varchar field name with length 10. If the import file for entity A contains any value for the field name with a length greater than 10 this conflict will arise.

Solutions

  • TRIM_EXTRA

  • SET_BY_USER

  • SET_NULL

  • FAIL

Root System Entity

...

AMID

...

PK

UNIQUE

...

FVP_UNIQUE

...

For the UNIQUE conflict of root system entities (AKTOR, TAG, RESTRICTION) a couple of additional solutions are available.

Example

The system already has an AKTOR with identifikator AKT-0001. If you try to import any data that has an AKTOR with identifikator AKT-0001 this conflict will arise.

Solutions

  • IGNORE

  • REPLACE_WITH_EXISTING

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

  • Applicable only for root system entities

  • 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

...