001package de.deepamehta.plugins.tags.migrations;
002
003import de.deepamehta.core.Topic;
004import de.deepamehta.core.TopicType;
005import de.deepamehta.core.service.Inject;
006import de.deepamehta.plugins.tags.TaggingService;
007import de.deepamehta.plugins.workspaces.WorkspacesService;
008import de.deepamehta.core.service.Migration;
009
010import java.util.logging.Logger;
011
012/**
013 * This migration assigns all three topic types of this plugin to the public "DeepaMehta" Workspace.
014 * Note: Since all types start with "dm4." this should already be done (automatically). TODO: Check.
015 * */
016public class Migration3 extends Migration {
017
018    @Inject
019    private WorkspacesService workspaceService;
020
021    @Override
022    public void run() {
023
024        Topic deepaMehtaWs = workspaceService.getWorkspace(WorkspacesService.DEEPAMEHTA_WORKSPACE_URI);
025        //
026        TopicType tagType = dms.getTopicType(TaggingService.TAG_URI);
027        TopicType tagLabelType = dms.getTopicType(TaggingService.TAG_LABEL_URI);
028        TopicType tagDefinitionType = dms.getTopicType(TaggingService.TAG_DEFINITION_URI);
029        //
030        workspaceService.assignTypeToWorkspace(tagType, deepaMehtaWs.getId());
031        workspaceService.assignTypeToWorkspace(tagLabelType, deepaMehtaWs.getId());
032        workspaceService.assignTypeToWorkspace(tagDefinitionType, deepaMehtaWs.getId());
033
034    }
035
036}