Skip to content

Commit

Permalink
Merge pull request #15 from ONLYOFFICE/release/1.0.0
Browse files Browse the repository at this point in the history
Release/1.0.0
  • Loading branch information
LinneyS committed Jan 22, 2024
2 parents 1a668f2 + 2710511 commit 558d9b6
Show file tree
Hide file tree
Showing 114 changed files with 772 additions and 257 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[submodule "src/main/resources/assets/document-templates"]
path = src/main/resources/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/new-lang-tag
branch = main/new-2letter-code
[submodule "src/main/resources/assets/document-formats"]
path = src/main/resources/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 1.0.0
## Changed
- list supported formats
- improved work with Settings
- UrlManager (added method replaceToDocumentServerUrl)
- ar and sr empty file templates

## 0.0.1
## Added
- common interfaces (DocumentManager, RequestManager, JwtManager, SettingsManager, UrlManager, ConfigService,
Expand Down
2 changes: 1 addition & 1 deletion demo-example/onlyoffice.header
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion onlyoffice.header
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
8 changes: 7 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>com.onlyoffice</groupId>
<artifactId>docs-integration-sdk</artifactId>
<version>0.0.1</version>
<version>1.0.0</version>
<packaging>jar</packaging>

<name>${project.groupId}:${project.artifactId}</name>
Expand Down Expand Up @@ -79,6 +79,11 @@
<artifactId>commons-io</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-properties</artifactId>
<version>2.13.5</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
Expand Down Expand Up @@ -174,6 +179,7 @@
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
<stagingProgressTimeoutMinutes>15</stagingProgressTimeoutMinutes>
</configuration>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -19,6 +19,7 @@
package com.onlyoffice.manager.document;

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.onlyoffice.manager.settings.SettingsManager;
import com.onlyoffice.model.documenteditor.config.document.DocumentType;
Expand All @@ -27,6 +28,7 @@
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.io.IOException;
import java.io.InputStream;
Expand All @@ -50,7 +52,8 @@ public abstract class DefaultDocumentManager implements DocumentManager {

/** {@link SettingsManager}. */
@Getter(AccessLevel.PROTECTED)
private final SettingsManager settingsManager;
@Setter(AccessLevel.PROTECTED)
private SettingsManager settingsManager;

/** Defines a list containing data about supported formats. */
private static List<Format> formats;
Expand Down Expand Up @@ -286,13 +289,10 @@ public Map<String, Boolean> getLossyEditableMap() {

@Override
public List<String> getInsertImageExtensions() {
String insertImage = settingsManager.getSDKSetting("integration-sdk.data.formats.insert-image");

if (insertImage != null && !insertImage.isEmpty()) {
return Arrays.asList(insertImage.split("\\|"));
}

return null;
return settingsManager.getDocsIntegrationSdkProperties()
.getDocumentServer()
.getEditingService()
.getInsertImage();
}

@Override
Expand All @@ -301,7 +301,7 @@ public List<String> getCompareFileExtensions() {
List<String> result = new ArrayList<>();

for (Format format : supportedFormats) {
if (format.getType().equals(DocumentType.WORD)) {
if (DocumentType.WORD.equals(format.getType())) {
result.add(format.getName());
}
}
Expand All @@ -315,7 +315,7 @@ public List<String> getMailMergeExtensions() {
List<String> result = new ArrayList<>();

for (Format format : supportedFormats) {
if (format.getType().equals(DocumentType.CELL)) {
if (DocumentType.CELL.equals(format.getType())) {
result.add(format.getName());
}
}
Expand All @@ -325,26 +325,20 @@ public List<String> getMailMergeExtensions() {

@Override
public long getMaxFileSize() {
long size;
try {
String filesizeMax = settingsManager.getSDKSetting("integration-sdk.data.filesize.editing.max");
size = Long.parseLong(filesizeMax);
} catch (Exception ex) {
size = 0;
}
long size = settingsManager.getDocsIntegrationSdkProperties()
.getDocumentServer()
.getEditingService()
.getMaxFileSize();

return size > 0 ? size : DEFAULT_MAX_FILE_SIZE;
}

@Override
public long getMaxConversionFileSize() {
long size;
try {
String filesizeMax = settingsManager.getSDKSetting("integration-sdk.data.filesize.conversion.max");
size = Long.parseLong(filesizeMax);
} catch (Exception ex) {
size = 0;
}
long size = settingsManager.getDocsIntegrationSdkProperties()
.getDocumentServer()
.getConvertService()
.getMaxFileSize();

return size > 0 ? size : DEFAULT_MAX_FILE_SIZE;
}
Expand All @@ -357,7 +351,8 @@ protected static void init() {
.getContextClassLoader()
.getResourceAsStream("assets/document-formats/onlyoffice-docs-formats.json");
try {
formats = objectMapper.readValue(inputStream, new TypeReference<List<Format>>() { });
formats = objectMapper.configure(DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_AS_NULL, true)
.readValue(inputStream, new TypeReference<List<Format>>() { });
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,7 @@
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.apache.http.HttpEntity;
import org.apache.http.HttpStatus;
import org.apache.http.StatusLine;
Expand Down Expand Up @@ -66,15 +67,18 @@ public class DefaultRequestManager implements RequestManager {

/** {@link UrlManager}. */
@Getter(AccessLevel.PROTECTED)
private final UrlManager urlManager;
@Setter(AccessLevel.PROTECTED)
private UrlManager urlManager;

/** {@link JwtManager}. */
@Getter(AccessLevel.PROTECTED)
private final JwtManager jwtManager;
@Setter(AccessLevel.PROTECTED)
private JwtManager jwtManager;

/** {@link SettingsManager}. */
@Getter(AccessLevel.PROTECTED)
private final SettingsManager settingsManager;
@Setter(AccessLevel.PROTECTED)
private SettingsManager settingsManager;

/** {@link ObjectMapper}. */
private final ObjectMapper objectMapper = new ObjectMapper();
Expand Down Expand Up @@ -143,7 +147,7 @@ private <R> R executeRequest(final HttpUriRequest request, final HttpClientSetti
StatusLine statusLine = response.getStatusLine();
if (statusLine == null) {
throw new ClientProtocolException(
settingsManager.getSDKSetting("integration-sdk.product.name")
settingsManager.getDocsIntegrationSdkProperties().getProduct().getName()
+ " URL: " + request.getURI() + " did not return a response.\n"
+ "Request: " + request.toString() + "\n"
+ "Response: " + response
Expand All @@ -153,7 +157,7 @@ private <R> R executeRequest(final HttpUriRequest request, final HttpClientSetti
HttpEntity resEntity = response.getEntity();
if (resEntity == null) {
throw new ClientProtocolException(
settingsManager.getSDKSetting("integration-sdk.product.name")
settingsManager.getDocsIntegrationSdkProperties().getProduct().getName()
+ " URL: " + request.getURI() + " did not return content.\n"
+ "Request: " + request.toString() + "\n"
+ "Response: " + response
Expand All @@ -163,7 +167,7 @@ private <R> R executeRequest(final HttpUriRequest request, final HttpClientSetti
int statusCode = statusLine.getStatusCode();
if (statusCode != HttpStatus.SC_OK) {
throw new ClientProtocolException(
settingsManager.getSDKSetting("integration-sdk.product.name")
settingsManager.getDocsIntegrationSdkProperties().getProduct().getName()
+ " URL: " + request.getURI() + " return unexpected response.\n"
+ "Request: " + request.toString() + "\n"
+ "Response: " + response.toString()
Expand Down Expand Up @@ -212,21 +216,21 @@ private CloseableHttpClient getHttpClient(final HttpClientSettings httpClientSet
Boolean ignoreSSLCertificate = settingsManager.isIgnoreSSLCertificate();

Integer connectionTimeout = (int) TimeUnit.SECONDS.toMillis(
Long.parseLong(
settingsManager.getSDKSetting("integration-sdk.http.client.request.connection.timeout")
)
settingsManager.getDocsIntegrationSdkProperties()
.getHttpClient()
.getConnectionTimeout()
);

Integer connectionRequestTimeout = (int) TimeUnit.SECONDS.toMillis(
Long.parseLong(
settingsManager.getSDKSetting("integration-sdk.http.client.request.connectionRequest.timeout")
)
settingsManager.getDocsIntegrationSdkProperties()
.getHttpClient()
.getConnectionRequestTimeout()
);

Integer socketTimeout = (int) TimeUnit.SECONDS.toMillis(
Long.parseLong(
settingsManager.getSDKSetting("integration-sdk.http.client.request.socket.timeout")
)
settingsManager.getDocsIntegrationSdkProperties()
.getHttpClient()
.getSocketTimeout()
);

if (httpClientSettings != null) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down

0 comments on commit 558d9b6

Please sign in to comment.