public class WebclientPlugin extends PluginActivator implements AllPluginsActiveListener, IntroduceTopicTypeListener, IntroduceAssociationTypeListener, PreCreateTopicTypeListener, PreCreateAssociationTypeListener, PostUpdateTopicListener
Modifier and Type | Field and Description |
---|---|
private boolean |
hasWebclientLaunched |
private Logger |
logger |
private static String |
VIEW_CONFIG_LABEL |
bundle, dmx, mf
Constructor and Description |
---|
WebclientPlugin() |
Modifier and Type | Method and Description |
---|---|
private void |
addDefaultViewConfig(TypeModel typeModel)
Add a default view config topic to the given type model in case no one is set already.
|
void |
allPluginsActive() |
private Topic |
createSearchTopic(String searchTerm,
Collection<Topic> resultItems)
Creates a "Search" topic.
|
private Set<Topic> |
findSearchableUnits(List<? extends Topic> topics) |
List<RelatedTopic> |
getRelatedTopics(long objectId) |
Topic |
getTopics(String typeUri)
Performs a by-type search and creates a search result topic.
|
private Object |
getViewConfigValue(TopicType topicType,
String setting)
Convenience method to lookup a Webclient view config value.
|
private String |
getWebclientUrl() |
private boolean |
hasAssocDef(DMXObject parentObject,
RelatedTopic childTopic) |
void |
introduceAssociationType(AssociationType assocType) |
void |
introduceTopicType(TopicType topicType) |
private boolean |
isDirectModelledChildTopic(DMXObject parentObject,
RelatedTopic childTopic) |
void |
postUpdateTopic(Topic topic,
TopicModel updateModel,
TopicModel oldTopic)
Once a view configuration is updated in the DB we must update the cached view configuration model.
|
void |
preCreateAssociationType(AssociationTypeModel model)
Add a default view config to the type in case no one is set.
|
void |
preCreateTopicType(TopicTypeModel model)
Add a default view config to the type in case no one is set.
|
private boolean |
searchableAsUnit(Topic topic) |
Topic |
searchTopics(String searchTerm,
String fieldUri)
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) |
private void |
updateTopicType(Topic type,
Topic viewConfig) |
private void |
updateType(Topic viewConfig) |
private void |
updateViewConfig(DMXType type,
Topic viewConfig) |
getBundleContext, getPluginName, getStaticResource, getUri, init, preInstall, publishFileSystem, serviceArrived, serviceGone, setCoreService, shutdown, start, stop, toString
private static final String VIEW_CONFIG_LABEL
private boolean hasWebclientLaunched
public WebclientPlugin()
public Topic searchTopics(String searchTerm, String fieldUri)
public Topic getTopics(String typeUri)
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 service or make the Type Search plugin an integral part of the Webclient plugin.
public List<RelatedTopic> getRelatedTopics(long objectId)
public void allPluginsActive()
allPluginsActive
in interface AllPluginsActiveListener
public void preCreateTopicType(TopicTypeModel model)
Note: the default view config needs a workspace assignment. The default view config must be added *before* the assignment can take place. Workspace assignment for a type (including its components like the view config) is performed by the type-introduction hook of the Workspaces module. Here we use the pre-create-type hook (instead of type-introduction too) as the pre-create-type hook is guaranteed to be invoked *before* type-introduction. On the other hand the order of type-introduction invocations is not deterministic accross plugins.
preCreateTopicType
in interface PreCreateTopicTypeListener
public void preCreateAssociationType(AssociationTypeModel model)
Note: the default view config needs a workspace assignment. The default view config must be added *before* the assignment can take place. Workspace assignment for a type (including its components like the view config) is performed by the type-introduction hook of the Workspaces module. Here we use the pre-create-type hook (instead of type-introduction too) as the pre-create-type hook is guaranteed to be invoked *before* type-introduction. On the other hand the order of type-introduction invocations is not deterministic accross plugins.
preCreateAssociationType
in interface PreCreateAssociationTypeListener
public void postUpdateTopic(Topic topic, TopicModel updateModel, TopicModel oldTopic)
postUpdateTopic
in interface PostUpdateTopicListener
public void introduceTopicType(TopicType topicType)
introduceTopicType
in interface IntroduceTopicTypeListener
public void introduceAssociationType(AssociationType assocType)
introduceAssociationType
in interface IntroduceAssociationTypeListener
private Set<Topic> findSearchableUnits(List<? extends Topic> topics)
private Topic createSearchTopic(String searchTerm, Collection<Topic> resultItems)
private boolean searchableAsUnit(Topic topic)
private Object getViewConfigValue(TopicType topicType, String setting)
Compare to client-side counterpart: function get_view_config() in webclient.js
topicType
- The topic type whose view configuration is used for lookup.setting
- Last component of the child type URI whose value to lookup, e.g. "icon".null
if no value is setprivate void updateType(Topic viewConfig)
private void updateTopicType(Topic type, Topic viewConfig)
private void updateAssociationType(Topic type, Topic viewConfig)
private void updateViewConfig(DMXType type, Topic viewConfig)
private void setViewConfigLabel(ViewConfiguration viewConfig)
private void setConfigTopicLabel(Topic viewConfig)
private void addDefaultViewConfig(TypeModel typeModel)
This ensures a programmatically created type (through a migration) will have a view config in any case, for being edited interactively afterwards.
private String getWebclientUrl()
private boolean isDirectModelledChildTopic(DMXObject parentObject, RelatedTopic childTopic)
private boolean hasAssocDef(DMXObject parentObject, RelatedTopic childTopic)
Copyright © 2018. All Rights Reserved.