Class AlfrescoFunctionEvaluationContext

  • All Implemented Interfaces:
    FunctionEvaluationContext

    public class AlfrescoFunctionEvaluationContext
    extends java.lang.Object
    implements FunctionEvaluationContext
    Alfrecso function evaluation context for evaluating FTS expressions against lucene.
    Author:
    andyh
    • Constructor Detail

      • AlfrescoFunctionEvaluationContext

        public AlfrescoFunctionEvaluationContext​(NamespacePrefixResolver namespacePrefixResolver,
                                                 DictionaryService dictionaryService,
                                                 java.lang.String defaultNamespace)
        Parameters:
        namespacePrefixResolver - NamespacePrefixResolver
        dictionaryService - DictionaryService
        defaultNamespace - String
    • Method Detail

      • buildLuceneEquality

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneEquality​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                     java.lang.String propertyName,
                                                                                     java.io.Serializable value,
                                                                                     PredicateMode mode,
                                                                                     LuceneFunction luceneFunction)
                                                                              throws E extends java.lang.Throwable
        Specified by:
        buildLuceneEquality in interface FunctionEvaluationContext
        propertyName - String
        value - Serializable
        mode - PredicateMode
        luceneFunction - LuceneFunction
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneExists

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneExists​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                   java.lang.String propertyName,
                                                                                   java.lang.Boolean not)
                                                                            throws E extends java.lang.Throwable
        Description copied from interface: FunctionEvaluationContext
        Note: null and not null are not required to support functions from the spec
        Specified by:
        buildLuceneExists in interface FunctionEvaluationContext
        propertyName - String
        not - Boolean
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneGreaterThan

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneGreaterThan​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                        java.lang.String propertyName,
                                                                                        java.io.Serializable value,
                                                                                        PredicateMode mode,
                                                                                        LuceneFunction luceneFunction)
                                                                                 throws E extends java.lang.Throwable
        Specified by:
        buildLuceneGreaterThan in interface FunctionEvaluationContext
        propertyName - String
        value - Serializable
        mode - PredicateMode
        luceneFunction - LuceneFunction
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneGreaterThanOrEquals

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneGreaterThanOrEquals​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                                java.lang.String propertyName,
                                                                                                java.io.Serializable value,
                                                                                                PredicateMode mode,
                                                                                                LuceneFunction luceneFunction)
                                                                                         throws E extends java.lang.Throwable
        Specified by:
        buildLuceneGreaterThanOrEquals in interface FunctionEvaluationContext
        propertyName - String
        value - Serializable
        mode - PredicateMode
        luceneFunction - LuceneFunction
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneIn

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneIn​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                               java.lang.String propertyName,
                                                                               java.util.Collection<java.io.Serializable> values,
                                                                               java.lang.Boolean not,
                                                                               PredicateMode mode)
                                                                        throws E extends java.lang.Throwable
        Description copied from interface: FunctionEvaluationContext
        Note: In is not required to support functions from the spec
        Specified by:
        buildLuceneIn in interface FunctionEvaluationContext
        propertyName - String
        not - Boolean
        mode - PredicateMode
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneInequality

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneInequality​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                       java.lang.String propertyName,
                                                                                       java.io.Serializable value,
                                                                                       PredicateMode mode,
                                                                                       LuceneFunction luceneFunction)
                                                                                throws E extends java.lang.Throwable
        Specified by:
        buildLuceneInequality in interface FunctionEvaluationContext
        propertyName - String
        value - Serializable
        mode - PredicateMode
        luceneFunction - LuceneFunction
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneLessThan

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneLessThan​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                     java.lang.String propertyName,
                                                                                     java.io.Serializable value,
                                                                                     PredicateMode mode,
                                                                                     LuceneFunction luceneFunction)
                                                                              throws E extends java.lang.Throwable
        Specified by:
        buildLuceneLessThan in interface FunctionEvaluationContext
        propertyName - String
        value - Serializable
        mode - PredicateMode
        luceneFunction - LuceneFunction
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneLessThanOrEquals

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneLessThanOrEquals​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                             java.lang.String propertyName,
                                                                                             java.io.Serializable value,
                                                                                             PredicateMode mode,
                                                                                             LuceneFunction luceneFunction)
                                                                                      throws E extends java.lang.Throwable
        Specified by:
        buildLuceneLessThanOrEquals in interface FunctionEvaluationContext
        propertyName - String
        value - Serializable
        mode - PredicateMode
        luceneFunction - LuceneFunction
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • buildLuceneLike

        public <Q,​S,​E extends java.lang.Throwable> Q buildLuceneLike​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                 java.lang.String propertyName,
                                                                                 java.io.Serializable value,
                                                                                 java.lang.Boolean not)
                                                                          throws E extends java.lang.Throwable
        Description copied from interface: FunctionEvaluationContext
        Note: Like is not required to support functions from the spec
        Specified by:
        buildLuceneLike in interface FunctionEvaluationContext
        propertyName - String
        value - Serializable
        not - Boolean
        Returns:
        the query
        Throws:
        E
        E extends java.lang.Throwable
      • getLuceneSortField

        public <Q,​S,​E extends java.lang.Throwable> java.lang.String getLuceneSortField​(LuceneQueryParserAdaptor<Q,​S,​E> lqpa,
                                                                                                   java.lang.String propertyName)
                                                                                            throws E extends java.lang.Throwable
        Specified by:
        getLuceneSortField in interface FunctionEvaluationContext
        propertyName - String
        Returns:
        the field used for sorting the given property
        Throws:
        E
        E extends java.lang.Throwable
      • getProperty

        public java.io.Serializable getProperty​(NodeRef nodeRef,
                                                java.lang.String propertyName)
        Description copied from interface: FunctionEvaluationContext
        Get a property
        Specified by:
        getProperty in interface FunctionEvaluationContext
        Parameters:
        nodeRef - NodeRef
        propertyName - String
        Returns:
        the property (at navigation time)
      • getScores

        public java.util.Map<java.lang.String,​java.lang.Float> getScores()
        Specified by:
        getScores in interface FunctionEvaluationContext
        Returns:
        the scores by selector (at navigation time)
      • isObjectId

        public boolean isObjectId​(java.lang.String propertyName)
        Specified by:
        isObjectId in interface FunctionEvaluationContext
        Parameters:
        propertyName - String
        Returns:
        - is this an object id
      • isOrderable

        public boolean isOrderable​(java.lang.String fieldName)
        Specified by:
        isOrderable in interface FunctionEvaluationContext
        Parameters:
        fieldName - String
        Returns:
        Is this property orderable
      • isQueryable

        public boolean isQueryable​(java.lang.String fieldName)
        Specified by:
        isQueryable in interface FunctionEvaluationContext
        Parameters:
        fieldName - String
        Returns:
        is this property queryable
      • getLuceneFieldName

        public java.lang.String getLuceneFieldName​(java.lang.String propertyName)
        Specified by:
        getLuceneFieldName in interface FunctionEvaluationContext
        Parameters:
        propertyName - String
        Returns:
        the lucene field name for the property
      • stripSuffixes

        public QName stripSuffixes​(QName qname)