Class TemplateQueryContext

    • Constructor Detail

      • TemplateQueryContext

        protected TemplateQueryContext()
        Cons for internal/tests use, generally subclasses shall not call it.
    • Method Detail

      • getNode

        public SNode getNode()
        'node' mapping
      • getInputNode

        public SNode getInputNode()
      • getOutputNode

        public SNode getOutputNode()
      • getInputModel

        public SModel getInputModel()
      • getOutputModel

        public SModel getOutputModel()
      • getOriginalInputModel

        public SModel getOriginalInputModel()
      • getOutputNodeByMappingLabel

        @Nullable
        public SNode getOutputNodeByMappingLabel​(String label,
                                                 @Nullable
                                                 SModel inputModel)
        Find out conditional root with a given ML, created from specified model
        Parameters:
        label - generally shall not be null, as it's required in GenerationContextOp_GetOutputByLabel
        inputModel - can be null, which indicates current input model. Otherwise, a model root was created from
        Returns:
        a node in a transient/checkpoint model if generator has any recorded.
        Since:
        3.4
      • getOutputNodeByInputNodeAndMappingLabel

        public SNode getOutputNodeByInputNodeAndMappingLabel​(SNode inputNode,
                                                             String label)
      • getAllOutputNodesByInputNodeAndMappingLabel

        public List<SNode> getAllOutputNodesByInputNodeAndMappingLabel​(SNode inputNode,
                                                                       String label)
      • registerMappingLabel

        public void registerMappingLabel​(SNode inputNode,
                                         String mappingName,
                                         SNode outputNode)
      • getCopiedOutputNodeForInputNode

        public SNode getCopiedOutputNodeForInputNode​(SNode inputNode)
      • getPreviousInputNodeByMappingLabel

        public SNode getPreviousInputNodeByMappingLabel​(String label)
      • getOriginalCopiedInputNode

        public SNode getOriginalCopiedInputNode​(SNode node)
      • createUniqueName

        public String createUniqueName​(String baseName,
                                       SNode contextNode)
        Parameters:
        baseName - prefix
        contextNode - optional extra context node. Contributes (if a named node) a name fragment to further distinguish names, holds used names (IOW, defines name visibility context). If no contextNode is specified, scope is global.
        Returns:
        value baseName[_hash(contextNode)][_hash(getInputNode())][_counter]
      • createIndexedName

        public String createIndexedName​(String baseName,
                                        SNode contextNode,
                                        boolean noIndexForFirst)
        Parameters:
        baseName - prefix the name sequence would share
        contextNode - optional context node to keep last used index for baseName.null means global (i.e. session) context.
        noIndexForFirst - if true, the first value returned would be "baseName", second "baseName1", etc. When false, all names would get index, starting from 0.
        Returns:
        baseName[counter]
      • getTransientObject

        public Object getTransientObject​(Object key)
      • getPatternVariable

        public Object getPatternVariable​(String name)
      • getGenerationParameter

        public Object getGenerationParameter​(String name)
      • getStepObject

        public Object getStepObject​(Object key)
      • getSessionObject

        public Object getSessionObject​(Object key)
      • showInformationMessage

        public void showInformationMessage​(SNode node,
                                           String message)
      • showWarningMessage

        public void showWarningMessage​(SNode node,
                                       String message)
      • showErrorMessage

        public void showErrorMessage​(SNode node,
                                     String message)
      • getTemplateReference

        @Nullable
        public final SNodeReference getTemplateReference()
        Returns:
        context template node where the query is evaluated, if known.
      • getTemplateNodeRef

        @Nullable
        protected SNodeReference getTemplateNodeRef()
        Returns:
        context template node where the query is evaluated
      • getRuleNode

        @Nullable
        protected SNodeReference getRuleNode()
        Returns:
        context rule, where query is being evaluated, if available