001/* 002 * SPDX-FileCopyrightText: none 003 * SPDX-License-Identifier: CC0-1.0 004 */ 005 006package dev.metaschema.oscal.lib.profile.resolver.support; 007 008import java.net.URI; 009 010import dev.metaschema.core.metapath.item.node.IModelNodeItem; 011import edu.umd.cs.findbugs.annotations.NonNull; 012 013public interface IEntityItem { 014 015 enum ItemType { 016 ROLE(false), 017 LOCATION(true), 018 PARTY(true), 019 GROUP(false), 020 CONTROL(false), 021 PART(false), 022 PARAMETER(false), 023 RESOURCE(true); 024 025 private final boolean uuid; 026 027 ItemType(boolean isUuid) { 028 this.uuid = isUuid; 029 } 030 031 public boolean isUuid() { 032 return uuid; 033 } 034 } 035 036 /** 037 * Get the identifier originally assigned to this entity. 038 * <p> 039 * If the identifier value was reassigned, the return value of this method will 040 * be different than value returned by {@link #getIdentifier()}. In such cases, 041 * a call to {@link #isIdentifierReassigned()} is expected to return 042 * {@code true}. 043 * <p> 044 * If the value was not reassigned, the return value of this method will be the 045 * same value returned by {@link #getIdentifier()}. In this case, 046 * {@link #isIdentifierReassigned()} is expected to return {@code false}. 047 * 048 * @return the original identifier value before reassignment 049 */ 050 @NonNull 051 String getOriginalIdentifier(); 052 053 /** 054 * Get the entity's current identifier value. 055 * 056 * @return the identifier value 057 */ 058 @NonNull 059 String getIdentifier(); 060 061 /** 062 * Determine if the identifier was reassigned. 063 * 064 * @return {@code true} if the identifier was reassigned, or {@code false} 065 * otherwise 066 */ 067 boolean isIdentifierReassigned(); 068 069 @NonNull 070 IModelNodeItem<?, ?> getInstance(); 071 072 void setInstance(@NonNull IModelNodeItem<?, ?> item); 073 074 @NonNull 075 <T> T getInstanceValue(); 076 077 @NonNull 078 ItemType getItemType(); 079 080 @NonNull 081 URI getSource(); 082 083 int getReferenceCount(); 084 085 void incrementReferenceCount(); 086 087 int resetReferenceCount(); 088}