本文整理了Java中org.openmrs.Obs.setComplexData()
方法的一些代码示例,展示了Obs.setComplexData()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Obs.setComplexData()
方法的具体详情如下:
包路径:org.openmrs.Obs
类名称:Obs
方法名:setComplexData
[英]Set the ComplexData for this Obs. The ComplexData is stored in the file system or elsewhere, but is not persisted to the database.
ComplexObsHandlers that are registered to ConceptComplexs will persist the ComplexData#getData() object to the correct place for the given concept.
[中]设置此Obs的ComplexData。ComplexData存储在文件系统或其他地方,但不会持久化到数据库中。
注册到ConceptComplex的ComplexObsHandler将把ComplexData#getData()对象持久化到给定概念的正确位置。
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.obs.ComplexObsHandler#purgeComplexData(org.openmrs.Obs)
*/
public boolean purgeComplexData(Obs obs) {
File file = getComplexDataFile(obs);
if (!file.exists()) {
return true;
} else if (file.delete()) {
obs.setComplexData(null);
return true;
}
log.warn(
"Could not delete complex data object for obsId=" + obs.getObsId() + " located at " + file.getAbsolutePath());
return false;
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.obs.ComplexObsHandler#getObs(Obs, String)
*/
public Obs getObs(Obs obs, String view) {
File file = BinaryDataHandler.getComplexDataFile(obs);
log.debug("value complex: " + obs.getValueComplex());
log.debug("file path: " + file.getAbsolutePath());
ComplexData complexData = null;
try {
complexData = new ComplexData(file.getName(), OpenmrsUtil.getFileAsBytes(file));
}
catch (IOException e) {
log.error("Trying to read file: " + file.getAbsolutePath(), e);
}
String mimeType = OpenmrsUtil.getFileMimeType(file);
complexData.setMimeType(mimeType);
obs.setComplexData(complexData);
return obs;
}
代码示例来源:origin: openmrs/openmrs-core
obs.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
complexData.setMimeType(mimeType);
obs.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
complexData.setMimeType(mimeType);
obs.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
complexData.setMimeType(mimeType);
obs.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
/**
* @see org.openmrs.obs.ComplexObsHandler#saveObs(org.openmrs.Obs)
*/
@Override
public Obs saveObs(Obs obs) throws APIException {
try {
// Write the File to the File System
String fileName = obs.getComplexData().getTitle();
File outfile = getOutputFileToWrite(obs);
OutputStream out = new FileOutputStream(outfile, false);
FileInputStream mediaStream = (FileInputStream) obs.getComplexData().getData();
OpenmrsUtil.copyFile(mediaStream, out);
// Store the filename in the Obs
obs.setComplexData(null);
obs.setValueComplex(fileName + "|" + outfile.getName());
// close the stream
out.close();
}
catch (IOException ioe) {
throw new APIException("Obs.error.trying.write.complex", null, ioe);
}
return obs;
}
代码示例来源:origin: openmrs/openmrs-core
/**
* @see ComplexObsHandler#saveObs(Obs)
*/
@Override
public Obs saveObs(Obs obs) throws APIException {
try {
// Write the File to the File System
String fileName = obs.getComplexData().getTitle();
InputStream in = (InputStream) obs.getComplexData().getData();
File outfile = getOutputFileToWrite(obs);
OutputStream out = new FileOutputStream(outfile, false);
OpenmrsUtil.copyFile(in, out);
// Store the filename in the Obs
obs.setComplexData(null);
obs.setValueComplex(fileName + "|" + outfile.getName());
// close the stream
out.close();
}
catch (Exception e) {
throw new APIException("Obs.error.writing.binary.data.complex", null, e);
}
return obs;
}
代码示例来源:origin: openmrs/openmrs-core
obs.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
@Test
public void getOutputFileToWrite_shouldCorrectlyNameTitledFileWithoutExtension() throws IOException, ParseException {
ComplexData complexDataWithoutExtension = new ComplexData(FilenameUtils.removeExtension(FILENAME), null);
Obs obsWithoutExtension = new Obs();
obsWithoutExtension.setComplexData(complexDataWithoutExtension);
File extensionlessFile = handler.getOutputFileToWrite(obsWithoutExtension);
extensionlessFile.createNewFile();
String[] nameWithoutExtension = extensionlessFile.getName().split("_|\\.");
String titlePartExtensionless = nameWithoutExtension[0];
String uuidPartExtensionless = nameWithoutExtension[1];
String extensionPartExtensionless = nameWithoutExtension[2];
assertEquals(titlePartExtensionless, FilenameUtils.removeExtension(FILENAME));
assertEquals(extensionPartExtensionless, "dat");
assertEquals(uuidPartExtensionless, obsWithoutExtension.getUuid());
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void getOutputFileToWrite_shouldCorrectlyNameNullTitledFile() throws IOException, ParseException {
ComplexData complexDataWithNullTitle = new ComplexData(null, null);
Obs obsWithNullTitle = new Obs();
obsWithNullTitle.setComplexData(complexDataWithNullTitle);
File nullTitleFile = handler.getOutputFileToWrite(obsWithNullTitle);
nullTitleFile.createNewFile();
String[] nameWithNullTitle = nullTitleFile.getName().split("\\.");
String uuidPartWithNullTitle = nameWithNullTitle[0];
String extensionPartWithNullTitle = nameWithNullTitle[1];
assertEquals(extensionPartWithNullTitle, "dat");
assertEquals(uuidPartWithNullTitle, obsWithNullTitle.getUuid());
}
代码示例来源:origin: openmrs/openmrs-core
@Test
public void getOutputFileToWrite_shouldCorrectlyNameTitledFileWithExtension() throws IOException, ParseException {
ComplexData complexDataWithTitle = new ComplexData(FILENAME, null);
Obs obsWithTitle = new Obs();
obsWithTitle.setComplexData(complexDataWithTitle);
File titledFile = handler.getOutputFileToWrite(obsWithTitle);
titledFile.createNewFile();
String[] nameWithTitle = titledFile.getName().split("_|\\.");
String titlePart = nameWithTitle[0];
String uuidPartWithTitle = nameWithTitle[1];
String extensionPart = nameWithTitle[2];
assertEquals(titlePart, FilenameUtils.removeExtension(FILENAME));
assertEquals(extensionPart, "txt");
assertEquals(uuidPartWithTitle, obsWithTitle.getUuid());
}
代码示例来源:origin: openmrs/openmrs-core
obsToSave.setComplexData(complexData);
os.saveObs(obsToSave, null);
ComplexData updatedComplexData = new ComplexData("nameOfUpdatedFile.txt", updatedInput);
obsToSave.setComplexData(updatedComplexData);
try {
os.saveObs(obsToSave, changeMessage);
代码示例来源:origin: openmrs/openmrs-core
obsToSave.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
obsToSave.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
obs1.setComplexData(complexData1);
obs2.setComplexData(complexData2);
代码示例来源:origin: openmrs/openmrs-core
obs1.setComplexData(complexData);
obs2.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
obs1.setComplexData(complexData);
obs2.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
obs1.setComplexData(complexData);
obs2.setComplexData(complexData);
代码示例来源:origin: openmrs/openmrs-core
obs1.setComplexData(complexData);
obs2.setComplexData(complexData);
内容来源于网络,如有侵权,请联系作者删除!