Skip to content

Commit

Permalink
Merge branch 'feature/ts-integration' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
vincenzo-ingenito committed Aug 4, 2023
2 parents 0a8654f + 41560d0 commit 4a2ac88
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public static class Schematron {
@JsonProperty
private String version;
@JsonProperty
private String system;
@JsonProperty
private String templateIdRoot;
@JsonProperty
private Date lastUpdateDate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public class SchematronETY {
public static final String FIELD_FILENAME = "name_schematron";
public static final String FIELD_CONTENT = "content_schematron";
public static final String FIELD_VERSION = "version";
public static final String FIELD_ROOT = "template_id_root";
public static final String FIELD_SYSTEM = "system";
public static final String FIELD_ROOT = "template_id_root";
public static final String FIELD_LAST_UPDATE = "last_update_date";
public static final String FIELD_LAST_SYNC = "last_sync";
public static final String FIELD_DELETED = "deleted";
Expand All @@ -47,6 +48,8 @@ public class SchematronETY {
private String templateIdRoot;
@Field(name = FIELD_VERSION)
private String version;
@Field(name = FIELD_SYSTEM)
private String system;
@Field(name = FIELD_LAST_UPDATE)
private Date lastUpdateDate;
@Field(name = FIELD_LAST_SYNC)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@ public Document getUpsertQuery(SchematronDTO dto) {
// Get data
SchematronDTO.Schematron schematron = dto.getDocument();
// Create
return new org.bson.Document()
Document doc = new Document()
.append(FIELD_ID, new ObjectId(schematron.getId()))
.append(FIELD_FILENAME, schematron.getName())
.append(FIELD_CONTENT, new Binary(StringUtility.decodeBase64(schematron.getContent())))
.append(FIELD_VERSION, schematron.getVersion())
.append(FIELD_SYSTEM, schematron.getSystem())
.append(FIELD_ROOT, schematron.getTemplateIdRoot())
.append(FIELD_LAST_UPDATE, schematron.getLastUpdateDate())
.append(FIELD_DELETED, false);

if(schematron.getSystem() == null) doc.remove(FIELD_SYSTEM);

return doc;
}

/**
Expand Down Expand Up @@ -80,6 +85,7 @@ public Document getComparatorQuery(Document doc) {
.append(FIELD_CONTENT, doc.get(FIELD_CONTENT, Binary.class))
.append(FIELD_VERSION, doc.getString(FIELD_VERSION))
.append(FIELD_ROOT, doc.getString(FIELD_ROOT))
.append(FIELD_SYSTEM, doc.getString(FIELD_SYSTEM))
.append(FIELD_LAST_UPDATE, doc.getDate(FIELD_LAST_UPDATE))
.append(FIELD_LAST_SYNC, doc.getDate(FIELD_LAST_SYNC))
.append(FIELD_DELETED, doc.getBoolean(FIELD_DELETED));
Expand Down

0 comments on commit 4a2ac88

Please sign in to comment.