本文整理了Java中org.openmrs.Obs.getVoided()
方法的一些代码示例,展示了Obs.getVoided()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.getVoided()
方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:getVoided
暂无
代码示例来源:origin: openmrs/openmrs-core
/**
* Returns all Obs where Obs.encounterId = Encounter.encounterId In practice, this method should
* not be used very often...
*
* @param includeVoided specifies whether or not to include voided Obs
* @return Returns the all Obs.
* @should not return null with null obs set
* @should get obs
* @should get both parent and child obs
* @should get both parent and child with child directly on encounter
* @should get both child and parent obs after removing child from parent grouping
*/
public Set<Obs> getAllObs(boolean includeVoided) {
if (includeVoided && obs != null) {
return obs;
}
Set<Obs> ret = new LinkedHashSet<>();
if (this.obs != null) {
ret = this.obs.stream().
filter(o -> includeVoided || !o.getVoided())
.collect(Collectors.toSet());
}
return ret;
}
代码示例来源:origin: openmrs/openmrs-core
assertNotEquals(newValueText, unVoidedObs.getValueText());
assertTrue(alreadyVoidedObs.getVoided());
assertNotNull(alreadyVoidedObs.getVoidedBy());
assertNotNull(alreadyVoidedObs.getDateVoided());
assertNotNull(alreadyVoidedObs.getVoidReason());
assertFalse(toBeVoidedObs.getVoided());
assertNull(toBeVoidedObs.getVoidedBy());
assertNull(toBeVoidedObs.getDateVoided());
assertNull(toBeVoidedObs.getVoidReason());
assertFalse(unVoidedObsToUpdate.getVoided());
assertNull(unVoidedObsToUpdate.getVoidedBy());
assertNull(unVoidedObsToUpdate.getDateVoided());
assertNull(unVoidedObsToUpdate.getVoidReason());
assertFalse(unVoidedObs.getVoided());
assertNull(unVoidedObs.getVoidedBy());
assertNull(unVoidedObs.getDateVoided());
assertTrue(unVoidedObsToUpdate.getVoided());
assertNotNull(unVoidedObsToUpdate.getVoidedBy());
assertNotNull(unVoidedObsToUpdate.getDateVoided());
assertFalse(unVoidedObs.getVoided());
assertNull(unVoidedObs.getVoidedBy());
assertNull(unVoidedObs.getDateVoided());
代码示例来源:origin: openmrs/openmrs-core
/**
* Convenience method to recursively get all leaf obs of this encounter. This method goes down
* into each obs and adds all non-grouping obs to the return list
*
* @param obsParent current obs to loop over
* @return list of leaf obs
*/
private List<Obs> getObsLeaves(Obs obsParent) {
List<Obs> leaves = new ArrayList<>();
if (obsParent.hasGroupMembers()) {
for (Obs child : obsParent.getGroupMembers()) {
if (!child.getVoided()) {
if (!child.isObsGrouping()) {
leaves.add(child);
} else {
// recurse if this is a grouping obs
leaves.addAll(getObsLeaves(child));
}
}
}
} else if (!obsParent.getVoided()) {
leaves.add(obsParent);
}
return leaves;
}
代码示例来源:origin: openmrs/openmrs-core
assertTrue(obs.getVoided());
assertNotNull(obs.getDateVoided());
assertNotNull(obs.getVoidedBy());
代码示例来源:origin: openmrs/openmrs-core
if (obs == null) {
throw new APIException("Obs can't be null");
} else if (obs.getVoided()) {
return;
代码示例来源:origin: openmrs/openmrs-core
newObs.setCreator(obsToCopy.getCreator());
newObs.setDateCreated(obsToCopy.getDateCreated());
newObs.setVoided(obsToCopy.getVoided());
newObs.setVoidedBy(obsToCopy.getVoidedBy());
newObs.setDateVoided(obsToCopy.getDateVoided());
代码示例来源:origin: openmrs/openmrs-core
private void mergeObservationsNotContainedInEncounters(Patient preferred, Patient notPreferred,
PersonMergeLogData mergedData) {
// move all obs that weren't contained in encounters
// TODO: this should be a copy, not a move
ObsService obsService = Context.getObsService();
for (Obs obs : obsService.getObservationsByPerson(notPreferred)) {
if (obs.getEncounter() == null && !obs.getVoided()) {
obs.setPerson(preferred);
Obs persisted = obsService.saveObs(obs, "Merged from patient #" + notPreferred.getPatientId());
mergedData.addMovedIndependentObservation(persisted.getUuid());
}
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ObsService#unvoidObs(Obs)
*/
@Test
public void unvoidObs_shouldCascadeUnvoidToChildGroupedObs() {
executeDataSet(INITIAL_OBS_XML);
ObsService obsService = Context.getObsService();
// a obs with child groups
Obs parentObs = obsService.getObs(2);
obsService.voidObs(parentObs, "testing void cascade to child obs groups");
Assert.assertTrue(obsService.getObs(9).getVoided());
Assert.assertTrue(obsService.getObs(10).getVoided());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ObsService#unvoidObs(Obs)
*/
@Test
public void unvoidObs_shouldUnsetVoidedBitOnGivenObs() {
ObsService obsService = Context.getObsService();
Obs obs = obsService.getObs(7);
obsService.unvoidObs(obs);
assertFalse(obs.getVoided());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ObsService#voidObs(Obs,String)
*/
@Test
public void voidObs_shouldSetVoidedBitOnGivenObs() {
ObsService obsService = Context.getObsService();
Obs obs = obsService.getObs(7);
obsService.voidObs(obs, "testing void function");
assertTrue(obs.getVoided());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* Tests that we support a manual workaround in case you need to modify a FINAL obs and leave its status as FINAL
*/
@Test
public void shouldNotAutomaticallySetStatusWhenManuallyCopyingAnObs() throws Exception {
Obs existing = obsService.getObs(7);
Obs newObs = Obs.newInstance(existing);
newObs.setValueNumeric(60.0);
newObs.setPreviousVersion(existing);
newObs = obsService.saveObs(newObs, null);
obsService.voidObs(existing, "testing");
assertThat(existing.getStatus(), is(Obs.Status.FINAL));
assertThat(existing.getVoided(), is(true));
assertThat(newObs.getStatus(), is(Obs.Status.FINAL));
}
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.api.ObsService#saveObs(org.openmrs.Obs, String)
*/
@Override
public Obs saveObs(Obs obs, String changeMessage) throws APIException {
if(obs == null){
throw new APIException("Obs.error.cannot.be.null", (Object[]) null);
}
if(obs.getId() != null && changeMessage == null){
throw new APIException("Obs.error.ChangeMessage.required", (Object[]) null);
}
handleExistingObsWithComplexConcept(obs);
ensureRequirePrivilege(obs);
//Should allow updating a voided Obs, it seems to be pointless to restrict it,
//otherwise operations like merge patients won't be possible when to moving voided obs
if (obs.getObsId() == null || obs.getVoided()) {
return saveNewOrVoidedObs(obs,changeMessage);
} else if(!obs.isDirty()){
setPersonFromEncounter(obs);
return saveObsNotDirty(obs, changeMessage);
} else {
setPersonFromEncounter(obs);
return saveExistingObs(obs,changeMessage);
}
}
代码示例来源:origin: openmrs/openmrs-core
if (!o.getVoided()) {
os.voidObs(o, reason);
代码示例来源:origin: openmrs/openmrs-core
@Test
public void saveEncounter_shouldUpdateExistingEncounterWhenAChildObsIsEdited() {
executeDataSet(ENC_OBS_HIERARCHY_DATA_XML);
EncounterService es = Context.getEncounterService();
ObsService os = Context.getObsService();
Encounter enc = es.getEncounter(100);
Obs o = os.getObs(101);
o.setValueText("Obs value updated");
es.saveEncounter(enc);
Context.flushSession();
Context.clearSession();
updateSearchIndex();
enc = es.getEncounter(100);
Set<Obs> obsAtTopLevelUpdated = enc.getObsAtTopLevel(true);
Obs oParent = os.getObs(100);
final Obs editedObs = os.getObs(101);
Obs o2 = os.getObs(102);
Obs o3 = getNewVersionOfEditedObs(oParent,editedObs);
assertEquals(1,obsAtTopLevelUpdated.size());
assertEquals(3, oParent.getGroupMembers(true).size());
assertTrue(editedObs.getVoided());
assertFalse(oParent.getVoided());
assertFalse(o2.getVoided());
assertNotNull(o3);
assertFalse(o3.getVoided());
assertEquals("Obs value updated", o3.getValueText());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see EncounterService#voidEncounter(Encounter,String)
*/
@Test
public void voidEncounter_shouldCascadeToObs() {
EncounterService encounterService = Context.getEncounterService();
// get a nonvoided encounter that has some obs
Encounter encounter = encounterService.getEncounter(1);
encounterService.voidEncounter(encounter, "Just Testing");
Obs obs = Context.getObsService().getObs(1);
assertTrue(obs.getVoided());
assertEquals("Just Testing", obs.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ObsService#saveObs(Obs,String)
*/
@Test
public void saveObs_shouldVoidTheGivenObsInTheDatabase() {
Obs obs = Context.getObsService().getObs(7);
obs.setValueNumeric(1.0);
Context.getObsService().saveObs(obs, "just testing");
// fetch the obs from the database again
obs = Context.getObsService().getObs(7);
Assert.assertTrue(obs.getVoided());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see EncounterService#unvoidEncounter(Encounter)
*/
@Test
public void unvoidEncounter_shouldCascadeUnvoidToObs() {
EncounterService encounterService = Context.getEncounterService();
// get a voided encounter that has some voided obs
Encounter encounter = encounterService.getEncounter(2);
encounterService.unvoidEncounter(encounter);
Obs obs = Context.getObsService().getObs(4);
assertFalse(obs.getVoided());
assertNull(obs.getVoidReason());
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ObsService#saveObs(Obs,String)
*/
@Test
public void saveObs_shouldNotVoidAnObsWithNoChanges() {
executeDataSet(ENCOUNTER_OBS_XML);
ObsService os = Context.getObsService();
Obs obs = os.getObs(14);
assertFalse(obs.getGroupMembers(true).isEmpty());
assertFalse(obs.getGroupMembers(false).isEmpty());
assertFalse(obs.isDirty());
Set<Obs> originalMembers = new HashSet<>(obs.getGroupMembers());
for (Obs o : originalMembers) {
assertFalse(o.isDirty());
}
Obs saveObs = os.saveObs(obs, "no change");
assertEquals(obs, saveObs);
assertFalse(saveObs.getVoided());
Set<Obs> savedMembers = new HashSet<>(saveObs.getGroupMembers());
assertFalse(saveObs.isDirty());
for (Obs o : savedMembers) {
assertFalse("obs"+o.getId(), o.isDirty());
}
}
代码示例来源:origin: openmrs/openmrs-core
os.voidObs(obsThatWasVoided, "testing void method");
assertTrue(obsThatWasVoided.getVoided());
assertFalse(obsThatWasVoided.getVoided());
assertTrue(oGGGPThatWasUpdated.getVoided());
assertTrue(childLeafObs.getVoided());
assertFalse(oGGGPThatWasUpdated.getVoided());
assertFalse(childLeafObs.getVoided());
assertTrue(childLeafObs.getVoided());
assertFalse(childLeafObs.getVoided());
assertTrue(childLeafObs.getVoided());
assertFalse(childLeafObsTwo.getVoided());
assertTrue(childLeafObs.getVoided());
代码示例来源:origin: openmrs/openmrs-module-webservices.rest
@Override
public void validateDefaultRepresentation() throws Exception {
super.validateDefaultRepresentation();
assertPropPresent("person");
assertPropPresent("concept");
assertPropPresent("value");
assertPropEquals("obsDatetime", getObject().getObsDatetime());
assertPropEquals("accessionNumber", getObject().getAccessionNumber());
assertPropEquals("obsGroup", getObject().getObsGroup());
assertPropPresent("groupMembers");
assertPropEquals("comment", getObject().getComment());
assertPropPresent("location");
assertPropPresent("order");
assertPropPresent("encounter");
assertPropEquals("voided", getObject().getVoided());
}
内容来源于网络,如有侵权,请联系作者删除!