public class TaggingPlugin extends PluginActivator implements TaggingService
Modifier and Type | Field and Description |
---|---|
private static String |
AGGREGATION |
private static String |
CHILD_URI |
private Logger |
log |
private static String |
PARENT_URI |
static String |
VIEW_CSS_CLASS_COUNT_URI |
static String |
VIEW_RELATED_COUNT_URI |
private WorkspacesService |
workspaceService |
bundle, dms
TAG_DEFINITION_URI, TAG_LABEL_URI, TAG_URI
Constructor and Description |
---|
TaggingPlugin() |
Modifier and Type | Method and Description |
---|---|
Topic |
createTagTopic(String name,
String definition,
boolean lowerCase)
Creates a topic of type "dm4.tags.tag" after checking for existence by name and trimming the name.
|
private void |
enrichTopicViewModelAboutCSSClass(Topic resource,
int related_count) |
private void |
enrichTopicViewModelAboutRelatedCount(Topic resource,
int count)
Private Helper Methods
|
Topic |
getTagTopic(String name,
boolean caseSensitive)
Returns a topic (typeUri="dm4.tags.tag") with the given name.
|
ResultList<RelatedTopic> |
getTopicsByTagAndTypeURI(long tagId,
String relatedTopicTypeUri)
Convenience method to fetch a list of topics (of a given
Topic Type ) using the "Tag"
with the given topic id . |
ResultList<RelatedTopic> |
getTopicsByTagsAndTypeUri(String tags,
String relatedTopicTypeUri)
Convenience method to fetch a list of topics (of a given
Topic Type ) using a list of "Tags". |
String |
getViewTagsModelWithRelatedCount(String relatedTopicTypeUri)
Generate a JSONArray with properties helpful to produce an interactive tag cloud.
|
private boolean |
hasRelatedTopicTag(RelatedTopic resource,
long tagId) |
getBundleContext, getPluginName, getStaticResource, getUri, init, preInstall, publishFileSystem, serviceArrived, serviceGone, setCoreService, shutdown, start, stop, toString
private static final String CHILD_URI
private static final String PARENT_URI
private static final String AGGREGATION
public static final String VIEW_RELATED_COUNT_URI
public static final String VIEW_CSS_CLASS_COUNT_URI
private WorkspacesService workspaceService
public TaggingPlugin()
public ResultList<RelatedTopic> getTopicsByTagAndTypeURI(long tagId, String relatedTopicTypeUri)
Topic Type
) using the "Tag"
with the given topic id
.
Note: This method provides no real benefit for developers familiar with the getRelatedTopics() of the
deepamehta-core API. It's just a convenient call.getTopicsByTagAndTypeURI
in interface TaggingService
tagId
- A topic id ot a "dm4.tags.tag"-TopicrelatedTopicTypeUri
- A Topic Type URI identifying a type of topics. The Topic Type
Definition
is expected to have an Aggregation Definition
with
cardinality set to Many
to the Topic Type Tag (typeUri="dm4.tags.tag").public ResultList<RelatedTopic> getTopicsByTagsAndTypeUri(String tags, String relatedTopicTypeUri)
Topic Type
) using a list of "Tags".getTopicsByTagsAndTypeUri
in interface TaggingService
tags
- A String of a JSONObject containing a JSONArray (under the
key="tags") of "dm4.tags.tag"-Topics is expected.
For example: "{ "tags": [ { "id": 1234 } ] }"
).relatedTopicTypeUri
- A type_uri of a composite (e.g. "org.deepamehta.resources.resource")
which must aggregate one or many "dm4.tags.tag".public String getViewTagsModelWithRelatedCount(String relatedTopicTypeUri)
getViewTagsModelWithRelatedCount
in interface TaggingService
relatedTopicTypeUri
- Type URI of related Topic Type counted.public Topic createTagTopic(String name, String definition, boolean lowerCase) throws IllegalArgumentException
IllegalArgumentException
is
thrown.createTagTopic
in interface TaggingService
name
- Label of the tag.definition
- Definition the label stands for.lowerCase
- Do existence check after converting the given name with a .toLowerCase()
call.IllegalArgumentException
public Topic getTagTopic(String name, boolean caseSensitive)
getTagTopic
in interface TaggingService
name
- label of given tagcaseSensitive
- flag if to use toLowerCase when gettingnull
if no topic was found under the given name.private void enrichTopicViewModelAboutRelatedCount(Topic resource, int count)
private void enrichTopicViewModelAboutCSSClass(Topic resource, int related_count)
private boolean hasRelatedTopicTag(RelatedTopic resource, long tagId)
Copyright © 2016. All Rights Reserved.