本文整理了Java中org.openmrs.Obs.newInstance()
方法的一些代码示例,展示了Obs.newInstance()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.newInstance()
方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:newInstance
[英]This is an equivalent to a copy constructor. Creates a new copy of the given obsToCopy
with a null obs id
[中]这相当于复制构造函数。创建具有空obs id的给定obsToCopy
的新副本
代码示例来源:origin: openmrs/openmrs-core
private Obs saveExistingObs(Obs obs, String changeMessage) {
// get a copy of the passed in obs and save it to the
// database. This allows us to create a new row and new obs_id
// this method doesn't copy the obs_id
Obs newObs = Obs.newInstance(obs);
unsetVoidedAndCreationProperties(newObs,obs);
Obs.Status originalStatus = dao.getSavedStatus(obs);
updateStatusIfNecessary(newObs, originalStatus);
RequiredDataAdvice.recursivelyHandle(SaveHandler.class, newObs, changeMessage);
// save the new row to the database with the changes that
// have been made to it
dao.saveObs(newObs);
saveObsGroup(newObs,null);
voidExistingObs(obs, changeMessage, newObs);
return newObs;
}
代码示例来源: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
@Test
public void newInstance_shouldCopyMostFields() throws Exception {
Obs obs = new Obs();
obs.setStatus(Obs.Status.PRELIMINARY);
obs.setInterpretation(Obs.Interpretation.LOW);
obs.setConcept(new Concept());
obs.setValueNumeric(1.2);
Obs copy = Obs.newInstance(obs);
// these fields are not copied
assertThat(copy.getObsId(), nullValue());
assertThat(copy.getUuid(), not(obs.getUuid()));
// other fields are copied
assertThat(copy.getConcept(), is(obs.getConcept()));
assertThat(copy.getValueNumeric(), is(obs.getValueNumeric()));
assertThat(copy.getStatus(), is(obs.getStatus()));
assertThat(copy.getInterpretation(), is(obs.getInterpretation()));
// TODO test that the rest of the fields are set
}
代码示例来源:origin: openmrs/openmrs-core
Obs obsCopy = Obs.newInstance(obs);
obsCopy.setEncounter(target);
obsCopy.setPerson(patient);
代码示例来源:origin: openmrs/openmrs-core
newObs.addGroupMember(member);
} else {
Obs newMember = Obs.newInstance(member);
newMember.setPreviousVersion(member);
newObs.addGroupMember(newMember);
内容来源于网络,如有侵权,请联系作者删除!