/** Default constructor, sets up the listener name and the list of events to subscribe to. */ public VCFInitializer() { super("patient-vcf-initializer", new PatientCreatingEvent()); }
/** Default constructor, sets up the listener name and the list of events to subscribe to. */ public OwnerUpdateEventListener() { super("phenotips-patient-owner-updater", new PatientCreatingEvent()); }
/** Default constructor, sets up the listener name and the list of events to subscribe to. */ public OwnerUpdateEventListener() { super("phenotips-entity-owner-updater", new PatientCreatingEvent()); }
/** Default constructor, sets up the listener name and the list of events to subscribe to. */ public VCFInitializer() { super("patient-vcf-initializer", new PatientCreatingEvent()); }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(Patient.CLASS_REFERENCE); if (patientRecordObj == null || "PatientTemplate".equals(doc.getDocumentReference().getName())) { return; } Patient patient = this.repo.load(doc); User user = this.userManager.getCurrentUser(); CancelableEvent patientEvent = new PatientCreatingEvent(patient, user); this.observationManager.notify(patientEvent, doc); if (patientEvent.isCanceled()) { // FIXME DocumentCancelingEvent is not cancelable yet! // ((CancelableEvent) event).cancel(); // return; } patientEvent = new PatientChangingEvent(patient, user); this.observationManager.notify(patientEvent, doc); if (patientEvent.isCanceled()) { // FIXME DocumentCancelingEvent is not cancelable yet! // ((CancelableEvent) event).cancel(); } } }
@Override public void onEvent(Event event, Object source, Object data) { XWikiDocument doc = (XWikiDocument) source; BaseObject patientRecordObj = doc.getXObject(Patient.CLASS_REFERENCE); if (patientRecordObj == null || "PatientTemplate".equals(doc.getDocumentReference().getName())) { return; } Patient patient = this.repo.load(doc); User user = this.userManager.getCurrentUser(); CancelableEvent patientEvent = new PatientCreatingEvent(patient, user); this.observationManager.notify(patientEvent, doc); if (patientEvent.isCanceled()) { // FIXME DocumentCancelingEvent is not cancelable yet! // ((CancelableEvent) event).cancel(); // return; } patientEvent = new PatientChangingEvent(patient, user); this.observationManager.notify(patientEvent, doc); if (patientEvent.isCanceled()) { // FIXME DocumentCancelingEvent is not cancelable yet! // ((CancelableEvent) event).cancel(); } } }