Package systems.dmx.core.service
Interface CoreService
-
- All Known Implementing Classes:
CoreServiceImpl
public interface CoreService
The DMX Core Service provides generic database operations (create, retrieve, update, delete) to deal with the DMX Core objects: Topics, Associations, Topic Types, Association Types.Inside the
PluginActivator
andMigration
(sub)classes an instance of the DMX Core Service is available as thedmx
object.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addAssocPropertyIndex(String propUri)
void
addTopicPropertyIndex(String propUri)
DMXTransaction
beginTx()
Assoc
createAssoc(AssocModel model)
AssocType
createAssocType(AssocTypeModel model)
RoleType
createRoleType(RoleTypeModel model)
Topic
createTopic(TopicModel model)
TopicType
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)
AssocType
getAssocType(String assocTypeUri)
AssocType
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)
Plugin
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.TopicType
getTopicType(String topicTypeUri)
TopicType
getTopicTypeImplicitly(long topicId)
Acccesses a topic type while enforcing the implicit READ permission.WebSocketService
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
updateAssoc(AssocModel updateModel)
void
updateAssocType(AssocTypeModel updateModel)
Topic
updateTopic(TopicModel updateModel)
void
updateTopicType(TopicTypeModel updateModel)
-
-
-
Method Detail
-
getTopic
Topic getTopic(long topicId)
Retrieves a topic by ID.- Returns:
- the topic.
- Throws:
RuntimeException
- if no topic is found.
-
getTopicByUri
Topic getTopicByUri(String uri)
Retrieves a topic by URI.- Returns:
- the topic, or
null
if no topic is found.
-
getTopicByValue
Topic getTopicByValue(String typeUri, SimpleValue value)
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.- 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. - Throws:
RuntimeException
- If more than one topic is found.RuntimeException
- If null is given for "typeUri".
-
getTopicsByValue
List<Topic> getTopicsByValue(String typeUri, SimpleValue value)
Retrieves topics by type and exact value. Lucene query syntax (wildcards, phrase search, ...) is not supported. A text search is case-sensitive.- 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.
- Throws:
RuntimeException
- If null is given for "typeUri".
-
queryTopics
List<Topic> queryTopics(String typeUri, String query)
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.- 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.
- Throws:
RuntimeException
- If null is given for "typeUri".
-
queryTopicsFulltext
TopicResult queryTopicsFulltext(String query, String typeUri, boolean searchChildTopics)
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.- 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).
-
createTopic
Topic createTopic(TopicModel model)
-
updateTopic
Topic updateTopic(TopicModel updateModel)
-
deleteTopic
void deleteTopic(long topicId)
-
getAssoc
Assoc getAssoc(long assocId)
-
getPlayerModels
List<PlayerModel> getPlayerModels(long assocId)
-
getAssocs
List<Assoc> getAssocs(long topic1Id, long topic2Id)
Returns all associations between two topics. If no such association exists an empty list is returned.
-
getAssocs
List<Assoc> getAssocs(long topic1Id, long topic2Id, String assocTypeUri)
Returns the associations between two topics. If no such association exists an empty list is returned.- Parameters:
assocTypeUri
- Assoc type filter. Passnull
to switch filter off.
-
getAssocBetweenTopicAndTopic
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. If no such association existsnull
is returned. If more than one association exist, a runtime exception is thrown.- Parameters:
assocTypeUri
- Assoc type filter. Passnull
to switch filter off.
-
getAssocBetweenTopicAndAssoc
Assoc getAssocBetweenTopicAndAssoc(String assocTypeUri, long topicId, long assocId, String topicRoleTypeUri, String assocRoleTypeUri)
-
getAssocByValue
Assoc getAssocByValue(String typeUri, SimpleValue value)
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.- 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. - Throws:
RuntimeException
- If more than one association is found.RuntimeException
- If null is given for "typeUri".
-
queryAssocs
List<Assoc> queryAssocs(String typeUri, String query)
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.- 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.
- Throws:
RuntimeException
- If null is given for "typeUri".
-
createAssoc
Assoc createAssoc(AssocModel model)
-
updateAssoc
void updateAssoc(AssocModel updateModel)
-
deleteAssoc
void deleteAssoc(long assocId)
-
getTopicTypeImplicitly
TopicType getTopicTypeImplicitly(long topicId)
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.
-
createTopicType
TopicType createTopicType(TopicTypeModel model)
-
updateTopicType
void updateTopicType(TopicTypeModel updateModel)
-
deleteTopicType
void deleteTopicType(String topicTypeUri)
-
getAssocTypeImplicitly
AssocType getAssocTypeImplicitly(long assocId)
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.
-
createAssocType
AssocType createAssocType(AssocTypeModel model)
-
updateAssocType
void updateAssocType(AssocTypeModel updateModel)
-
deleteAssocType
void deleteAssocType(String assocTypeUri)
-
createRoleType
RoleType createRoleType(RoleTypeModel model)
-
getObject
DMXObject getObject(long id)
-
query
QueryResult query(String topicQuery, String topicTypeUri, boolean searchTopicChildren, String assocQuery, String assocTypeUri, boolean searchAssocChildren)
-
getPluginInfo
List<PluginInfo> getPluginInfo()
-
getProperty
Object getProperty(long id, String propUri)
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.- Parameters:
id
- a topic ID, or an association ID
-
hasProperty
boolean hasProperty(long id, String propUri)
Checks whether for a given topic or association a property value is associated with a given property URI.- Parameters:
id
- a topic ID, or an association ID
-
getTopicsByPropertyRange
List<Topic> getTopicsByPropertyRange(String propUri, Number from, Number to)
-
getAssocsByPropertyRange
List<Assoc> getAssocsByPropertyRange(String propUri, Number from, Number to)
-
addTopicPropertyIndex
void addTopicPropertyIndex(String propUri)
-
addAssocPropertyIndex
void addAssocPropertyIndex(String propUri)
-
beginTx
DMXTransaction beginTx()
-
getModelFactory
ModelFactory getModelFactory()
-
getPrivilegedAccess
PrivilegedAccess getPrivilegedAccess()
-
getWebSocketService
WebSocketService getWebSocketService()
-
getDatabaseVendorObject
Object getDatabaseVendorObject()
-
-