本文整理匯總了Java中org.cqframework.cql.elm.tracking.TrackBack類的典型用法代碼示例。如果您正苦於以下問題:Java TrackBack類的具體用法?Java TrackBack怎麽用?Java TrackBack使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TrackBack類屬於org.cqframework.cql.elm.tracking包,在下文中一共展示了TrackBack類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: collect_errors
import org.cqframework.cql.elm.tracking.TrackBack; //導入依賴的package包/類
public static void collect_errors(ArrayList<String> errors,
Iterable<CqlTranslatorException> exceptions)
{
errors.add("Translation of CQL to ELM failed due to errors:");
for (CqlTranslatorException error : exceptions)
{
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format(
"%s[%d:%d, %d:%d]",
(tb.getLibrary() == null ? ""
: tb.getLibrary().getId()
+ (tb.getLibrary().getVersion() == null ? ""
: "-" + tb.getLibrary().getVersion()
)
),
tb.getStartLine(), tb.getStartChar(),
tb.getEndLine(), tb.getEndChar()
);
errors.add(lines + error.getMessage());
}
}
示例2: errorsToString
import org.cqframework.cql.elm.tracking.TrackBack; //導入依賴的package包/類
public static String errorsToString(Iterable<CqlTranslatorException> exceptions) {
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : exceptions) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format("%s[%d:%d, %d:%d]",
(tb.getLibrary() != null ? tb.getLibrary().getId() + (tb.getLibrary().getVersion() != null
? ("-" + tb.getLibrary().getVersion()) : "") : ""),
tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar());
errors.add(lines + error.getMessage());
}
return errors.toString();
}
示例3: beforeEachTestMethod
import org.cqframework.cql.elm.tracking.TrackBack; //導入依賴的package包/類
@BeforeMethod
public void beforeEachTestMethod() throws JAXBException, IOException {
String fileName = this.getClass().getSimpleName();
library = libraries.get(fileName);
if (library == null) {
ModelManager modelManager = new ModelManager();
LibraryManager libraryManager = new LibraryManager(modelManager);
try {
File cqlFile = new File(URLDecoder.decode(this.getClass().getResource(fileName + ".cql").getFile(), "UTF-8"));
ArrayList<CqlTranslator.Options> options = new ArrayList<>();
options.add(CqlTranslator.Options.EnableDateRangeOptimization);
CqlTranslator translator = CqlTranslator.fromFile(cqlFile, modelManager, libraryManager, options.toArray(new CqlTranslator.Options[options.size()]));
if (translator.getErrors().size() > 0) {
System.err.println("Translation failed due to errors:");
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : translator.getErrors()) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format("[%d:%d, %d:%d]",
tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar());
System.err.printf("%s %s%n", lines, error.getMessage());
errors.add(lines + error.getMessage());
}
throw new IllegalArgumentException(errors.toString());
}
assertThat(translator.getErrors().size(), is(0));
xmlFile = new File(cqlFile.getParent(), fileName + ".xml");
xmlFile.createNewFile();
PrintWriter pw = new PrintWriter(xmlFile, "UTF-8");
pw.println(translator.toXml());
pw.println();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}
library = CqlLibraryReader.read(xmlFile);
libraries.put(fileName, library);
}
}
示例4: beforeEachTestMethod
import org.cqframework.cql.elm.tracking.TrackBack; //導入依賴的package包/類
@BeforeMethod
public void beforeEachTestMethod() throws JAXBException, IOException {
String fileName = this.getClass().getSimpleName();
library = libraries.get(fileName);
if (library == null) {
ModelManager modelManager = new ModelManager();
LibraryManager libraryManager = new LibraryManager(modelManager);
try {
File cqlFile = new File(URLDecoder.decode(this.getClass().getResource(fileName + ".cql").getFile(), "UTF-8"));
ArrayList<CqlTranslator.Options> options = new ArrayList<>();
options.add(CqlTranslator.Options.EnableDateRangeOptimization);
CqlTranslator translator = CqlTranslator.fromFile(cqlFile, modelManager, libraryManager, options.toArray(new CqlTranslator.Options[options.size()]));
if (translator.getErrors().size() > 0) {
System.err.println("Translation failed due to errors:");
ArrayList<String> errors = new ArrayList<>();
for (CqlTranslatorException error : translator.getErrors()) {
TrackBack tb = error.getLocator();
String lines = tb == null ? "[n/a]" : String.format("[%d:%d, %d:%d]",
tb.getStartLine(), tb.getStartChar(), tb.getEndLine(), tb.getEndChar());
System.err.printf("%s %s%n", lines, error.getMessage());
errors.add(lines + error.getMessage());
}
throw new IllegalArgumentException(errors.toString());
}
assertThat(translator.getErrors().size(), is(0));
xmlFile = new File(cqlFile.getParent(), fileName + ".xml");
xmlFile.createNewFile();
String xml = translator.toXml();
PrintWriter pw = new PrintWriter(xmlFile, "UTF-8");
pw.println(xml);
pw.println();
pw.close();
} catch (IOException e) {
e.printStackTrace();
}
library = CqlLibraryReader.read(xmlFile);
libraries.put(fileName, library);
}
}