encounter.setForm(form); encounter.setEncounterType(encounterType); encounter.setCreator(enterer); encounter.setDateCreated(new Date());
encounter.setEncounterDatetime(new Date()); encounter.setPatient(new Patient(2)); encounter.setCreator(new User(4));
/** * @see EncounterService#saveEncounter(Encounter) */ @Test public void saveEncounter_shouldNotOverwriteCreatorIfNonNull() { EncounterService encounterService = Context.getEncounterService(); // the encounter to save with a non null creator Encounter encounter = buildEncounter(); encounter.setCreator(new User(4)); // make sure the logged in user isn't the user we're testing with assertNotSame(encounter.getCreator(), Context.getAuthenticatedUser()); encounterService.saveEncounter(encounter); // make sure the encounter creator is user 4 not user 1 assertEquals(4, encounter.getCreator().getId().intValue()); // make sure we can fetch this new encounter // from the database and its values are the same as the passed in ones Encounter newEncounter = encounterService.getEncounter(encounter.getEncounterId()); assertNotNull(newEncounter); assertEquals(4, encounter.getCreator().getId().intValue()); assertNotSame(encounter.getCreator(), Context.getAuthenticatedUser()); }
encounter.setCreator(new User(4)); Date date = new Date(System.currentTimeMillis() - 5000); // make sure we
encounter.setCreator(creator);
target.setCreator(getCreator()); target.setDateChanged(getDateChanged()); target.setDateCreated(getDateCreated());
Encounter encounter = new Encounter(); encounter.setCreator(new User()); encounter.setDateCreated(new Date()); encounter.setChangedBy(new User());
ret.setCreator(e.getCreator()); ret.setEncounterDatetime(e.getEncounterDatetime()); EncounterCompatibility.setProvider(ret, EncounterCompatibility.getProvider(e));
Encounter mrsToOpenMRSEncounter(MRSEncounter mrsEncounter) { Encounter openMrsEncounter = new Encounter(); EncounterType openMrsEncounterType = encounterService.getEncounterType(mrsEncounter.getEncounterType()); Patient patient = openMRSPatientAdapter.getOpenMrsPatient(mrsEncounter.getPatient().getPatientId()); User creator = openMRSUserAdapter.getOpenMrsUserById(mrsEncounter.getCreator().getUserId()); Location location = openMRSFacilityAdapter.getLocation(mrsEncounter.getFacility().getFacilityId()); Person provider = openMRSPersonAdapter.getPersonById(mrsEncounter.getProvider().getProviderId()); openMrsEncounter.setEncounterType(openMrsEncounterType); if (mrsEncounter.getDate() != null) { openMrsEncounter.setEncounterDatetime(mrsEncounter.getDate().toDate()); } openMrsEncounter.setPatient(patient); openMrsEncounter.setLocation(location); openMrsEncounter.setCreator(creator); openMrsEncounter.setProvider(provider); if (mrsEncounter.getObservations() != null) { openMrsEncounter.setObs(openMRSObservationAdapter.createOpenMRSObservationsForEncounter(mrsEncounter.getObservations(), openMrsEncounter, patient, location, creator)); } return openMrsEncounter; }