Class CoreServiceImpl

  • All Implemented Interfaces:
    CoreService

    public class CoreServiceImpl
    extends Object
    implements CoreService
    Implementation of the DMX core service. Embeddable into Java applications.
    • Constructor Detail

      • CoreServiceImpl

        public CoreServiceImpl​(AccessLayer al,
                               org.osgi.framework.BundleContext bundleContext)
        Parameters:
        bundleContext - The context of the DMX Core bundle.
    • Method Detail

      • getTopic

        public Topic getTopic​(long topicId)
        Description copied from interface: CoreService
        Retrieves a topic by ID.
        Specified by:
        getTopic in interface CoreService
        Returns:
        the topic.
      • getTopicByUri

        public Topic getTopicByUri​(String uri)
        Description copied from interface: CoreService
        Retrieves a topic by URI.
        Specified by:
        getTopicByUri in interface CoreService
        Returns:
        the topic, or null if no topic is found.
      • getTopicByValue

        public Topic getTopicByValue​(String typeUri,
                                     SimpleValue value)
        Description copied from interface: CoreService
        Retrieves a single topic by type and exact value. Throws if more than one topic is found. Lucene query syntax (wildcards, phrase search, ...) is not supported. A text search is case-sensitive.
        Specified by:
        getTopicByValue in interface CoreService
        Parameters:
        typeUri - a topic type URI; only topics of this type are searched; mandatory
        value - the value to search for
        Returns:
        the found topic, or null if no topic is found.
      • getTopicsByValue

        public List<Topic> getTopicsByValue​(String typeUri,
                                            SimpleValue value)
        Description copied from interface: CoreService
        Retrieves topics by type and exact value. Lucene query syntax (wildcards, phrase search, ...) is not supported. A text search is case-sensitive.
        Specified by:
        getTopicsByValue in interface CoreService
        Parameters:
        typeUri - a topic type URI; only topics of this type are searched; mandatory
        value - the value to search for
        Returns:
        a list of found topics, may be empty.
      • queryTopics

        public List<Topic> queryTopics​(String typeUri,
                                       String query)
        Description copied from interface: CoreService
        Retrieves topics by type and value. Lucene query syntax is supported. A topic is regarded a hit if the search term matches the topic's entire value (in contrast to a fulltext search). Spaces must be escaped though. Search is case-sensitive.
        Specified by:
        queryTopics in interface CoreService
        Parameters:
        typeUri - a topic type URI; only topics of this type are searched; mandatory
        query - The query. Must be non-empty. Lucene query syntax is supported:
        • "*" matches arbitrary characters
        • "?" matches a single character
        • phrases enclosed in double quotes (")
        • escape special character by preceding with back slash (\)
        • combining search terms by "AND"/"OR" (uppercase required). Default is "OR". "&&" and "||" are respective synonyms.
        Returns:
        a list of found topics, may be empty.
      • queryTopicsFulltext

        public TopicResult queryTopicsFulltext​(String query,
                                               String typeUri,
                                               boolean searchChildTopics)
        Description copied from interface: CoreService
        Performs a fulltext search in topic values and in entire topic trees. Single words are found in entire text-value. Lucene query syntax is supported. Search is case-insensitive.
        Specified by:
        queryTopicsFulltext in interface CoreService
        Parameters:
        query - The search query. Must be non-empty. Lucene query syntax is supported:
        • "*" matches arbitrary characters
        • "?" matches a single character
        • phrases enclosed in double quotes (")
        • escape special character by preceding with back slash (\)
        • combining search terms by "AND"/"OR" (uppercase required). Default is "OR". "&&" and "||" are respective synonyms.
        typeUri - Optional: a topic type URI; only topics of this type are searched. If null all topics are searched.
        If given, all returned topics are of this type (regardless of the "searchChildTopics" setting).
        searchChildTopics - Applicable only if "topicTypeUri" is given (ignored otherwise): if true the topic's child topics are searched as well.
        Example: to search for Persons where "Berlin" appears in *any* child topic pass "dmx.contacts.person" for "topicTypeUri", and set "searchChildTopics" to true.
        Returns:
        a TopicResult object that wraps both the original query parameters and the resulting topic list (may be empty).
      • deleteTopic

        public void deleteTopic​(long topicId)
        Specified by:
        deleteTopic in interface CoreService
      • getAssocs

        public List<Assoc> getAssocs​(long topic1Id,
                                     long topic2Id)
        Description copied from interface: CoreService
        Returns all associations between two topics. If no such association exists an empty list is returned.
        Specified by:
        getAssocs in interface CoreService
      • getAssocs

        public List<Assoc> getAssocs​(long topic1Id,
                                     long topic2Id,
                                     String assocTypeUri)
        Description copied from interface: CoreService
        Returns the associations between two topics. If no such association exists an empty list is returned.
        Specified by:
        getAssocs in interface CoreService
        assocTypeUri - Assoc type filter. Pass null to switch filter off.
      • getAssocBetweenTopicAndTopic

        public Assoc getAssocBetweenTopicAndTopic​(String assocTypeUri,
                                                  long topic1Id,
                                                  long topic2Id,
                                                  String roleTypeUri1,
                                                  String roleTypeUri2)
        Description copied from interface: CoreService
        Returns the association between two topics, qualified by association type and both role types. If no such association exists null is returned. If more than one association exist, a runtime exception is thrown.
        Specified by:
        getAssocBetweenTopicAndTopic in interface CoreService
        Parameters:
        assocTypeUri - Assoc type filter. Pass null to switch filter off.
      • getAssocByValue

        public Assoc getAssocByValue​(String typeUri,
                                     SimpleValue value)
        Description copied from interface: CoreService
        Retrieves a single association by type and exact value. Throws if more than one association is found. Lucene query syntax (wildcards, phrase search, ...) is not supported. A text search is case-sensitive.
        Specified by:
        getAssocByValue in interface CoreService
        Parameters:
        typeUri - an association type URI; only associations of this type are searched; mandatory
        value - the value to search for
        Returns:
        the found association, or null if no association is found.
      • queryAssocs

        public List<Assoc> queryAssocs​(String typeUri,
                                       String query)
        Description copied from interface: CoreService
        Retrieves associations by type and value. Lucene query syntax is supported. An association is regarded a hit if the search term matches the association's entire value (in contrast to a fulltext search). Spaces must be escaped though. Search is case-sensitive.
        Specified by:
        queryAssocs in interface CoreService
        Parameters:
        typeUri - an association type URI; only associations of this type are searched; mandatory
        query - The query. Must be non-empty. Lucene query syntax is supported:
        • "*" matches arbitrary characters
        • "?" matches a single character
        • phrases enclosed in double quotes (")
        • escape special character by preceding with back slash (\)
        • combining search terms by "AND"/"OR" (uppercase required). Default is "OR". "&&" and "||" are respective synonyms.
        Returns:
        a list of found associations, may be empty.
      • deleteAssoc

        public void deleteAssoc​(long assocId)
        Specified by:
        deleteAssoc in interface CoreService
      • getTopicTypeImplicitly

        public systems.dmx.core.impl.TopicTypeImpl getTopicTypeImplicitly​(long topicId)
        Description copied from interface: CoreService
        Acccesses a topic type while enforcing the implicit READ permission. A user has implicit READ permission for the topic type if she has READ permission for the given topic.
        Specified by:
        getTopicTypeImplicitly in interface CoreService
      • getAssocTypeImplicitly

        public systems.dmx.core.impl.AssocTypeImpl getAssocTypeImplicitly​(long assocId)
        Description copied from interface: CoreService
        Acccesses an association type while enforcing the implicit READ permission. A user has implicit READ permission for the association type if she has READ permission for the given association.
        Specified by:
        getAssocTypeImplicitly in interface CoreService
      • getProperty

        public Object getProperty​(long id,
                                  String propUri)
        Description copied from interface: CoreService
        Returns a topic's or association's property value associated with the given property URI. If there's no property value associated with the property URI an exception is thrown.
        Specified by:
        getProperty in interface CoreService
        Parameters:
        id - a topic ID, or an association ID
      • hasProperty

        public boolean hasProperty​(long id,
                                   String propUri)
        Description copied from interface: CoreService
        Checks whether for a given topic or association a property value is associated with a given property URI.
        Specified by:
        hasProperty in interface CoreService
        Parameters:
        id - a topic ID, or an association ID
      • shutdown

        public void shutdown()