1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package dev.metaschema.oscal.lib.profile.resolver.support;
7   
8   import java.net.URI;
9   
10  import dev.metaschema.core.metapath.item.node.IModelNodeItem;
11  import edu.umd.cs.findbugs.annotations.NonNull;
12  
13  public interface IEntityItem {
14  
15    enum ItemType {
16      ROLE(false),
17      LOCATION(true),
18      PARTY(true),
19      GROUP(false),
20      CONTROL(false),
21      PART(false),
22      PARAMETER(false),
23      RESOURCE(true);
24  
25      private final boolean uuid;
26  
27      ItemType(boolean isUuid) {
28        this.uuid = isUuid;
29      }
30  
31      public boolean isUuid() {
32        return uuid;
33      }
34    }
35  
36    /**
37     * Get the identifier originally assigned to this entity.
38     * <p>
39     * If the identifier value was reassigned, the return value of this method will
40     * be different than value returned by {@link #getIdentifier()}. In such cases,
41     * a call to {@link #isIdentifierReassigned()} is expected to return
42     * {@code true}.
43     * <p>
44     * If the value was not reassigned, the return value of this method will be the
45     * same value returned by {@link #getIdentifier()}. In this case,
46     * {@link #isIdentifierReassigned()} is expected to return {@code false}.
47     *
48     * @return the original identifier value before reassignment
49     */
50    @NonNull
51    String getOriginalIdentifier();
52  
53    /**
54     * Get the entity's current identifier value.
55     *
56     * @return the identifier value
57     */
58    @NonNull
59    String getIdentifier();
60  
61    /**
62     * Determine if the identifier was reassigned.
63     *
64     * @return {@code true} if the identifier was reassigned, or {@code false}
65     *         otherwise
66     */
67    boolean isIdentifierReassigned();
68  
69    @NonNull
70    IModelNodeItem<?, ?> getInstance();
71  
72    void setInstance(@NonNull IModelNodeItem<?, ?> item);
73  
74    @NonNull
75    <T> T getInstanceValue();
76  
77    @NonNull
78    ItemType getItemType();
79  
80    @NonNull
81    URI getSource();
82  
83    int getReferenceCount();
84  
85    void incrementReferenceCount();
86  
87    int resetReferenceCount();
88  }