de.deepamehta.plugins.webclient
Class WebclientPlugin

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.osgi.PluginActivator
      extended by de.deepamehta.plugins.webclient.WebclientPlugin
All Implemented Interfaces:
PluginContext, AllPluginsActiveListener, IntroduceAssociationTypeListener, IntroduceTopicTypeListener, PostUpdateTopicListener, PreUpdateTopicListener, EventListener, BundleActivator

public class WebclientPlugin
extends PluginActivator
implements AllPluginsActiveListener, IntroduceTopicTypeListener, IntroduceAssociationTypeListener, PreUpdateTopicListener, PostUpdateTopicListener


Field Summary
private  boolean hasWebclientLaunched
           
private  Logger logger
           
private static String VIEW_CONFIG_LABEL
           
 
Fields inherited from class de.deepamehta.core.osgi.PluginActivator
bundle, dms
 
Constructor Summary
WebclientPlugin()
           
 
Method Summary
 void allPluginsActive()
           
private  Topic createSearchTopic(String searchTerm, Collection<? extends Topic> resultItems, ClientState clientState)
          Creates a "Search" topic.
private  Set<Topic> findSearchableUnits(List<? extends Topic> topics)
           
 ResultList getRelatedTopics(long topicId)
           
 Topic getTopics(String typeUri, int maxResultSize, ClientState clientState)
          Performs a by-type search and creates a search result topic.
private  Object getViewConfig(TopicType topicType, String setting)
          Read out a view configuration setting.
private  String getWebclientUrl()
           
 void introduceAssociationType(AssociationType assocType, ClientState clientState)
           
 void introduceTopicType(TopicType topicType, ClientState clientState)
           
private  boolean isDirectModelledChildTopic(RelatedTopic childTopic, Topic parentTopic)
           
 void postUpdateTopic(Topic topic, TopicModel newModel, TopicModel oldModel, ClientState clientState, Directives directives)
          Once a view configuration is updated in the DB we must update the cached view configuration model.
 void preUpdateTopic(Topic topic, TopicModel newModel, Directives directives)
           
private  boolean searchableAsUnit(Topic topic)
           
 Topic searchTopics(String searchTerm, String fieldUri, ClientState clientState)
          Performs a fulltext search and creates a search result topic.
private  void setConfigTopicLabel(Topic viewConfig)
           
private  void setViewConfigLabel(ViewConfiguration viewConfig)
           
private  void updateAssociationType(Topic type, Topic viewConfig, Directives directives)
           
private  void updateTopicType(Topic type, Topic viewConfig, Directives directives)
           
private  void updateType(Topic viewConfig, Directives directives)
           
private  void updateViewConfig(Type type, Topic viewConfig)
           
 
Methods inherited from class de.deepamehta.core.osgi.PluginActivator
getBundleContext, 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

VIEW_CONFIG_LABEL

private static final String VIEW_CONFIG_LABEL
See Also:
Constant Field Values

hasWebclientLaunched

private boolean hasWebclientLaunched

logger

private Logger logger
Constructor Detail

WebclientPlugin

public WebclientPlugin()
Method Detail

searchTopics

public Topic searchTopics(String searchTerm,
                          String fieldUri,
                          @HeaderParam(value="Cookie")
                          ClientState clientState)
Performs a fulltext search and creates a search result topic.


getTopics

public Topic getTopics(String typeUri,
                       int maxResultSize,
                       @HeaderParam(value="Cookie")
                       ClientState clientState)
Performs a by-type search and creates a search result topic.

Note: this resource method is actually part of the Type Search plugin. TODO: proper modularization. Either let the Type Search plugin provide its own REST resource (with another namespace again) or make the Type Search plugin an integral part of the Webclient plugin.


getRelatedTopics

public ResultList getRelatedTopics(long topicId)

allPluginsActive

public void allPluginsActive()
Specified by:
allPluginsActive in interface AllPluginsActiveListener

preUpdateTopic

public void preUpdateTopic(Topic topic,
                           TopicModel newModel,
                           Directives directives)
Specified by:
preUpdateTopic in interface PreUpdateTopicListener

postUpdateTopic

public void postUpdateTopic(Topic topic,
                            TopicModel newModel,
                            TopicModel oldModel,
                            ClientState clientState,
                            Directives directives)
Once a view configuration is updated in the DB we must update the cached view configuration model.

Specified by:
postUpdateTopic in interface PostUpdateTopicListener

introduceTopicType

public void introduceTopicType(TopicType topicType,
                               ClientState clientState)
Specified by:
introduceTopicType in interface IntroduceTopicTypeListener

introduceAssociationType

public void introduceAssociationType(AssociationType assocType,
                                     ClientState clientState)
Specified by:
introduceAssociationType in interface IntroduceAssociationTypeListener

findSearchableUnits

private Set<Topic> findSearchableUnits(List<? extends Topic> topics)

createSearchTopic

private Topic createSearchTopic(String searchTerm,
                                Collection<? extends Topic> resultItems,
                                ClientState clientState)
Creates a "Search" topic.


searchableAsUnit

private boolean searchableAsUnit(Topic topic)

getViewConfig

private Object getViewConfig(TopicType topicType,
                             String setting)
Read out a view configuration setting.

Compare to client-side counterpart: function get_view_config() in webclient.js

Parameters:
topicType - The topic type whose view configuration is read out.
setting - Last component of the setting URI, e.g. "icon".
Returns:
The setting value, or null if there is no such setting

updateType

private void updateType(Topic viewConfig,
                        Directives directives)

updateTopicType

private void updateTopicType(Topic type,
                             Topic viewConfig,
                             Directives directives)

updateAssociationType

private void updateAssociationType(Topic type,
                                   Topic viewConfig,
                                   Directives directives)

updateViewConfig

private void updateViewConfig(Type type,
                              Topic viewConfig)

setViewConfigLabel

private void setViewConfigLabel(ViewConfiguration viewConfig)

setConfigTopicLabel

private void setConfigTopicLabel(Topic viewConfig)

getWebclientUrl

private String getWebclientUrl()

isDirectModelledChildTopic

private boolean isDirectModelledChildTopic(RelatedTopic childTopic,
                                           Topic parentTopic)


Copyright © 2014. All Rights Reserved.