https://github.com/galan/dms-exchange-java
Implementation of the dms-exchange-specification in java
https://github.com/galan/dms-exchange-java
dms exchange export import java transfer
Last synced: about 2 months ago
JSON representation
Implementation of the dms-exchange-specification in java
- Host: GitHub
- URL: https://github.com/galan/dms-exchange-java
- Owner: galan
- License: apache-2.0
- Created: 2014-10-13T09:40:57.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-09-13T15:03:40.000Z (almost 9 years ago)
- Last Synced: 2025-01-25T08:07:54.555Z (over 1 year ago)
- Topics: dms, exchange, export, import, java, transfer
- Language: Java
- Size: 318 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changes.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/galan/dms-exchange-java)
[](https://maven-badges.herokuapp.com/maven-central/de.galan/dms-exchange-java)
[](https://www.apache.org/licenses/LICENSE-2.0.html)
This java-library is the reference-implementation for the [dms-exchange-specification](https://github.com/galan/dms-exchange-specification). It covers the following use-cases:
* Creating new export-archives and adding document-containers
* Reading existing document-container from existing export-archives
The library can be used in any existing dms/software to enable support for the dms-exchange-specification. It is licenced under the conditions of the Apache License 2.0 (see LICENCE file).
# Usage
## Creating an export-archive
Create the writer using one of the convenience construction methods from DmsExchange:
DmsWriter writer = DmsExchange.createWriter("/path/to/archive.tgz");
Feed the writer with documents:
writer.add(...);
As last step, close the writer (AutoClosable can be used):
writer.close();
Other writer also support writing to OutputStreams or splitting files depending on conditions, such as amount of document or filesize.
## Reading an export-archive
Create the reader using one of the convenience construction methods from DmsExchange:
DmsReader reader = DmsExchange.createReader("/path/to/archive.tgz");
Read the documents using a single consumer:
reader.readDocuments(document -> /* eg. import to your system */);
# Document
Documents are simple java beans, they can be instantiated using `new`, fields are accessed using the according setter/getter accessor methods. Fluent setters are also available.
Example of creating a minimal `Document` with some fields:
// Source keeps same, use a constant
private static final Source SOURCE = new Source("dms-name", null, "https://www.example.com", "contact@example.com");
Document doc = new Document().source(SOURCE);
DocumentFile docfile = new DocumentFile("car-insurance-2014.pdf");
docfile.addRevision(new Revision(/*documentfile creation-time*/).data(byte[] or InputStream or File));
doc.addDocumentFile(docfile);
// use a setter
doc.setNote("Keep an eye on this");
// or the fluent methods
doc.note("Keep an eye on this").labels("important", "invoice").project("insurance");
# Compatiblity
dms-exchange-java supports the [dms-exchange-specification](https://github.com/galan/dms-exchange-specification) version 1.0.0.
When newer versions of dms-exchange-specification will be released, this library is designed to be backward compatible.
# Integration with Maven
Just add the following dependency:
de.galan
dms-exchange-java
1.0.2