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

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

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

Obs.hasGroupMembers介绍

[英]A convenience method to check for nullity and length to determine if this obs has group members. By default, this ignores voided-objects. To include voided, use #hasGroupMembers(boolean) with value true.
[中]检查空值和长度以确定此obs是否有组成员的简便方法。默认情况下,这会忽略已作废的对象。要包含作废的,请使用#hasGroupMembers(布尔值)并将值设置为true。

代码示例

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

/**
 * A convenience method to check for nullity and length to determine if this obs has group
 * members. By default, this ignores voided-objects. To include voided, use
 * {@link #hasGroupMembers(boolean)} with value true.
 * 
 * @return true if this is the parent group of other obs
 * @should not include voided obs
 */
public boolean hasGroupMembers() {
  return hasGroupMembers(false);
}

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

/**
 * Convenience method that checks for if this obs has 1 or more group members (either voided or
 * non-voided) Note this method differs from hasGroupMembers(), as that method excludes voided
 * obs; logic is that while a obs that has only voided group members should be seen as
 * "having no group members" it still should be considered an "obs grouping"
 * <p>
 * NOTE: This method could also be called "isObsGroup" for a little less confusion on names.
 * However, jstl in a web layer (or any psuedo-getter) access isn't good with both an
 * "isObsGroup" method and a "getObsGroup" method. Which one should be returned with a
 * simplified jstl call like ${obs.obsGroup} ? With this setup, ${obs.obsGrouping} returns a
 * boolean of whether this obs is a parent and has members. ${obs.obsGroup} returns the parent
 * object to this obs if this obs is a group member of some other group.
 * 
 * @return true if this is the parent group of other obs
 */
public boolean isObsGrouping() {
  return hasGroupMembers(true);
}

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

private void evictObsAndChildren(Obs obs) {
  Context.evictFromSession(obs);
  if(obs.hasGroupMembers()) {
    for(Obs member : obs.getGroupMembers()) {
      evictObsAndChildren(member);
    }
  }
}

代码示例来源: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

/**
 * @see org.openmrs.api.db.ObsDAO#saveObs(org.openmrs.Obs)
 */
@Override
public Obs saveObs(Obs obs) throws DAOException {
  if (obs.hasGroupMembers() && obs.getObsId() != null) {
    // hibernate has a problem updating child collections
    // if the parent object was already saved so we do it
    // explicitly here
    for (Obs member : obs.getGroupMembers()) {
      if (member.getObsId() == null) {
        saveObs(member);
      }
    }
  }
  
  sessionFactory.getCurrentSession().saveOrUpdate(obs);
  
  return obs;
}

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

/**
 * @see Obs#hasGroupMembers(boolean)
 */
@Test
public void hasGroupMembers_shouldReturnTrueIfThisObsHasGroupMembersBasedOnParameter() throws Exception {
  Obs parent = new Obs(5);
  Obs child = new Obs(33);
  child.setVoided(true);
  parent.addGroupMember(child); // Only contains 1 voided child
  assertTrue("When checking for all members, should return true", parent.hasGroupMembers(true));
  assertFalse("When checking for non-voided, should return false", parent.hasGroupMembers(false));
  assertFalse("Default should check for non-voided", parent.hasGroupMembers());
}

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

} else if (getValueText() != null) {
  return getValueText();
} else if (hasGroupMembers()) {

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

assertFalse(obsGroup.hasGroupMembers(false));
assertFalse(obsGroup.hasGroupMembers(true)); // Check both flags for false
assertTrue(obsGroup.hasGroupMembers(false));
assertEquals("Duplicate add should not increase the grouped obs size", 1, obsGroup.getGroupMembers().size());
assertTrue(obsGroup.hasGroupMembers(false));
assertEquals("Removing a non existent obs should not decrease the number of grouped obs", 1, obsGroup
    .getGroupMembers().size());

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

if (obs.hasGroupMembers()) {
  if (obs.getValueCoded() != null) {
    errors.rejectValue("valueCoded", "error.not.null");
else if (!obs.hasGroupMembers()) {
  ConceptDatatype dt = c.getDatatype();
  if (dt != null) {

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

if (obsToCopy.hasGroupMembers(true)) {
  for (Obs member : obsToCopy.getGroupMembers(true)) {

代码示例来源:origin: openmrs/openmrs-module-webservices.rest

Assert.assertTrue(parentObs.hasGroupMembers());
Assert.assertTrue(childObs.hasGroupMembers());

代码示例来源:origin: org.motechproject/motech-openmrs-api

private MRSObservation createMRSObservation(Obs obs, Object value) {
  final OpenMRSObservation mrsObservation = new OpenMRSObservation(Integer.toString(obs.getId()), obs.getObsDatetime(),
      obs.getConcept().getName().getName(), value);
  if (obs.getPatient() != null) {
    List<PatientIdentifier> patientIdentifiers = obs.getPatient().getActiveIdentifiers();
    if (patientIdentifiers != null) {
      for (PatientIdentifier patientId : patientIdentifiers) {
        if (IdentifierType.IDENTIFIER_MOTECH_ID.getName().equals(patientId.getIdentifierType().getName())) {
          mrsObservation.setPatientId(patientId.getIdentifier());
        }
      }
    }
  }
  if (obs.hasGroupMembers()) {
    for (Obs observation : obs.getGroupMembers()) {
      mrsObservation.addDependantObservation(convertOpenMRSToMRSObservation(observation));
    }
  }
  eventRelay.sendEventMessage(new MotechEvent(EventKeys.CREATED_NEW_OBSERVATION_SUBJECT, EventHelper.observationParameters(mrsObservation)));
  return mrsObservation;
}

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

o.setLocation(o.getEncounter().getLocation());
if (o.hasGroupMembers())
  toCheck.addAll(o.getGroupMembers());

相关文章