Skip to content

Commit 7b8fb08

Browse files
Merge branch 'master' into release
2 parents 84997ed + 02b5ff7 commit 7b8fb08

File tree

10 files changed

+154
-8
lines changed

10 files changed

+154
-8
lines changed

ExamplesData/test_doc.docx

14 KB
Binary file not shown.

Jenkinsfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ properties([
66
[$class: 'StringParameterDefinition', name: 'apiUrl', defaultValue: 'https://api-qa.aspose.cloud', description: 'api url'],
77
[$class: 'BooleanParameterDefinition', name: 'debugMode', defaultValue: 'false', description: 'debug mode'],
88
[$class: 'BooleanParameterDefinition', name: 'ignoreCiSkip', defaultValue: false, description: 'ignore CI Skip'],
9+
[$class: 'StringParameterDefinition', name: 'credentialsId', defaultValue: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', description: 'credentials id'],
910
]
1011
]
1112
])
@@ -17,7 +18,7 @@ def runtests(directory)
1718
dir(directory){
1819
try {
1920
stage('checkout'){
20-
checkout([$class: 'GitSCM', branches: [[name: params.branch]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'LocalBranch', localBranch: "**"]], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-java.git']]])
21+
checkout([$class: 'GitSCM', branches: [[name: params.branch]], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: '361885ba-9425-4230-950e-0af201d90547', url: 'https://git.auckland.dynabic.com/words-cloud/words-cloud-java.git']]])
2122

2223
sh 'git show -s HEAD > gitMessage'
2324
def commitMessage = readFile('gitMessage').trim()
@@ -26,7 +27,7 @@ def runtests(directory)
2627
sh 'git clean -fdx'
2728

2829
if (needToBuild) {
29-
withCredentials([usernamePassword(credentialsId: '6839cbe8-39fa-40c0-86ce-90706f0bae5d', passwordVariable: 'ClientSecret', usernameVariable: 'ClientId')]) {
30+
withCredentials([usernamePassword(credentialsId: params.credentialsId, passwordVariable: 'ClientSecret', usernameVariable: 'ClientId')]) {
3031
sh 'mkdir -p Settings'
3132
sh 'echo "{\\"ClientId\\": \\"$ClientId\\",\\"ClientSecret\\": \\"$ClientSecret\\", \\"BaseUrl\\": \\"$apiUrl\\", \\"Debug\\" : \\"$debugMode\\" }}" > Settings/servercreds.json'
3233
}

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@ This repository contains Aspose.Words Cloud SDK for Java source code. This SDK a
1313
* Watermarks and protection
1414
* Full read & write access to Document Object Model, including sections, paragraphs, text, images, tables, headers/footers and many others
1515

16+
## Enhancements in Version 21.3
17+
18+
- Added 'UpdateCreatedTimeProperty' save option
19+
- Added Tables into HeaderFooter so it's possible to address paragraphs inside table which is located in headerfooter (sections/0/headersfooters/1/tables/0/rows/0/cells/0/paragraphs/0)
20+
21+
1622
## Enhancements in Version 21.2
1723

1824
- Added delete all comments method
@@ -122,7 +128,7 @@ Add this dependency to your project's POM:
122128
<dependency>
123129
<groupId>com.aspose</groupId>
124130
<artifactId>aspose-words-cloud</artifactId>
125-
<version>21.2.0</version>
131+
<version>21.3.0</version>
126132
</dependency>
127133
</dependencies>
128134
```

examples/AcceptAllRevisions.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import com.aspose.words.cloud.*;
2+
import com.aspose.words.cloud.api.*;
3+
import com.aspose.words.cloud.model.*;
4+
import com.aspose.words.cloud.model.requests.*;
5+
import com.aspose.words.cloud.model.responses.*;
6+
import java.nio.file.Files;
7+
import java.nio.file.Paths;
8+
9+
String documentsDir = "...";
10+
ApiClient apiClient = new ApiClient(/*clientId*/ "####-####-####-####-####", /*clientSecret*/ "##################", null);
11+
WordsApi wordsApi = new WordsApi(apiClient);
12+
String fileName = "test_doc.docx";
13+
14+
// Upload original document to cloud storage.
15+
UploadFileRequest uploadFileRequest = new UploadFileRequest(Files.readAllBytes(Paths.get(documentsDir, fileName).toAbsolutePath()),fileName,null);
16+
wordsApi.uploadFile(uploadFileRequest);
17+
18+
// Calls AcceptAllRevisions method for document in cloud.
19+
AcceptAllRevisionsRequest request = new AcceptAllRevisionsRequest(fileName,null,null,null,null,null);
20+
wordsApi.acceptAllRevisions(request);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
String documentsDir = "...";
2+
ApiClient apiClient = new ApiClient(/*clientId*/ "####-####-####-####-####", /*clientSecret*/ "##################", null);
3+
WordsApi wordsApi = new WordsApi(apiClient);
4+
String fileName = "test_doc.docx";
5+
6+
// Calls AcceptAllRevisionsOnline method for document in cloud.
7+
AcceptAllRevisionsOnlineRequest request = new AcceptAllRevisionsOnlineRequest(Files.readAllBytes(Paths.get(documentsDir, fileName).toAbsolutePath()),null,null,null);
8+
AcceptAllRevisionsOnlineResponse acceptAllRevisionsOnlineResult = wordsApi.acceptAllRevisionsOnline(request);
9+
Files.write(Paths.get("test_result.docx"), acceptAllRevisionsOnlineResult.getDocument());

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<artifactId>aspose-words-cloud</artifactId>
55
<packaging>jar</packaging>
66
<name>AsposeWordsCloud</name>
7-
<version>21.2.0</version>
7+
<version>21.3.0</version>
88
<url>https://www.aspose.cloud/</url>
99
<description>Aspose Words Java SDK</description>
1010
<scm>

src/main/java/com/aspose/words/cloud/ApiClient.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public class ApiClient {
5656
private String apiVersion = "v4.0";
5757
private String baseUrl = "https://api.aspose.cloud";
5858
private String basePath = baseUrl + "/" + apiVersion;
59-
private String clientVersion = "21.2";
59+
private String clientVersion = "21.3";
6060
private boolean debugging = false;
6161
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
6262
private String tempFolderPath = null;
@@ -202,7 +202,7 @@ public ApiClient setBaseUrl(String baseUrl) {
202202
/**
203203
* Set base path
204204
*
205-
* @param basePath Base path of the URL (e.g https://api.aspose.cloud/v1.1
205+
* @param basePath Base path of the URL (e.g https://api.aspose.cloud/v4.0
206206
* @return An instance of OkHttpClient
207207
*/
208208
public ApiClient setBasePath(String basePath) {

src/main/java/com/aspose/words/cloud/model/SaveOptionsData.java

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ public Dml3DEffectsRenderingModeEnum read(final JsonReader jsonReader) throws IO
111111
@SerializedName("SaveFormat")
112112
private String saveFormat = null;
113113

114+
@SerializedName("UpdateCreatedTimeProperty")
115+
private Boolean updateCreatedTimeProperty = null;
116+
114117
@SerializedName("UpdateFields")
115118
private Boolean updateFields = null;
116119

@@ -234,6 +237,25 @@ public void setSaveFormat(String saveFormat) {
234237
this.saveFormat = saveFormat;
235238
}
236239

240+
public SaveOptionsData updateCreatedTimeProperty(Boolean updateCreatedTimeProperty) {
241+
this.updateCreatedTimeProperty = updateCreatedTimeProperty;
242+
return this;
243+
}
244+
245+
/**
246+
* Gets or sets a value determining whether the Aspose.Words.Properties.BuiltInDocumentProperties.CreatedTime property is updated before saving.
247+
* Default value is false.
248+
* @return updateCreatedTimeProperty
249+
**/
250+
@ApiModelProperty(value = "Gets or sets a value determining whether the Aspose.Words.Properties.BuiltInDocumentProperties.CreatedTime property is updated before saving. Default value is false.")
251+
public Boolean getUpdateCreatedTimeProperty() {
252+
return updateCreatedTimeProperty;
253+
}
254+
255+
public void setUpdateCreatedTimeProperty(Boolean updateCreatedTimeProperty) {
256+
this.updateCreatedTimeProperty = updateCreatedTimeProperty;
257+
}
258+
237259
public SaveOptionsData updateFields(Boolean updateFields) {
238260
this.updateFields = updateFields;
239261
return this;
@@ -342,6 +364,7 @@ public boolean equals(java.lang.Object o) {
342364
Objects.equals(this.dmlRenderingMode, saveOptionsData.dmlRenderingMode) &&
343365
Objects.equals(this.fileName, saveOptionsData.fileName) &&
344366
Objects.equals(this.saveFormat, saveOptionsData.saveFormat) &&
367+
Objects.equals(this.updateCreatedTimeProperty, saveOptionsData.updateCreatedTimeProperty) &&
345368
Objects.equals(this.updateFields, saveOptionsData.updateFields) &&
346369
Objects.equals(this.updateLastPrintedProperty, saveOptionsData.updateLastPrintedProperty) &&
347370
Objects.equals(this.updateLastSavedTimeProperty, saveOptionsData.updateLastSavedTimeProperty) &&
@@ -351,7 +374,7 @@ public boolean equals(java.lang.Object o) {
351374

352375
@Override
353376
public int hashCode() {
354-
return Objects.hash(allowEmbeddingPostScriptFonts, dml3DEffectsRenderingMode, dmlEffectsRenderingMode, dmlRenderingMode, fileName, saveFormat, updateFields, updateLastPrintedProperty, updateLastSavedTimeProperty, updateSdtContent, zipOutput);
377+
return Objects.hash(allowEmbeddingPostScriptFonts, dml3DEffectsRenderingMode, dmlEffectsRenderingMode, dmlRenderingMode, fileName, saveFormat, updateCreatedTimeProperty, updateFields, updateLastPrintedProperty, updateLastSavedTimeProperty, updateSdtContent, zipOutput);
355378
}
356379

357380
@Override
@@ -364,6 +387,7 @@ public String toString() {
364387
sb.append(" dmlRenderingMode: ").append(toIndentedString(dmlRenderingMode)).append("\n");
365388
sb.append(" fileName: ").append(toIndentedString(fileName)).append("\n");
366389
sb.append(" saveFormat: ").append(toIndentedString(saveFormat)).append("\n");
390+
sb.append(" updateCreatedTimeProperty: ").append(toIndentedString(updateCreatedTimeProperty)).append("\n");
367391
sb.append(" updateFields: ").append(toIndentedString(updateFields)).append("\n");
368392
sb.append(" updateLastPrintedProperty: ").append(toIndentedString(updateLastPrintedProperty)).append("\n");
369393
sb.append(" updateLastSavedTimeProperty: ").append(toIndentedString(updateLastSavedTimeProperty)).append("\n");
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* --------------------------------------------------------------------------------
3+
* <copyright company="Aspose" file="TestExamples.java">
4+
* Copyright (c) 2021 Aspose.Words for Cloud
5+
* </copyright>
6+
* <summary>
7+
* Permission is hereby granted, free of charge, to any person obtaining a copy
8+
* of this software and associated documentation files (the "Software"), to deal
9+
* in the Software without restriction, including without limitation the rights
10+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11+
* copies of the Software, and to permit persons to whom the Software is
12+
* furnished to do so, subject to the following conditions:
13+
*
14+
* The above copyright notice and this permission notice shall be included in all
15+
* copies or substantial portions of the Software.
16+
*
17+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23+
* SOFTWARE.
24+
* </summary>
25+
* --------------------------------------------------------------------------------
26+
*/
27+
package com.aspose.words.cloud;
28+
29+
import com.aspose.words.cloud.*;
30+
import com.aspose.words.cloud.api.*;
31+
import com.aspose.words.cloud.model.*;
32+
import com.aspose.words.cloud.model.requests.*;
33+
import com.aspose.words.cloud.model.responses.*;
34+
import java.nio.file.Files;
35+
import java.nio.file.Paths;
36+
import junit.framework.TestCase;
37+
import org.junit.Test;
38+
39+
public class TestExamples extends TestCase
40+
{
41+
private ApiClient apiClient;
42+
43+
@Override
44+
protected void setUp() throws Exception {
45+
super.setUp();
46+
TestInitializer.Initialize();
47+
apiClient = TestInitializer.apiClient;
48+
WordsApi api = new WordsApi(apiClient);
49+
api.uploadFile(new UploadFileRequest(
50+
Files.readAllBytes(Paths.get("ExamplesData", "test_doc.docx").toAbsolutePath()),
51+
"test_doc.docx",
52+
null
53+
));
54+
}
55+
56+
@Test
57+
public void testAcceptAllRevisions() throws Exception
58+
{
59+
String documentsDir = "ExamplesData";
60+
WordsApi wordsApi = new WordsApi(apiClient);
61+
String fileName = "test_doc.docx";
62+
63+
// Upload original document to cloud storage.
64+
UploadFileRequest uploadFileRequest = new UploadFileRequest(Files.readAllBytes(Paths.get(documentsDir, fileName).toAbsolutePath()),fileName,null);
65+
wordsApi.uploadFile(uploadFileRequest);
66+
67+
// Calls AcceptAllRevisions method for document in cloud.
68+
AcceptAllRevisionsRequest request = new AcceptAllRevisionsRequest(fileName,null,null,null,null,null);
69+
wordsApi.acceptAllRevisions(request);
70+
}
71+
72+
@Test
73+
public void testAcceptAllRevisionsOnline() throws Exception
74+
{
75+
String documentsDir = "ExamplesData";
76+
WordsApi wordsApi = new WordsApi(apiClient);
77+
String fileName = "test_doc.docx";
78+
79+
// Calls AcceptAllRevisionsOnline method for document in cloud.
80+
AcceptAllRevisionsOnlineRequest request = new AcceptAllRevisionsOnlineRequest(Files.readAllBytes(Paths.get(documentsDir, fileName).toAbsolutePath()),null,null,null);
81+
AcceptAllRevisionsOnlineResponse acceptAllRevisionsOnlineResult = wordsApi.acceptAllRevisionsOnline(request);
82+
Files.write(Paths.get("test_result.docx"), acceptAllRevisionsOnlineResult.getDocument());
83+
}
84+
}

src/test/java/com/aspose/words/cloud/TestInitializer.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
import java.util.Map;
4242

4343
public final class TestInitializer {
44+
public static ApiClient apiClient;
4445
public static WordsApi wordsApi;
4546
public static String LocalTestFolder = "TestData";
4647
public static String LocalCommonFolder = PathUtil.get(LocalTestFolder, "Common");
@@ -55,7 +56,8 @@ public static void Initialize() throws FileNotFoundException, ApiException {
5556

5657
public static void Initialize(String credsPath) throws FileNotFoundException, ApiException {
5758
Map<String, String> creds = GetConfig(credsPath);
58-
wordsApi = new WordsApi(creds.get("ClientId"), creds.get("ClientSecret"), creds.get("BaseUrl"));
59+
apiClient = new ApiClient(creds.get("ClientId"), creds.get("ClientSecret"), creds.get("BaseUrl"));
60+
wordsApi = new WordsApi(apiClient);
5961
}
6062

6163
public static Map<String, String> GetConfig(String credsPath) throws FileNotFoundException {

0 commit comments

Comments
 (0)