@Test public void createPatientFromSummaryWithNullSummaryReturnsNull() throws Exception { assertNull(this.mocker.getComponentUnderTest().createPatientSummary((Object[]) null, this.uriInfo)); }
@Override public PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo) { if (patient == null) { return null; } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(currentUser, Right.VIEW, patient.getDocumentReference())) { return null; } PatientSummary result = new PatientSummary(); XWikiDocument doc = patient.getXDocument(); result.withId(patient.getId()).withEid(patient.getExternalId()); result.withCreatedBy(String.valueOf(patient.getReporter())).withLastModifiedBy( String.valueOf(doc.getAuthorReference())); result.withVersion(doc.getVersion()); result.withCreatedOn(new DateTime(doc.getCreationDate()).withZone(DateTimeZone.UTC)); result.withLastModifiedOn(new DateTime(doc.getDate()).withZone(DateTimeZone.UTC)); result.withLinks(this.autolinker.get().forSecondaryResource(PatientResource.class, uriInfo) .withExtraParameters("entity-id", patient.getId()) .withExtraParameters("entity-type", "patients") .build()); return result; }
DefaultDomainObjectFactory implements DomainObjectFactory { @Override public PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo) { if (patient == null) { return null; } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(currentUser, Right.VIEW, patient.getDocumentReference())) { return null; } PatientSummary result = new PatientSummary(); XWikiDocument doc = patient.getXDocument(); result.withId(patient.getId()).withEid(patient.getExternalId()); result.withCreatedBy(String.valueOf(patient.getReporter())).withLastModifiedBy( String.valueOf(doc.getAuthorReference())); result.withVersion(doc.getVersion()); result.withCreatedOn(new DateTime(doc.getCreationDate()).withZone(DateTimeZone.UTC)); result.withLastModifiedOn(new DateTime(doc.getDate()).withZone(DateTimeZone.UTC)); result.withLinks(this.autolinker.get().forSecondaryResource(PatientResource.class, uriInfo) .withExtraParameters("entity-id", patient.getId()) .withExtraParameters("entity-type", "patients") .build()); return result; } }
DefaultDomainObjectFactory implements DomainObjectFactory { @Override public PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo) { if (patient == null) { return null; } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(currentUser, Right.VIEW, patient.getDocumentReference())) { return null; } PatientSummary result = new PatientSummary(); XWikiDocument doc = patient.getXDocument(); result.withId(patient.getId()).withEid(patient.getExternalId()); result.withCreatedBy(String.valueOf(patient.getReporter())).withLastModifiedBy( String.valueOf(doc.getAuthorReference())); result.withVersion(doc.getVersion()); result.withCreatedOn(new DateTime(doc.getCreationDate()).withZone(DateTimeZone.UTC)); result.withLastModifiedOn(new DateTime(doc.getDate()).withZone(DateTimeZone.UTC)); result.withLinks(this.autolinker.get().forSecondaryResource(PatientResource.class, uriInfo) .withExtraParameters("entity-id", patient.getId()) .withExtraParameters("entity-type", "patients") .build()); return result; }  }
DefaultDomainObjectFactory implements DomainObjectFactory { @Override public PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo) { if (patient == null) { return null; } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(currentUser, Right.VIEW, patient.getDocumentReference())) { return null; } PatientSummary result = new PatientSummary(); XWikiDocument doc = patient.getXDocument(); result.withId(patient.getId()).withEid(patient.getExternalId()); result.withCreatedBy(String.valueOf(patient.getReporter())).withLastModifiedBy( String.valueOf(doc.getAuthorReference())); result.withVersion(doc.getVersion()); result.withCreatedOn(new DateTime(doc.getCreationDate()).withZone(DateTimeZone.UTC)); result.withLastModifiedOn(new DateTime(doc.getDate()).withZone(DateTimeZone.UTC)); result.withLinks(this.autolinker.get().forSecondaryResource(PatientResource.class, uriInfo) .withExtraParameters("entity-id", patient.getId()) .withExtraParameters("entity-type", "patients") .build()); return result; }  @Override PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo); @Override PatientSummary createPatientSummary(Object[] summaryData, UriInfo uriInfo); @Override Alternatives createAlternatives(List<String> alternativeIdentifiers, UriInfo uriInfo); @Override Alternative createAlternative(String id, UriInfo uriInfo); }
DefaultDomainObjectFactory implements DomainObjectFactory { @Override public PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo) { if (patient == null) { return null; } User currentUser = this.users.getCurrentUser(); if (!this.access.hasAccess(currentUser, Right.VIEW, patient.getDocumentReference())) { return null; } PatientSummary result = new PatientSummary(); XWikiDocument doc = patient.getXDocument(); result.withId(patient.getId()).withEid(patient.getExternalId()); result.withCreatedBy(String.valueOf(patient.getReporter())).withLastModifiedBy( String.valueOf(doc.getAuthorReference())); result.withVersion(doc.getVersion()); result.withCreatedOn(new DateTime(doc.getCreationDate()).withZone(DateTimeZone.UTC)); result.withLastModifiedOn(new DateTime(doc.getDate()).withZone(DateTimeZone.UTC)); result.withLinks(this.autolinker.get().forSecondaryResource(PatientResource.class, uriInfo) .withExtraParameters("entity-id", patient.getId()) .withExtraParameters("entity-type", "patients") .build()); return result; }  @Override PatientSummary createPatientSummary(Patient patient, UriInfo uriInfo); @Override PatientSummary createPatientSummary(Object[] summaryData, UriInfo uriInfo); @Override Alternatives createAlternatives(List<String> alternativeIdentifiers, UriInfo uriInfo); @Override Alternative createAlternative(String id, UriInfo uriInfo);  }