@Override public String getId() { try { return delegate.getId(); } catch (Exception e) { return "--"; } }
@Override public String doNotNullMarshall(final SessionInfo sessionInfo, final MarshallingSession marshallingSession) { return "{\"" + SerializationParts.ENCODED_TYPE + "\":\"" + SessionInfo.class.getName() + "\"," + "\"" + SerializationParts.OBJECT_ID + "\":\"" + sessionInfo.hashCode() + "\"," + "\"" + "id" + "\":\"" + sessionInfo.getId() + "\"," + "\"" + "identityId" + "\":\"" + sessionInfo.getIdentity().getIdentifier() + "\"}"; }
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()); } } }
@Override public String getId() { try { return delegate.getId(); } catch (Exception e) { return "--"; } }
void onResourceDeleted(@Observes final ResourceDeletedEvent deletedEvent) { if (path != null && path.equals(deletedEvent.getPath())) { if (sessionInfo.getId().equals(deletedEvent.getSessionInfo().getId())) { executeDeleteCommands(); } else { executeConcurrentDeleteCommand(deletedEvent.getPath(), deletedEvent.getSessionInfo().getId(), deletedEvent.getSessionInfo().getIdentity()); } } }
private String getSessionId(SessionInfo sessionInfo) { return sessionInfo != null ? sessionInfo.getId() : null; }
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()); } } }
@Override public String getId() { if( delegate.isUnsatisfied() ) { return UNKNOWN_SESSION_ID; } // default try { return delegate.get().getId(); } catch ( Exception e ) { return UNKNOWN_SESSION_ID; } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof SessionInfo)) { return false; } SessionInfo that = (SessionInfo) o; if (!getId().equals(that.getId())) { return false; } return getIdentity().getIdentifier().equals(that.getIdentity().getIdentifier()); }
@Override public String getId() { if( delegate.isUnsatisfied() ) { return UNKNOWN_SESSION_ID; } // default try { return delegate.get().getId(); } catch ( Exception e ) { return UNKNOWN_SESSION_ID; } }
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()); } } }
public static CommentedOption makeCommentedOption(final User identity, final SessionInfo sessionInfo, final String commitMessage) { final String name = identity.getIdentifier(); final Date when = new Date(); final CommentedOption co = new CommentedOption(sessionInfo.getId(), name, null, commitMessage, when); return co; } }
private void verifyResourceAddedEvent(String file, String sessionId, String userId, String commitMessage) { verify(resourceAddedEvent, times(1)).fire(resourceAddedEventCaptor.capture()); assertEquals(file, resourceAddedEventCaptor.getValue().getPath().toURI()); assertEquals(sessionId, resourceAddedEventCaptor.getValue().getSessionInfo().getId()); assertEquals(userId, resourceAddedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier()); assertEquals(commitMessage, resourceAddedEventCaptor.getValue().getMessage()); }
public static CommentedOption makeCommentedOption(final User identity, final SessionInfo sessionInfo, final String commitMessage) { final String name = identity.getIdentifier(); final Date when = new Date(); final CommentedOption co = new CommentedOption(sessionInfo.getId(), name, null, commitMessage, when); return co; } }
private void verifyResourceDeletedEvent(String file, String sessionId, String userId, String commitMessage) { verify(resourceDeletedEvent, times(1)).fire(resourceDeletedEventCaptor.capture()); assertEquals(file, resourceDeletedEventCaptor.getValue().getPath().toURI()); assertEquals(sessionId, resourceDeletedEventCaptor.getValue().getSessionInfo().getId()); assertEquals(userId, resourceDeletedEventCaptor.getValue().getSessionInfo().getIdentity().getIdentifier()); assertEquals(commitMessage, resourceDeletedEventCaptor.getValue().getMessage()); }
private CommentedOption commentedOption(final String comment) { return new CommentedOption(sessionInfo != null ? sessionInfo.getId() : "--", identity.getIdentifier(), null, comment); }
@Override public SessionInfo getSessionInfo() { if( delegate.isUnsatisfied() ) { return createSessionInfo(); } try { SessionInfo sessionInfo = delegate.get(); sessionInfo.getId(); return sessionInfo; } catch( Exception e ) { logger.debug("SessionInfo bean was available but could not be retrieved: " + e.getMessage(), e ); return createSessionInfo(); } }
@Override public SessionInfo getSessionInfo() { if( delegate.isUnsatisfied() ) { return createSessionInfo(); } try { SessionInfo sessionInfo = delegate.get(); sessionInfo.getId(); return sessionInfo; } catch( Exception e ) { logger.debug("SessionInfo bean was available but could not be retrieved: " + e.getMessage(), e ); return createSessionInfo(); } }
void deletePathIfExists(final Path path, final String comment) { // Delegate additional changes required for a deletion to applicable Helpers. Helpers are invoked before // the deletion as Helpers may depend on the presence of the file; in particular when it is necessary to // resolve a Package from a file name. notifyDeleteHelpers(path); ioService.deleteIfExists(Paths.convert(path), new CommentedOption(sessionInfo.getId(), identity.getIdentifier(), null, comment), StandardDeleteOption.NON_EMPTY_DIRECTORIES ); }
void deletePathIfExists(final Path path, final String comment) { // Delegate additional changes required for a deletion to applicable Helpers. Helpers are invoked before // the deletion as Helpers may depend on the presence of the file; in particular when it is necessary to // resolve a Package from a file name. notifyDeleteHelpers(path); ioService.deleteIfExists(Paths.convert(path), new CommentedOption(sessionInfo.getId(), identity.getIdentifier(), null, comment), StandardDeleteOption.NON_EMPTY_DIRECTORIES ); }