1   /*
2    * SPDX-FileCopyrightText: none
3    * SPDX-License-Identifier: CC0-1.0
4    */
5   
6   package gov.nist.secauto.metaschema.core.mdm.impl;
7   
8   import gov.nist.secauto.metaschema.core.metapath.StaticContext;
9   import gov.nist.secauto.metaschema.core.metapath.item.atomic.IAnyAtomicItem;
10  import gov.nist.secauto.metaschema.core.metapath.item.node.IAssemblyNodeItem;
11  import gov.nist.secauto.metaschema.core.metapath.item.node.INodeItem;
12  import gov.nist.secauto.metaschema.core.model.IFieldDefinition;
13  import gov.nist.secauto.metaschema.core.model.IFieldInstance;
14  
15  import edu.umd.cs.findbugs.annotations.NonNull;
16  
17  /**
18   * A Metapath field node item that is orphaned from a document-based data model.
19   */
20  public class DefinitionFieldNodeItem
21      extends AbstractDMFieldNodeItem {
22    @NonNull
23    private final IFieldDefinition definition;
24    @NonNull
25    private final StaticContext staticContext;
26  
27    /**
28     * Construct a new node item.
29     *
30     * @param definition
31     *          the Metaschema module definition associated with this node
32     * @param value
33     *          the initial field value
34     * @param staticContext
35     *          the static context to use when evaluating Metapath expressions
36     *          against this node
37     */
38    public DefinitionFieldNodeItem(
39        @NonNull IFieldDefinition definition,
40        @NonNull IAnyAtomicItem value,
41        @NonNull StaticContext staticContext) {
42      super(value);
43      this.definition = definition;
44      this.staticContext = staticContext;
45    }
46  
47    @Override
48    public int getPosition() {
49      return 1;
50    }
51  
52    @Override
53    public INodeItem getParentNodeItem() {
54      // always null
55      return null;
56    }
57  
58    @Override
59    public IAssemblyNodeItem getParentContentNodeItem() {
60      // always null
61      return null;
62    }
63  
64    @Override
65    public IFieldDefinition getDefinition() {
66      return definition;
67    }
68  
69    @Override
70    public IFieldInstance getInstance() {
71      // always null
72      return null;
73    }
74  
75    @Override
76    public StaticContext getStaticContext() {
77      return staticContext;
78    }
79  }