de.deepamehta.plugins.workspaces
Class WorkspacesPlugin

Show UML class diagram
java.lang.Object
  extended by de.deepamehta.core.osgi.PluginActivator
      extended by de.deepamehta.plugins.workspaces.WorkspacesPlugin
All Implemented Interfaces:
PluginContext, IntroduceAssociationTypeListener, IntroduceTopicTypeListener, PostCreateAssociationListener, PostCreateTopicListener, EventListener, PluginService, WorkspacesService, org.osgi.framework.BundleActivator

public class WorkspacesPlugin
extends PluginActivator
implements WorkspacesService, IntroduceTopicTypeListener, IntroduceAssociationTypeListener, PostCreateTopicListener, PostCreateAssociationListener


Field Summary
private  FacetsService facetsService
           
private  Logger logger
           
private static String PARAM_NO_WORKSPACE_ASSIGNMENT
           
private static String PROP_WORKSPACE_ID
           
private  TopicmapsService topicmapsService
           
private  javax.ws.rs.core.UriInfo uriInfo
           
 
Fields inherited from class de.deepamehta.core.osgi.PluginActivator
bundle, dms
 
Fields inherited from interface de.deepamehta.plugins.workspaces.service.WorkspacesService
DEEPAMEHTA_WORKSPACE_NAME, DEEPAMEHTA_WORKSPACE_SHARING_MODE, DEEPAMEHTA_WORKSPACE_URI
 
Constructor Summary
WorkspacesPlugin()
           
 
Method Summary
private  void _assignToWorkspace(DeepaMehtaObject object, long workspaceId)
           
private  boolean abortAssignment(DeepaMehtaObject object)
           
private  void applyWorkspaceFilter(Iterator<? extends Topic> topics, long workspaceId)
           
 void assignToWorkspace(DeepaMehtaObject object, long workspaceId)
          Assigns the given object to the given workspace.
 Directives assignToWorkspace(long objectId, long workspaceId)
           
 void assignTypeToWorkspace(Type type, long workspaceId)
          Assigns the given type and all its view configuration topics to the given workspace.
private  void checkArgument(long topicId)
          Checks if the topic with the specified ID exists and is a Workspace.
 Topic createWorkspace(String name, String uri, SharingMode sharingMode)
           
 ResultList<RelatedTopic> getAssignedTopics(long workspaceId, String topicTypeUri)
          Returns all topics of the given type that are assigned to the given workspace.
 Topic getAssignedWorkspace(long objectId)
          Returns the workspace a topic or association is assigned to.
private  long getAssignedWorkspaceId(long objectId)
           
private  Topic getDeepaMehtaWorkspace()
          Returns the DeepaMehta workspace or throws an exception if it doesn't exist.
 Topic getWorkspace(String uri)
          Returns a workspace by URI.
private  String info(DeepaMehtaObject object)
           
 void introduceAssociationType(AssociationType assocType)
          Takes care the DeepaMehta standard types (and their parts) get an assignment to the DeepaMehta workspace.
 void introduceTopicType(TopicType topicType)
          Takes care the DeepaMehta standard types (and their parts) get an assignment to the DeepaMehta workspace.
 boolean isAssignedToWorkspace(long objectId, long workspaceId)
          Checks weather the given topic or association is assigned to the given workspace.
private  boolean isDeepaMehtaStandardType(Type type)
           
private  boolean isWorkspaceAssignment(Association assoc)
           
private  boolean isWorkspaceDescription(Topic topic)
           
 void postCreateAssociation(Association assoc)
          Assigns every created association to the current workspace.
 void postCreateTopic(Topic topic)
          Assigns every created topic to the current workspace.
private  long workspaceId()
           
private  long workspaceIdForType(Type type)
          Returns the ID of the DeepaMehta workspace or -1 to signal abortion of type introduction.
 
Methods inherited from class de.deepamehta.core.osgi.PluginActivator
getBundleContext, getPluginName, getStaticResource, getUri, init, 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

PROP_WORKSPACE_ID

private static final String PROP_WORKSPACE_ID
See Also:
Constant Field Values

PARAM_NO_WORKSPACE_ASSIGNMENT

private static final String PARAM_NO_WORKSPACE_ASSIGNMENT
See Also:
Constant Field Values

facetsService

private FacetsService facetsService

topicmapsService

private TopicmapsService topicmapsService

uriInfo

@Context
private javax.ws.rs.core.UriInfo uriInfo

logger

private Logger logger
Constructor Detail

WorkspacesPlugin

public WorkspacesPlugin()
Method Detail

createWorkspace

public Topic createWorkspace(String name,
                             String uri,
                             SharingMode sharingMode)
Specified by:
createWorkspace in interface WorkspacesService
uri - may be null

getWorkspace

public Topic getWorkspace(String uri)
Description copied from interface: WorkspacesService
Returns a workspace by URI. If no workspace exists for the given URI a runtime exception is thrown.

