Requirements

Mandatory requirements:

Recommended:


Documentation

Read the following user guide to know how to use this library properly.

You can also see the Javadoc

Document creation

First of all, you need to declare and initialize an AgreementManager:

AgreementManager manager = new AgreementManager();

You can pass a configuration file to the manager as a parameter. This file has to be written in JSON format.

{
    "defaultInputFormat": "IAGREE",
    "CSPReasoner": "CPLEX",
    "CSPWebReasonerEndpoint": "http://150.214.188.130:8080/CSPWebReasoner",
    "DLReasoner": "none",
    "ANDConstraintsBreaking" : "true" 
}

To create a template, an offer or an agreement, use the manager as follow:

AgreementModel model = manager.createAgreementTemplate("Template's content");
AgreementModel model = manager.createAgreementOffer("Offer's content");
AgreementModel model = manager.createAgreement("Agreement's content");

To create a template, an offer or an agreement from a file, use these methods instead:

AgreementModel model = manager.createAgreementTemplateFromFile("path/to/file.at");
AgreementModel model = manager.createAgreementOfferFromFile("path/to/file.ao");
AgreementModel model = manager.createAgreementFromFile("path/to/file.ag");

AgreementModel is a superclass that contains the following subclasses: AgreementTemplate, AgreementOffer and Agreement. We can cast our model to one of these three types depending on our case.

Saving documents

Note that when we create models, we are not registering it. So if we need to use it later, we won't be able to retrieve it.
If you want that a model persists, you should use register methods.

manager.register(model);

In this case, you'll be able to retrieve your model specifying its ID. If you prefer to specify a custom name, use the following method instead:

manager.register("MyModel", model);

To create a template, an offer or an agreement from a file, use these methods instead:

manager.registerFromFile(file); // file: File format
manager.registerFromFile("path/to/file");

Retrieving documents

To retrieve a model, simply use one of these three methods, depending on your case:

manager.getAgreementTemplate("MyModel");
manager.getAgreementOffer("MyModel");
manager.getAgreement("MyModel");

Derived documents

Generating offers from templates

Generate an offer from a template is as easy as use the method generateAgreementOffer from the type AgreementTemplate.

AgreementTemplate myTemplate = manager.createAgreementTemplateFromFile("path/to/file.at");
AgreementOffer myOffer = myTemplate.generateAgreementOffer("Consumer name")

Generating agreements from offers

In the same way, we can generate an agreement from an offer using the method generateAgreement:

AgreementOffer myOffer = manager.createAgreementOfferFromFile("path/to/file.ao");
Agreement myAgreement = myOffer.generateAgreement("Consumer name");

Showcases

You can find some showcases in aml-showcases, such as the papamoscas showcase project. Each showcase project will have the following architecture:


Contributing

To contribute to this project, read our development policies


CHANGELOG

CHANGELOG file