From dde4df2020c2604ac89cb22b3220402ea6e57a07 Mon Sep 17 00:00:00 2001 From: diazos1 Date: Fri, 24 Mar 2017 14:39:24 -0400 Subject: [PATCH] Add created field --- .../silanis/esl/api/model/BasePackage.java | 32 ++++++++++++++++--- .../com/silanis/esl/api/model/Layout.java | 16 +++++++++- .../com/silanis/esl/api/model/Package.java | 15 ++++++++- .../com/silanis/esl/api/model/Template.java | 16 +++++++++- .../com/silanis/esl/sdk/DocumentPackage.java | 10 ++++++ .../converter/DocumentPackageConverter.java | 3 ++ .../DocumentPackageConverterTest.java | 2 ++ 7 files changed, 86 insertions(+), 8 deletions(-) diff --git a/sdk/src/main/java/com/silanis/esl/api/model/BasePackage.java b/sdk/src/main/java/com/silanis/esl/api/model/BasePackage.java index 52f464ca0..12a9e8a03 100644 --- a/sdk/src/main/java/com/silanis/esl/api/model/BasePackage.java +++ b/sdk/src/main/java/com/silanis/esl/api/model/BasePackage.java @@ -61,6 +61,8 @@ public class BasePackage extends Entity public static final String FIELD_UPDATED = "updated"; @JsonIgnore public static final String FIELD_VISIBILITY = "visibility"; + @JsonIgnore + public static final String FIELD_CREATED = "created"; // Empty Constructor public BasePackage ( ) {} @@ -85,6 +87,7 @@ public BasePackage ( ) {} protected String _type = "PACKAGE"; protected java.util.Date _updated; protected String _visibility = "ACCOUNT"; + protected java.util.Date _created; // Accessors @@ -160,7 +163,7 @@ public BasePackage setDescription( String value ){ // Used internally by aws. Invokes a the corresponding setter if the value is not null @JsonIgnore public BasePackage safeSetDescription( String value ){ - if ( value != null ) { this.setDescription( value ); } + if ( value != null ) { this.setDescription(value); } return this; } public String getDescription(){ @@ -265,7 +268,7 @@ public BasePackage setLanguage( String value ){ // Used internally by aws. Invokes a the corresponding setter if the value is not null @JsonIgnore public BasePackage safeSetLanguage( String value ){ - if ( value != null ) { this.setLanguage( value ); } + if ( value != null ) { this.setLanguage(value); } return this; } public String getLanguage(){ @@ -344,7 +347,7 @@ public BasePackage setNotarized( Boolean value ){ // Used internally by aws. Invokes a the corresponding setter if the value is not null @JsonIgnore public BasePackage safeSetNotarized( Boolean value ){ - if ( value != null ) { this.setNotarized( value ); } + if ( value != null ) { this.setNotarized(value); } return this; } public Boolean getNotarized(){ @@ -537,6 +540,25 @@ public BasePackage safeSetVisibility( String value ){ public String getVisibility(){ return _visibility; } - - + + + @JsonDeserialize(using = JsonDateDeserializer.class) + public BasePackage setCreated( java.util.Date value ){ + SchemaSanitizer.throwOnNull(FIELD_CREATED, value); + this._created = value; + setDirty(FIELD_CREATED); + return this; + } + // Used internally by aws. Invokes a the corresponding setter if the value is not null + @JsonIgnore + public BasePackage safeSetCreated( java.util.Date value ){ + if ( value != null ) { this.setCreated( value ); } + return this; + } + + @JsonSerialize(using = JsonDateSerializer.class) + public java.util.Date getCreated(){ + return _created; + } + } \ No newline at end of file diff --git a/sdk/src/main/java/com/silanis/esl/api/model/Layout.java b/sdk/src/main/java/com/silanis/esl/api/model/Layout.java index f40110ce0..92f86148c 100644 --- a/sdk/src/main/java/com/silanis/esl/api/model/Layout.java +++ b/sdk/src/main/java/com/silanis/esl/api/model/Layout.java @@ -57,6 +57,8 @@ public class Layout extends BaseTemplate public static final String FIELD_UPDATED = "updated"; @JsonIgnore public static final String FIELD_VISIBILITY = "visibility"; + @JsonIgnore + public static final String FIELD_CREATED = "created"; // Empty Constructor public Layout ( ) {} @@ -392,6 +394,18 @@ public Layout safeSetVisibility( String value ){ if ( value != null ) { this.setVisibility( value ); } return this; } - + + @JsonDeserialize(using = JsonDateDeserializer.class) + @Override + public Layout setCreated( java.util.Date value ){ + super.setCreated(value); + return this; + } + // Used internally by aws. Invokes a the corresponding setter if the value is not null + @JsonIgnore + public Layout safeSetCreated( java.util.Date value ){ + if ( value != null ) { this.setCreated( value ); } + return this; + } } \ No newline at end of file diff --git a/sdk/src/main/java/com/silanis/esl/api/model/Package.java b/sdk/src/main/java/com/silanis/esl/api/model/Package.java index 998e5a6d2..b82c2d91c 100644 --- a/sdk/src/main/java/com/silanis/esl/api/model/Package.java +++ b/sdk/src/main/java/com/silanis/esl/api/model/Package.java @@ -64,6 +64,8 @@ public class Package extends BasePackage public static final String FIELD_UPDATED = "updated"; @JsonIgnore public static final String FIELD_VISIBILITY = "visibility"; + @JsonIgnore + public static final String FIELD_CREATED = "created"; // Empty Constructor public Package ( ) {} @@ -445,6 +447,17 @@ public Package safeSetVisibility( String value ){ if ( value != null ) { this.setVisibility( value ); } return this; } - + + @JsonDeserialize(using = JsonDateDeserializer.class) + @Override + public Package setCreated( java.util.Date value ){ + super.setCreated(value); + return this; + } + @JsonIgnore + public Package safeSetCreated( java.util.Date value ){ + if ( value != null ) { this.setCreated( value ); } + return this; + } } \ No newline at end of file diff --git a/sdk/src/main/java/com/silanis/esl/api/model/Template.java b/sdk/src/main/java/com/silanis/esl/api/model/Template.java index 8db316bee..cfe868f66 100644 --- a/sdk/src/main/java/com/silanis/esl/api/model/Template.java +++ b/sdk/src/main/java/com/silanis/esl/api/model/Template.java @@ -57,6 +57,8 @@ public class Template extends BaseTemplate public static final String FIELD_UPDATED = "updated"; @JsonIgnore public static final String FIELD_VISIBILITY = "visibility"; + @JsonIgnore + public static final String FIELD_CREATED = "created"; // Empty Constructor public Template ( ) {} @@ -391,6 +393,18 @@ public Template safeSetVisibility( String value ){ if ( value != null ) { this.setVisibility( value ); } return this; } - + + @JsonDeserialize(using = JsonDateDeserializer.class) + @Override + public Template setCreated( java.util.Date value ){ + super.setCreated(value); + return this; + } + // Used internally by aws. Invokes a the corresponding setter if the value is not null + @JsonIgnore + public Template safeSetCreated( java.util.Date value ){ + if ( value != null ) { this.setCreated( value ); } + return this; + } } \ No newline at end of file diff --git a/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackage.java b/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackage.java index c9d45664f..e65804a16 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackage.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/DocumentPackage.java @@ -20,6 +20,7 @@ public class DocumentPackage implements Serializable { private String description; private Date expiryDate; private Date updatedDate; + private Date createdDate; private String packageMessage; private Boolean notarized; private Boolean trashed; @@ -208,6 +209,15 @@ public Date getUpdatedDate() { return updatedDate; } + + public Date getCreatedDate() { + return createdDate; + } + + public void setCreatedDate(Date createdDate) { + this.createdDate = createdDate; + } + /** * Sets the package message * diff --git a/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverter.java b/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverter.java index 7c9795010..cfd28a079 100644 --- a/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverter.java +++ b/sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverter.java @@ -244,6 +244,9 @@ else if ( role.getSigners().get( 0 ).getGroup() != null ) { if (apiPackage.getUpdated() != null) { documentPackage.setUpdatedDate(apiPackage.getUpdated()); } + if (apiPackage.getCreated() != null) { + documentPackage.setCreatedDate(apiPackage.getCreated()); + } return documentPackage; } diff --git a/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverterTest.java b/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverterTest.java index 2daa46371..c68a1f201 100644 --- a/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverterTest.java +++ b/sdk/src/test/java/com/silanis/esl/sdk/internal/converter/DocumentPackageConverterTest.java @@ -107,6 +107,7 @@ public void convertAPIToSDK() { assertThat("Message status was not correctly set", apiPackage1.getMessages().get(0).getStatus().toString(), is(equalTo(sdkDocumentPackage1.getMessages().get(0).getStatus().toString()))); assertThat("Message content was not correctly set", apiPackage1.getMessages().get(0).getContent(), is(equalTo(sdkDocumentPackage1.getMessages().get(0).getContent()))); assertThat("Sender email address was not correctly set", apiPackage1.getSender().getEmail(), is(equalTo(sdkDocumentPackage1.getSenderInfo().getEmail()))); + assertThat("Creation date was not correctly set", apiPackage1.getCreated(), is(sdkDocumentPackage1.getCreatedDate())); } @Override @@ -159,6 +160,7 @@ private com.silanis.esl.api.model.Package createTypicalAPIDocumentPackage() { apiDocumentPackage.setDue(new Date()); apiDocumentPackage.setName("API package name"); apiDocumentPackage.setStatus(PackageStatus.DRAFT.getApiValue()); + apiDocumentPackage.setCreated(new Date()); Message apiMessage = new Message(); apiMessage.setContent("opt-out reason");