de.deepamehta.plugins.tags
Class TaggingPlugin

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.osgi.PluginActivator
      extended by de.deepamehta.plugins.tags.TaggingPlugin
All Implemented Interfaces:
PluginContext, PluginService, TaggingService, org.osgi.framework.BundleActivator

public class TaggingPlugin
extends PluginActivator
implements TaggingService

A basic plugin-service for fetching topics in DeepaMehta 4 by type and one or many tags.

Version:
1.3.8 compatible with DeepaMehta 4.4
Author:
Malte Reißig ()

Field Summary
private static String AGGREGATION
           
private static String CHILD_URI
           
private  Logger log
           
private static String PARENT_URI
           
static String TAG_DEFINITION_URI
           
static String TAG_LABEL_URI
           
static String TAG_URI
           
static String VIEW_CSS_CLASS_COUNT_URI
           
static String VIEW_RELATED_COUNT_URI
           
 
Fields inherited from class de.deepamehta.core.osgi.PluginActivator
bundle, dms
 
Constructor Summary
TaggingPlugin()
           
 
Method Summary
 Topic createTagTopic(String name, String definition)
           
private  void enrichTopicViewModelAboutCSSClass(Topic resource, int related_count)
           
private  void enrichTopicViewModelAboutRelatedCount(Topic resource, int count)
          Private Helper Methods
 Topic getTagTopic(String name, boolean caseSensitive)
           
 ResultList<RelatedTopic> getTopicsByTagAndTypeURI(long tagId, String relatedTopicTypeUri)
          Fetches all topics of given type "aggregating" the "Tag" with the given tagId.
 ResultList<RelatedTopic> getTopicsByTagsAndTypeUri(String tags, String relatedTopicTypeUri)
          Fetches all topics of given type "aggregating" all given "Tag"-Topics.
 String getViewTagsModelWithRelatedCount(String relatedTopicTypeUri)
          Getting {"value", "type_uri", "id" and "related_count:"} values of (interesting) topics in range.
private  boolean hasRelatedTopicTag(RelatedTopic resource, long tagId)
           
 
Methods inherited from class de.deepamehta.core.osgi.PluginActivator
getBundleContext, getPluginName, getStaticResource, getUri, init, postInstall, publishDirectory, serviceArrived, serviceGone, setCoreService, shutdown, start, stop, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

private Logger log

CHILD_URI

private static final String CHILD_URI
See Also:
Constant Field Values

PARENT_URI

private static final String PARENT_URI
See Also:
Constant Field Values

AGGREGATION

private static final String AGGREGATION
See Also:
Constant Field Values

TAG_URI

public static final String TAG_URI
See Also:
Constant Field Values

TAG_LABEL_URI

public static final String TAG_LABEL_URI
See Also:
Constant Field Values

TAG_DEFINITION_URI

public static final String TAG_DEFINITION_URI
See Also:
Constant Field Values

VIEW_RELATED_COUNT_URI

public static final String VIEW_RELATED_COUNT_URI
See Also:
Constant Field Values

VIEW_CSS_CLASS_COUNT_URI

public static final String VIEW_CSS_CLASS_COUNT_URI
See Also:
Constant Field Values
Constructor Detail

TaggingPlugin

public TaggingPlugin()
Method Detail

getTopicsByTagAndTypeURI

public ResultList<RelatedTopic> getTopicsByTagAndTypeURI(long tagId,
                                                         String relatedTopicTypeUri)
Fetches all topics of given type "aggregating" the "Tag" with the given tagId.

Specified by:
getTopicsByTagAndTypeURI in interface TaggingService
Parameters:
tagId - An id ot a "dm4.tags.tag"-Topic
relatedTopicTypeUri - A type_uri of a composite (e.g. "org.deepamehta.resources.resource") which aggregates one or many "dm4.tags.tag". Note: This method provides actually no real benefit for developers familiar with the getRelatedTopics() of the deepamehta-core API. It's just a convenient call.

getTopicsByTagsAndTypeUri

public ResultList<RelatedTopic> getTopicsByTagsAndTypeUri(String tags,
                                                          String relatedTopicTypeUri)
Fetches all topics of given type "aggregating" all given "Tag"-Topics.

Specified by:
getTopicsByTagsAndTypeUri in interface TaggingService
Parameters:
tags - A JSONObject containing JSONArray ("tags") of "Tag"-Topics is expected (e.g. { "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".

getViewTagsModelWithRelatedCount

public String getViewTagsModelWithRelatedCount(String relatedTopicTypeUri)
Getting {"value", "type_uri", "id" and "related_count:"} values of (interesting) topics in range.

Specified by:
getViewTagsModelWithRelatedCount in interface TaggingService
Parameters:
relatedTopicTypeUri - Type URI of related Topic Type

createTagTopic

public Topic createTagTopic(String name,
                            String definition)
Specified by:
createTagTopic in interface TaggingService

getTagTopic

public Topic getTagTopic(String name,
                         boolean caseSensitive)
Specified by:
getTagTopic in interface TaggingService

enrichTopicViewModelAboutRelatedCount

private void enrichTopicViewModelAboutRelatedCount(Topic resource,
                                                   int count)
Private Helper Methods


enrichTopicViewModelAboutCSSClass

private void enrichTopicViewModelAboutCSSClass(Topic resource,
                                               int related_count)

hasRelatedTopicTag

private boolean hasRelatedTopicTag(RelatedTopic resource,
                                   long tagId)


Copyright © 2014. All Rights Reserved.