Specified by:
getWorkspace in interface WorkspacesService
Returns:
The workspace (a topic of type "Workspace").

getAssignedTopics

public ResultList<RelatedTopic> getAssignedTopics(long workspaceId,
                                                  String topicTypeUri)
Description copied from interface: WorkspacesService
Returns all topics of the given type that are assigned to the given workspace.

Specified by:
getAssignedTopics in interface WorkspacesService

getAssignedWorkspace

public Topic getAssignedWorkspace(long objectId)
Description copied from interface: WorkspacesService
Returns the workspace a topic or association is assigned to.

Specified by:
getAssignedWorkspace in interface WorkspacesService
Returns:
The assigned workspace (a topic of type "Workspace"), or null if no workspace is assigned.

isAssignedToWorkspace

public boolean isAssignedToWorkspace(long objectId,
                                     long workspaceId)
Description copied from interface: WorkspacesService
Checks weather the given topic or association is assigned to the given workspace.

Specified by:
isAssignedToWorkspace in interface WorkspacesService

assignToWorkspace

public Directives assignToWorkspace(long objectId,
                                    long workspaceId)

assignToWorkspace

public void assignToWorkspace(DeepaMehtaObject object,
                              long workspaceId)
Description copied from interface: WorkspacesService
Assigns the given object to the given workspace.

Specified by:
assignToWorkspace in interface WorkspacesService

assignTypeToWorkspace

public void assignTypeToWorkspace(Type type,
                                  long workspaceId)
Description copied from interface: WorkspacesService
Assigns the given type and all its view configuration topics to the given workspace.

Specified by:
assignTypeToWorkspace in interface WorkspacesService

introduceTopicType

public void introduceTopicType(TopicType topicType)
Takes care the DeepaMehta standard types (and their parts) get an assignment to the DeepaMehta workspace. This is important in conjunction with access control. Note: type introduction is aborted if at least one of these conditions apply: - A workspace cookie is present. In this case the type gets its workspace assignment the regular way (this plugin's post-create listeners). This happens e.g. when a type is created interactively in the Webclient. - The type is not a DeepaMehta standard type. In this case the 3rd-party plugin developer is responsible for doing the workspace assignment (in case the type is created programmatically while a migration). DM can't know to which workspace a 3rd-party type belongs to. A type is regarded a DeepaMehta standard type if its URI begins with "dm4."

Specified by:
introduceTopicType in interface IntroduceTopicTypeListener

introduceAssociationType

public void introduceAssociationType(AssociationType assocType)
Takes care the DeepaMehta standard types (and their parts) get an assignment to the DeepaMehta workspace. This is important in conjunction with access control. Note: type introduction is aborted if at least one of these conditions apply: - A workspace cookie is present. In this case the type gets its workspace assignment the regular way (this plugin's post-create listeners). This happens e.g. when a type is created interactively in the Webclient. - The type is not a DeepaMehta standard type. In this case the 3rd-party plugin developer is responsible for doing the workspace assignment (in case the type is created programmatically while a migration). DM can't know to which workspace a 3rd-party type belongs to. A type is regarded a DeepaMehta standard type if its URI begins with "dm4."

Specified by:
introduceAssociationType in interface IntroduceAssociationTypeListener

postCreateTopic

public void postCreateTopic(Topic topic)
Assigns every created topic to the current workspace.

Specified by:
postCreateTopic in interface PostCreateTopicListener

postCreateAssociation

public void postCreateAssociation(Association assoc)
Assigns every created association to the current workspace.

Specified by:
postCreateAssociation in interface PostCreateAssociationListener

workspaceId

private long workspaceId()

workspaceIdForType

private long workspaceIdForType(Type type)
Returns the ID of the DeepaMehta workspace or -1 to signal abortion of type introduction.


getAssignedWorkspaceId

private long getAssignedWorkspaceId(long objectId)

_assignToWorkspace

private void _assignToWorkspace(DeepaMehtaObject object,
                                long workspaceId)

isDeepaMehtaStandardType

private boolean isDeepaMehtaStandardType(Type type)

isWorkspaceDescription

private boolean isWorkspaceDescription(Topic topic)

isWorkspaceAssignment

private boolean isWorkspaceAssignment(Association assoc)

getDeepaMehtaWorkspace

private Topic getDeepaMehtaWorkspace()
Returns the DeepaMehta workspace or throws an exception if it doesn't exist.


applyWorkspaceFilter

private void applyWorkspaceFilter(Iterator<? extends Topic> topics,
                                  long workspaceId)

checkArgument

private void checkArgument(long topicId)
Checks if the topic with the specified ID exists and is a Workspace. If not, an exception is thrown.


abortAssignment

private boolean abortAssignment(DeepaMehtaObject object)

info

private String info(DeepaMehtaObject object)


Copyright © 2015. All Rights Reserved.