Skip to content

Commit

Permalink
Merge pull request #300 from symphony-youri/cleanup-upgrade
Browse files Browse the repository at this point in the history
Cleanup/Upgrade dependencies
  • Loading branch information
symphony-youri authored Oct 26, 2021
2 parents f1bee93 + f615e9f commit 825c09c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 117 deletions.
3 changes: 0 additions & 3 deletions .settings/org.eclipse.jdt.ui.prefs

This file was deleted.

94 changes: 52 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,86 +6,96 @@

# Introduction

MessageML is a markup language used by the Symphony Agent API for representing messages, including formatting (bold, italic, numbered and unnumbered lists etc.)
and entity data representing [_structured objects_](https://rest-api.symphony.com/docs/objects).
MessageML is a markup language used by the Symphony Agent API for representing messages, including formatting (bold,
italic, numbered and unnumbered lists etc.)
and entity data representing [_structured
objects_](https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml/entities/structured-objects)
.

The format is intended to allow third parties to create and render rich content messages representing complex objects,
The format is intended to allow third parties to create and render rich content messages representing complex objects,
enabling deep workflow integrations across multiple systems, with Symphony being the central hub.

# Description

Support of Symphony structured objects comprises the ability to parse and render the following formats:

* [MessageML](https://rest-api.symphony.com/docs/messagemlv2),
a superset of PresentationML, adding a number of convenience tags for more complex or frequently used constructs.
It is translated to PresentationML internally by the Agent API before ingestion in Symphony.
* [PresentationML](https://rest-api.symphony.com/docs/messagemlv2#reading-messageml-messages),
a strict subset of HTML5 describing the markup which controls the formatting (presentation) of a message.
PresenttionML is the format used internally by Symphony and returned from message ingestion and retrieval by the Agent API.
* [EntityJSON](https://rest-api.symphony.com/docs/objects#message-and-object-presentation),
JSON data representing complex financial objects and other structured data.
EntityJSON elements are referenced in PresentationML and are provided by the message originator
or generated automatically during the expansion of MessageML convenience tags.
* [Freemarker](http://freemarker.org/),
a templating language providing macros (conditional blocks, iterations, assignments etc.)
to expand message templates into MessageML messages. Freemarker support is experimental.
* [Markdown](http://daringfireball.net/projects/markdown/syntax),
the legacy text format used by Symphony.
Markdown parsing and rendering capabilities are provided for compatibility with older versions of Symphony.
* [MessageML](https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml), a superset of PresentationML, adding a number of
convenience tags for more complex or frequently used constructs. It is translated to PresentationML internally by the
Agent API before ingestion in Symphony.
* [PresentationML](https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-presentationml), a strict subset of HTML5
describing the markup which controls the formatting (presentation) of a message. PresenttionML is the format used
internally by Symphony and returned from message ingestion and retrieval by the Agent API.
* [EntityJSON](https://docs.developers.symphony.com/building-bots-on-symphony/messages/overview-of-messageml/entities), JSON data representing
complex financial objects and other structured data. EntityJSON elements are referenced in PresentationML and are
provided by the message originator or generated automatically during the expansion of MessageML convenience tags.
* [Freemarker](http://freemarker.org/), a templating language providing macros (conditional blocks, iterations,
assignments etc.)
to expand message templates into MessageML messages. Freemarker support is experimental.
* [Markdown](http://daringfireball.net/projects/markdown/syntax), the legacy text format used by Symphony. Markdown
parsing and rendering capabilities are provided for compatibility with older versions of Symphony.

More specifically, the MessageML parser can be used to:

* validate the input message as correct MessageML or PresentationML and the input data as correct EntityJSON;
if the input message contains references to entity data, the validation process verifies if the provided data matches those references
* expand Freemarker templates into MessageML messages; this includes processing Freemarker macros
and injecting EntityJSON data referenced by template variables
* validate the input message as correct MessageML or PresentationML and the input data as correct EntityJSON; if the
input message contains references to entity data, the validation process verifies if the provided data matches those
references
* expand Freemarker templates into MessageML messages; this includes processing Freemarker macros and injecting
EntityJSON data referenced by template variables
* construct a document tree representing the message
* serialize the MessageML tree as PresentationML; this step includes generation of EntityJSON data from convenience MessageML tags
* serialize the MessageML tree as PresentationML; this step includes generation of EntityJSON data from convenience
MessageML tags
* serialize the MessageML tree as Markdown
* parse Markdown input into a MessageML document tree

# Usage

```java
/* Instantiate the parsing context. The "dataProvider" object is used to resolve user mentions and check supplied URLs against a whitelist of supported URI schemes. */
MessageMLContext context = new MessageMLContext(/*IDataProvider*/ dataProvider);
MessageMLContext context=new MessageMLContext(/*IDataProvider*/ dataProvider);

/* Parse the message and entity data */
context.parseMessageML(/*String*/ message, /*String*/ entityJSON, /*String*/ version);
/* Parse the message and entity data */
context.parseMessageML(/*String*/ message, /*String*/ entityJSON, /*String*/ version);

/* Parse a Markdown message into a MessageML document tree */
context.parseMarkdown(/*String*/ markdown, /*JsonNode*/ entities, /*JsonNode*/ media);
/* Parse a Markdown message into a MessageML document tree */
context.parseMarkdown(/*String*/ markdown, /*JsonNode*/ entities, /*JsonNode*/ media);

/* Get the MessageML document tree */
Element messageML = context.getMessageML();
/* Get the MessageML document tree */
Element messageML=context.getMessageML();

/* Get the PresenttionML representation of the message */
String presentationML = context.getPresentationML();
/* Get the PresenttionML representation of the message */
String presentationML=context.getPresentationML();

/* Get the entity data of the message, including data auto-generated from MessageML convenience tags*/
String entityJSON = context.getEntityJson();
/* Get the entity data of the message, including data auto-generated from MessageML convenience tags*/
String entityJSON=context.getEntityJson();

/* Get the Markdown representation of the message */
String markdown = context.getMarkdown();
/* Get the Markdown representation of the message */
String markdown=context.getMarkdown();

/* Get the plain text of the message */
String text = context.getText();
/* Get the plain text of the message */
String text=context.getText();
```

## Contributing

1. Fork it (<https://github.com/symphonyoss/messageml-utils/fork>)
2. Create your feature branch (`git checkout -b feature/fooBar`)
3. Read our [contribution guidelines](.github/CONTRIBUTING.md) and [Community Code of Conduct](https://www.finos.org/code-of-conduct)
3. Read our [contribution guidelines](.github/CONTRIBUTING.md)
and [Community Code of Conduct](https://www.finos.org/code-of-conduct)
4. Commit your changes (`git commit -am 'Add some fooBar'`)
5. Push to the branch (`git push origin feature/fooBar`)
6. Create a new Pull Request

_NOTE:_ Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active, executed Individual Contributor License Agreement (ICLA) with FINOS OR who are covered under an existing and active Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered under an ICLA or CCLA will be flagged and blocked by the FINOS Clabot tool. Please note that some CCLAs require individuals/employees to be explicitly named on the CCLA.
_NOTE:_ Commits and pull requests to FINOS repositories will only be accepted from those contributors with an active,
executed Individual Contributor License Agreement (ICLA) with FINOS OR who are covered under an existing and active
Corporate Contribution License Agreement (CCLA) executed with FINOS. Commits from individuals not covered under an ICLA
or CCLA will be flagged and blocked by the FINOS Clabot tool. Please note that some CCLAs require individuals/employees
to be explicitly named on the CCLA.

*Need an ICLA? Unsure if you are covered under an existing CCLA? Email [[email protected]](mailto:[email protected])*

## License

The code in this repository is distributed under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).
The code in this repository is distributed under
the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0).

Copyright 2016-2021 Symphony LLC
57 changes: 7 additions & 50 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand Down Expand Up @@ -63,66 +64,22 @@
<role>Senior Developer Platform</role>
</roles>
</developer>
<developer>
<id>bruceskingle</id>
<name>Bruce Skingle</name>
<email>[email protected]</email>
<url>http://github.com/bruceskingle</url>
<organization>Symphony Communication Services LLC</organization>
<organizationUrl>http://symphony.com</organizationUrl>
<roles>
<role>Principal Software Engineer</role>
</roles>
</developer>
<developer>
<id>cristiadu</id>
<name>Cristiano Faustino</name>
<email>[email protected]</email>
<url>http://github.com/cristiadu</url>
<organization>Symphony Communication Services LLC</organization>
<organizationUrl>http://symphony.com</organizationUrl>
<roles>
<role>Software Developer</role>
</roles>
</developer>
<developer>
<id>miltongq</id>
<name>Milton Gonçalves Quilzini</name>
<email>[email protected]</email>
<url>http://github.com/miltongq</url>
<organization>Symphony Communication Services LLC</organization>
<organizationUrl>http://symphony.com</organizationUrl>
<roles>
<role>Software Developer</role>
</roles>
</developer>
</developers>

<contributors>
<contributor>
<name>Daniel Nathanson</name>
<email>[email protected]</email>
<organization>Symphony Communication Services LLC</organization>
<roles>
<role>Senior Director Platform Engineering</role>
</roles>
</contributor>
</contributors>

<properties>
<json.schema.validator.version>2.2.14</json.schema.validator.version>
<jackson.version>2.10.1</jackson.version>
<jackson.databind.version>2.10.5.1</jackson.databind.version>
<commons.io.version>2.10.0</commons.io.version>
<commons.io.version>2.11.0</commons.io.version>
<commons.lang3.version>3.12.0</commons.lang3.version>
<freemarker.version>2.3.31</freemarker.version>
<commonmark.version>0.15.1</commonmark.version>
<mozilla.rhino.version>1.7.12</mozilla.rhino.version>
<mozilla.rhino.version>1.7.13</mozilla.rhino.version>
<junit.version>4.13.2</junit.version>
<junit.jupiter.params.version>5.7.1</junit.jupiter.params.version>
<mockito.version>3.11.2</mockito.version>
<junit.jupiter.params.version>5.8.1</junit.jupiter.params.version>
<mockito.version>4.0.0</mockito.version>
<slf4j.version>1.7.31</slf4j.version>
<jmh.version>1.32</jmh.version>
<jmh.version>1.33</jmh.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.jar.version>3.1.2</maven.jar.version>
Expand Down
Loading

0 comments on commit 825c09c

Please sign in to comment.