用于 Java 到 EDI 转换的 Java 库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20400238/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Java library for Java to EDI conversion
提问by kailash
I am looking for a Java library that does Java to EDIconversion -
more specifically an EDI 835format used in Healthcare.
Although a lot of libraries promise Java to EDIconversion, there is no
documentation or code samples available for the same on their sites.
Here is a list of libraries I have tried so far with no luck:
1. EdiReader(EdiWriter is commercial and does not have a trial download).
2. Smooks(No trial download and documentation does not mention Java to EDI conversion).
3. Open Business Objects- OBOE from americancoders.com(Has a trial download but Java to EDI not mentioned).
4. Oakland data transformer(This doesn't even let me download the library and docs).
我正在寻找一个可以将 Java转换为 EDI的 Java 库- 更具体地说是医疗保健中使用的EDI 835格式。尽管许多库承诺将Java转换为 EDI,但在其站点上没有可用的文档或代码示例。这是我迄今为止尝试过但没有运气的库列表:
1. EdiReader(EdiWriter 是商业的,没有试用版下载)。
2. Smooks(没有试用版下载,文档也没有提到 Java 到 EDI 的转换)。
3. Open Business Objects- 来自 americancoders.com 的 OBOE(有试用版下载,但未提及 Java 到 EDI)。
4.奥克兰数据转换器(这甚至不允许我下载库和文档)。
Does anyone know other solutions that might be helpful ?
I am open to any commercial solution too.
有谁知道其他可能有用的解决方案?
我也对任何商业解决方案持开放态度。
Thanks!
谢谢!
采纳答案by Ben
SMOOKS IS NO LONGER UNDER ACTIVE DEVELOPMENT
SMOOKS 不再处于积极发展之中
Trial download for smooks?! You dont need a license. Theres also a good documentation. Check it out: http://www.smooks.org/
试下载smooks?!你不需要许可证。还有一个很好的文档。检查一下:http: //www.smooks.org/
IMHO I would go with smooks if you want no commercial solution.
恕我直言,如果您不想要商业解决方案,我会选择 smooks。
回答by Shiju K Babu
There is not much Open source Java EDI APIs. But still, there are some as you provided.
开源 Java EDI API 并不多。但是,仍然有一些你提供的。
I have also searched many.
我也搜索了很多。
Smookneeds some XML configuration to read the particular EDI file.
Smook需要一些 XML 配置来读取特定的 EDI 文件。
Then I tried EDI Reader. Actually EDI reader is available to download from internet.
然后我尝试了EDI Reader。实际上EDI阅读器可以从互联网上下载。
For me it was the only one that helped me to convert one EDI file to XML. Even the generated XML was somewhat complicated. But you can use any other API to parse the XML. Here is the download link for EDI Reader.
对我来说,它是唯一一个帮助我将一个 EDI 文件转换为 XML 的文件。甚至生成的 XML 也有些复杂。但是您可以使用任何其他 API 来解析 XML。这是EDI 阅读器的下载链接。
Read about EDI Reader, and for example programs, downloads.
It is a ZIP file Contains JAR files and some example JAVA codes
它是一个 ZIP 文件 包含 JAR 文件和一些示例 JAVA 代码
回答by Andrew
If you're open to a commercial solution, you may want to look at Altova's MapForce. It has a drag-drop mapper that you can create your map, and then it generates code to plug into your application. MapForce
如果您对商业解决方案持开放态度,则可能需要查看 Altova 的 MapForce。它有一个拖放映射器,您可以使用它来创建地图,然后生成代码以插入到您的应用程序中。 地图部队
"Java to EDI" seems to be a popular misnomer. In your case, you are creating a standardized text document (in this case an 835 EDI document) from source data (RDBMS, XML, flat file, iDoc, etc). Java is the conduit. You are basically trying to reinvent a 30+ year old wheel by writing your own translator / parser and that is usually done without the benefits of EDI syntax checking / FA reconciliation / robust partner tools. If I wanted to stop that kind of insanity, I'd look at Liaisonand their tools, specifically ECS and Delta. Those tools are Windows-based, so that might not be an option, but for an inexpensive commercial tool that can integrate easily with your architecture, your ROI would be apparent quickly.
“Java 到 EDI”似乎是一个流行的误称。在您的情况下,您正在从源数据(RDBMS、XML、平面文件、iDoc 等)创建标准化文本文档(在本例中为 835 EDI 文档)。 Java 是管道。您基本上是在尝试通过编写自己的翻译器/解析器来重新发明一个 30 多年的轮子,而这通常没有 EDI 语法检查/FA 协调/强大的合作伙伴工具的好处。如果我想停止这种疯狂,我会看看Liaison和他们的工具,特别是 ECS 和 Delta。这些工具是基于 Windows 的,因此这可能不是一种选择,但对于可以轻松与您的架构集成的廉价商业工具,您的投资回报率会很快显现出来。
回答by Calipso
If you are thinking to implement the solution with Smooks, I just refer some useful information from Smooks' Documentation:
如果您正在考虑使用 Smooks 实施解决方案,我只是参考 Smooks 文档中的一些有用信息:
Java to Text (XML, CSV, EDI etc)
Java 到文本(XML、CSV、EDI 等)
As stated in other parts of this guide, the Smooks core runtime works by processing a stream of SAX events produced by an input Source of some type (XML, EDI, Java etc) and using those events to trigger Visitor logic. In the case of a Java Source (see previous section on "Java to Java"), Smooks uses XStream to generate this stream of SAX events.
Sometimes, however, you just want to apply a template (e.g. a FreeMarker template) to a Java Source object model and produce XML, CSV, EDI etc. You don't want to incur the wasted overhead of generating a stream of SAX events that you are not going to use. To do this, you need to tell the Smooks core runtime to not generate the stream of events. This can be done in one of 2 ways.
By calling setEventStreamRequired(false) on the JavaSource instance being supplied to Smooks.filterSource:
如本指南的其他部分所述,Smooks 核心运行时通过处理由某种类型(XML、EDI、Java 等)的输入源生成的 SAX 事件流并使用这些事件触发访问者逻辑来工作。对于 Java 源(请参阅上一节“Java 到 Java”),Smooks 使用 XStream 生成此 SAX 事件流。
然而,有时您只想将模板(例如 FreeMarker 模板)应用于 Java 源对象模型并生成 XML、CSV、EDI 等。您不想招致因生成 SAX 事件流而浪费的开销你不会使用。为此,您需要告诉 Smooks 核心运行时不要生成事件流。这可以通过两种方式之一完成。
通过在提供给 Smooks.filterSource 的 JavaSource 实例上调用 setEventStreamRequired(false):
JavaSource javaSource = new JavaSource(orderBean);
// Turn streaming off via the JavaSource...
javaSource.setEventStreamRequired(false);
smooks.filterSource(javaSource, result);
Or, by turning off the "http://www.smooks.org/sax/features/generate-java-event-stream" feature in the Smooks configuration:
或者,通过关闭Smooks 配置中的“ http://www.smooks.org/sax/features/generate-java-event-stream”功能:
<reader>
<features>
<setOff feature="http://www.smooks.org/sax/features/generate-java-event-stream" />
</features>
</reader>
<!-- Other Smooks configurations e.g. a FreeMarker template... -->
When applying the FreeMarker template, the name of the templating context beans (i.e. the names used in your template) depends on the Object type in the JavaSource:
If the object is a Map, then that Map instance becomes the templating context and so you can just use the Map entry keys as the bean names in your template. For non-Map objects, the JavaSource class takes the Object Class SimpleName and creates a JavaBean property name from it. This is the name of the context bean used for the templating. So, if the bean class name is com.acme.Order, then the context bean name, for the purpose of templating, will be "order".
应用 FreeMarker 模板时,模板上下文 bean 的名称(即模板中使用的名称)取决于 JavaSource 中的 Object 类型:
如果对象是 Map,则该 Map 实例成为模板上下文,因此您可以仅使用 Map 条目键作为模板中的 bean 名称。对于非 Map 对象,JavaSource 类采用对象类 SimpleName 并从中创建一个 JavaBean 属性名称。这是用于模板的上下文 bean 的名称。因此,如果 bean 类名称是 com.acme.Order,那么上下文 bean 名称(用于模板)将是“order”。
Source: http://www.smooks.org/guide
回答by SD Shaw
I agree that there are very few open source libraries in the market which can help on EDI to xml conversion. Many of them have not been updated for years. I visited the "Smooks" site and it seems, that the project has been discontinued.
我同意市场上很少有开源库可以帮助将 EDI 转换为 xml。其中许多已经多年未更新。我访问了“Smooks”网站,似乎该项目已停止。
If you are okay with paying for a solution, you may give EDI parser from Progressa try.
如果您愿意为解决方案付费,您可以尝试使用Progress的EDI 解析器。
It comes with a free trial version for 15 days and the apis are very easy to use and integrate in your project.
它带有 15 天的免费试用版,API 非常易于使用和集成到您的项目中。
It does not only support EDI to xml conversion, but also EDI to CSV conversion (you have the option to decide the delimiter).
它不仅支持 EDI 到 xml 的转换,还支持 EDI 到 CSV 的转换(您可以选择决定分隔符)。