本文整理汇总了Java中org.eclipse.mdht.uml.cda.util.CDAUtil类的典型用法代码示例。如果您正苦于以下问题:Java CDAUtil类的具体用法?Java CDAUtil怎么用?Java CDAUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
CDAUtil类属于org.eclipse.mdht.uml.cda.util包,在下文中一共展示了CDAUtil类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateCCDA
import org.eclipse.mdht.uml.cda.util.CDAUtil; //导入依赖的package包/类
@Override
public List<DocumentValidationResultDetail> validateCCDA(byte[] document, Optional<String> documentEncoding) {
ValidationResult result = new ValidationResult();
XPathIndexer xpathIndexer = new XPathIndexer();
try {
processParseXMLDocument(xpathIndexer, DocumentHandler
.convertByteDocumentToString(document, documentEncoding));
InputStream ccdaDocumentStream = new ByteArrayInputStream(document);
log.info("Using validation criteria: " + ValidationCriteria.C_CDA_IG_ONLY);
CDAUtil.load(ccdaDocumentStream, result);
} catch (Exception e) {
log.error(e.getMessage(), e);
throw new CcdaValidatorRunningException(e);
}
return analysisValidationResults(xpathIndexer, result);
}
示例2: testCCDAExport
import org.eclipse.mdht.uml.cda.util.CDAUtil; //导入依赖的package包/类
@Test
public void testCCDAExport() throws Exception {
Config.set("exporter.baseDirectory", tempFolder.newFolder().toString());
CDAUtil.loadPackages();
List<String> validationErrors = new ArrayList<String>();
int numberOfPeople = 10;
Generator generator = new Generator(numberOfPeople);
for (int i = 0; i < numberOfPeople; i++) {
int x = validationErrors.size();
TestHelper.exportOff();
Person person = generator.generatePerson(i);
Config.set("exporter.ccda.export", "true");
String ccdaXml = CCDAExporter.export(person, System.currentTimeMillis());
InputStream inputStream = IOUtils.toInputStream(ccdaXml, "UTF-8");
try {
CDAUtil.load(inputStream, new BasicValidationHandler() {
public void handleError(Diagnostic diagnostic) {
System.out.println("ERROR: " + diagnostic.getMessage());
validationErrors.add(diagnostic.getMessage());
}
});
} catch (Exception e) {
e.printStackTrace();
}
int y = validationErrors.size();
if (x != y) {
Exporter.export(person, System.currentTimeMillis());
}
}
assertEquals(0, validationErrors.size());
}
示例3: validateDocumentByTypeUsingMDHTApi
import org.eclipse.mdht.uml.cda.util.CDAUtil; //导入依赖的package包/类
private void validateDocumentByTypeUsingMDHTApi(InputStream in, InputStream in2, String validationObjective,
ValidationResult result) throws Exception {
if(StringUtils.isEmpty(validationObjective)) {
logAndThrowException("The validationObjective given is " + (validationObjective == null ? "null" : "empty"),
"The validationObjective given was null or empty. Please try one of the following valid Strings instead: "
+ ValidationObjectives.getObjectives() + " " + CCDATypes.getTypes());
}
String mdhtValidationObjective = mapMdhtValidationObjective(validationObjective);
//implementing a temporary work-around to allow invalid objectives to apply a default for the ETT
if(mdhtValidationObjective == null) {
validationObjective = ValidationObjectives.Sender.C_CDA_IG_PLUS_VOCAB;
mdhtValidationObjective = CCDATypes.NON_SPECIFIC_CCDAR2;
}
logger.info("Mapped mdhtValidationObjective: " + (mdhtValidationObjective != null ? mdhtValidationObjective : "null objective"));
ClinicalDocument clinicalDocument = null;
if(mdhtValidationObjective != null) {
//populate the field for reuse
isValidationObjectiveMu2Type = isValidationObjectiveMu2Type(mdhtValidationObjective);
isValidationObjectiveDS4PType = isValidationObjectiveDS4PType(mdhtValidationObjective);
if (isValidationObjectiveCCDAType(mdhtValidationObjective)) {
Mu2consolPackage.eINSTANCE.unload();
CONTENTPROFILEPackage.eINSTANCE.unload();
ConsolPackage.eINSTANCE.eClass();
logger.info("Loading mdhtValidationObjective: " + mdhtValidationObjective
+ " mapped from valdationObjective: " + validationObjective);
clinicalDocument = CDAUtil.load(in, result);
} else if (isValidationObjectiveMu2Type) {
CONTENTPROFILEPackage.eINSTANCE.unload();
Mu2consolPackage.eINSTANCE.reload();
Mu2consolPackage.eINSTANCE.eClass();
EClass docType = null;
if (mdhtValidationObjective.equalsIgnoreCase(CCDATypes.CLINICAL_OFFICE_VISIT_SUMMARY)) {
docType = Mu2consolPackage.eINSTANCE.getClinicalOfficeVisitSummary();
} else if (mdhtValidationObjective.equalsIgnoreCase(CCDATypes.TRANSITIONS_OF_CARE_AMBULATORY_SUMMARY)) {
docType = Mu2consolPackage.eINSTANCE.getTransitionOfCareAmbulatorySummary();
} else if (mdhtValidationObjective.equalsIgnoreCase(CCDATypes.TRANSITIONS_OF_CARE_INPATIENT_SUMMARY)) {
docType = Mu2consolPackage.eINSTANCE.getTransitionOfCareInpatientSummary();
} else if (mdhtValidationObjective.equalsIgnoreCase(CCDATypes.VDT_AMBULATORY_SUMMARY)) {
docType = Mu2consolPackage.eINSTANCE.getVDTAmbulatorySummary();
} else if (mdhtValidationObjective.equalsIgnoreCase(CCDATypes.VDT_INPATIENT_SUMMARY)) {
docType = Mu2consolPackage.eINSTANCE.getVDTInpatientSummary();
}
boolean isDocTypeNull = docType == null || docType.getName() == null;
logger.info("Loading mdhtValidationObjective: " + mdhtValidationObjective
+ " as MU2 docType: " + (!isDocTypeNull ? docType : "null docType")
+ " mapped from valdationObjective: " + validationObjective);
if(!isDocTypeNull) {
clinicalDocument = CDAUtil.loadAs(in, docType, result);
} else {
logAndThrowException("docType == null", "The MU2 docType EClass could not be assigned "
+ "from mdhtValidationObjective: " + mdhtValidationObjective);
}
} else if (isValidationObjectiveDS4PType) {
Mu2consolPackage.eINSTANCE.unload();
CONTENTPROFILEPackage.eINSTANCE.reload();
CONTENTPROFILEPackage.eINSTANCE.eClass();
logger.info("Loading mdhtValidationObjective: " + mdhtValidationObjective
+ " mapped from valdationObjective: " + validationObjective);
DS4PUtil.validateAsDS4P(in, result);
clinicalDocument = CDAUtil.load(in2, result);
}
} else {
//Note: This is dead code for now as null values are temporarily populated to a default
logAndThrowException("The validationObjective given is invalid",
"The validationObjective given was invalid. Please try one of the following valid Strings instead: "
+ ValidationObjectives.getObjectives() + " " + CCDATypes.getTypes());
}
ccdaDocumentType = determineCcdaDocumentType(clinicalDocument);
}