org.openmrs.Obs.equals()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(2.9k)|赞(0)|评价(0)|浏览(206)

本文整理了Java中org.openmrs.Obs.equals()方法的一些代码示例,展示了Obs.equals()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.equals()方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:equals

Obs.equals介绍

暂无

代码示例

代码示例来源:origin: openmrs/openmrs-core

/**
 * Convenience method to add the given <code>obs</code> to this grouping. Will implicitly make
 * this obs an ObsGroup.
 * 
 * @param member Obs to add to this group
 * @see #setGroupMembers(Set)
 * @see #getGroupMembers()
 * @should return true when a new obs is added as a member
 * @should return false when a duplicate obs is added as a member
 */
public void addGroupMember(Obs member) {
  if (member == null) {
    return;
  }
  
  if (getGroupMembers() == null) {
    groupMembers = new HashSet<>();
  }
  
  // a quick sanity check to make sure someone isn't adding
  // itself to the group
  if (member.equals(this)) {
    throw new APIException("Obs.error.groupCannotHaveItselfAsAMentor", new Object[] { this, member });
  }
  
  member.setObsGroup(this);
  groupMembers.add(member);
}

代码示例来源:origin: openmrs/openmrs-core

private Obs getNewVersionOfEditedObs(Obs parentObs, Obs originalObs){
  for(Obs childObs: parentObs.getGroupMembers()){
    if(originalObs.equals(childObs.getPreviousVersion())){
      return childObs;
    }
  }
  return null;
}

代码示例来源:origin: openmrs/openmrs-core

private Obs saveObsNotDirty(Obs obs, String changeMessage) {
  if(!obs.isObsGrouping()){
    return obs;
  }
  ObsService os = Context.getObsService();
  boolean refreshNeeded = false;
  for (Obs o : obs.getGroupMembers(true)) {
    if (o.getId() == null) {
      os.saveObs(o, null);
    } else {
      Obs newObs = os.saveObs(o, changeMessage);
      refreshNeeded = !newObs.equals(o) || refreshNeeded;
    }
  }
  if(refreshNeeded) {
    Context.refreshEntity(obs);
  }
  return obs;
}

代码示例来源:origin: openmrs/openmrs-core

/**
 * @see Encounter#getObs()
 */
@Test
public void getObs_shouldOnlyGetChildObs() {
  Encounter encounter = new Encounter();
  
  //create and add an Obs
  Obs parentObs = new Obs();
  encounter.addObs(parentObs);
  
  //add a child to the obs and make sure that the Obs is an ObsGroup with one child:
  Obs childObs = new Obs();
  parentObs.addGroupMember(childObs);
  
  //obsGroup should recurse and ONLY the child obs should be picked up:
  assertEquals(1, encounter.getObs().size());
  // make sure that the obs is the oChild
  Obs obsInEncounter = (Obs) encounter.getObs().toArray()[0];
  assertTrue(childObs.equals(obsInEncounter));
  assertFalse(obsInEncounter.isObsGrouping());
}

代码示例来源:origin: openmrs/openmrs-module-htmlformentry

/**
 * Utility function that adds a set of Obs to an Encounter, skipping Obs that are already part
 * of the Encounter
 * 
 * @param encounter
 * @param group
 */
private void addObsToEncounterIfNotAlreadyThere(Encounter encounter, Obs group) {
  for (Obs obs : encounter.getObsAtTopLevel(true)) {
    if (obs.equals(group))
      return;
  }
  encounter.addObs(group);
}

代码示例来源:origin: openmrs/openmrs-module-htmlformentry

boolean matched = false;
for (Obs oMatched : matchedObs) {
  if (replacementObs.get(oMatched) != null && replacementObs.get(oMatched).equals(o)) {
    o.setVoided(true);
    o.setVoidedBy(Context.getAuthenticatedUser());

代码示例来源:origin: openmrs/openmrs-module-htmlformentry

if (mapEntry.getKey().equals(oTest)){
  found = true;
  continue;

相关文章