1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.core.model.constraint.impl;
7   
8   import java.util.List;
9   import java.util.Map;
10  import java.util.Set;
11  
12  import dev.metaschema.core.datatype.markup.MarkupLine;
13  import dev.metaschema.core.datatype.markup.MarkupMultiline;
14  import dev.metaschema.core.metapath.IMetapathExpression;
15  import dev.metaschema.core.model.IAttributable;
16  import dev.metaschema.core.model.ISource;
17  import dev.metaschema.core.model.constraint.IKeyField;
18  import dev.metaschema.core.model.constraint.IUniqueConstraint;
19  import edu.umd.cs.findbugs.annotations.NonNull;
20  import edu.umd.cs.findbugs.annotations.Nullable;
21  
22  /**
23   * Represents a key-based constraint that requires unique keys.
24   * <p>
25   * Uses a set of key fields to build a key used to identify non-unique items.
26   * Each derived key must be unique.
27   */
28  public class DefaultUniqueConstraint
29      extends AbstractKeyConstraint
30      implements IUniqueConstraint {
31  
32    /**
33     * Construct a new key-based constraint.
34     *
35     * @param id
36     *          the optional identifier for the constraint
37     * @param formalName
38     *          the constraint's formal name or {@code null} if not provided
39     * @param description
40     *          the constraint's semantic description or {@code null} if not
41     *          provided
42     * @param source
43     *          information about the constraint source
44     * @param level
45     *          the significance of a violation of this constraint
46     * @param target
47     *          the Metapath expression identifying the nodes the constraint targets
48     * @param properties
49     *          a collection of associated properties
50     * @param keyFields
51     *          a list of key fields associated with the constraint
52     * @param message
53     *          an optional message to emit when the constraint is violated
54     * @param remarks
55     *          optional remarks describing the intent of the constraint
56     */
57    public DefaultUniqueConstraint(
58        @Nullable String id,
59        @Nullable String formalName,
60        @Nullable MarkupLine description,
61        @NonNull ISource source,
62        @NonNull Level level,
63        @NonNull IMetapathExpression target,
64        @NonNull Map<IAttributable.Key, Set<String>> properties,
65        @NonNull List<IKeyField> keyFields,
66        @Nullable String message,
67        @Nullable MarkupMultiline remarks) {
68      super(id, formalName, description, source, level, target, properties, keyFields, message, remarks);
69    }
70  
71  }