@Test public void onOtherEvents() { this.listener.onEvent(null, null, null); verify(this.linkRefactoring, never()).updateRelativeLinks(any(), any()); }
@Override public void onEvent(Event event, Object source, Object data) { boolean updateRelativeLinks = data instanceof AbstractCopyOrMoveRequest ? ((AbstractCopyOrMoveRequest) data).isUpdateLinks() : true; if (updateRelativeLinks && (event instanceof DocumentCopiedEvent || event instanceof DocumentRenamedEvent)) { @SuppressWarnings("unchecked") AbstractEntityCopyOrRenameEvent<DocumentReference> copyOrRenameEvent = (AbstractEntityCopyOrRenameEvent<DocumentReference>) event; this.logger.info("Updating the relative links from [{}].", copyOrRenameEvent.getTargetReference()); this.linkRefactoring.updateRelativeLinks(copyOrRenameEvent.getSourceReference(), copyOrRenameEvent.getTargetReference()); } }
RelativeLinkUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { boolean updateRelativeLinks = data instanceof AbstractCopyOrMoveRequest ? ((AbstractCopyOrMoveRequest) data).isUpdateLinks() : true; if (updateRelativeLinks && (event instanceof DocumentCopiedEvent || event instanceof DocumentRenamedEvent)) { @SuppressWarnings("unchecked") AbstractEntityCopyOrRenameEvent<DocumentReference> copyOrRenameEvent = (AbstractEntityCopyOrRenameEvent<DocumentReference>) event; this.logger.info("Updating the relative links from [{}].", copyOrRenameEvent.getTargetReference()); this.linkRefactoring.updateRelativeLinks(copyOrRenameEvent.getSourceReference(), copyOrRenameEvent.getTargetReference()); } } }
RelativeLinkUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { boolean updateRelativeLinks = data instanceof AbstractCopyOrMoveRequest ? ((AbstractCopyOrMoveRequest) data).isUpdateLinks() : true; if (updateRelativeLinks && (event instanceof DocumentCopiedEvent || event instanceof DocumentRenamedEvent)) { @SuppressWarnings("unchecked") AbstractEntityCopyOrRenameEvent<DocumentReference> copyOrRenameEvent = (AbstractEntityCopyOrRenameEvent<DocumentReference>) event; this.logger.info("Updating the relative links from [{}].", copyOrRenameEvent.getTargetReference()); this.linkRefactoring.updateRelativeLinks(copyOrRenameEvent.getSourceReference(), copyOrRenameEvent.getTargetReference()); } } RelativeLinkUpdaterListener(); }
RelativeLinkUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { boolean updateRelativeLinks = data instanceof AbstractCopyOrMoveRequest ? ((AbstractCopyOrMoveRequest) data).isUpdateLinks() : true; if (updateRelativeLinks && (event instanceof DocumentCopiedEvent || event instanceof DocumentRenamedEvent)) { @SuppressWarnings("unchecked") AbstractEntityCopyOrRenameEvent<DocumentReference> copyOrRenameEvent = (AbstractEntityCopyOrRenameEvent<DocumentReference>) event; this.logger.info("Updating the relative links from [{}].", copyOrRenameEvent.getTargetReference()); this.linkRefactoring.updateRelativeLinks(copyOrRenameEvent.getSourceReference(), copyOrRenameEvent.getTargetReference()); } } RelativeLinkUpdaterListener(); @Override void onEvent(Event event, Object source, Object data); }
RelativeLinkUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { boolean updateRelativeLinks = data instanceof AbstractCopyOrMoveRequest ? ((AbstractCopyOrMoveRequest) data).isUpdateLinks() : true; if (updateRelativeLinks && (event instanceof DocumentCopiedEvent || event instanceof DocumentRenamedEvent)) { @SuppressWarnings("unchecked") AbstractEntityCopyOrRenameEvent<DocumentReference> copyOrRenameEvent = (AbstractEntityCopyOrRenameEvent<DocumentReference>) event; this.logger.info("Updating the relative links from [{}].", copyOrRenameEvent.getTargetReference()); this.linkRefactoring.updateRelativeLinks(copyOrRenameEvent.getSourceReference(), copyOrRenameEvent.getTargetReference()); } } RelativeLinkUpdaterListener(); @Override void onEvent(Event event, Object source, Object data); static final String NAME; }