protected String getSessionId(SessionInfo sessionInfo) {
   try {
     return sessionInfo != null ? sessionInfo.getId() : UNKNOWN_SESSION;
   } catch (ContextNotActiveException e) {
     return UNKNOWN_SESSION;
   }
 }
示例#2
0
 private CommentedOption makeCommentedOption(final String commitMessage) {
   final String name = identity.getName();
   final Date when = new Date();
   final CommentedOption co =
       new CommentedOption(sessionInfo.getId(), name, null, commitMessage, when);
   return co;
 }
 @Inject
 public DataModelerScreenPresenter(DataModelerScreenView baseView, SessionInfo sessionInfo) {
   super(baseView);
   view = baseView;
   this.sessionInfo = sessionInfo;
   editorId = sessionInfo.getId() + "-" + editorIds++;
 }
示例#4
0
 void onResourceBatchEvent(@Observes final ResourceBatchChangesEvent batchEvent) {
   if (path != null && batchEvent.containPath(path)) {
     if (sessionInfo.getId().equals(batchEvent.getSessionInfo().getId())) {
       for (final ResourceChange change : batchEvent.getChanges(path)) {
         switch (change.getType()) {
           case COPY:
             executeCopyCommands();
             break;
           case DELETE:
             executeDeleteCommands();
             break;
           case RENAME:
             path = ((ResourceRenamed) change).getDestinationPath();
             executeRenameCommands();
             break;
           case UPDATE:
             executeUpdateCommands();
             break;
         }
       }
     } else {
       for (final ResourceChange change : batchEvent.getChanges(path)) {
         switch (change.getType()) {
           case COPY:
             executeConcurrentCopyCommand(
                 path,
                 ((ResourceCopied) change).getDestinationPath(),
                 batchEvent.getSessionInfo().getId(),
                 batchEvent.getSessionInfo().getIdentity());
             break;
           case DELETE:
             executeConcurrentDeleteCommand(
                 path,
                 batchEvent.getSessionInfo().getId(),
                 batchEvent.getSessionInfo().getIdentity());
             break;
           case RENAME:
             path = ((ResourceRenamed) change).getDestinationPath();
             executeConcurrentRenameCommand(
                 path,
                 ((ResourceRenamed) change).getDestinationPath(),
                 batchEvent.getSessionInfo().getId(),
                 batchEvent.getSessionInfo().getIdentity());
             break;
           case UPDATE:
             executeConcurrentUpdateCommand(
                 path,
                 batchEvent.getSessionInfo().getId(),
                 batchEvent.getSessionInfo().getIdentity());
             break;
         }
       }
     }
   }
 }
示例#5
0
 void onResourceUpdated(@Observes final ResourceUpdatedEvent updatedEvent) {
   if (path != null && path.equals(updatedEvent.getPath())) {
     if (sessionInfo.getId().equals(updatedEvent.getSessionInfo().getId())) {
       executeUpdateCommands();
     } else {
       executeConcurrentUpdateCommand(
           updatedEvent.getPath(),
           updatedEvent.getSessionInfo().getId(),
           updatedEvent.getSessionInfo().getIdentity());
     }
   }
 }
示例#6
0
 void onResourceCopied(@Observes final ResourceCopiedEvent copiedEvent) {
   if (path != null && path.equals(copiedEvent.getPath())) {
     if (sessionInfo.getId().equals(copiedEvent.getSessionInfo().getId())) {
       executeCopyCommands();
     } else {
       executeConcurrentCopyCommand(
           copiedEvent.getPath(),
           copiedEvent.getDestinationPath(),
           copiedEvent.getSessionInfo().getId(),
           copiedEvent.getSessionInfo().getIdentity());
     }
   }
 }
示例#7
0
 void onResourceRenamed(@Observes final ResourceRenamedEvent renamedEvent) {
   if (path != null && path.equals(renamedEvent.getPath())) {
     path = renamedEvent.getDestinationPath();
     if (sessionInfo.getId().equals(renamedEvent.getSessionInfo().getId())) {
       executeRenameCommands();
     } else {
       executeConcurrentRenameCommand(
           renamedEvent.getPath(),
           renamedEvent.getDestinationPath(),
           renamedEvent.getSessionInfo().getId(),
           renamedEvent.getSessionInfo().getIdentity());
     }
   }
 }
示例#8
0
  @Override
  public void delete(final Path pathToPomXML, final String comment) {
    try {
      final org.uberfire.java.nio.file.Path projectDirectory =
          Paths.convert(pathToPomXML).getParent();
      final Project project2Delete = resolveProject(Paths.convert(projectDirectory));

      ioService.delete(
          projectDirectory,
          StandardDeleteOption.NON_EMPTY_DIRECTORIES,
          new CommentedOption(sessionInfo.getId(), identity.getName(), null, comment));
      deleteProjectEvent.fire(new DeleteProjectEvent(project2Delete));
    } catch (final Exception e) {
      throw ExceptionUtilities.handleException(e);
    }
  }