@Test public void onClassMovedToDifferentWiki() throws Exception { this.listener.onEvent( new DocumentRenamedEvent(this.oldClassReference, new DocumentReference("bar", "Code", "NewClass")), null, null); verify(this.queryManager, never()).createQuery(any(), any()); verify(this.wiki, never()).saveDocument(any(), any()); }
@Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateLinks = true; if (data instanceof MoveRequest) { updateLinks = ((MoveRequest) data).isUpdateLinks(); } if (updateLinks) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; updateObjects(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } }
UpdateObjectsOnClassRenameListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateLinks = true; if (data instanceof MoveRequest) { updateLinks = ((MoveRequest) data).isUpdateLinks(); } if (updateLinks) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; updateObjects(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } }
UpdateObjectsOnClassRenameListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateLinks = true; if (data instanceof MoveRequest) { updateLinks = ((MoveRequest) data).isUpdateLinks(); } if (updateLinks) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; updateObjects(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } UpdateObjectsOnClassRenameListener(); }
UpdateObjectsOnClassRenameListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateLinks = true; if (data instanceof MoveRequest) { updateLinks = ((MoveRequest) data).isUpdateLinks(); } if (updateLinks) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; updateObjects(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } UpdateObjectsOnClassRenameListener(); @Override void onEvent(Event event, Object source, Object data); }
UpdateObjectsOnClassRenameListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateLinks = true; if (data instanceof MoveRequest) { updateLinks = ((MoveRequest) data).isUpdateLinks(); } if (updateLinks) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; updateObjects(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } UpdateObjectsOnClassRenameListener(); @Override void onEvent(Event event, Object source, Object data); static final String NAME; }