Package systems.dmx.core.impl
Class CoreServiceImpl
- java.lang.Object
-
- systems.dmx.core.impl.CoreServiceImpl
-
- All Implemented Interfaces:
CoreService
public class CoreServiceImpl extends Object implements CoreService
Implementation of the DMX core service. Embeddable into Java applications.
-
-
Constructor Summary
Constructors Constructor Description CoreServiceImpl(AccessLayer al, org.osgi.framework.BundleContext bundleContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAssocPropertyIndex(String propUri)
void
addTopicPropertyIndex(String propUri)
DMXTransaction
beginTx()
systems.dmx.core.impl.AssocImpl
createAssoc(AssocModel model)
systems.dmx.core.impl.AssocTypeImpl
createAssocType(AssocTypeModel model)
RoleType
createRoleType(RoleTypeModel model)
systems.dmx.core.impl.TopicImpl
createTopic(TopicModel model)
systems.dmx.core.impl.TopicTypeImpl
createTopicType(TopicTypeModel model)
void
deleteAssoc(long assocId)
void
deleteAssocType(String assocTypeUri)
void
deleteTopic(long topicId)
void
deleteTopicType(String topicTypeUri)
void
dispatchEvent(String pluginUri, DMXEvent event, Object... params)
void
fireEvent(DMXEvent event, Object... params)
Iterable<Assoc>
getAllAssocs()
List<AssocType>
getAllAssocTypes()
List<RoleType>
getAllRoleTypes()
Iterable<Topic>
getAllTopics()
List<TopicType>
getAllTopicTypes()
Assoc
getAssoc(long assocId)
Assoc
getAssocBetweenTopicAndAssoc(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
Assoc
getAssocBetweenTopicAndTopic(String assocTypeUri, long topic1Id, long topic2Id, String roleTypeUri1, String roleTypeUri2)
Returns the association between two topics, qualified by association type and both role types.Assoc
getAssocByValue(String typeUri, SimpleValue value)
Retrieves a single association by type and exact value.List<Assoc>
getAssocs(long topic1Id, long topic2Id)
Returns all associations between two topics.List<Assoc>
getAssocs(long topic1Id, long topic2Id, String assocTypeUri)
Returns the associations between two topics.List<Assoc>
getAssocsByProperty(String propUri, Object propValue)
List<Assoc>
getAssocsByPropertyRange(String propUri, Number from, Number to)
List<Assoc>
getAssocsByRoleType(String roleTypeUri)
List<Assoc>
getAssocsByType(String assocTypeUri)
systems.dmx.core.impl.AssocTypeImpl
getAssocType(String uri)
systems.dmx.core.impl.AssocTypeImpl
getAssocTypeImplicitly(long assocId)
Acccesses an association type while enforcing the implicit READ permission.Object
getDatabaseVendorObject()
ModelFactory
getModelFactory()
DMXObject
getObject(long id)
List<PlayerModel>
getPlayerModels(long assocId)
PluginImpl
getPlugin(String pluginUri)
List<PluginInfo>
getPluginInfo()
PrivilegedAccess
getPrivilegedAccess()
Object
getProperty(long id, String propUri)
Returns a topic's or association's property value associated with the given property URI.RoleType
getRoleType(String roleTypeUri)
RoleType
getRoleTypeImplicitly(long assocId, String roleTypeUri)
Topic
getTopic(long topicId)
Retrieves a topic by ID.Topic
getTopicByUri(String uri)
Retrieves a topic by URI.Topic
getTopicByValue(String typeUri, SimpleValue value)
Retrieves a single topic by type and exact value.List<Topic>
getTopicsByProperty(String propUri, Object propValue)
List<Topic>
getTopicsByPropertyRange(String propUri, Number from, Number to)
List<Topic>
getTopicsByType(String topicTypeUri)
List<Topic>
getTopicsByValue(String typeUri, SimpleValue value)
Retrieves topics by type and exact value.systems.dmx.core.impl.TopicTypeImpl
getTopicType(String uri)
systems.dmx.core.impl.TopicTypeImpl
getTopicTypeImplicitly(long topicId)
Acccesses a topic type while enforcing the implicit READ permission.WebSocketServiceImpl
getWebSocketService()
boolean
hasProperty(long id, String propUri)
Checks whether for a given topic or association a property value is associated with a given property URI.void
indexTopicFulltext(long topicId, String text, String indexKey)
QueryResult
query(String topicQuery, String topicTypeUri, boolean searchTopicChildren, String assocQuery, String assocTypeUri, boolean searchAssocChildren)
List<Assoc>
queryAssocs(String typeUri, String query)
Retrieves associations by type and value.List<Topic>
queryTopics(String typeUri, String query)
Retrieves topics by type and value.TopicResult
queryTopicsFulltext(String query, String typeUri, boolean searchChildTopics)
Performs a fulltext search in topic values and in entire topic trees.void
shutdown()
void
updateAssoc(AssocModel updateModel)
void
updateAssocType(AssocTypeModel updateModel)
systems.dmx.core.impl.TopicImpl
updateTopic(TopicModel updateModel)
void
updateTopicType(TopicTypeModel updateModel)
-
-
-
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 interfaceCoreService
- Returns:
- the topic.
-
getTopicByUri
public Topic getTopicByUri(String uri)
Description copied from interface:CoreService
Retrieves a topic by URI.- Specified by:
getTopicByUri
in interfaceCoreService
- Returns:
- the topic, or
null
if no topic is found.
-
getTopicsByType
public List<Topic> getTopicsByType(String topicTypeUri)
- Specified by:
getTopicsByType
in interfaceCoreService
-
getAllTopics
public Iterable<Topic> getAllTopics()
- Specified by:
getAllTopics
in interfaceCoreService
-
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 interfaceCoreService
- Parameters:
typeUri
- a topic type URI; only topics of this type are searched; mandatoryvalue
- 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 interfaceCoreService
- Parameters:
typeUri
- a topic type URI; only topics of this type are searched; mandatoryvalue
- 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 interfaceCoreService
- Parameters:
typeUri
- a topic type URI; only topics of this type are searched; mandatoryquery
- 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 interfaceCoreService
- 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).
-
indexTopicFulltext
public void indexTopicFulltext(long topicId, String text, String indexKey)
- Specified by:
indexTopicFulltext
in interfaceCoreService
-
createTopic
public systems.dmx.core.impl.TopicImpl createTopic(TopicModel model)
- Specified by:
createTopic
in interfaceCoreService
-
updateTopic
public systems.dmx.core.impl.TopicImpl updateTopic(TopicModel updateModel)
- Specified by:
updateTopic
in interfaceCoreService
-
deleteTopic
public void deleteTopic(long topicId)
- Specified by:
deleteTopic
in interfaceCoreService
-
getAssoc
public Assoc getAssoc(long assocId)
- Specified by:
getAssoc
in interfaceCoreService
-
getPlayerModels
public List<PlayerModel> getPlayerModels(long assocId)
- Specified by:
getPlayerModels
in interfaceCoreService
-
getAssocsByType
public List<Assoc> getAssocsByType(String assocTypeUri)
- Specified by:
getAssocsByType
in interfaceCoreService
-
getAssocsByRoleType
public List<Assoc> getAssocsByRoleType(String roleTypeUri)
- Specified by:
getAssocsByRoleType
in interfaceCoreService
-
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 interfaceCoreService
-
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 interfaceCoreService
assocTypeUri
- Assoc type filter. Passnull
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 existsnull
is returned. If more than one association exist, a runtime exception is thrown.- Specified by:
getAssocBetweenTopicAndTopic
in interfaceCoreService
- Parameters:
assocTypeUri
- Assoc type filter. Passnull
to switch filter off.
-
getAssocBetweenTopicAndAssoc
public Assoc getAssocBetweenTopicAndAssoc(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
- Specified by:
getAssocBetweenTopicAndAssoc
in interfaceCoreService
-
getAllAssocs
public Iterable<Assoc> getAllAssocs()
- Specified by:
getAllAssocs
in interfaceCoreService
-
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 interfaceCoreService
- Parameters:
typeUri
- an association type URI; only associations of this type are searched; mandatoryvalue
- 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 interfaceCoreService
- Parameters:
typeUri
- an association type URI; only associations of this type are searched; mandatoryquery
- 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.
-
createAssoc
public systems.dmx.core.impl.AssocImpl createAssoc(AssocModel model)
- Specified by:
createAssoc
in interfaceCoreService
-
updateAssoc
public void updateAssoc(AssocModel updateModel)
- Specified by:
updateAssoc
in interfaceCoreService
-
deleteAssoc
public void deleteAssoc(long assocId)
- Specified by:
deleteAssoc
in interfaceCoreService
-
getTopicType
public systems.dmx.core.impl.TopicTypeImpl getTopicType(String uri)
- Specified by:
getTopicType
in interfaceCoreService
-
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 interfaceCoreService
-
getAllTopicTypes
public List<TopicType> getAllTopicTypes()
- Specified by:
getAllTopicTypes
in interfaceCoreService
-
createTopicType
public systems.dmx.core.impl.TopicTypeImpl createTopicType(TopicTypeModel model)
- Specified by:
createTopicType
in interfaceCoreService
-
updateTopicType
public void updateTopicType(TopicTypeModel updateModel)
- Specified by:
updateTopicType
in interfaceCoreService
-
deleteTopicType
public void deleteTopicType(String topicTypeUri)
- Specified by:
deleteTopicType
in interfaceCoreService
-
getAssocType
public systems.dmx.core.impl.AssocTypeImpl getAssocType(String uri)
- Specified by:
getAssocType
in interfaceCoreService
-
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 interfaceCoreService
-
getAllAssocTypes
public List<AssocType> getAllAssocTypes()
- Specified by:
getAllAssocTypes
in interfaceCoreService
-
createAssocType
public systems.dmx.core.impl.AssocTypeImpl createAssocType(AssocTypeModel model)
- Specified by:
createAssocType
in interfaceCoreService
-
updateAssocType
public void updateAssocType(AssocTypeModel updateModel)
- Specified by:
updateAssocType
in interfaceCoreService
-
deleteAssocType
public void deleteAssocType(String assocTypeUri)
- Specified by:
deleteAssocType
in interfaceCoreService
-
getRoleType
public RoleType getRoleType(String roleTypeUri)
- Specified by:
getRoleType
in interfaceCoreService
-
getRoleTypeImplicitly
public RoleType getRoleTypeImplicitly(long assocId, String roleTypeUri)
- Specified by:
getRoleTypeImplicitly
in interfaceCoreService
-
getAllRoleTypes
public List<RoleType> getAllRoleTypes()
- Specified by:
getAllRoleTypes
in interfaceCoreService
-
createRoleType
public RoleType createRoleType(RoleTypeModel model)
- Specified by:
createRoleType
in interfaceCoreService
-
getObject
public DMXObject getObject(long id)
- Specified by:
getObject
in interfaceCoreService
-
query
public QueryResult query(String topicQuery, String topicTypeUri, boolean searchTopicChildren, String assocQuery, String assocTypeUri, boolean searchAssocChildren)
- Specified by:
query
in interfaceCoreService
-
getPlugin
public PluginImpl getPlugin(String pluginUri)
- Specified by:
getPlugin
in interfaceCoreService
-
getPluginInfo
public List<PluginInfo> getPluginInfo()
- Specified by:
getPluginInfo
in interfaceCoreService
-
fireEvent
public void fireEvent(DMXEvent event, Object... params)
- Specified by:
fireEvent
in interfaceCoreService
-
dispatchEvent
public void dispatchEvent(String pluginUri, DMXEvent event, Object... params)
- Specified by:
dispatchEvent
in interfaceCoreService
-
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 interfaceCoreService
- 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 interfaceCoreService
- Parameters:
id
- a topic ID, or an association ID
-
getTopicsByProperty
public List<Topic> getTopicsByProperty(String propUri, Object propValue)
- Specified by:
getTopicsByProperty
in interfaceCoreService
-
getTopicsByPropertyRange
public List<Topic> getTopicsByPropertyRange(String propUri, Number from, Number to)
- Specified by:
getTopicsByPropertyRange
in interfaceCoreService
-
getAssocsByProperty
public List<Assoc> getAssocsByProperty(String propUri, Object propValue)
- Specified by:
getAssocsByProperty
in interfaceCoreService
-
getAssocsByPropertyRange
public List<Assoc> getAssocsByPropertyRange(String propUri, Number from, Number to)
- Specified by:
getAssocsByPropertyRange
in interfaceCoreService
-
addTopicPropertyIndex
public void addTopicPropertyIndex(String propUri)
- Specified by:
addTopicPropertyIndex
in interfaceCoreService
-
addAssocPropertyIndex
public void addAssocPropertyIndex(String propUri)
- Specified by:
addAssocPropertyIndex
in interfaceCoreService
-
beginTx
public DMXTransaction beginTx()
- Specified by:
beginTx
in interfaceCoreService
-
getModelFactory
public ModelFactory getModelFactory()
- Specified by:
getModelFactory
in interfaceCoreService
-
getPrivilegedAccess
public PrivilegedAccess getPrivilegedAccess()
- Specified by:
getPrivilegedAccess
in interfaceCoreService
-
getWebSocketService
public WebSocketServiceImpl getWebSocketService()
- Specified by:
getWebSocketService
in interfaceCoreService
-
getDatabaseVendorObject
public Object getDatabaseVendorObject()
- Specified by:
getDatabaseVendorObject
in interfaceCoreService
-
shutdown
public void shutdown()
-
-