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

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

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

Obs.setObsGroup介绍

[英]This method does NOT add this current obs to the list of obs in obsGroup.getGroupMembers(). That must be done (and should be done) manually. (I am not doing it here for fear of screwing up the normal loading and creation of this object via hibernate/spring)
[中]此方法不会将此当前obs添加到obs组中的obs列表中。getGroupMembers()。这必须(而且应该)手动完成。(我不在这里这么做,因为我担心会破坏通过hibernate/spring正常加载和创建该对象的过程)

代码示例

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

/**
 * Convenience method to remove an Obs from this grouping This also removes the link in the
 * given <code>obs</code>object to this obs grouper
 * 
 * @param member Obs to remove from this group
 * @see #setGroupMembers(Set)
 * @see #getGroupMembers()
 * @should return true when an obs is removed
 * @should return false when a non existent obs is removed
 */
public void removeGroupMember(Obs member) {
  if (member == null || getGroupMembers() == null) {
    return;
  }
  
  if (groupMembers.remove(member)) {
    member.setObsGroup(null);
  }
}

代码示例来源: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-module-webservices.rest

/**
 * Sets the members of an obs group
 * 
 * @param obsGroup the obs group whose members to set
 * @param members the members to set
 */
@PropertySetter("groupMembers")
public static void setGroupMembers(Obs obsGroup, Set<Obs> members) {
  for (Obs member : members) {
    member.setObsGroup(obsGroup);
  }
  obsGroup.setGroupMembers(members);
}

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

/**
 * Removes any Obs that are empty or which have only empty children
 */
public static void removeEmptyObs(Collection<Obs> obsList) {
  if (obsList != null) {
    Set<Obs> obsToRemove = new HashSet<Obs>();
    for (Obs o : obsList) {
      removeEmptyObs(o.getGroupMembers());
      boolean valueEmpty = StringUtils.isEmpty(o.getValueAsString(Context.getLocale()));
      boolean membersEmpty = o.getGroupMembers() == null || o.getGroupMembers().isEmpty();
      if (valueEmpty && membersEmpty) {
        obsToRemove.add(o);
      }
    }
    for (Obs o : obsToRemove) {
      if (o.getObsGroup() != null) {
        o.getObsGroup().removeGroupMember(o);
        o.setObsGroup(null);
      }
      if (o.getEncounter() != null) {
        o.getEncounter().removeObs(o);
        o.setEncounter(null);
      }
      obsList.remove(o);
    }
  }
}

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

obsToCopy.getLocation());
newObs.setObsGroup(obsToCopy.getObsGroup());
newObs.setAccessionNumber(obsToCopy.getAccessionNumber());
newObs.setValueCoded(obsToCopy.getValueCoded());

相关文章