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

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

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

Obs.isComplex介绍

暂无

代码示例

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

/**
 * Internal method to remove ComplexData when an Obs is purged.
 */
protected boolean purgeComplexData(Obs obs) throws APIException {
  if (obs.isComplex()) {
    ComplexObsHandler handler = getHandler(obs);
    if (null != handler) {
      return handler.purgeComplexData(obs);
    }
  }
  
  return true;
}

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

/**
 * @see org.openmrs.api.ObsService#getComplexObs(Integer, String)
 */
@Override
@Transactional(readOnly = true)
public Obs getComplexObs(Integer obsId, String view) throws APIException {
  Obs obs = dao.getObs(obsId);
  
  if (obs != null && obs.isComplex()) {
    return getHandler(obs).getObs(obs, view);
  }
  
  return obs;
}

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

/**
 * @see org.openmrs.api.ObsService#getObsByUuid(java.lang.String)
 */
@Override
@Transactional(readOnly = true)
public Obs getObsByUuid(String uuid) throws APIException {
  Obs obsByUuid = dao.getObsByUuid(uuid);
  if (obsByUuid != null && obsByUuid.isComplex()) {
    return getHandler(obsByUuid).getObs(obsByUuid,ComplexObsHandler.RAW_VIEW);
  }
  return obsByUuid;
}

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

/**
 * @see org.openmrs.api.ObsService#getObs(java.lang.Integer)
 */
@Override
@Transactional(readOnly = true)
public Obs getObs(Integer obsId) throws APIException {
  Obs obs = dao.getObs(obsId);
  if (obs != null && obs.isComplex()) {
    return getHandler(obs).getObs(obs,ComplexObsHandler.RAW_VIEW);
  }
  return obs;
}

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

private void voidExistingObs(Obs obs, String changeMessage, Obs newObs) {
  // void out the original observation to keep it around for
  // historical purposes
  try {
    Context.addProxyPrivilege(PrivilegeConstants.DELETE_OBS);
    // fetch a clean copy of this obs from the database so that
    // we don't write the changes to the database when we save
    // the fact that the obs is now voided
    evictObsAndChildren(obs);
    obs = Context.getObsService().getObs(obs.getObsId());
    //delete the previous file from the appdata/complex_obs folder
    if (newObs.hasPreviousVersion() && newObs.getPreviousVersion().isComplex()) {
      File previousFile = AbstractHandler.getComplexDataFile(obs);
      previousFile.delete();
    }
    // calling this via the service so that AOP hooks are called
    Context.getObsService().voidObs(obs, changeMessage);
  }
  finally {
    Context.removeProxyPrivilege(PrivilegeConstants.DELETE_OBS);
  }
}

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

/**
 * @see ObsService#getComplexObs(Integer,String)
 */
@Test
public void getComplexObs_shouldReturnNormalObsForNonComplexObs() {
  executeDataSet(COMPLEX_OBS_XML);
  
  ObsService os = Context.getObsService();
  
  Obs normalObs = os.getComplexObs(7, ComplexObsHandler.RAW_VIEW);
  
  Assert.assertFalse(normalObs.isComplex());
}

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

Assert.assertTrue(complexObs.isComplex());
Assert.assertNotNull(complexObs.getValueComplex());
Assert.assertNotNull(complexObs.getComplexData());

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

/**
 * @see Obs#isComplex()
 */
@Test
public void isComplex_shouldReturnTrueIfTheConceptIsComplex() throws Exception {
  ConceptDatatype cd = new ConceptDatatype();
  cd.setName("Complex");
  cd.setHl7Abbreviation("ED");
  
  ConceptComplex complexConcept = new ConceptComplex();
  complexConcept.setDatatype(cd);
  
  Obs obs = new Obs();
  obs.setConcept(complexConcept);
  
  Assert.assertTrue(obs.isComplex());
}

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

throws Exception {
Obs obs = obsService.getObsByUuid(uuid);
if (!obs.isComplex()) {
  throw new IllegalRequestException("It is not a complex obs, thus have no data.");

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

@Override
public Object upload(MultipartFile file, RequestContext context) throws ResponseException, IOException {
  String json = context.getParameter("json");
  if (json == null) {
    throw new IllegalRequestException("Obs metadata must be included in a request parameter named 'json'.");
  }
  
  SimpleObject object = SimpleObject.parseJson(json);
  Obs obs = convert(object);
  
  if (!obs.isComplex()) {
    throw new IllegalRequestException("Complex concept must be set in order to create a complex obs with data.");
  }
  
  ObsService obsService = Context.getObsService();
  
  ComplexData complexData = new ComplexData(file.getOriginalFilename(), new ByteArrayInputStream(file.getBytes()));
  obs.setComplexData(complexData);
  
  obs = obsService.saveObs(obs, null);
  
  SimpleObject ret = (SimpleObject) ConversionUtil.convertToRepresentation(obs, Representation.DEFAULT);
  return ret;
}

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

public static void setValue(Obs obs, Object value) throws ParseException, ConversionException, IOException {
  if (value != null) {
    if (obs.isComplex()) {
      byte[] bytes = DatatypeConverter.parseBase64Binary(value.toString());

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

if (obs.isComplex()) {

相关文章

微信公众号

最新文章

更多