Skip to content

Commit

Permalink
Merge branch '11.5.1' into dev
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
#	release/pom.xml
#	sdk/pom.xml
#	sdk/src/main/java/com/silanis/esl/sdk/internal/converter/DocumentConverter.java
#	tester/pom.xml
  • Loading branch information
john committed Jan 15, 2018
2 parents 5b0bd41 + 942f0c6 commit 7a50677
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 4 deletions.
19 changes: 19 additions & 0 deletions sdk/src/main/java/com/silanis/esl/sdk/Document.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class Document implements Serializable {
private byte[] content;
private String fileName;
private int index;
private int numberOfPages;
private boolean extract;
private Set<String> extractionTypes = Sets.newHashSet();
private DocumentId id;
Expand Down Expand Up @@ -114,6 +115,24 @@ public int getIndex() {
return index;
}

/**
* <p>Accessor method used to retrieve the number of pages of the document</p>
*
* @return the number of pages
*/
public int getNumberOfPages() {
return numberOfPages;
}

/**
* <p>Accessor method used to specify the number of pages of the document.</p>
*
* @param numberOfPages the document signing order
*/
public void setNumberOfPages(int numberOfPages) {
this.numberOfPages = numberOfPages;
}

/**
*
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public static void main( String... args ) {
}

public void execute() {
documentInputStream1 = this.getClass().getClassLoader().getResourceAsStream("document_with_text_tag_and_form_field.pdf");
email2 = "CapitalLetters@email.com";

DocumentPackage superDuperPackage = newPackageNamed(getPackageName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
import com.silanis.esl.api.model.External;
import com.silanis.esl.api.model.Package;
import com.silanis.esl.api.model.Role;
import com.silanis.esl.sdk.*;
import com.silanis.esl.sdk.Document;
import com.silanis.esl.sdk.Field;
import com.silanis.esl.sdk.FieldStyle;
import com.silanis.esl.sdk.GroupId;
import com.silanis.esl.sdk.Signature;
import com.silanis.esl.sdk.builder.DocumentBuilder;

/**
Expand Down Expand Up @@ -77,7 +81,12 @@ public com.silanis.esl.sdk.Document toSDKDocument() {
}
}

return documentBuilder.build();
Document document = documentBuilder.build();
if ( apiDocument.getPages() != null && !apiDocument.getPages().isEmpty() ) {
document.setNumberOfPages(apiDocument.getPages().size());
}

return document;
}
/**
* Convert from SDK document to API Document.
Expand All @@ -93,7 +102,6 @@ public com.silanis.esl.api.model.Document toAPIDocument( final com.silanis.esl.a
com.silanis.esl.api.model.Document result = new com.silanis.esl.api.model.Document()
.setIndex(sdkDocument.getIndex())
.setExtract(sdkDocument.isExtract())
.setExtractionTypes(sdkDocument.getExtractionTypes())
.setData(sdkDocument.getData())
.setName(sdkDocument.getName());

Expand Down Expand Up @@ -143,7 +151,6 @@ public com.silanis.esl.api.model.Document toAPIDocumentMetadata(){
com.silanis.esl.api.model.Document result = new com.silanis.esl.api.model.Document()
.safeSetIndex(sdkDocument.getIndex())
.safeSetExtract(sdkDocument.isExtract())
.setExtractionTypes(sdkDocument.getExtractionTypes())
.safeSetName(sdkDocument.getName())
.safeSetExternal(new ExternalConverter(sdkDocument.getExternal()).toAPIExternal())
.safeSetDescription(sdkDocument.getDescription());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void verifyResult() {

// Document 1
Document document = documentPackage.getDocument(DOCUMENT1_NAME);
assertThat("The number of pages in the document is not set correctly.", document.getNumberOfPages(), is(7));

Iterator<Signature> signatures = document.getSignatures().iterator();
assertTrue("Signature doesn't exist in First Document.", signatures.hasNext());
Expand All @@ -94,6 +95,7 @@ public void verifyResult() {

// Document 2
document = documentPackage.getDocument(DOCUMENT2_NAME);
assertThat("The number of pages in the document is not set correctly.", document.getNumberOfPages(), is(1));
signatures = document.getSignatures().iterator();
assertTrue("Signature doesn't exist in Second Document.", signatures.hasNext());

Expand Down

0 comments on commit 7a50677

Please sign in to comment.