Skip to content

Commit 6d64c2b

Browse files
committed
Updated sources
1 parent 6c604cb commit 6d64c2b

File tree

10 files changed

+159
-18
lines changed

10 files changed

+159
-18
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2003-2019 Aspose Pty Ltd
3+
Copyright (c) 2003-2021 Aspose Pty Ltd
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Add following repository and dependency to your project's POM
3838
<dependency>
3939
<groupId>com.groupdocs</groupId>
4040
<artifactId>groupdocs-annotation-cloud</artifactId>
41-
<version>21.2</version>
41+
<version>21.6</version>
4242
<scope>compile</scope>
4343
</dependency>
4444
```
@@ -53,7 +53,7 @@ mvn package
5353

5454
Then manually install the following JARs:
5555

56-
* target/groupdocs-annotation-cloud-21.2.jar
56+
* target/groupdocs-annotation-cloud-21.6.jar
5757
* target/lib/*.jar
5858

5959
## Getting Started

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>groupdocs-annotation-cloud</artifactId>
66
<packaging>jar</packaging>
77
<name>groupdocs-annotation-cloud</name>
8-
<version>21.2</version>
8+
<version>21.6</version>
99
<url>https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-java</url>
1010
<description>Java library for communicating with the GroupDocs.Annotation Cloud API</description>
1111
<scm>

src/main/java/com/groupdocs/cloud/annotation/client/ApiClient.java

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public ApiClient(Configuration configuration) {
9797
this.json = new JSON();
9898

9999
// Set default User-Agent.
100-
setUserAgent("java-sdk/21.2");
100+
setUserAgent("java-sdk/21.6");
101101

102102
// Set connection timeout
103103
setConnectTimeout(configuration.getTimeout());
@@ -868,13 +868,23 @@ public <T> T handleResponse(Response response, Type returnType) throws ApiExcept
868868
throw new ApiException(response.message(), response.code());
869869
}
870870

871-
ApiError apiError = null;
871+
com.groupdocs.cloud.annotation.model.Error Error = null;
872872
try {
873-
apiError = json.deserialize(respBody, ApiError.class);
873+
Error = json.deserialize(respBody, com.groupdocs.cloud.annotation.model.Error.class);
874874
} catch (Exception e) {
875875
//NOTE: ignore
876876
}
877-
if(apiError != null && apiError.getError() != null) {
877+
if(Error != null && Error.getCode() != null) {
878+
throw new ApiException(Error.getMessage(), response.code());
879+
}
880+
881+
com.groupdocs.cloud.annotation.model.ApiError apiError = null;
882+
try {
883+
apiError = json.deserialize(respBody, com.groupdocs.cloud.annotation.model.ApiError.class);
884+
} catch (Exception e) {
885+
//NOTE: ignore
886+
}
887+
if(apiError != null && apiError.getError().getCode() != null) {
878888
throw new ApiException(apiError.getError().getMessage(), response.code());
879889
}
880890

src/main/java/com/groupdocs/cloud/annotation/model/AnnotateOptions.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ public class AnnotateOptions {
6464
@SerializedName("outputPath")
6565
private String outputPath = null;
6666

67+
@SerializedName("fontsPath")
68+
private String fontsPath = null;
69+
6770
public AnnotateOptions fileInfo(FileInfo fileInfo) {
6871
this.fileInfo = fileInfo;
6972
return this;
@@ -180,6 +183,24 @@ public void setOutputPath(String outputPath) {
180183
this.outputPath = outputPath;
181184
}
182185

186+
public AnnotateOptions fontsPath(String fontsPath) {
187+
this.fontsPath = fontsPath;
188+
return this;
189+
}
190+
191+
/**
192+
* The path to directory containing custom fonts in storage
193+
* @return fontsPath
194+
**/
195+
@ApiModelProperty(value = "The path to directory containing custom fonts in storage")
196+
public String getFontsPath() {
197+
return fontsPath;
198+
}
199+
200+
public void setFontsPath(String fontsPath) {
201+
this.fontsPath = fontsPath;
202+
}
203+
183204

184205
@Override
185206
public boolean equals(java.lang.Object o) {
@@ -195,12 +216,13 @@ public boolean equals(java.lang.Object o) {
195216
Objects.equals(this.firstPage, annotateOptions.firstPage) &&
196217
Objects.equals(this.lastPage, annotateOptions.lastPage) &&
197218
Objects.equals(this.onlyAnnotatedPages, annotateOptions.onlyAnnotatedPages) &&
198-
Objects.equals(this.outputPath, annotateOptions.outputPath);
219+
Objects.equals(this.outputPath, annotateOptions.outputPath) &&
220+
Objects.equals(this.fontsPath, annotateOptions.fontsPath);
199221
}
200222

201223
@Override
202224
public int hashCode() {
203-
return Objects.hash(fileInfo, annotations, firstPage, lastPage, onlyAnnotatedPages, outputPath);
225+
return Objects.hash(fileInfo, annotations, firstPage, lastPage, onlyAnnotatedPages, outputPath, fontsPath);
204226
}
205227

206228

@@ -215,6 +237,7 @@ public String toString() {
215237
sb.append(" lastPage: ").append(toIndentedString(lastPage)).append("\n");
216238
sb.append(" onlyAnnotatedPages: ").append(toIndentedString(onlyAnnotatedPages)).append("\n");
217239
sb.append(" outputPath: ").append(toIndentedString(outputPath)).append("\n");
240+
sb.append(" fontsPath: ").append(toIndentedString(fontsPath)).append("\n");
218241
sb.append("}");
219242
return sb.toString();
220243
}

src/main/java/com/groupdocs/cloud/annotation/model/AnnotationInfo.java

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,9 @@ public PenStyleEnum read(final JsonReader jsonReader) throws IOException {
357357
@SerializedName("angle")
358358
private Double angle = null;
359359

360+
@SerializedName("zindex")
361+
private Integer zindex = null;
362+
360363
@SerializedName("url")
361364
private String url = null;
362365

@@ -829,6 +832,24 @@ public void setAngle(Double angle) {
829832
this.angle = angle;
830833
}
831834

835+
public AnnotationInfo zindex(Integer zindex) {
836+
this.zindex = zindex;
837+
return this;
838+
}
839+
840+
/**
841+
* Gets or sets z-index. Default value is 0 The z-index property specifies the stack order of an element.
842+
* @return zindex
843+
**/
844+
@ApiModelProperty(required = true, value = "Gets or sets z-index. Default value is 0 The z-index property specifies the stack order of an element.")
845+
public Integer getZindex() {
846+
return zindex;
847+
}
848+
849+
public void setZindex(Integer zindex) {
850+
this.zindex = zindex;
851+
}
852+
832853
public AnnotationInfo url(String url) {
833854
this.url = url;
834855
return this;
@@ -900,13 +921,14 @@ public boolean equals(java.lang.Object o) {
900921
Objects.equals(this.fontSize, annotationInfo.fontSize) &&
901922
Objects.equals(this.opacity, annotationInfo.opacity) &&
902923
Objects.equals(this.angle, annotationInfo.angle) &&
924+
Objects.equals(this.zindex, annotationInfo.zindex) &&
903925
Objects.equals(this.url, annotationInfo.url) &&
904926
Objects.equals(this.imagePath, annotationInfo.imagePath);
905927
}
906928

907929
@Override
908930
public int hashCode() {
909-
return Objects.hash(id, text, textToReplace, horizontalAlignment, verticalAlignment, creatorId, creatorName, creatorEmail, box, points, pageNumber, annotationPosition, svgPath, type, replies, createdOn, fontColor, penColor, penWidth, penStyle, backgroundColor, fontFamily, fontSize, opacity, angle, url, imagePath);
931+
return Objects.hash(id, text, textToReplace, horizontalAlignment, verticalAlignment, creatorId, creatorName, creatorEmail, box, points, pageNumber, annotationPosition, svgPath, type, replies, createdOn, fontColor, penColor, penWidth, penStyle, backgroundColor, fontFamily, fontSize, opacity, angle, zindex, url, imagePath);
910932
}
911933

912934

@@ -940,6 +962,7 @@ public String toString() {
940962
sb.append(" fontSize: ").append(toIndentedString(fontSize)).append("\n");
941963
sb.append(" opacity: ").append(toIndentedString(opacity)).append("\n");
942964
sb.append(" angle: ").append(toIndentedString(angle)).append("\n");
965+
sb.append(" zindex: ").append(toIndentedString(zindex)).append("\n");
943966
sb.append(" url: ").append(toIndentedString(url)).append("\n");
944967
sb.append(" imagePath: ").append(toIndentedString(imagePath)).append("\n");
945968
sb.append("}");

src/main/java/com/groupdocs/cloud/annotation/model/ApiError.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
@ApiModel(description = "Describes API error.")
4141
public class ApiError {
42-
@SerializedName("Error")
42+
@SerializedName("error")
4343
private Error error = null;
4444

4545
public ApiError error(Error error) {

src/main/java/com/groupdocs/cloud/annotation/model/Error.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
*/
4040
@ApiModel(description = "Describes API error.")
4141
public class Error {
42-
@SerializedName("Code")
42+
@SerializedName("code")
4343
private String code = null;
4444

4545
public Error code(String code) {
@@ -60,7 +60,7 @@ public void setCode(String code) {
6060
this.code = code;
6161
}
6262

63-
@SerializedName("Message")
63+
@SerializedName("message")
6464
private String message = null;
6565

6666
public Error message(String message) {

src/main/java/com/groupdocs/cloud/annotation/model/PreviewOptions.java

Lines changed: 71 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,18 @@ public FormatEnum read(final JsonReader jsonReader) throws IOException {
109109
@SerializedName("height")
110110
private Integer height = null;
111111

112+
@SerializedName("resolution")
113+
private Integer resolution = null;
114+
112115
@SerializedName("renderComments")
113116
private Boolean renderComments = null;
114117

118+
@SerializedName("renderAnnotations")
119+
private Boolean renderAnnotations = null;
120+
121+
@SerializedName("fontsPath")
122+
private String fontsPath = null;
123+
115124
public PreviewOptions fileInfo(FileInfo fileInfo) {
116125
this.fileInfo = fileInfo;
117126
return this;
@@ -210,6 +219,24 @@ public void setHeight(Integer height) {
210219
this.height = height;
211220
}
212221

222+
public PreviewOptions resolution(Integer resolution) {
223+
this.resolution = resolution;
224+
return this;
225+
}
226+
227+
/**
228+
* Gets or sets the resolution for generated images, in dots per inch. The default value is 96.
229+
* @return resolution
230+
**/
231+
@ApiModelProperty(required = true, value = "Gets or sets the resolution for generated images, in dots per inch. The default value is 96.")
232+
public Integer getResolution() {
233+
return resolution;
234+
}
235+
236+
public void setResolution(Integer resolution) {
237+
this.resolution = resolution;
238+
}
239+
213240
public PreviewOptions renderComments(Boolean renderComments) {
214241
this.renderComments = renderComments;
215242
return this;
@@ -228,6 +255,42 @@ public void setRenderComments(Boolean renderComments) {
228255
this.renderComments = renderComments;
229256
}
230257

258+
public PreviewOptions renderAnnotations(Boolean renderAnnotations) {
259+
this.renderAnnotations = renderAnnotations;
260+
return this;
261+
}
262+
263+
/**
264+
* The property that controls whether annotations will be generated on the preview. Default State - true.
265+
* @return renderAnnotations
266+
**/
267+
@ApiModelProperty(required = true, value = "The property that controls whether annotations will be generated on the preview. Default State - true.")
268+
public Boolean getRenderAnnotations() {
269+
return renderAnnotations;
270+
}
271+
272+
public void setRenderAnnotations(Boolean renderAnnotations) {
273+
this.renderAnnotations = renderAnnotations;
274+
}
275+
276+
public PreviewOptions fontsPath(String fontsPath) {
277+
this.fontsPath = fontsPath;
278+
return this;
279+
}
280+
281+
/**
282+
* The path to directory containing custom fonts in storage
283+
* @return fontsPath
284+
**/
285+
@ApiModelProperty(value = "The path to directory containing custom fonts in storage")
286+
public String getFontsPath() {
287+
return fontsPath;
288+
}
289+
290+
public void setFontsPath(String fontsPath) {
291+
this.fontsPath = fontsPath;
292+
}
293+
231294

232295
@Override
233296
public boolean equals(java.lang.Object o) {
@@ -243,12 +306,15 @@ public boolean equals(java.lang.Object o) {
243306
Objects.equals(this.pageNumbers, previewOptions.pageNumbers) &&
244307
Objects.equals(this.width, previewOptions.width) &&
245308
Objects.equals(this.height, previewOptions.height) &&
246-
Objects.equals(this.renderComments, previewOptions.renderComments);
309+
Objects.equals(this.resolution, previewOptions.resolution) &&
310+
Objects.equals(this.renderComments, previewOptions.renderComments) &&
311+
Objects.equals(this.renderAnnotations, previewOptions.renderAnnotations) &&
312+
Objects.equals(this.fontsPath, previewOptions.fontsPath);
247313
}
248314

249315
@Override
250316
public int hashCode() {
251-
return Objects.hash(fileInfo, format, pageNumbers, width, height, renderComments);
317+
return Objects.hash(fileInfo, format, pageNumbers, width, height, resolution, renderComments, renderAnnotations, fontsPath);
252318
}
253319

254320

@@ -262,7 +328,10 @@ public String toString() {
262328
sb.append(" pageNumbers: ").append(toIndentedString(pageNumbers)).append("\n");
263329
sb.append(" width: ").append(toIndentedString(width)).append("\n");
264330
sb.append(" height: ").append(toIndentedString(height)).append("\n");
331+
sb.append(" resolution: ").append(toIndentedString(resolution)).append("\n");
265332
sb.append(" renderComments: ").append(toIndentedString(renderComments)).append("\n");
333+
sb.append(" renderAnnotations: ").append(toIndentedString(renderAnnotations)).append("\n");
334+
sb.append(" fontsPath: ").append(toIndentedString(fontsPath)).append("\n");
266335
sb.append("}");
267336
return sb.toString();
268337
}

src/test/java/com/groupdocs/cloud/annotation/api/AnnotationInfoApiTests.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,31 @@
3232
import com.groupdocs.cloud.annotation.model.requests.GetInfoRequest;
3333
import junitparams.JUnitParamsRunner;
3434
import junitparams.Parameters;
35-
import static org.junit.Assert.assertEquals;
36-
import static org.junit.Assert.assertNotNull;
35+
import static org.junit.Assert.*;
3736
import org.junit.Test;
3837
import org.junit.runner.RunWith;
3938

4039
@RunWith(JUnitParamsRunner.class)
4140
public class AnnotationInfoApiTests extends BaseApiTest
4241
{
42+
@Test
43+
public void TestGetInfoReturnsFileNotFound()
44+
{
45+
// Arrange
46+
FileInfo fileInfo = new FileInfo();
47+
fileInfo.setFilePath("some-folder\\notExists.docx");
4348

49+
GetInfoRequest request = new GetInfoRequest(fileInfo);
50+
51+
// Act & Assert
52+
try {
53+
infoApi.getInfo(request);
54+
fail("Expected ApiException was not thrown.");
55+
} catch (ApiException ex) {
56+
assertEquals("Specified file not found", ex.getMessage());
57+
}
58+
}
59+
4460
@Test
4561
@Parameters(
4662
{

0 commit comments

Comments
 (0)