Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(document): document deserialization & serialization #3066

Merged
merged 11 commits into from
Aug 19, 2024

Conversation

chillleader
Copy link
Member

@chillleader chillleader commented Aug 7, 2024

Description

This PR will add the first implementation of serialization and deserialization of document references.

Highlights:

  • Jackson deserializer to handle the simple case when connector wants to get a Document object
  • Jackson deserializer to handle more complex cases when target type is not a Document but the document can be converted to the target type
  • Operation execution
    • Lazy and eager models are available
    • Lazy is applied by default when the connector doesn't specify its target type (e.g. just Object). The operation will be evaluated on serialization instead in this case.
  • Jackson serializer that can execute operations
  • Refined document class structure
  • DocumentStore interface and in-memory impl

Related issues

related https://github.com/camunda/team-connectors/issues/873

(cherry picked from commit a57e940)
(cherry picked from commit 5634aea)
(cherry picked from commit 92ec79f)
(cherry picked from commit 5a808bd)
(cherry picked from commit 0b0a558)
@chillleader chillleader self-assigned this Aug 7, 2024
@chillleader chillleader marked this pull request as ready for review August 7, 2024 19:49
@chillleader chillleader requested a review from a team as a code owner August 7, 2024 19:49
@chillleader chillleader changed the title Document serialization feat(document): document deserialization & serialization Aug 8, 2024
private final DocumentStore documentStore;

public DocumentFactoryImpl(DocumentStore documentStore) {
this.documentStore = documentStore;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this class carry all of the future possible store ? In this case, how do you make the link between the document creation request and the corresponding store?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future we will generally use only one store here for connecting to the C8 document API. The in-memory implementation will be reserved for tests. As of now, I don't see the need to have multiple store implementations active at the same time - different stores are anyway hidden behind the C8 REST API.

One thing where a different approach is needed is external documents (such as something only available to us via an external URL). But this probably will be handled separately in the DocumentFactory

job,
secretProvider,
validationProvider,
new DocumentFactoryImpl(new InMemoryDocumentStore()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How will it work when new store comes?

*/
package io.camunda.connector.api.document;

public interface DocumentReference {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we seal this interface?

Copy link
Member Author

@chillleader chillleader Aug 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's being extended / implemented by classes in a different package (DocumentReferenceModel where operation is added) so I couldn't seal it here

Copy link
Contributor

@sbuettner sbuettner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! Some minor comments.

@chillleader chillleader merged commit a8b8e07 into epic-1748-doc-ref-handling Aug 19, 2024
7 checks passed
@chillleader chillleader deleted the document-serialization branch August 19, 2024 09:40
chillleader added a commit that referenced this pull request Aug 29, 2024
* wip

(cherry picked from commit a57e940)

* wip

(cherry picked from commit 5634aea)

* prepare end-to-end draft

(cherry picked from commit 92ec79f)

* prepare end-to-end draft

(cherry picked from commit 5a808bd)

* rework deserializers

(cherry picked from commit 0b0a558)

* incorporate feedback, move jackson code into a separate module

* clean up accidental change

* naming adjustments

* lint

* remove extra dollar sign

* remove extra dollar sign
github-merge-queue bot pushed a commit that referenced this pull request Oct 2, 2024
* feat(sdk): first iteration of document support

* apply review suggestions

* feat(document): document deserialization & serialization (#3066)

* wip

(cherry picked from commit a57e940)

* wip

(cherry picked from commit 5634aea)

* prepare end-to-end draft

(cherry picked from commit 92ec79f)

* prepare end-to-end draft

(cherry picked from commit 5a808bd)

* rework deserializers

(cherry picked from commit 0b0a558)

* incorporate feedback, move jackson code into a separate module

* clean up accidental change

* naming adjustments

* lint

* remove extra dollar sign

* remove extra dollar sign

* feat(document): restructure the project and move document stuff to a different package (#3149)

* refactor: move document stuff to a different module

---------

Co-authored-by: Jonathan Roques <jonathan.roques@camunda.com>

* fix(document): document serializer doesn't handle sdk document model (#3205)

* feat(doc-handling): Some investigations to use documents in the REST … (#2976)

* feat(doc-handling): Some investigations to use documents in the REST connector

---------

Co-authored-by: Pavel Kotelevsky <pavel.kotelevskii@camunda.com>
Co-authored-by: Pavel Kotelevsky <38818382+chillleader@users.noreply.github.com>
chillleader added a commit that referenced this pull request Oct 7, 2024
* wip

(cherry picked from commit a57e940)

* wip

(cherry picked from commit 5634aea)

* prepare end-to-end draft

(cherry picked from commit 92ec79f)

* prepare end-to-end draft

(cherry picked from commit 5a808bd)

* rework deserializers

(cherry picked from commit 0b0a558)

* incorporate feedback, move jackson code into a separate module

* clean up accidental change

* naming adjustments

* lint

* remove extra dollar sign

* remove extra dollar sign
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants