private void unsetVoidedAndCreationProperties(Obs newObs,Obs obs) { newObs.setVoided(false); newObs.setVoidReason(null); newObs.setDateVoided(null); newObs.setVoidedBy(null); newObs.setCreator(null); newObs.setDateCreated(null); newObs.setPreviousVersion(obs); }
/** * @see Obs#isDirty() */ @Test public void isDirty_shouldReturnFalseWhenOnlyMutableFieldsAreChanged() throws Exception { Obs obs = new Obs(); obs.setVoided(true); obs.setVoidedBy(new User(1000)); obs.setVoidReason("some other reason"); obs.setDateVoided(new Date()); assertFalse(obs.isDirty()); Obs obsEdited = new Obs(5); obsEdited.setVoided(true); obsEdited.setVoidedBy(new User(1000)); obsEdited.setVoidReason("some other reason"); obsEdited.setDateVoided(new Date()); assertFalse(obsEdited.isDirty()); }
newObs.setDateCreated(obsToCopy.getDateCreated()); newObs.setVoided(obsToCopy.getVoided()); newObs.setVoidedBy(obsToCopy.getVoidedBy()); newObs.setDateVoided(obsToCopy.getDateVoided()); newObs.setVoidReason(obsToCopy.getVoidReason());
/** * Voids an observation for the `MOTECH user, with the given reason * * @param mrsObservation MRSObservation to be voided * @param reason Reason for voiding the MRSObservation * @param userMotechId MOTECH ID of the user who's MRSObservation needs to be voided * @throws ObservationNotFoundException Exception when the expected Observation does not exist */ @Override public void voidObservation(MRSObservation mrsObservation, String reason, String userMotechId) throws ObservationNotFoundException { Obs obs = obsService.getObs(Integer.valueOf(mrsObservation.getObservationId())); if (obs == null) { throw new ObservationNotFoundException("Observation not found for MOTECH id :" + userMotechId + " and with MRS observation id :" + mrsObservation.getObservationId()); } obs.setVoided(true); obs.setVoidReason(reason); obs.setDateVoided(new Date()); obs.setVoidedBy(openMRSUserAdapter.getOpenMrsUserByUserName(userMotechId)); obsService.voidObs(obs, reason); eventRelay.sendEventMessage(new MotechEvent(EventKeys.DELETED_OBSERVATION_SUBJECT, EventHelper.observationParameters(convertOpenMRSToMRSObservation(obs)))); }
if (replacementObs.get(oMatched) != null && replacementObs.get(oMatched).equals(o)) { o.setVoided(true); o.setVoidedBy(Context.getAuthenticatedUser()); o.setVoidReason(voidReason); o.setDateVoided(new Date());
for (Obs o : e.getAllObs(true)) { o.setVoided(true); o.setVoidedBy(Context.getUserService().getUser(1)); o.setVoidReason("blah"); o.setDateVoided(new Date());