/**
   * Call this method to add the {@link WabitObject}s in the loaded workspaces to the given session
   * . This is the last step to importing a file into Wabit workspace.
   *
   * <p>If importing is done on multiple threads this operation must be done on the event dispatch
   * thread. This should only be called once for each DAO or the same workspace will be added to the
   * context multiple times.
   *
   * @param session The session that will have {@link WabitObject}s added to it. Null should not be
   *     passed into this method.
   */
  public void addImportedWorkspaceContentToWorkspace(WabitSession session) {
    if (session == null) {
      context.createUserPrompter(
          "Select a workspace to import into.",
          UserPromptType.MESSAGE,
          UserPromptOptions.OK,
          UserPromptResponse.OK,
          null);
      return;
    }

    if (cancelled.get()) return;

    try {
      final WabitWorkspace workspace = session.getWorkspace();
      int importObjectCount = 0;
      WabitSession importingSession = saxHandler.getSession();
      final WabitWorkspace importingWorkspace = importingSession.getWorkspace();
      importObjectCount += importingWorkspace.mergeIntoWorkspace(workspace);
      logger.debug(
          "Imported " + importObjectCount + " objects into " + session.getWorkspace().getName());
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
Beispiel #2
0
 public void actionPerformed(ActionEvent e) {
   GrantPanel panel =
       new GrantPanel(this.workspace, this.systemWorkspace, objectType, objectUuid, label);
   DataEntryPanelBuilder.createDataEntryPanelDialog(
           panel,
           ((WabitSwingSessionContext) workspace.getSession().getContext()).getFrame(),
           "Sharing and security - " + label,
           "Apply changes")
       .setVisible(true);
 }