001package systems.dmx.workspaces.migrations;
002
003import systems.dmx.workspaces.WorkspacesService;
004
005import systems.dmx.core.service.Inject;
006import systems.dmx.core.service.Migration;
007
008
009
010/**
011 * Creates the "DMX" workspace.
012 * Runs only in CLEAN_INSTALL mode.
013 * <p>
014 * Note: when UPDATEing to 4.5 the "DMX" workspace already exists.
015 * It was created via postInstall() hook (which is obsolete in 4.5)
016 * <p>
017 * Part of DM 4.5
018 */
019public class Migration4 extends Migration {
020
021    // ---------------------------------------------------------------------------------------------- Instance Variables
022
023    @Inject
024    private WorkspacesService wsService;
025
026    // -------------------------------------------------------------------------------------------------- Public Methods
027
028    @Override
029    public void run() {
030        wsService.createWorkspace(
031            WorkspacesService.DMX_WORKSPACE_NAME,
032            WorkspacesService.DMX_WORKSPACE_URI,
033            WorkspacesService.DMX_WORKSPACE_SHARING_MODE
034        );
035        // Note 1: the workspace has no owner yet as the Access Control plugin is not yet activated (as it depends
036        // on the Workspaces plugin). We set the owner in the Access Control migration #7.
037        // Note 2: we can't postpone the creation of the "DMX" workspace to a Access Control migration as it
038        // must be already available at Workspaces plugin activation time (as needed for the type introduction).
039    }
040}