io.evitadb.api.requestResponse.schema.EvolutionMode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of evita_api Show documentation
Show all versions of evita_api Show documentation
Module contains external API of the evitaDB.
/*
*
* _ _ ____ ____
* _____ _(_) |_ __ _| _ \| __ )
* / _ \ \ / / | __/ _` | | | | _ \
* | __/\ V /| | || (_| | |_| | |_) |
* \___| \_/ |_|\__\__,_|____/|____/
*
* Copyright (c) 2023
*
* Licensed under the Business Source License, Version 1.1 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://github.com/FgForrest/evitaDB/blob/master/LICENSE
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.evitadb.api.requestResponse.schema;
import io.evitadb.api.requestResponse.data.structure.EntityReference;
import io.evitadb.api.requestResponse.data.structure.Reference;
/**
* Evolution mode allows to specify how strict is evitaDB when unknown information is presented to her for the first
* time. When no evolution mode is set, each violation of the {@link EntitySchemaContract} is
* reported by an exception. This behaviour can be changed by this evolution mode, however.
*
* @author Jan Novotný ([email protected]), FG Forrest a.s. (c) 2021
*/
public enum EvolutionMode {
/**
* When first entity is inserted in the collection - primary key generation will automatically adapt whether
* this first entity has the primary key already present or not. If it is present all other entities are expected
* to have also primary key provided from external systems, if not primary keys will be always automatically
* generated by Evita and may never be provided from outside.
*/
ADAPT_PRIMARY_KEY_GENERATION,
/**
* When new attribute is encountered, it is silently added to a collection schema as non-filterable, non-sortable,
* non-unique attribute of the type that was used for the first value. Localizability of the attribute is determined
* by the fact whether the first value encountered was associated with any {@link java.util.Locale}.
*/
ADDING_ATTRIBUTES,
/**
* When new associated data is encountered, it is silently added to a collection schema. Localizability of
* the associated data is determined by the fact whether the first value encountered was associated with any
* {@link java.util.Locale}.
*/
ADDING_ASSOCIATED_DATA,
/**
* When new reference type is encountered, it is silently added. It's linked to other evitaDB entity when
* the {@link Reference#getReferencedEntityType()} or {@link Reference#getGroup()} respectively matches by
* {@link EntityReference#getType()} any existing entity collection. Reference is not indexed, nor
* hierarchy indexed by default and this must be changed by updating the schema.
*/
ADDING_REFERENCES,
/**
* When entity has no prices and new price is encountered, it is silently added. That means that entity type
* starts supporting prices when first price has been added.
*/
ADDING_PRICES,
/**
* When new locale is encountered, it is silently added.
*/
ADDING_LOCALES,
/**
* When new currency is encountered in prices, it is silently added.
*/
ADDING_CURRENCIES,
/**
* When hierarchy placement for the entity is encountered, it is silently added.
*/
ADDING_HIERARCHY
}