https://github.com/raycw/edidom
Java-centric EDI library
https://github.com/raycw/edidom
edi java
Last synced: 2 months ago
JSON representation
Java-centric EDI library
- Host: GitHub
- URL: https://github.com/raycw/edidom
- Owner: raycw
- Created: 2013-05-24T08:20:28.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2020-09-10T08:53:35.000Z (over 5 years ago)
- Last Synced: 2025-01-20T13:23:26.411Z (about 1 year ago)
- Topics: edi, java
- Language: Java
- Homepage:
- Size: 206 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://travis-ci.org/raycw/edidom)
# Introduction #
Inspired by JDOM, **edidom** is both Java-centric and Java-optimized. It behaves like Java, it uses Java collections, it is completely natural API for current Java developers, and it provides a low-cost entry point for using EDI.
## How to build ##
You need to install [MAVEN](http://maven.apache.org/), edidom is using maven to manage project build. If you using eclipse, I highly recommend you to install [m2e](http://www.eclipse.org/m2e/).
mvn package
## Data Structure ##
+-------------------------------------------------------------------+
| InterchangeEnvelope (1) |
|-------------------------------------------------------------------|
| |
| +------------------------------------------------------------+ |
| | GroupEnvelope (0..*) | |
| |------------------------------------------------------------| |
| | | |
| | +-----------------------------------------------------+ | |
| | | Transaction (1..*) | | |
| | |-----------------------------------------------------| | |
| | | +-------------------------------------------------+ | | |
| | | | Segment (1..*) | | | |
| | | +-------------------------------------------------+ | | |
| | | ... | | |
| | | ... | | |
| | | .. | | |
| | | .. | | |
| | | . | | |
| | | +-------------------------------------------------+ | | |
| | | | Segment | | | |
| | | +-------------------------------------------------+ | | |
| | +-----------------------------------------------------+ | |
| +------------------------------------------------------------+ |
+-------------------------------------------------------------------+
## Getting Started ##
### Read EDI ###
Create a Builder first. For X12, use com.github.raycw.edidom.input.X12Builder, for EDIFACT, use com.github.raycw.edidom.input.EdifactBuilder
File ediFile = new File(path);
Builder builder = new EdifactBuilder();
Document doc = builder.buildDocument(ediFile);
### Modify Content ###
Get all Segment "N9" and change the value of field number 2
List segments = doc.getSegments("N9);
for (Segment seg : segments) {
seg.getField(2).setValue("AA")
}
### Write EDI ###
Create cooresponding outputter and output as a string
X12Outputter outputter = new X12Outputter();
String ediOutput = outputter.outputString(doc);
That is!! Good luck!!
## License ##
Apache License, Version 2
http://www.apache.org/licenses/LICENSE-2.0