001 package de.deepamehta.plugins.workspaces.service;
002
003 import de.deepamehta.core.DeepaMehtaObject;
004 import de.deepamehta.core.RelatedTopic;
005 import de.deepamehta.core.Topic;
006 import de.deepamehta.core.Type;
007 import de.deepamehta.core.service.PluginService;
008 import de.deepamehta.core.service.ResultList;
009 import de.deepamehta.core.service.accesscontrol.SharingMode;
010
011
012
013 public interface WorkspacesService extends PluginService {
014
015 // ------------------------------------------------------------------------------------------------------- Constants
016
017 static final String DEEPAMEHTA_WORKSPACE_NAME = "DeepaMehta";
018 static final String DEEPAMEHTA_WORKSPACE_URI = "dm4.workspaces.deepamehta";
019 static final SharingMode DEEPAMEHTA_WORKSPACE_SHARING_MODE = SharingMode.PUBLIC;
020
021 // -------------------------------------------------------------------------------------------------- Public Methods
022
023 /**
024 * @param uri may be null
025 */
026 Topic createWorkspace(String name, String uri, SharingMode sharingMode);
027
028 // ---
029
030 /**
031 * Returns a workspace by URI.
032 * If no workspace exists for the given URI a runtime exception is thrown.
033 *
034 * @return The workspace (a topic of type "Workspace").
035 */
036 Topic getWorkspace(String uri);
037
038 /**
039 * Returns all topics of the given type that are assigned to the given workspace.
040 */
041 ResultList<RelatedTopic> getAssignedTopics(long workspaceId, String typeUri);
042
043 /**
044 * Returns the workspace a topic or association is assigned to.
045 *
046 * @param id a topic ID, or an association ID
047 *
048 * @return The assigned workspace (a topic of type "Workspace"),
049 * or <code>null</code> if no workspace is assigned.
050 */
051 Topic getAssignedWorkspace(long objectId);
052
053 /**
054 * Checks weather the given topic or association is assigned to the given workspace.
055 */
056 boolean isAssignedToWorkspace(long objectId, long workspaceId);
057
058 // ---
059
060 /**
061 * Assigns the given object to the given workspace.
062 */
063 void assignToWorkspace(DeepaMehtaObject object, long workspaceId);
064
065 /**
066 * Assigns the given type and all its view configuration topics to the given workspace.
067 */
068 void assignTypeToWorkspace(Type type, long workspaceId);
069 }