An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![Build Status](https://img.shields.io/travis/galan/dms-exchange-java.svg?style=flat)](https://travis-ci.org/galan/dms-exchange-java)
[![Maven Central](https://img.shields.io/maven-central/v/de.galan/dms-exchange-java.svg?style=flat)](https://maven-badges.herokuapp.com/maven-central/de.galan/dms-exchange-java)
[![License](https://img.shields.io/github/license/galan/dms-exchange-java.svg?style=flat)](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