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