@Test public void onDocumentRenamedWithoutUpdateParentField() { renameRequest.setUpdateParentField(false); this.listener.onEvent(documentRenamedEvent, null, renameRequest); verify(this.modelBridge, never()).updateParentField(any(), any()); }
@Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateParentField = true; if (data instanceof MoveRequest) { updateParentField = ((MoveRequest) data).isUpdateParentField(); } if (updateParentField) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; this.logger.info("Updating the document parent fields from [{}] to [{}].", documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); this.modelBridge.updateParentField(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } }
LegacyParentFieldUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateParentField = true; if (data instanceof MoveRequest) { updateParentField = ((MoveRequest) data).isUpdateParentField(); } if (updateParentField) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; this.logger.info("Updating the document parent fields from [{}] to [{}].", documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); this.modelBridge.updateParentField(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } }
LegacyParentFieldUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateParentField = true; if (data instanceof MoveRequest) { updateParentField = ((MoveRequest) data).isUpdateParentField(); } if (updateParentField) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; this.logger.info("Updating the document parent fields from [{}] to [{}].", documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); this.modelBridge.updateParentField(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } LegacyParentFieldUpdaterListener(); }
LegacyParentFieldUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateParentField = true; if (data instanceof MoveRequest) { updateParentField = ((MoveRequest) data).isUpdateParentField(); } if (updateParentField) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; this.logger.info("Updating the document parent fields from [{}] to [{}].", documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); this.modelBridge.updateParentField(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } LegacyParentFieldUpdaterListener(); @Override void onEvent(Event event, Object source, Object data); }
LegacyParentFieldUpdaterListener extends AbstractEventListener { @Override public void onEvent(Event event, Object source, Object data) { if (event instanceof DocumentRenamedEvent) { boolean updateParentField = true; if (data instanceof MoveRequest) { updateParentField = ((MoveRequest) data).isUpdateParentField(); } if (updateParentField) { DocumentRenamedEvent documentRenamedEvent = (DocumentRenamedEvent) event; this.logger.info("Updating the document parent fields from [{}] to [{}].", documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); this.modelBridge.updateParentField(documentRenamedEvent.getSourceReference(), documentRenamedEvent.getTargetReference()); } } } LegacyParentFieldUpdaterListener(); @Override void onEvent(Event event, Object source, Object data); static final String NAME; }