diff --git a/3rd-Party.license b/3rd-Party.license new file mode 100644 index 0000000..bd05653 --- /dev/null +++ b/3rd-Party.license @@ -0,0 +1,70 @@ +ONLYOFFICE Applications example uses code from the following 3rd party projects: + + +Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE) +License: Apache 2.0 +License File: gson.license + +H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html) +License: MPL 2.0 or EPL 1.0 +License File: h2database.license + +Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE) +License: Apache 2.0 +License File: jackson-databind.license + +jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/) +License: MIT, GPL +License File: jQuery.BlockUI.license + +jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt) +License: MIT +License File: jQuery.FileUpload.license + +jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt) +License: MIT +License File: jQuery.iframe-transport.license + +jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/) +License: MIT +License File: jQuery.license + +jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt) +License: OpenJS +License File: jQuery.Migrate.license + +jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/) +License: MIT +License File: jQuery.UI.license + +JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt) +License: Apache 2.0 +License File: JSON.simple.license + +Project Lombok - Project Lombok is a java library that automatically plugs into your editor and build tools. (https://mvnrepository.com/artifact/org.projectlombok/lombok). +License: MIT +License File lombok.license + +ModelMapper - ModelMapper is an intelligent object mapping library that automatically maps objects to each other. (https://github.com/modelmapper/modelmapper) +License: Apache 2.0 +License File modelmapper.license + +Prime JWT - is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson. (https://github.com/ws-apps/prime-jwt/blob/master/LICENSE) +License: Apache 2.0 +License File: prime-jwt.license + +Spring Boot - Helps create Spring-powered, production-grade applications and services. Has external dependencies on Spring Framework. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-boot.license + +Spring Boot Devtools - Provides fast application restarts, LiveReload, and configurations for enhanced development experience. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-boot.license + +Spring Boot Starter Thymeleaf - A modern server-side Java template engine for both web and standalone environments. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-boot.license + +Spring Data JPA - Persist data in SQL stores with Java Persistence API using Spring Data and Hibernate. (https://github.com/spring-projects/spring-data-jpa/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-data-jpa.license diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..44bc670 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,4 @@ +FROM maven:3.8.1-jdk-8 +COPY . /usr/src/app +WORKDIR /usr/src/app +RUN mvn -f /usr/src/app/pom.xml clean \ No newline at end of file diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md index 7066879..337ee9a 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,247 @@ -# OnlyOffice-Backend +## Overview -OnlyOffice在线文档 \ No newline at end of file +This example will help you integrate ONLYOFFICE Docs into your web application written in Java +with Spring Boot. + +Spring Boot has a lot of functionality, but its most significant features are: dependency management, +auto-configuration, and built-in servlet containers. + +**Please note**: It is intended for testing purposes and demonstrating functionality of the editors. Do NOT use this integration example on your own server without proper code modifications! In case you enabled the test example, disable it before going for production. + +## For Windows + +### Step 1. Install ONLYOFFICE Docs + +Download and install ONLYOFFICE Docs (packaged as Document Server). + +See the detailed guide to learn how to install Document Server [for Windows](https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx). + +### Step 2. Download the Java code for the editors integration + +Download the [Java-Spring example](https://api.onlyoffice.com/editors/demopreview) from our site. + +To connect the editors to your website, specify the path to the editors installation, server port and the path to the storage folder in the *\src\main\resources\application.properties* file: + +``` + files.storage= + server.port=port + files.docservice.url.site=https://documentserver/ +``` + +where the **documentserver** is the name of the server with the ONLYOFFICE Docs installed, **port** is any available port and **files.storage** is the path where files will be created and stored (in the project folder by default). You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator. + +If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) it the *\src\main\resources\editor.html* file. + +### Step 3. Install the prerequisites +To run the Java example code, install the Java version 11 appropriate for your OS and framework **Apache Maven**: + +* Java (download from [the Oracle official website](https://www.oracle.com/ru/java/technologies/javase-jdk11-downloads.html)); +* Apache Maven (download from [the official website](https://maven.apache.org/download.cgi)). + +### Step 4. Set environment variables + +1. After you have installed Java on Windows, set the **JAVA_HOME** environment variable to point to the Java installation directory. + + Find out where Java is installed. If you didn't change the path during installation, it will be something like this: + + ``` + C:\Program Files\Java\jdk11 + ``` + + In **Windows 7** right click **My Computer** and select **Properties**, then click **Advanced**. + + In **Windows 8** go to **Control Panel** -> **System** -> **Advanced System Settings**. + + Click the **Environment Variables** button. + + Under **System Variables**, click **New**. + + In the **Variable Name** field, enter **JAVA_HOME** if you installed the **JDK** (Java Development Kit) or **JRE_HOME** if you installed the **JRE** (Java Runtime Environment). + + In the **Variable Value** field, enter your **JDK** or **JRE** installation path, for example C:\Program Files\Java\jdk11. + + Check if the variable created successfully by **echo** command in the **Command Prompt**: + + ``` + echo %JAVA_HOME% + ``` + +2. Set the **MAVEN_HOME** environment variable: + + Unzip the downloaded archive with the maven to any directory, it will be something like this: + + ``` + C:\apache-maven-3.8.1 + ``` + In **Windows 7** right click **My Computer** and select **Properties**, then click **Advanced**. + + In **Windows 8** go to **Control Panel** -> **System** -> **Advanced System Settings**. + + Click the **Environment Variables** button. + + Under **System Variables**, click **New**. + + In the **Variable Name** field, enter **MAVEN_HOME**. + + In the **Variable Value** field, enter your **JDK** or **JRE** installation path, for example C:\apache-maven-3.8.1. + + Add C:\apache-maven-3.8.1\bin to the PATH system variable: + In system variables, find PATH, clicks on the Edit... button. In “Edit environment variable” dialog, clicks on the New button and add this C:\apache-maven-3.8.1\bin + + Check if the variable created successfully by **echo** command in the **Command Prompt**: + + ``` + echo %MAVEN_HOME% + ``` + + +### Step 5. Start application with Maven + +1. Open the console and go the java-spring folder using the **cd** command, for example: + ``` + cd C:\Program Files\document-server-integration\web\documentserver-example\java-spring + ``` +2. In the open console enter the following commands: + ``` + mvn clean + mvn package + mvn spring-boot:run + ``` +3. Open your browser using **server.address** and **server.port**: + + ``` + http://server.address:server.port/ + ``` + +### Step 6. Check accessibility + + In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files. + +Make sure that the Document Server has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files. + +## For Linux +### Step 1. Install ONLYOFFICE Docs + +Download and install ONLYOFFICE Docs (packaged as Document Server). + +See the detailed guide to learn how to install Document Server [for Linux](https://helpcenter.onlyoffice.com/installation/docs-developer-install-ubuntu.aspx). + +### Step 2. Install the prerequisites and run the website with the editors + +1. Install **Java**: + + ``` + sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java11-installer + ``` + +2. Download the archive with the Java-Spring example and unpack the archive or clone git repository: + + a) archive with Java-Spring: + + ``` + wget https://api.onlyoffice.com/app_data/editor/Java%20Spring%20Example.zip + ``` + + ``` + unzip Java\ Spring\ Example.zip + ``` + b) git repository: + ``` + git clone https://github.com/ONLYOFFICE/document-server-integration.git + ``` + + +3. Change the current directory for the project directory: + + a) from archive + + ``` + cd Java\ Spring\ Example/ + ``` + b) from git repository + ``` + cd document-server-integration/web/documentserver-example/java-spring + ``` +4. Edit the *application.properties* configuration file. Specify the name of your local server with the ONLYOFFICE Document Server installed. + + ``` + nano src/main/resources/application.properties + ``` + + Edit the following lines: + + ``` + files.storage= + server.port=port + files.docservice.url.site=https://documentserver/ + ``` + + where the **documentserver** is the name of the server with the ONLYOFFICE Docs installed, **port** is any available port and **files.storage** is the path where files will be created and stored (in the project folder by default). You can set an absolute path. + + +5. Install **Maven**: + + ``` + sudo apt-get install maven + ``` + +6. Build: + + ``` + mvn package + ``` + + 7. Start Java-Spring example: + ``` + ./mvnw spring-boot:run + ``` + 8. Open your browser using **server.address** and **server.port**: + + ``` + http://server.address:server.port/ + ``` + + +### Step 3. Check accessibility + +In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files. + +Make sure that the Document Server has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files. + +## For Docker + +1. Edit the *application.properties* configuration file. Specify the name of your local server with the ONLYOFFICE Document Server installed ([installation instructions](https://helpcenter.onlyoffice.com/installation/docs-developer-install-docker.aspx)). + + ``` + nano src/main/resources/application.properties + ``` + +2. Edit the following lines: + + ``` + files.storage= + server.port=port + files.docservice.url.site=https://documentserver/ + ``` + + where the **documentserver** is the name of the server with the ONLYOFFICE Docs installed, **port** is any available port and **files.storage** is the path where files will be created and stored (in the project folder by default). You can set an absolute path. + +3. Run the next command in the java example directory: + + ``` + docker-compose up + ``` +4. Open your browser using **server.address** and **server.port**: + + ``` + http://server.address:server.port/ + ``` + +## Important security info + +Please keep in mind the following security aspects when you are using test examples: + +* There is no protection of the storage from unauthorized access since there is no need for authorization. +* There are no checks against parameter substitution in links, since the parameters are generated by the code according to the pre-arranged scripts. +* There are no data checks in requests of saving the file after editing, since each test example is intended for requests only from ONLYOFFICE Document Server. +* There are no prohibitions on using test examples from other sites, since they are intended to interact with ONLYOFFICE Document Server from another domain. \ No newline at end of file diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml new file mode 100644 index 0000000..51c082f --- /dev/null +++ b/checkstyle-suppressions.xml @@ -0,0 +1,13 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/checkstyle.xml b/checkstyle.xml new file mode 100644 index 0000000..64f5b78 --- /dev/null +++ b/checkstyle.xml @@ -0,0 +1,199 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..562bb04 --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,15 @@ +version: '3' +services: + java-spring: + build: + context: ./ + dockerfile: Dockerfile + image: maven:3.8.1 + working_dir: /java-spring + volumes: + - .:/java-spring + ports: + - 4000:4000 + command: mvn clean spring-boot:run + + \ No newline at end of file diff --git a/documents/5242880/new (1).docx b/documents/5242880/new (1).docx new file mode 100644 index 0000000..3a89798 Binary files /dev/null and b/documents/5242880/new (1).docx differ diff --git a/documents/5242880/new (1).docx-hist/createdInfo.json b/documents/5242880/new (1).docx-hist/createdInfo.json new file mode 100644 index 0000000..263ede0 --- /dev/null +++ b/documents/5242880/new (1).docx-hist/createdInfo.json @@ -0,0 +1 @@ +{"created":"2024-02-06 15:04:31","name":"John Smith","id":"1"} \ No newline at end of file diff --git a/documents/5242880/new (2).docx b/documents/5242880/new (2).docx new file mode 100644 index 0000000..3a89798 Binary files /dev/null and b/documents/5242880/new (2).docx differ diff --git a/documents/5242880/new (2).docx-hist/createdInfo.json b/documents/5242880/new (2).docx-hist/createdInfo.json new file mode 100644 index 0000000..6d88bc5 --- /dev/null +++ b/documents/5242880/new (2).docx-hist/createdInfo.json @@ -0,0 +1 @@ +{"created":"2024-02-06 15:29:41","name":"John Smith","id":"1"} \ No newline at end of file diff --git a/documents/5242880/new.docx b/documents/5242880/new.docx new file mode 100644 index 0000000..3a89798 Binary files /dev/null and b/documents/5242880/new.docx differ diff --git a/documents/5242880/new.docx-hist/createdInfo.json b/documents/5242880/new.docx-hist/createdInfo.json new file mode 100644 index 0000000..ed84a82 --- /dev/null +++ b/documents/5242880/new.docx-hist/createdInfo.json @@ -0,0 +1 @@ +{"created":"2024-02-06 15:02:16","name":"John Smith","id":"1"} \ No newline at end of file diff --git a/documents/5242880/new.pptx b/documents/5242880/new.pptx new file mode 100644 index 0000000..df6dff5 Binary files /dev/null and b/documents/5242880/new.pptx differ diff --git a/documents/5242880/new.pptx-hist/createdInfo.json b/documents/5242880/new.pptx-hist/createdInfo.json new file mode 100644 index 0000000..8c6051a --- /dev/null +++ b/documents/5242880/new.pptx-hist/createdInfo.json @@ -0,0 +1 @@ +{"created":"2024-02-06 15:29:53","name":"John Smith","id":"1"} \ No newline at end of file diff --git a/documents/5242880/new.xlsx b/documents/5242880/new.xlsx new file mode 100644 index 0000000..1289bac Binary files /dev/null and b/documents/5242880/new.xlsx differ diff --git a/documents/5242880/new.xlsx-hist/createdInfo.json b/documents/5242880/new.xlsx-hist/createdInfo.json new file mode 100644 index 0000000..2cb381b --- /dev/null +++ b/documents/5242880/new.xlsx-hist/createdInfo.json @@ -0,0 +1 @@ +{"created":"2024-02-06 15:29:48","name":"John Smith","id":"1"} \ No newline at end of file diff --git a/integration.iml b/integration.iml new file mode 100644 index 0000000..1b041ae --- /dev/null +++ b/integration.iml @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/licenses/3rd-Party.license b/licenses/3rd-Party.license new file mode 100644 index 0000000..bd05653 --- /dev/null +++ b/licenses/3rd-Party.license @@ -0,0 +1,70 @@ +ONLYOFFICE Applications example uses code from the following 3rd party projects: + + +Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE) +License: Apache 2.0 +License File: gson.license + +H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html) +License: MPL 2.0 or EPL 1.0 +License File: h2database.license + +Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE) +License: Apache 2.0 +License File: jackson-databind.license + +jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/) +License: MIT, GPL +License File: jQuery.BlockUI.license + +jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt) +License: MIT +License File: jQuery.FileUpload.license + +jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt) +License: MIT +License File: jQuery.iframe-transport.license + +jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/) +License: MIT +License File: jQuery.license + +jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt) +License: OpenJS +License File: jQuery.Migrate.license + +jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/) +License: MIT +License File: jQuery.UI.license + +JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt) +License: Apache 2.0 +License File: JSON.simple.license + +Project Lombok - Project Lombok is a java library that automatically plugs into your editor and build tools. (https://mvnrepository.com/artifact/org.projectlombok/lombok). +License: MIT +License File lombok.license + +ModelMapper - ModelMapper is an intelligent object mapping library that automatically maps objects to each other. (https://github.com/modelmapper/modelmapper) +License: Apache 2.0 +License File modelmapper.license + +Prime JWT - is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson. (https://github.com/ws-apps/prime-jwt/blob/master/LICENSE) +License: Apache 2.0 +License File: prime-jwt.license + +Spring Boot - Helps create Spring-powered, production-grade applications and services. Has external dependencies on Spring Framework. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-boot.license + +Spring Boot Devtools - Provides fast application restarts, LiveReload, and configurations for enhanced development experience. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-boot.license + +Spring Boot Starter Thymeleaf - A modern server-side Java template engine for both web and standalone environments. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-boot.license + +Spring Data JPA - Persist data in SQL stores with Java Persistence API using Spring Data and Hibernate. (https://github.com/spring-projects/spring-data-jpa/blob/main/LICENSE.txt) +License: Apache 2.0 +License File: spring-data-jpa.license diff --git a/licenses/JSON.simple.license b/licenses/JSON.simple.license new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/licenses/JSON.simple.license @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/licenses/gson.license b/licenses/gson.license new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/licenses/gson.license @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/licenses/h2database.license b/licenses/h2database.license new file mode 100644 index 0000000..432fbaa --- /dev/null +++ b/licenses/h2database.license @@ -0,0 +1,250 @@ +Summary and License FAQ + +H2 is dual licensed and available under the MPL 2.0 (Mozilla Public License Version 2.0) or under the EPL 1.0 (Eclipse Public License). There is a license FAQ for both the MPL and the EPL. + + You can use H2 for free. + You can integrate it into your applications (including in commercial applications) and distribute it. + Files containing only your code are not covered by this license (it is 'commercial friendly'). + Modifications to the H2 source code must be published. + You don't need to provide the source code of H2 if you did not modify anything. + If you distribute a binary that includes H2, you need to add a disclaimer of liability - see the example below. + +However, nobody is allowed to rename H2, modify it a little, and sell it as a database engine without telling the customers it is in fact H2. This happened to HSQLDB: a company called 'bungisoft' copied HSQLDB, renamed it to 'RedBase', and tried to sell it, hiding the fact that it was in fact just HSQLDB. It seems 'bungisoft' does not exist any more, but you can use the Wayback Machine and visit old web pages of http://www.bungisoft.com. + +About porting the source code to another language (for example C# or C++): converted source code (even if done manually) stays under the same copyright and license as the original code. The copyright of the ported source code does not (automatically) go to the person who ported the code. + +If you distribute a binary that includes H2, you need to add the license and a disclaimer of liability (as you should do for your own code). You should add a disclaimer for each open source library you use. For example, add a file 3rdparty_license.txt in the directory where the jar files are, and list all open source libraries, each one with its license and disclaimer. For H2, a simple solution is to copy the following text below. You may also include a copy of the complete license. + +This software contains unmodified binary redistributions for +H2 database engine (https://h2database.com/), +which is dual licensed and available under the MPL 2.0 +(Mozilla Public License) or under the EPL 1.0 (Eclipse Public License). +An original copy of the license agreement can be found at: +https://h2database.com/html/license.html + +Mozilla Public License Version 2.0 +1. Definitions + +1.1. "Contributor" means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. + +1.2. "Contributor Version" means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" means Covered Software of a particular Contributor. + +1.4. "Covered Software" means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. + +1.5. "Incompatible With Secondary Licenses" means + +a. that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or + +b. that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. + +1.6. "Executable Form" means any form of the work other than Source Code Form. + +1.7. "Larger Work" means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. + +1.8. "License" means this document. + +1.9. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. + +1.10. "Modifications" means any of the following: + +a. any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or + +b. any new file in Source Code Form that contains any Covered Software. + +1.11. "Patent Claims" of a Contributor means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. + +1.12. "Secondary License" means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. + +1.13. "Source Code Form" means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") means an individual or a legal entity exercising rights under this License. For legal entities, "You" includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, "control" means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. +2. License Grants and Conditions +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: + + under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and + + under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: + + for any code that a Contributor has removed from Covered Software; or + + for infringements caused by: (i) Your and any other third party's modifications of Covered Software, or (ii) the combination of its Contributions with other software (except as part of its Contributor Version); or + + under Patent Claims infringed by Covered Software in the absence of its Contributions. + +This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). +2.5. Representation + +Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. +2.6. Fair Use + +This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. +3. Responsibilities +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + + such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and + + You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). +3.4. Notices + +You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. +4. Inability to Comply Due to Statute or Regulation + +If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. +5. Termination + +5.1. The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated (a) provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and (b) on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. +6. Disclaimer of Warranty + +Covered Software is provided under this License on an "as is" basis, without warranty of any kind, either expressed, implied, or statutory, including, without limitation, warranties that the Covered Software is free of defects, merchantable, fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of the Covered Software is with You. Should any Covered Software prove defective in any respect, You (not any Contributor) assume the cost of any necessary servicing, repair, or correction. This disclaimer of warranty constitutes an essential part of this License. No use of any Covered Software is authorized under this License except under this disclaimer. +7. Limitation of Liability + +Under no circumstances and under no legal theory, whether tort (including negligence), contract, or otherwise, shall any Contributor, or anyone who distributes Covered Software as permitted above, be liable to You for any direct, indirect, special, incidental, or consequential damages of any character including, without limitation, damages for lost profits, loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses, even if such party shall have been informed of the possibility of such damages. This limitation of liability shall not apply to liability for death or personal injury resulting from such party's negligence to the extent applicable law prohibits such limitation. Some jurisdictions do not allow the exclusion or limitation of incidental or consequential damages, so this exclusion and limitation may not apply to You. +8. Litigation + +Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. +9. Miscellaneous + +This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. +10. Versions of the License +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. +10.3. Modified Versions + +If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). +10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses + +If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. +Exhibit A - Source Code Form License Notice + +This Source Code Form is subject to the terms of the Mozilla +Public License, v. 2.0. If a copy of the MPL was not distributed +with this file, you can obtain one at http://mozilla.org/MPL/2.0 + +If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. + +You may add additional accurate notices of copyright ownership. +Exhibit B - "Incompatible With Secondary Licenses" Notice + +This Source Code Form is "Incompatible With Secondary Licenses", +as defined by the Mozilla Public License, v. 2.0. + +Eclipse Public License - Version 1.0 + +THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. +1. DEFINITIONS + +"Contribution" means: + +a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and + +b) in the case of each subsequent Contributor: + +i) changes to the Program, and + +ii) additions to the Program; + +where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. + +"Contributor" means any person or entity that distributes the Program. + +"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. + +"Program" means the Contributions distributed in accordance with this Agreement. + +"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. +2. GRANT OF RIGHTS + +a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. + +b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. + +c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. + +d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. +3. REQUIREMENTS + +A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: + +a) it complies with the terms and conditions of this Agreement; and + +b) its license agreement: + +i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; + +ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; + +iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and + +iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. + +When the Program is made available in source code form: + +a) it must be made available under this Agreement; and + +b) a copy of this Agreement must be included with each copy of the Program. + +Contributors may not remove or alter any copyright notices contained within the Program. + +Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. +4. COMMERCIAL DISTRIBUTION + +Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. + +For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. +5. NO WARRANTY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. +6. DISCLAIMER OF LIABILITY + +EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. +7. GENERAL + +If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. + +If Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. + +All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. + +Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. The Eclipse Foundation is the initial Agreement Steward. The Eclipse Foundation may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. + +This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. +Export Control Classification Number (ECCN) + +As far as we know, the U.S. Export Control Classification Number (ECCN) for this software is 5D002. However, for legal reasons, we can make no warranty that this information is correct. For details, see also the Apache Software Foundation Export Classifications page. \ No newline at end of file diff --git a/licenses/jQuery.BlockUI.license b/licenses/jQuery.BlockUI.license new file mode 100644 index 0000000..efc544f --- /dev/null +++ b/licenses/jQuery.BlockUI.license @@ -0,0 +1,9 @@ +Copyright © 2007-2013 M. Alsup. + +The BlockUI plugin is dual licensed under the MIT and GPL licenses. + +You may use either license. The MIT license is recommended for most projects because it is simple and easy to understand and it places almost no restrictions on what you can do with the plugin. + +If the GPL suits your project better you are also free to use the plugin under that license. + +You do not have to do anything special to choose one license or the other and you don't have to notify anyone which license you are using. You are free to use the BlockUI plugin in commercial projects as long as the copyright header is left intact. \ No newline at end of file diff --git a/licenses/jQuery.FileUpload.license b/licenses/jQuery.FileUpload.license new file mode 100644 index 0000000..5dd45bf --- /dev/null +++ b/licenses/jQuery.FileUpload.license @@ -0,0 +1,20 @@ +MIT License + +Copyright © 2010 Sebastian Tschan, https://blueimp.net + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/licenses/jQuery.Migrate.license b/licenses/jQuery.Migrate.license new file mode 100644 index 0000000..6043d9b --- /dev/null +++ b/licenses/jQuery.Migrate.license @@ -0,0 +1,36 @@ +Copyright OpenJS Foundation and other contributors, https://openjsf.org/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery-migrate + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. \ No newline at end of file diff --git a/licenses/jQuery.UI.license b/licenses/jQuery.UI.license new file mode 100644 index 0000000..a685832 --- /dev/null +++ b/licenses/jQuery.UI.license @@ -0,0 +1,43 @@ +Copyright jQuery Foundation and other contributors, https://jquery.org/ + +This software consists of voluntary contributions made by many +individuals. For exact contribution history, see the revision history +available at https://github.com/jquery/jquery-ui + +The following license applies to all parts of this software except as +documented below: + +==== + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +==== + +Copyright and related rights for sample code are waived via CC0. Sample +code is defined as all source code contained within the demos directory. + +CC0: http://creativecommons.org/publicdomain/zero/1.0/ + +==== + +All files located in the node_modules and external directories are +externally maintained libraries used by this software which have their +own licenses; we recommend you read them, as their terms may differ from +the terms above. \ No newline at end of file diff --git a/licenses/jQuery.iframe-transport.license b/licenses/jQuery.iframe-transport.license new file mode 100644 index 0000000..5dd45bf --- /dev/null +++ b/licenses/jQuery.iframe-transport.license @@ -0,0 +1,20 @@ +MIT License + +Copyright © 2010 Sebastian Tschan, https://blueimp.net + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/licenses/jQuery.license b/licenses/jQuery.license new file mode 100644 index 0000000..f642c3f --- /dev/null +++ b/licenses/jQuery.license @@ -0,0 +1,20 @@ +Copyright OpenJS Foundation and other contributors, https://openjsf.org/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/licenses/jackson-databind.license b/licenses/jackson-databind.license new file mode 100644 index 0000000..d645695 --- /dev/null +++ b/licenses/jackson-databind.license @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/licenses/lombok.license b/licenses/lombok.license new file mode 100644 index 0000000..a80ced4 --- /dev/null +++ b/licenses/lombok.license @@ -0,0 +1,104 @@ +Copyright (C) 2009-2021 The Project Lombok Authors. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +============================================================================== +Licenses for included components: + +org.ow2.asm:asm +org.ow2.asm:asm-analysis +org.ow2.asm:asm-commons +org.ow2.asm:asm-tree +org.ow2.asm:asm-util +ASM: a very small and fast Java bytecode manipulation framework + Copyright (c) 2000-2011 INRIA, France Telecom + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + THE POSSIBILITY OF SUCH DAMAGE. + +------------------------------------------------------------------------------ +rzwitserloot/com.zwitserloot.cmdreader + + Copyright © 2010 Reinier Zwitserloot. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +------------------------------------------------------------------------------ + +projectlombok/lombok.patcher + + Copyright (C) 2009-2021 The Project Lombok Authors. + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +------------------------------------------------------------------------------ \ No newline at end of file diff --git a/licenses/modelmapper.license b/licenses/modelmapper.license new file mode 100644 index 0000000..4947287 --- /dev/null +++ b/licenses/modelmapper.license @@ -0,0 +1,177 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/licenses/prime-jwt.license b/licenses/prime-jwt.license new file mode 100644 index 0000000..ad410e1 --- /dev/null +++ b/licenses/prime-jwt.license @@ -0,0 +1,201 @@ +Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/licenses/spring-boot.license b/licenses/spring-boot.license new file mode 100644 index 0000000..823c1c8 --- /dev/null +++ b/licenses/spring-boot.license @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/licenses/spring-data-jpa.license b/licenses/spring-data-jpa.license new file mode 100644 index 0000000..ff77379 --- /dev/null +++ b/licenses/spring-data-jpa.license @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/mvnw b/mvnw new file mode 100644 index 0000000..a16b543 --- /dev/null +++ b/mvnw @@ -0,0 +1,310 @@ +#!/bin/sh +# ---------------------------------------------------------------------------- +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven Start Up Batch script +# +# Required ENV vars: +# ------------------ +# JAVA_HOME - location of a JDK home dir +# +# Optional ENV vars +# ----------------- +# M2_HOME - location of maven2's installed home dir +# MAVEN_OPTS - parameters passed to the Java VM when running Maven +# e.g. to debug Maven itself, use +# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# ---------------------------------------------------------------------------- + +if [ -z "$MAVEN_SKIP_RC" ] ; then + + if [ -f /etc/mavenrc ] ; then + . /etc/mavenrc + fi + + if [ -f "$HOME/.mavenrc" ] ; then + . "$HOME/.mavenrc" + fi + +fi + +# OS specific support. $var _must_ be set to either true or false. +cygwin=false; +darwin=false; +mingw=false +case "`uname`" in + CYGWIN*) cygwin=true ;; + MINGW*) mingw=true;; + Darwin*) darwin=true + # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home + # See https://developer.apple.com/library/mac/qa/qa1170/_index.html + if [ -z "$JAVA_HOME" ]; then + if [ -x "/usr/libexec/java_home" ]; then + export JAVA_HOME="`/usr/libexec/java_home`" + else + export JAVA_HOME="/Library/Java/Home" + fi + fi + ;; +esac + +if [ -z "$JAVA_HOME" ] ; then + if [ -r /etc/gentoo-release ] ; then + JAVA_HOME=`java-config --jre-home` + fi +fi + +if [ -z "$M2_HOME" ] ; then + ## resolve links - $0 may be a link to maven's home + PRG="$0" + + # need this for relative symlinks + while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG="`dirname "$PRG"`/$link" + fi + done + + saveddir=`pwd` + + M2_HOME=`dirname "$PRG"`/.. + + # make it fully qualified + M2_HOME=`cd "$M2_HOME" && pwd` + + cd "$saveddir" + # echo Using m2 at $M2_HOME +fi + +# For Cygwin, ensure paths are in UNIX format before anything is touched +if $cygwin ; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --unix "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --unix "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --unix "$CLASSPATH"` +fi + +# For Mingw, ensure paths are in UNIX format before anything is touched +if $mingw ; then + [ -n "$M2_HOME" ] && + M2_HOME="`(cd "$M2_HOME"; pwd)`" + [ -n "$JAVA_HOME" ] && + JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +fi + +if [ -z "$JAVA_HOME" ]; then + javaExecutable="`which javac`" + if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then + # readlink(1) is not available as standard on Solaris 10. + readLink=`which readlink` + if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then + if $darwin ; then + javaHome="`dirname \"$javaExecutable\"`" + javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" + else + javaExecutable="`readlink -f \"$javaExecutable\"`" + fi + javaHome="`dirname \"$javaExecutable\"`" + javaHome=`expr "$javaHome" : '\(.*\)/bin'` + JAVA_HOME="$javaHome" + export JAVA_HOME + fi + fi +fi + +if [ -z "$JAVACMD" ] ; then + if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + else + JAVACMD="`which java`" + fi +fi + +if [ ! -x "$JAVACMD" ] ; then + echo "Error: JAVA_HOME is not defined correctly." >&2 + echo " We cannot execute $JAVACMD" >&2 + exit 1 +fi + +if [ -z "$JAVA_HOME" ] ; then + echo "Warning: JAVA_HOME environment variable is not set." +fi + +CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher + +# traverses directory structure from process work directory to filesystem root +# first directory with .mvn subdirectory is considered project base directory +find_maven_basedir() { + + if [ -z "$1" ] + then + echo "Path not specified to find_maven_basedir" + return 1 + fi + + basedir="$1" + wdir="$1" + while [ "$wdir" != '/' ] ; do + if [ -d "$wdir"/.mvn ] ; then + basedir=$wdir + break + fi + # workaround for JBEAP-8937 (on Solaris 10/Sparc) + if [ -d "${wdir}" ]; then + wdir=`cd "$wdir/.."; pwd` + fi + # end of workaround + done + echo "${basedir}" +} + +# concatenates all lines of a file +concat_lines() { + if [ -f "$1" ]; then + echo "$(tr -s '\n' ' ' < "$1")" + fi +} + +BASE_DIR=`find_maven_basedir "$(pwd)"` +if [ -z "$BASE_DIR" ]; then + exit 1; +fi + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" + +# For Cygwin, switch paths to Windows format before running java +if $cygwin; then + [ -n "$M2_HOME" ] && + M2_HOME=`cygpath --path --windows "$M2_HOME"` + [ -n "$JAVA_HOME" ] && + JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` + [ -n "$CLASSPATH" ] && + CLASSPATH=`cygpath --path --windows "$CLASSPATH"` + [ -n "$MAVEN_PROJECTBASEDIR" ] && + MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +fi + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +exec "$JAVACMD" \ + $MAVEN_OPTS \ + -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ + "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ + ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/mvnw.cmd b/mvnw.cmd new file mode 100644 index 0000000..c8d4337 --- /dev/null +++ b/mvnw.cmd @@ -0,0 +1,182 @@ +@REM ---------------------------------------------------------------------------- +@REM Licensed to the Apache Software Foundation (ASF) under one +@REM or more contributor license agreements. See the NOTICE file +@REM distributed with this work for additional information +@REM regarding copyright ownership. The ASF licenses this file +@REM to you under the Apache License, Version 2.0 (the +@REM "License"); you may not use this file except in compliance +@REM with the License. You may obtain a copy of the License at +@REM +@REM https://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, +@REM software distributed under the License is distributed on an +@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +@REM KIND, either express or implied. See the License for the +@REM specific language governing permissions and limitations +@REM under the License. +@REM ---------------------------------------------------------------------------- + +@REM ---------------------------------------------------------------------------- +@REM Maven Start Up Batch script +@REM +@REM Required ENV vars: +@REM JAVA_HOME - location of a JDK home dir +@REM +@REM Optional ENV vars +@REM M2_HOME - location of maven2's installed home dir +@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands +@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending +@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven +@REM e.g. to debug Maven itself, use +@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 +@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM ---------------------------------------------------------------------------- + +@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' +@echo off +@REM set title of command window +title %0 +@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' +@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% + +@REM set %HOME% to equivalent of $HOME +if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") + +@REM Execute a user defined script before this one +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre +@REM check for pre script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" +if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" +:skipRcPre + +@setlocal + +set ERROR_CODE=0 + +@REM To isolate internal variables from possible post scripts, we use another setlocal +@setlocal + +@REM ==== START VALIDATION ==== +if not "%JAVA_HOME%" == "" goto OkJHome + +echo. +echo Error: JAVA_HOME not found in your environment. >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +:OkJHome +if exist "%JAVA_HOME%\bin\java.exe" goto init + +echo. +echo Error: JAVA_HOME is set to an invalid directory. >&2 +echo JAVA_HOME = "%JAVA_HOME%" >&2 +echo Please set the JAVA_HOME variable in your environment to match the >&2 +echo location of your Java installation. >&2 +echo. +goto error + +@REM ==== END VALIDATION ==== + +:init + +@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". +@REM Fallback to current working directory if not found. + +set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% +IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir + +set EXEC_DIR=%CD% +set WDIR=%EXEC_DIR% +:findBaseDir +IF EXIST "%WDIR%"\.mvn goto baseDirFound +cd .. +IF "%WDIR%"=="%CD%" goto baseDirNotFound +set WDIR=%CD% +goto findBaseDir + +:baseDirFound +set MAVEN_PROJECTBASEDIR=%WDIR% +cd "%EXEC_DIR%" +goto endDetectBaseDir + +:baseDirNotFound +set MAVEN_PROJECTBASEDIR=%EXEC_DIR% +cd "%EXEC_DIR%" + +:endDetectBaseDir + +IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig + +@setlocal EnableExtensions EnableDelayedExpansion +for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a +@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% + +:endReadAdditionalConfig + +SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" +set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" +set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* +if ERRORLEVEL 1 goto error +goto end + +:error +set ERROR_CODE=1 + +:end +@endlocal & set ERROR_CODE=%ERROR_CODE% + +if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost +@REM check for post script, once with legacy .bat ending and once with .cmd ending +if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" +if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" +:skipRcPost + +@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' +if "%MAVEN_BATCH_PAUSE%" == "on" pause + +if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% + +exit /B %ERROR_CODE% diff --git a/onlyoffice.header b/onlyoffice.header new file mode 100644 index 0000000..3a09da8 --- /dev/null +++ b/onlyoffice.header @@ -0,0 +1,17 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..ba4ac4d --- /dev/null +++ b/pom.xml @@ -0,0 +1,112 @@ + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.5.1 + + + com.onlyoffice + integration + 1.0 + Java Spring Integration Example + ONLYOFFICE Java Spring Integration + + 11 + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-devtools + true + + + org.springframework.boot + spring-boot-starter-thymeleaf + 2.5.1 + + + org.springframework.boot + spring-boot-starter-data-jpa + + + com.h2database + h2 + runtime + + + com.googlecode.json-simple + json-simple + 1.1 + + + com.google.code.gson + gson + 2.8.9 + + + com.inversoft + prime-jwt + 1.3.1 + + + org.projectlombok + lombok + 1.18.20 + provided + + + com.fasterxml.jackson.core + jackson-core + 2.13.4 + + + com.fasterxml.jackson.core + jackson-databind + 2.13.4.2 + + + org.modelmapper + modelmapper + 2.4.2 + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.2.0 + + + validate + validate + + checkstyle.xml + true + true + true + warning + true + true + + + + check + + + + + + + diff --git a/src/main/java/com/onlyoffice/integration/ExampleData.java b/src/main/java/com/onlyoffice/integration/ExampleData.java new file mode 100644 index 0000000..6fe3c3a --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/ExampleData.java @@ -0,0 +1,115 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration; + +import com.onlyoffice.integration.documentserver.serializers.FilterState; +import com.onlyoffice.integration.services.UserServices; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.PostConstruct; +import java.util.ArrayList; +import java.util.List; + +@Component +public class ExampleData { + @Autowired + private UserServices userService; + @PostConstruct + public void init() { + // the description for user 0 + List descriptionUserZero = List.of( + "The name is requested when the editor is opened", + "Doesn’t belong to any group", + "Can review all the changes", + "Can perform all actions with comments", + "The file favorite state is undefined", + "Can't mention others in comments", + "Can't create new files from the editor", + "Can’t see anyone’s information", + "Can't rename files from the editor", + "Can't view chat", + "Can't protect file", + "View file without collaboration" + ); + + // the description for user 1 + List descriptionUserFirst = List.of( + "File author by default", + "He doesn’t belong to any of the groups", + "He can review all the changes", + "He can do everything with the comments", + "The file favorite state is undefined", + "Can create a file from a template with data from the editor", + "Can see the information about all users", + "Can view chat" + ); + + // the description for user 2 + List descriptionUserSecond = List.of( + "He belongs to Group2", + "He can review only his own changes or the changes made by the users who don’t belong" + + " to any of the groups", + "He can view every comment, edit his comments and the comments left by the users " + + "who don't belong to any of the groups and remove only his comments", + "This file is favorite", + "Can create a file from an editor", + "Can see the information about users from Group2 and users who don’t belong to any group", + "Can view chat" + ); + + // the description for user 3 + List descriptionUserThird = List.of( + "He belongs to Group3", + "He can review only the changes made by the users from Group2", + "He can view the comments left by the users from Group2 and Group3 and edit the comments left by " + + "the users from Group2", + "This file isn’t favorite", + "He can’t copy data from the file into the clipboard", + "He can’t download the file", + "He can’t print the file", + "Can create a file from an editor", + "Can see the information about Group2 users", + "Can view chat" + ); + + // create user 1 with the specified parameters + userService.createUser("John Smith", "smith@example.com", descriptionUserFirst, + "", List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), + List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), + List.of(FilterState.NULL.toString()), null, true, true); + + // create user 2 with the specified parameters + userService.createUser("Mark Pottato", "pottato@example.com", descriptionUserSecond, + "group-2", List.of("", "group-2"), List.of(FilterState.NULL.toString()), + List.of("group-2", ""), List.of("group-2"), List.of("group-2", ""), true, true, + true); + + // create user 3 with the specified parameters + userService.createUser("Hamish Mitchell", "mitchell@example.com", descriptionUserThird, + "group-3", List.of("group-2"), List.of("group-2", "group-3"), List.of("group-2"), + new ArrayList<>(), List.of("group-2"), false, true, true); + + // create user 0 with the specified parameters + userService.createUser("Anonymous", null, descriptionUserZero, "", + List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), + List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), + new ArrayList<>(), null, false, false); + } +} diff --git a/src/main/java/com/onlyoffice/integration/IntegrationApplication.java b/src/main/java/com/onlyoffice/integration/IntegrationApplication.java new file mode 100644 index 0000000..4a1a0cc --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/IntegrationApplication.java @@ -0,0 +1,32 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class IntegrationApplication { + + // run the SpringApplication from the IntagrationApplication with the specified parameters + public static void main(final String[] args) { + SpringApplication.run(IntegrationApplication.class, args); + } + +} diff --git a/src/main/java/com/onlyoffice/integration/IntegrationConfiguration.java b/src/main/java/com/onlyoffice/integration/IntegrationConfiguration.java new file mode 100644 index 0000000..d9d7520 --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/IntegrationConfiguration.java @@ -0,0 +1,87 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import org.json.simple.parser.JSONParser; +import org.modelmapper.ModelMapper; +import org.modelmapper.convention.MatchingStrategies; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import javax.annotation.PostConstruct; + +import com.onlyoffice.integration.documentserver.util.SSLUtils; + +@Configuration +public class IntegrationConfiguration { + + @Value("${files.storage}") + private String storageAddress; + + @Value("${files.docservice.verify-peer-off}") + private String verifyPerrOff; + + @Autowired + private FileStoragePathBuilder storagePathBuilder; + + @Autowired + private SSLUtils ssl; + + @Bean + public ModelMapper mapper() { // create the model mapper + ModelMapper mapper = new ModelMapper(); + mapper.getConfiguration() // get the mapper configuration and set new parameters to it + .setMatchingStrategy(MatchingStrategies.STRICT) // specify the STRICT matching strategy + .setFieldMatchingEnabled(true) // define if the field matching is enabled or not + .setSkipNullEnabled(true) // define if null value will be skipped or not + .setFieldAccessLevel(org.modelmapper.config.Configuration.AccessLevel.PRIVATE); /* specify + the PRIVATE field access level */ + return mapper; + } + + @Bean + public JSONParser jsonParser() { // create JSON parser + return new JSONParser(); + } + + @PostConstruct + public void init() { // initialize the storage path builder + storagePathBuilder.configure(storageAddress.isBlank() ? null : storageAddress); + if (!verifyPerrOff.isEmpty()) { + try { + if (verifyPerrOff.equals("true")) { + ssl.turnOffSslChecking(); //the certificate will be ignored + } else { + ssl.turnOnSslChecking(); //the certificate will be verified + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } + + @Bean + public ObjectMapper objectMapper() { // create the object mapper + return new ObjectMapper(); + } +} diff --git a/src/main/java/com/onlyoffice/integration/controllers/EditorController.java b/src/main/java/com/onlyoffice/integration/controllers/EditorController.java new file mode 100644 index 0000000..f9c24ad --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/controllers/EditorController.java @@ -0,0 +1,239 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.controllers; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onlyoffice.integration.documentserver.managers.history.HistoryManager; +import com.onlyoffice.integration.documentserver.managers.jwt.JwtManager; +import com.onlyoffice.integration.documentserver.models.enums.Action; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import com.onlyoffice.integration.entities.User; +import com.onlyoffice.integration.dto.Mentions; +import com.onlyoffice.integration.documentserver.models.enums.Type; +import com.onlyoffice.integration.documentserver.models.filemodel.FileModel; +import com.onlyoffice.integration.services.UserServices; +import com.onlyoffice.integration.services.configurers.FileConfigurer; +import com.onlyoffice.integration.services.configurers.wrappers.DefaultFileWrapper; +import lombok.SneakyThrows; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestParam; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; + +import static com.onlyoffice.integration.documentserver.util.Constants.ANONYMOUS_USER_ID; + +@CrossOrigin("*") +@Controller +public class EditorController { + + @Value("${files.docservice.url.site}") + private String docserviceSite; + + @Value("${files.docservice.url.api}") + private String docserviceApiUrl; + + @Value("${files.docservice.languages}") + private String langs; + + @Autowired + private FileStoragePathBuilder storagePathBuilder; + + @Autowired + private JwtManager jwtManager; + + @Autowired + private UserServices userService; + + @Autowired + private HistoryManager historyManager; + + @Autowired + private ObjectMapper objectMapper; + + @Autowired + private FileConfigurer fileConfigurer; + + @GetMapping(path = "${url.editor}") + // process request to open the editor page + public String index(@RequestParam("fileName") final String fileName, + @RequestParam(value = "action", required = false) final String actionParam, + @RequestParam(value = "type", required = false) final String typeParam, + @RequestParam(value = "actionLink", required = false) final String actionLink, + @RequestParam(value = "directUrl", required = false, + defaultValue = "false") final Boolean directUrl, + @CookieValue(value = "uid") final String uid, + @CookieValue(value = "ulang") final String lang, + final Model model) throws JsonProcessingException { + Action action = Action.edit; + Type type = Type.desktop; + Locale locale = new Locale("en"); + + if (actionParam != null) { + action = Action.valueOf(actionParam); + } + if (typeParam != null) { + type = Type.valueOf(typeParam); + } + + List langsAndKeys = Arrays.asList(langs.split("\\|")); + for (String langAndKey : langsAndKeys) { + String[] couple = langAndKey.split(":"); + if (couple[0].equals(lang)) { + String[] langAndCountry = couple[0].split("-"); + locale = new Locale(langAndCountry[0], langAndCountry.length > 1 ? langAndCountry[1] : ""); + } + } + + Optional optionalUser = userService.findUserById(Integer.parseInt(uid)); + + // if the user is not present, return the ONLYOFFICE start page + if (!optionalUser.isPresent()) { + return "index.html"; + } + + User user = optionalUser.get(); + + // get file model with the default file parameters + FileModel fileModel = fileConfigurer.getFileModel( + DefaultFileWrapper + .builder() + .fileName(fileName) + .type(type) + .lang(locale.toLanguageTag()) + .action(action) + .user(user) + .actionData(actionLink) + .isEnableDirectUrl(directUrl) + .build() + ); + + // add attributes to the specified model + // add file model with the default parameters to the original model + model.addAttribute("model", fileModel); + + // get file history and add it to the model + model.addAttribute("fileHistory", historyManager.getHistory(fileModel.getDocument())); + + // create the document service api URL and add it to the model + model.addAttribute("docserviceApiUrl", docserviceSite + docserviceApiUrl); + + // get an image and add it to the model + model.addAttribute("dataInsertImage", getInsertImage(directUrl)); + + // get a document for comparison and add it to the model + model.addAttribute("dataCompareFile", getCompareFile(directUrl)); + + // get recipients data for mail merging and add it to the model + model.addAttribute("dataMailMergeRecipients", getMailMerge(directUrl)); + + // get user data for mentions and add it to the model + model.addAttribute("usersForMentions", getUserMentions(uid)); + return "editor.html"; + } + + private List getUserMentions(final String uid) { // get user data for mentions + List usersForMentions = new ArrayList<>(); + if (uid != null && !uid.equals("4")) { + List list = userService.findAll(); + for (User u : list) { + if (u.getId() != Integer.parseInt(uid) && u.getId() != ANONYMOUS_USER_ID) { + + // user data includes user names and emails + usersForMentions.add(new Mentions(u.getName(), u.getEmail())); + } + } + } + + return usersForMentions; + } + + @SneakyThrows + private String getInsertImage(final Boolean directUrl) { // get an image that will be inserted into the document + Map dataInsertImage = new HashMap<>(); + dataInsertImage.put("fileType", "png"); + dataInsertImage.put("url", storagePathBuilder.getServerUrl(true) + "/css/img/logo.png"); + if (directUrl) { + dataInsertImage.put("directUrl", storagePathBuilder + .getServerUrl(false) + "/css/img/logo.png"); + } + + // check if the document token is enabled + if (jwtManager.tokenEnabled()) { + + // create token from the dataInsertImage object + dataInsertImage.put("token", jwtManager.createToken(dataInsertImage)); + } + + return objectMapper.writeValueAsString(dataInsertImage) + .substring(1, objectMapper.writeValueAsString(dataInsertImage).length() - 1); + } + + // get a document that will be compared with the current document + @SneakyThrows + private String getCompareFile(final Boolean directUrl) { + Map dataCompareFile = new HashMap<>(); + dataCompareFile.put("fileType", "docx"); + dataCompareFile.put("url", storagePathBuilder.getServerUrl(true) + "/assets?name=sample.docx"); + if (directUrl) { + dataCompareFile.put("directUrl", storagePathBuilder + .getServerUrl(false) + "/assets?name=sample.docx"); + } + + // check if the document token is enabled + if (jwtManager.tokenEnabled()) { + + // create token from the dataCompareFile object + dataCompareFile.put("token", jwtManager.createToken(dataCompareFile)); + } + + return objectMapper.writeValueAsString(dataCompareFile); + } + + @SneakyThrows + private String getMailMerge(final Boolean directUrl) { + Map dataMailMergeRecipients = new HashMap<>(); // get recipients data for mail merging + dataMailMergeRecipients.put("fileType", "csv"); + dataMailMergeRecipients.put("url", storagePathBuilder.getServerUrl(true) + "/csv"); + if (directUrl) { + dataMailMergeRecipients.put("directUrl", storagePathBuilder.getServerUrl(false) + "/csv"); + } + + // check if the document token is enabled + if (jwtManager.tokenEnabled()) { + + // create token from the dataMailMergeRecipients object + dataMailMergeRecipients.put("token", jwtManager.createToken(dataMailMergeRecipients)); + } + + return objectMapper.writeValueAsString(dataMailMergeRecipients); + } +} diff --git a/src/main/java/com/onlyoffice/integration/controllers/FileController.java b/src/main/java/com/onlyoffice/integration/controllers/FileController.java new file mode 100644 index 0000000..c5259ea --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/controllers/FileController.java @@ -0,0 +1,624 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.controllers; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.onlyoffice.integration.documentserver.callbacks.CallbackHandler; +import com.onlyoffice.integration.documentserver.managers.jwt.JwtManager; +import com.onlyoffice.integration.documentserver.storage.FileStorageMutator; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import com.onlyoffice.integration.dto.Converter; +import com.onlyoffice.integration.dto.ConvertedData; +import com.onlyoffice.integration.dto.Track; +import com.onlyoffice.integration.entities.User; +import com.onlyoffice.integration.documentserver.models.enums.DocumentType; +import com.onlyoffice.integration.services.UserServices; +import com.onlyoffice.integration.documentserver.util.file.FileUtility; +import com.onlyoffice.integration.documentserver.util.service.ServiceConverter; +import com.onlyoffice.integration.documentserver.managers.document.DocumentManager; +import com.onlyoffice.integration.documentserver.managers.callback.CallbackManager; + +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.Resource; +import org.springframework.http.HttpHeaders; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.CookieValue; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.PutMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletRequest; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.IOException; +import java.io.InputStream; +import java.net.InetAddress; +import java.net.URL; +import java.net.URLEncoder; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.text.SimpleDateFormat; +import java.util.ArrayList; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Optional; + +@CrossOrigin("*") +@Controller +public class FileController { + + @Value("${files.docservice.header}") + private String documentJwtHeader; + + @Value("${filesize-max}") + private String filesizeMax; + + @Value("${files.docservice.url.site}") + private String docserviceUrlSite; + + @Value("${files.docservice.url.command}") + private String docserviceUrlCommand; + + @Autowired + private FileUtility fileUtility; + @Autowired + private DocumentManager documentManager; + @Autowired + private JwtManager jwtManager; + @Autowired + private FileStorageMutator storageMutator; + @Autowired + private FileStoragePathBuilder storagePathBuilder; + @Autowired + private UserServices userService; + @Autowired + private CallbackHandler callbackHandler; + @Autowired + private ObjectMapper objectMapper; + @Autowired + private ServiceConverter serviceConverter; + @Autowired + private CallbackManager callbackManager; + + // create user metadata + private String createUserMetadata(final String uid, final String fullFileName) { + Optional optionalUser = userService.findUserById(Integer.parseInt(uid)); // find a user by their ID + String documentType = fileUtility.getDocumentType(fullFileName).toString().toLowerCase(); // get document type + if (optionalUser.isPresent()) { + User user = optionalUser.get(); + storageMutator.createMeta(fullFileName, // create meta information with the user ID and name specified + String.valueOf(user.getId()), user.getName()); + } + return "{ \"filename\": \"" + fullFileName + "\", \"documentType\": \"" + documentType + "\" }"; + } + + // download data from the specified file + private ResponseEntity downloadFile(final String fileName) { + Resource resource = storageMutator.loadFileAsResource(fileName); // load the specified file as a resource + String contentType = "application/octet-stream"; + + // create a response with the content type, header and body with the file data + return ResponseEntity.ok() + .contentType(MediaType.parseMediaType(contentType)) + .header(HttpHeaders.CONTENT_DISPOSITION, + "attachment; filename=\"" + resource.getFilename() + "\"") + .body(resource); + } + + // download data from the specified history file + private ResponseEntity downloadFileHistory(final String fileName, + final String version, + final String file) { + + // load the specified file as a resource + Resource resource = storageMutator.loadFileAsResourceHistory(fileName, version, file); + String contentType = "application/octet-stream"; + + // create a response with the content type, header and body with the file data + return ResponseEntity.ok() + .contentType(MediaType.parseMediaType(contentType)) + .header(HttpHeaders.CONTENT_DISPOSITION, + "attachment; filename=\"" + resource.getFilename() + "\"") + .body(resource); + } + + @PostMapping("/upload") + @ResponseBody + public String upload(@RequestParam("file") final MultipartFile file, // upload a file + @CookieValue("uid") final String uid) { + try { + String fullFileName = file.getOriginalFilename(); // get file name + String fileExtension = fileUtility.getFileExtension(fullFileName); // get file extension + long fileSize = file.getSize(); // get file size + byte[] bytes = file.getBytes(); // get file in bytes + + // check if the file size exceeds the maximum file size or is less than 0 + if (fileUtility.getMaxFileSize() < fileSize || fileSize <= 0) { + return "{ \"error\": \"File size is incorrect\"}"; // if so, write an error message to the response + } + + // check if file extension is supported by the editor + if (!fileUtility.getFileExts().contains(fileExtension)) { + + // if not, write an error message to the response + return "{ \"error\": \"File type is not supported\"}"; + } + + String fileNamePath = storageMutator.updateFile(fullFileName, bytes); // update a file + if (fileNamePath.isBlank()) { + throw new IOException("Could not update a file"); // if the file cannot be updated, an error occurs + } + + fullFileName = fileUtility.getFileNameWithoutExtension(fileNamePath) + fileExtension; // get full file name + + return createUserMetadata(uid, fullFileName); // create user metadata and return it + } catch (Exception e) { + e.printStackTrace(); + } + + // if the operation of file uploading is unsuccessful, an error occurs + return "{ \"error\": \"Something went wrong when uploading the file.\"}"; + } + + @PostMapping(path = "${url.converter}") + @ResponseBody + public String convert(@RequestBody final Converter body, // convert a file + @CookieValue("uid") final String uid, @CookieValue("ulang") final String lang) { + // get file name + String fileName = body.getFileName(); + + // get URL for downloading a file with the specified name + String fileUri = documentManager.getDownloadUrl(fileName, true); + + // get file password if it exists + String filePass = body.getFilePass() != null ? body.getFilePass() : null; + + // get file extension + String fileExt = fileUtility.getFileExtension(fileName); + + // get document type (word, cell or slide) + DocumentType type = fileUtility.getDocumentType(fileName); + + // convert to .ooxml + String internalFileExt = "ooxml"; + + try { + // check if the file with such an extension can be converted + if (fileUtility.getConvertExts().contains(fileExt)) { + String key = serviceConverter.generateRevisionId(fileUri); // generate document key + ConvertedData response = serviceConverter // get the URL to the converted file + .getConvertedData(fileUri, fileExt, internalFileExt, key, filePass, true, lang); + + String newFileUri = response.getUri(); + String newFileType = "." + response.getFileType(); + + if (newFileUri.isEmpty()) { + return "{ \"step\" : \"0\", \"filename\" : \"" + fileName + "\"}"; + } + + /* get a file name of an internal file extension with an index if the file + with such a name already exists */ + String nameWithInternalExt = fileUtility.getFileNameWithoutExtension(fileName) + newFileType; + String correctedName = documentManager.getCorrectName(nameWithInternalExt); + + URL url = new URL(newFileUri); + java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection(); + InputStream stream = connection.getInputStream(); // get input stream of the converted file + + if (stream == null) { + connection.disconnect(); + throw new RuntimeException("Input stream is null"); + } + + // remove source file + storageMutator.deleteFile(fileName); + + // create the converted file with input stream + storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(correctedName)), stream); + fileName = correctedName; + } + + // create meta information about the converted file with the user ID and name specified + return createUserMetadata(uid, fileName); + } catch (Exception e) { + e.printStackTrace(); + } + // if the operation of file converting is unsuccessful, an error occurs + return "{ \"error\": \"" + "The file can't be converted.\"}"; + } + + @PostMapping("/delete") + @ResponseBody + public String delete(@RequestBody final Converter body) { // delete a file + try { + String fullFileName = fileUtility.getFileName(body.getFileName()); // get full file name + + // delete a file from the storage and return the status of this operation (true or false) + boolean fileSuccess = storageMutator.deleteFile(fullFileName); + + // delete file history and return the status of this operation (true or false) + boolean historySuccess = storageMutator.deleteFileHistory(fullFileName); + + return "{ \"success\": \"" + (fileSuccess && historySuccess) + "\"}"; + } catch (Exception e) { + // if the operation of file deleting is unsuccessful, an error occurs + return "{ \"error\": \"" + e.getMessage() + "\"}"; + } + } + + @GetMapping("/downloadhistory") + public ResponseEntity downloadHistory(final HttpServletRequest request, // download a file + @RequestParam("fileName") final String fileName, + @RequestParam("ver") final String version, + @RequestParam("file") final String file) { // history file + try { + // check if a token is enabled or not + if (jwtManager.tokenEnabled() && jwtManager.tokenUseForRequest()) { + String header = request.getHeader(documentJwtHeader == null // get the document JWT header + || documentJwtHeader.isEmpty() ? "Authorization" : documentJwtHeader); + if (header != null && !header.isEmpty()) { + String token = header + .replace("Bearer ", ""); // token is the header without the Bearer prefix + jwtManager.readToken(token); // read the token + } else { + return null; + } + } + return downloadFileHistory(fileName, version, file); // download data from the specified file + } catch (Exception e) { + return null; + } + } + + @GetMapping(path = "${url.download}") + public ResponseEntity download(final HttpServletRequest request, // download a file + @RequestParam("fileName") final String fileName, + @RequestParam(value = "userAddress", required = false) + final String userAddress) { + try { + // check if a token is enabled or not + if (jwtManager.tokenEnabled() && userAddress != null && jwtManager.tokenUseForRequest()) { + String header = request.getHeader(documentJwtHeader == null // get the document JWT header + || documentJwtHeader.isEmpty() ? "Authorization" : documentJwtHeader); + if (header != null && !header.isEmpty()) { + String token = header + .replace("Bearer ", ""); // token is the header without the Bearer prefix + jwtManager.readToken(token); // read the token + } else { + return null; + } + } + return downloadFile(fileName); // download data from the specified file + } catch (Exception e) { + return null; + } + } + + @GetMapping("/create") + public String create(@RequestParam("fileExt") + final String fileExt, // create a sample file of the specified extension + @RequestParam(value = "sample", required = false) final Optional isSample, + @CookieValue(value = "uid", required = false) final String uid, + final Model model) { + // specify if the sample data exists or not + Boolean sampleData = (isSample.isPresent() && !isSample.isEmpty()) && isSample.get(); + if (fileExt != null) { + try { + Optional user = userService.findUserById(Integer.parseInt(uid)); // find a user by their ID + if (!user.isPresent()) { + // if the user with the specified ID doesn't exist, an error occurs + throw new RuntimeException("Could not fine any user with id = " + uid); + } + String fileName = documentManager.createDemo(fileExt, + sampleData, + uid, + user.get().getName()); // create a demo document with the sample data + if (fileName.isBlank() || fileName == null) { + throw new RuntimeException("You must have forgotten to add asset files"); + } + return "redirect:editor?fileName=" + URLEncoder + .encode(fileName, StandardCharsets.UTF_8); // redirect the request + } catch (Exception ex) { + model.addAttribute("error", ex.getMessage()); + return "error.html"; + } + } + return "redirect:/"; + } + + @GetMapping("/assets") + public ResponseEntity assets(@RequestParam("name") + final String name) { // get sample files from the assests + String fileName = Path.of("assets", "document-templates", "sample", fileUtility.getFileName(name)).toString(); + return downloadFile(fileName); + } + + @GetMapping("/csv") + public ResponseEntity csv() { // download a csv file + String fileName = Path.of("assets", "document-templates", "sample", "csv.csv").toString(); + return downloadFile(fileName); + } + + @GetMapping("/files") + @ResponseBody + public ArrayList> files(@RequestParam(value = "fileId", required = false) + final String fileId) { // get files information + return fileId == null ? documentManager.getFilesInfo() : documentManager.getFilesInfo(fileId); + } + + @PostMapping(path = "${url.track}") + @ResponseBody + public String track(final HttpServletRequest request, // track file changes + @RequestParam("fileName") final String fileName, + @RequestParam("userAddress") final String userAddress, + @RequestBody final Track body) { + Track track; + try { + String bodyString = objectMapper + .writeValueAsString(body); // write the request body to the object mapper as a string + String header = request.getHeader(documentJwtHeader == null // get the request header + || documentJwtHeader.isEmpty() ? "Authorization" : documentJwtHeader); + + if (bodyString.isEmpty()) { // if the request body is empty, an error occurs + throw new RuntimeException("{\"error\":1,\"message\":\"Request payload is empty\"}"); + } + + JSONObject bodyCheck = jwtManager.parseBody(bodyString, header); // parse the request body + track = objectMapper.readValue(bodyCheck.toJSONString(), Track.class); // read the request body + } catch (Exception e) { + e.printStackTrace(); + return e.getMessage(); + } + + int error = callbackHandler.handle(track, fileName); + + return "{\"error\":" + error + "}"; + } + + @PostMapping("/saveas") + @ResponseBody + public String saveAs(@RequestBody final JSONObject body, @CookieValue("uid") final String uid) { + String title = (String) body.get("title"); + String saveAsFileUrl = (String) body.get("url"); + + try { + String fileName = documentManager.getCorrectName(title); + String curExt = fileUtility.getFileExtension(fileName); + + if (!fileUtility.getFileExts().contains(curExt)) { + return "{\"error\":\"File type is not supported\"}"; + } + + URL url = new URL(saveAsFileUrl); + java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection(); + InputStream stream = connection.getInputStream(); + + if (Integer.parseInt(filesizeMax) < stream.available() || stream.available() <= 0) { + return "{\"error\":\"File size is incorrect\"}"; + } + storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(fileName)), stream); + createUserMetadata(uid, fileName); + + return "{\"file\": \"" + fileName + "\"}"; + } catch (IOException e) { + e.printStackTrace(); + return "{ \"error\" : 1, \"message\" : \"" + e.getMessage() + "\"}"; + } + } + + @PostMapping("/rename") + @ResponseBody + public String rename(@RequestBody final JSONObject body) { + String newfilename = (String) body.get("newfilename"); + String dockey = (String) body.get("dockey"); + String origExt = "." + (String) body.get("ext"); + String curExt = newfilename; + + if (newfilename.indexOf(".") != -1) { + curExt = (String) fileUtility.getFileExtension(newfilename); + } + + if (origExt.compareTo(curExt) != 0) { + newfilename += origExt; + } + + HashMap meta = new HashMap<>(); + meta.put("title", newfilename); + + try { + callbackManager.commandRequest("meta", dockey, meta); + return "result ok"; + } catch (Exception e) { + e.printStackTrace(); + return e.getMessage(); + } + } + + @PostMapping("/reference") + @ResponseBody + public String reference(@RequestBody final JSONObject body) { + try { + JSONParser parser = new JSONParser(); + Gson gson = new GsonBuilder().disableHtmlEscaping().create(); + + String userAddress = ""; + String fileName = ""; + + if (body.containsKey("referenceData")) { + LinkedHashMap referenceDataObj = (LinkedHashMap) body.get("referenceData"); + String instanceId = (String) referenceDataObj.get("instanceId"); + + if (instanceId.equals(storagePathBuilder.getServerUrl(false))) { + JSONObject fileKey = (JSONObject) parser.parse((String) referenceDataObj.get("fileKey")); + userAddress = (String) fileKey.get("userAddress"); + if (userAddress.equals(InetAddress.getLocalHost().getHostAddress())) { + fileName = (String) fileKey.get("fileName"); + } + } + } + + + if (fileName.equals("")) { + try { + String path = (String) body.get("path"); + path = fileUtility.getFileName(path); + File f = new File(storagePathBuilder.getFileLocation(path)); + if (f.exists()) { + fileName = path; + } + } catch (Exception e) { + return "{ \"error\" : 1, \"message\" : \"" + e.getMessage() + "\"}"; + } + } + + if (fileName.equals("")) { + return "{ \"error\": \"File not found\"}"; + } + + boolean directUrl = (boolean) body.get("directUrl"); + + HashMap fileKey = new HashMap<>(); + fileKey.put("fileName", fileName); + fileKey.put("userAddress", InetAddress.getLocalHost().getHostAddress()); + + HashMap referenceData = new HashMap<>(); + referenceData.put("instanceId", storagePathBuilder.getServerUrl(true)); + referenceData.put("fileKey", gson.toJson(fileKey)); + + HashMap data = new HashMap<>(); + data.put("fileType", fileUtility.getFileExtension(fileName).replace(".", "")); + data.put("url", documentManager.getDownloadUrl(fileName, true)); + data.put("directUrl", directUrl ? documentManager.getDownloadUrl(fileName, false) : null); + data.put("referenceData", referenceData); + data.put("path", fileName); + + if (jwtManager.tokenEnabled()) { + String token = jwtManager.createToken(data); + data.put("token", token); + } + return gson.toJson(data); + } catch (Exception e) { + e.printStackTrace(); + return "{ \"error\" : 1, \"message\" : \"" + e.getMessage() + "\"}"; + } + } + + @PutMapping("/restore") + @ResponseBody + public String restore(@RequestBody final JSONObject body) { + try { + String sourceBasename = (String) body.get("fileName"); + Integer version = (Integer) body.get("version"); + String userID = (String) body.get("userId"); + + String sourceStringFile = storagePathBuilder.getFileLocation(sourceBasename); + File sourceFile = new File(sourceStringFile); + Path sourcePathFile = sourceFile.toPath(); + String historyDirectory = storagePathBuilder.getHistoryDir(sourcePathFile.toString()); + + Integer bumpedVersion = storagePathBuilder.getFileVersion(historyDirectory, false); + String bumpedVersionStringDirectory = documentManager.versionDir(historyDirectory, bumpedVersion, true); + File bumpedVersionDirectory = new File(bumpedVersionStringDirectory); + if (!bumpedVersionDirectory.exists()) { + bumpedVersionDirectory.mkdir(); + } + + Path bumpedKeyPathFile = Paths.get(bumpedVersionStringDirectory, "key.txt"); + String bumpedKeyStringFile = bumpedKeyPathFile.toString(); + File bumpedKeyFile = new File(bumpedKeyStringFile); + String bumpedKey = serviceConverter.generateRevisionId( + storagePathBuilder.getStorageLocation() + + "/" + + sourceBasename + + "/" + + Long.toString(sourceFile.lastModified()) + ); + FileWriter bumpedKeyFileWriter = new FileWriter(bumpedKeyFile); + bumpedKeyFileWriter.write(bumpedKey); + bumpedKeyFileWriter.close(); + + Integer userInnerID = Integer.parseInt(userID.replace("uid-", "")); + User user = userService.findUserById(userInnerID).get(); + + Path bumpedChangesPathFile = Paths.get(bumpedVersionStringDirectory, "changes.json"); + String bumpedChangesStringFile = bumpedChangesPathFile.toString(); + File bumpedChangesFile = new File(bumpedChangesStringFile); + JSONObject bumpedChangesUser = new JSONObject(); + // Don't add the `uid-` prefix. + // https://github.com/ONLYOFFICE/document-server-integration/issues/437#issuecomment-1663526562 + bumpedChangesUser.put("id", user.getId()); + bumpedChangesUser.put("name", user.getName()); + JSONObject bumpedChangesChangesItem = new JSONObject(); + bumpedChangesChangesItem.put("created", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date())); + bumpedChangesChangesItem.put("user", bumpedChangesUser); + JSONArray bumpedChangesChanges = new JSONArray(); + bumpedChangesChanges.add(bumpedChangesChangesItem); + JSONObject bumpedChanges = new JSONObject(); + bumpedChanges.put("serverVersion", null); + bumpedChanges.put("changes", bumpedChangesChanges); + String bumpedChangesContent = bumpedChanges.toJSONString(); + FileWriter bumpedChangesFileWriter = new FileWriter(bumpedChangesFile); + bumpedChangesFileWriter.write(bumpedChangesContent); + bumpedChangesFileWriter.close(); + + String sourceExtension = fileUtility.getFileExtension(sourceBasename); + String previousBasename = "prev" + sourceExtension; + + Path bumpedFile = Paths.get(bumpedVersionStringDirectory, previousBasename); + Files.move(sourcePathFile, bumpedFile); + + String recoveryVersionStringDirectory = documentManager.versionDir(historyDirectory, version, true); + Path recoveryPathFile = Paths.get(recoveryVersionStringDirectory, previousBasename); + String recoveryStringFile = recoveryPathFile.toString(); + FileInputStream recoveryStream = new FileInputStream(recoveryStringFile); + storageMutator.createFile(sourcePathFile, recoveryStream); + recoveryStream.close(); + + JSONObject responseBody = new JSONObject(); + responseBody.put("error", null); + responseBody.put("success", true); + return responseBody.toJSONString(); + } catch (Exception error) { + error.printStackTrace(); + JSONObject responseBody = new JSONObject(); + responseBody.put("error", error.getMessage()); + responseBody.put("success", false); + return responseBody.toJSONString(); + } + } +} diff --git a/src/main/java/com/onlyoffice/integration/controllers/IndexController.java b/src/main/java/com/onlyoffice/integration/controllers/IndexController.java new file mode 100644 index 0000000..1088ead --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/controllers/IndexController.java @@ -0,0 +1,147 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.controllers; + +import com.onlyoffice.integration.documentserver.storage.FileStorageMutator; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import com.onlyoffice.integration.documentserver.util.Misc; +import com.onlyoffice.integration.documentserver.util.file.FileUtility; +import com.onlyoffice.integration.entities.User; +import com.onlyoffice.integration.services.UserServices; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.CrossOrigin; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; + +@CrossOrigin("*") +@Controller +public class IndexController { + + @Autowired + private FileStorageMutator storageMutator; + + @Autowired + private FileStoragePathBuilder storagePathBuilder; + + @Autowired + private FileUtility fileUtility; + + @Autowired + private Misc mistUtility; + + @Autowired + private UserServices userService; + + @Value("${files.docservice.url.site}") + private String docserviceSite; + + @Value("${files.docservice.url.preloader}") + private String docservicePreloader; + + @Value("${url.converter}") + private String urlConverter; + + @Value("${url.editor}") + private String urlEditor; + + @Value("${files.docservice.languages}") + private String langs; + + @GetMapping("${url.index}") + public String index(@RequestParam(value = "directUrl", required = false) final Boolean directUrl, + final Model model) { + java.io.File[] files = storageMutator.getStoredFiles(); // get all the stored files from the storage + List docTypes = new ArrayList<>(); + List filesEditable = new ArrayList<>(); + List versions = new ArrayList<>(); + List isFillFormDoc = new ArrayList<>(); + List langsAndKeys = Arrays.asList(langs.split("\\|")); + + Map languages = new LinkedHashMap<>(); + + langsAndKeys.forEach((str) -> { + String[] couple = str.split(":"); + languages.put(couple[0], couple[1]); + }); + + List users = userService.findAll(); // get a list of all the users + + String tooltip = users.stream() // get the tooltip with the user descriptions + .map(user -> mistUtility.convertUserDescriptions(user.getName(), + user.getDescriptions())) // convert user descriptions to the specified format + .collect(Collectors.joining()); + + for (java.io.File file:files) { // run through all the files + String fileName = file.getName(); // get file name + docTypes.add(fileUtility + .getDocumentType(fileName) + .toString() + .toLowerCase()); // add a document type of each file to the list + filesEditable.add(fileUtility.getEditedExts() + .contains(fileUtility.getFileExtension(fileName))); // specify if a file is editable or not + versions.add(" [" + storagePathBuilder. + getFileVersion(fileName, true) + "]"); // add a file version to the list + isFillFormDoc.add(fileUtility.getFillExts().contains(fileUtility.getFileExtension(fileName))); + } + + // add all the parameters to the model + model.addAttribute("isFillFormDoc", isFillFormDoc); + model.addAttribute("versions", versions); + model.addAttribute("files", files); + model.addAttribute("docTypes", docTypes); + model.addAttribute("filesEditable", filesEditable); + model.addAttribute("datadocs", docserviceSite + docservicePreloader); + model.addAttribute("tooltip", tooltip); + model.addAttribute("users", users); + model.addAttribute("languages", languages); + model.addAttribute("directUrl", directUrl); + + return "index.html"; + } + + @PostMapping("/config") + @ResponseBody + public HashMap configParameters() { // get configuration parameters + HashMap configuration = new HashMap<>(); + + configuration.put("FillExtList", String.join(",", fileUtility + .getFillExts())); // put a list of the extensions that can be filled to config + configuration.put("ConverExtList", String.join(",", fileUtility + .getConvertExts())); // put a list of the extensions that can be converted to config + configuration.put("EditedExtList", String.join(",", fileUtility + .getEditedExts())); // put a list of the extensions that can be edited to config + configuration.put("UrlConverter", urlConverter); + configuration.put("UrlEditor", urlEditor); + + return configuration; + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/callbacks/Callback.java b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/Callback.java new file mode 100644 index 0000000..5e5743a --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/Callback.java @@ -0,0 +1,32 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.callbacks; + +import com.onlyoffice.integration.dto.Track; +import org.springframework.beans.factory.annotation.Autowired; + +// specify the callback handler functions +public interface Callback { + int handle(Track body, String fileName); // handle the callback + int getStatus(); // get document status + @Autowired + default void selfRegistration(CallbackHandler callbackHandler) { // register a callback handler + callbackHandler.register(getStatus(), this); + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/callbacks/CallbackHandler.java b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/CallbackHandler.java new file mode 100644 index 0000000..3f643ce --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/CallbackHandler.java @@ -0,0 +1,50 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.callbacks; + +import com.onlyoffice.integration.dto.Track; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +@Service +public class CallbackHandler { + + private Logger logger = LoggerFactory.getLogger(CallbackHandler.class); + + private Map callbackHandlers = new HashMap<>(); + + public void register(final int code, final Callback callback) { // register a callback handler + callbackHandlers.put(code, callback); + } + + public int handle(final Track body, final String fileName) { // handle a callback + Callback callback = callbackHandlers.get(body.getStatus()); + if (callback == null) { + logger.warn("Callback status " + body.getStatus() + " is not supported yet"); + return 0; + } + + int result = callback.handle(body, fileName); + return result; + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/callbacks/Status.java b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/Status.java new file mode 100644 index 0000000..dfc27bb --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/Status.java @@ -0,0 +1,35 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.callbacks; + +// document status +public enum Status { + EDITING(1), // 1 - document is being edited + SAVE(2), // 2 - document is ready for saving + CORRUPTED(3), // 3 - document saving error has occurred + MUST_FORCE_SAVE(6), // 6 - document is being edited, but the current document state is saved + CORRUPTED_FORCE_SAVE(7); // 7 - error has occurred while force saving the document + private int code; + Status(final int codeParam) { + this.code = codeParam; + } + public int getCode() { // get document status + return this.code; + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/EditCallback.java b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/EditCallback.java new file mode 100644 index 0000000..4f482c7 --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/EditCallback.java @@ -0,0 +1,59 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.callbacks.implementations; + +import com.onlyoffice.integration.documentserver.callbacks.Callback; +import com.onlyoffice.integration.documentserver.callbacks.Status; +import com.onlyoffice.integration.documentserver.managers.callback.CallbackManager; +import com.onlyoffice.integration.dto.Action; +import com.onlyoffice.integration.dto.Track; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class EditCallback implements Callback { + @Autowired + private CallbackManager callbackManager; + @Override + public int handle(final Track body, + final String fileName) { // handle the callback when the document is being edited + int result = 0; + Action action = body.getActions().get(0); // get the user ID who is editing the document + if (action.getType().equals(com.onlyoffice.integration.documentserver.models.enums + .Action.edit)) { // if this value is not equal to the user ID + String user = action.getUserid(); // get user ID + if (!body.getUsers().contains(user)) { // if this user is not specified in the body + String key = body.getKey(); // get document key + try { + // create a command request to forcibly save the document being edited without closing it + callbackManager.commandRequest("forcesave", key, null); + } catch (Exception e) { + e.printStackTrace(); + result = 1; + } + } + } + return result; + } + + @Override + public int getStatus() { // get document status + return Status.EDITING.getCode(); // return status 1 - document is being edited + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/ForcesaveCallback.java b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/ForcesaveCallback.java new file mode 100644 index 0000000..0aa9c8e --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/ForcesaveCallback.java @@ -0,0 +1,50 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.callbacks.implementations; + +import com.onlyoffice.integration.documentserver.callbacks.Callback; +import com.onlyoffice.integration.documentserver.callbacks.Status; +import com.onlyoffice.integration.documentserver.managers.callback.CallbackManager; +import com.onlyoffice.integration.dto.Track; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class ForcesaveCallback implements Callback { + @Autowired + private CallbackManager callbackManager; + @Override + public int handle(final Track body, + final String fileName) { // handle the callback when the force saving request is performed + int result = 0; + try { + callbackManager.processForceSave(body, fileName); // file force saving process + } catch (Exception ex) { + ex.printStackTrace(); + result = 1; + } + return result; + } + + @Override + public int getStatus() { // get document status + // return status 6 - document is being edited, but the current document state is saved + return Status.MUST_FORCE_SAVE.getCode(); + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/SaveCallback.java b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/SaveCallback.java new file mode 100644 index 0000000..d679761 --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/callbacks/implementations/SaveCallback.java @@ -0,0 +1,50 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.callbacks.implementations; + +import com.onlyoffice.integration.documentserver.callbacks.Callback; +import com.onlyoffice.integration.documentserver.callbacks.Status; +import com.onlyoffice.integration.documentserver.managers.callback.CallbackManager; +import com.onlyoffice.integration.dto.Track; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class SaveCallback implements Callback { + @Autowired + private CallbackManager callbackManager; + @Override + public int handle(final Track body, + final String fileName) { // handle the callback when the saving request is performed + int result = 0; + try { + callbackManager.processSave(body, fileName); // file saving process + } catch (Exception ex) { + ex.printStackTrace(); + result = 1; + } + + return result; + } + + @Override + public int getStatus() { // get document status + return Status.SAVE.getCode(); // return status 2 - document is ready for saving + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/callback/CallbackManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/callback/CallbackManager.java new file mode 100644 index 0000000..e0d3c5d --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/callback/CallbackManager.java @@ -0,0 +1,28 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.callback; + +import com.onlyoffice.integration.dto.Track; +import java.util.HashMap; + +public interface CallbackManager { // specify the callback manager functions + void processSave(Track body, String fileName); // file saving process + void commandRequest(String method, String key, HashMap meta); // create a command request + void processForceSave(Track body, String fileName); // file force saving process +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/callback/DefaultCallbackManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/callback/DefaultCallbackManager.java new file mode 100644 index 0000000..d1edc0b --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/callback/DefaultCallbackManager.java @@ -0,0 +1,333 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.callback; + +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onlyoffice.integration.documentserver.managers.document.DocumentManager; +import com.onlyoffice.integration.documentserver.managers.jwt.JwtManager; +import com.onlyoffice.integration.documentserver.storage.FileStorageMutator; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import com.onlyoffice.integration.documentserver.util.file.FileUtility; +import com.onlyoffice.integration.dto.Action; +import com.onlyoffice.integration.documentserver.util.service.ServiceConverter; +import com.onlyoffice.integration.dto.Track; +import lombok.SneakyThrows; +import org.json.simple.JSONObject; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Primary; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Component; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URL; +import java.nio.charset.StandardCharsets; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import static com.onlyoffice.integration.documentserver.util.Constants.FILE_SAVE_TIMEOUT; + +// todo: Refactoring +@Component +@Primary +public class DefaultCallbackManager implements CallbackManager { + + @Value("${files.docservice.url.site}") + private String docserviceUrlSite; + @Value("${files.docservice.url.command}") + private String docserviceUrlCommand; + @Value("${files.docservice.header}") + private String documentJwtHeader; + + @Autowired + private DocumentManager documentManager; + @Autowired + private JwtManager jwtManager; + @Autowired + private FileUtility fileUtility; + @Autowired + private FileStorageMutator storageMutator; + @Autowired + private FileStoragePathBuilder storagePathBuilder; + @Autowired + private ObjectMapper objectMapper; + @Autowired + private ServiceConverter serviceConverter; + + // download file from url + @SneakyThrows + private byte[] getDownloadFile(final String url) { + if (url == null || url.isEmpty()) { + throw new RuntimeException("Url argument is not specified"); // URL isn't specified + } + + URL uri = new URL(url); + java.net.HttpURLConnection connection = (java.net.HttpURLConnection) uri.openConnection(); + connection.setConnectTimeout(FILE_SAVE_TIMEOUT); + InputStream stream = connection.getInputStream(); // get input stream of the file information from the URL + + int statusCode = connection.getResponseCode(); + if (statusCode != HttpStatus.OK.value()) { // checking status code + connection.disconnect(); + throw new RuntimeException("Document editing service returned status: " + statusCode); + } + + if (stream == null) { + connection.disconnect(); + throw new RuntimeException("Input stream is null"); + } + + return stream.readAllBytes(); + } + + // file saving + @SneakyThrows + private void saveFile(final byte[] byteArray, final Path path) { + if (path == null) { + throw new RuntimeException("Path argument is not specified"); // file isn't specified + } + // update a file or create a new one + storageMutator.createOrUpdateFile(path, new ByteArrayInputStream(byteArray)); + } + + @Override + @SneakyThrows + public void processSave(final Track body, final String fileName) { // file saving process + String downloadUri = body.getUrl(); + String changesUri = body.getChangesurl(); + String key = body.getKey(); + String newFileName = fileName; + + String curExt = fileUtility.getFileExtension(fileName); // get current file extension + String downloadExt = "." + body.getFiletype(); // get an extension of the downloaded file + + // todo: Refactoring + // convert downloaded file to the file with the current extension if these extensions aren't equal + if (!curExt.equals(downloadExt)) { + try { + String newFileUri = serviceConverter + .getConvertedData(downloadUri, downloadExt, curExt, + serviceConverter.generateRevisionId(downloadUri), null, false, + null).getUri(); // convert a file and get URL to a new file + if (newFileUri.isEmpty()) { + newFileName = documentManager + .getCorrectName(fileUtility.getFileNameWithoutExtension(fileName) + + downloadExt); // get the correct file name if it already exists + } else { + downloadUri = newFileUri; + } + } catch (Exception e) { + newFileName = documentManager + .getCorrectName(fileUtility.getFileNameWithoutExtension(fileName) + downloadExt); + } + } + + byte[] byteArrayFile = getDownloadFile(downloadUri); // download document file + + String storagePath = storagePathBuilder.getFileLocation(newFileName); // get the path to a new file + Path lastVersion = Paths.get(storagePathBuilder + .getFileLocation(fileName)); // get the path to the last file version + + if (lastVersion.toFile().exists()) { // if the last file version exists + Path histDir = Paths.get(storagePathBuilder.getHistoryDir(storagePath)); // get the history directory + storageMutator.createDirectory(histDir); // and create it + + String versionDir = documentManager + .versionDir(histDir.toAbsolutePath().toString(), // get the file version directory + storagePathBuilder + .getFileVersion(histDir.toAbsolutePath().toString(), false), true); + + Path ver = Paths.get(versionDir); + Path toSave = Paths.get(storagePath); + + storageMutator.createDirectory(ver); // create the file version directory + + lastVersion.toFile().renameTo(new File(versionDir + File.separator + "prev" + curExt)); + + saveFile(byteArrayFile, toSave); // save document file + + byte[] byteArrayChanges = getDownloadFile(changesUri); // download file changes + saveFile(byteArrayChanges, Path + .of(versionDir + File.separator + "diff.zip")); // save file changes to the diff.zip archive + + JSONObject jsonChanges = new JSONObject(); // create a json object for document changes + jsonChanges.put("changes", body.getHistory().getChanges()); // put the changes to the json object + jsonChanges.put("serverVersion", body.getHistory() + .getServerVersion()); // put the server version to the json object + String history = objectMapper.writeValueAsString(jsonChanges); + + if (history == null && body.getHistory() != null) { + history = objectMapper.writeValueAsString(body.getHistory()); + } + + if (history != null && !history.isEmpty()) { + // write the history changes to the changes.json file + storageMutator.writeToFile(versionDir + File.separator + "changes.json", history); + } + + // write the key value to the key.txt file + storageMutator.writeToFile(versionDir + File.separator + "key.txt", key); + + // get the path to the forcesaved file version and remove it + storageMutator.deleteFile(storagePathBuilder.getForcesavePath(newFileName, false)); + } + } + + // todo: Replace (String method) with (Enum method) + @SneakyThrows + public void commandRequest(final String method, + final String key, + final HashMap meta) { // create a command request + String documentCommandUrl = docserviceUrlSite + docserviceUrlCommand; + + URL url = new URL(documentCommandUrl); + java.net.HttpURLConnection connection = (java.net.HttpURLConnection) url.openConnection(); + + HashMap params = new HashMap(); + params.put("c", method); + params.put("key", key); + + if (meta != null) { + params.put("meta", meta); + } + + String headerToken; + // check if a secret key to generate token exists or not + if (jwtManager.tokenEnabled() && jwtManager.tokenUseForRequest()) { + Map payloadMap = new HashMap<>(); + payloadMap.put("payload", params); + headerToken = jwtManager.createToken(payloadMap); // encode a payload object into a header token + + // add a header Authorization with a header token and Authorization prefix in it + connection.setRequestProperty(documentJwtHeader.equals("") + ? "Authorization" : documentJwtHeader, "Bearer " + headerToken); + + String token = jwtManager.createToken(params); // encode a payload object into a body token + params.put("token", token); + } + + String bodyString = objectMapper.writeValueAsString(params); + + byte[] bodyByte = bodyString.getBytes(StandardCharsets.UTF_8); + + connection.setRequestMethod("POST"); // set the request method + connection + .setRequestProperty("Content-Type", "application/json; charset=UTF-8"); // set the Content-Type header + connection.setDoOutput(true); // set the doOutput field to true + connection.connect(); + + try (OutputStream os = connection.getOutputStream()) { + os.write(bodyByte); // write bytes to the output stream + } + + InputStream stream = connection.getInputStream(); // get input stream + + if (stream == null) { + throw new RuntimeException("Could not get an answer"); + } + + String jsonString = serviceConverter.convertStreamToString(stream); // convert stream to json string + connection.disconnect(); + + JSONObject response = serviceConverter.convertStringToJSON(jsonString); // convert json string to json object + // todo: Add errors ENUM + String responseCode = response.get("error").toString(); + switch (responseCode) { + case "0": + case "4": + break; + default: + throw new RuntimeException(response.toJSONString()); + } + } + + @SneakyThrows + public void processForceSave(final Track body, final String fileNameParam) { // file force saving process + + String downloadUri = body.getUrl(); + String fileName = fileNameParam; + + String curExt = fileUtility.getFileExtension(fileName); // get current file extension + String downloadExt = "." + body.getFiletype(); // get an extension of the downloaded file + + Boolean newFileName = false; + + // convert downloaded file to the file with the current extension if these extensions aren't equal + // todo: Extract function + if (!curExt.equals(downloadExt)) { + try { + // convert file and get URL to a new file + String newFileUri = serviceConverter + .getConvertedData(downloadUri, downloadExt, curExt, serviceConverter + .generateRevisionId(downloadUri), null, false, null).getUri(); + if (newFileUri.isEmpty()) { + newFileName = true; + } else { + downloadUri = newFileUri; + } + } catch (Exception e) { + newFileName = true; + } + } + + byte[] byteArrayFile = getDownloadFile(downloadUri); // download document file + String forcesavePath = ""; + + // todo: Use ENUMS + // todo: Pointless toString conversion + boolean isSubmitForm = body.getForcesavetype().toString().equals("3"); + + // todo: Extract function + if (isSubmitForm) { // if the form is submitted + if (newFileName) { + // get the correct file name if it already exists + fileName = documentManager + .getCorrectName(fileUtility + .getFileNameWithoutExtension(fileName) + "-form" + downloadExt); + } else { + fileName = documentManager + .getCorrectName(fileUtility.getFileNameWithoutExtension(fileName) + "-form" + curExt); + } + forcesavePath = storagePathBuilder.getFileLocation(fileName); // create forcesave path if it doesn't exist + List actions = body.getActions(); + Action action = actions.get(0); + String user = action.getUserid(); // get the user ID + // create meta data for the forcesaved file + storageMutator.createMeta(fileName, user, "Filling Form"); + } else { + if (newFileName) { + fileName = documentManager + .getCorrectName(fileUtility.getFileNameWithoutExtension(fileName) + downloadExt); + } + + forcesavePath = storagePathBuilder.getForcesavePath(fileName, false); + if (forcesavePath.isEmpty()) { + forcesavePath = storagePathBuilder.getForcesavePath(fileName, true); + } + } + + saveFile(byteArrayFile, Path.of(forcesavePath)); + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/document/DefaultDocumentManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/document/DefaultDocumentManager.java new file mode 100644 index 0000000..1baecb4 --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/document/DefaultDocumentManager.java @@ -0,0 +1,246 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.document; + +import com.onlyoffice.integration.documentserver.storage.FileStorageMutator; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import com.onlyoffice.integration.documentserver.util.file.FileUtility; +import com.onlyoffice.integration.documentserver.util.service.ServiceConverter; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Primary; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.net.InetAddress; +import java.net.URLEncoder; +import java.net.UnknownHostException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Date; +import java.util.LinkedHashMap; +import java.util.Map; + +import static com.onlyoffice.integration.documentserver.util.Constants.KILOBYTE_SIZE; + +@Component +@Primary +public class DefaultDocumentManager implements DocumentManager { + + @Value("${files.storage.folder}") + private String storageFolder; + @Value("${files.storage}") + private String filesStorage; + @Value("${url.track}") + private String trackUrl; + @Value("${url.download}") + private String downloadUrl; + + @Autowired + private FileStorageMutator storageMutator; + @Autowired + private FileStoragePathBuilder storagePathBuilder; + @Autowired + private FileUtility fileUtility; + @Autowired + private ServiceConverter serviceConverter; + + // get URL to the created file + public String getCreateUrl(final String fileName, final Boolean sample) { + String fileExt = fileUtility.getFileExtension(fileName).replace(".", ""); + String url = storagePathBuilder.getServerUrl(true) + + "/create?fileExt=" + fileExt + "&sample=" + sample; + return url; + } + + // get a file name with an index if the file with such a name already exists + public String getCorrectName(final String fileName) { + String baseName = fileUtility.getFileNameWithoutExtension(fileName); // get file name without extension + String ext = fileUtility.getFileExtension(fileName); // get file extension + String name = baseName + ext; // create a full file name + + Path path = Paths.get(storagePathBuilder.getFileLocation(name)); + + // run through all the files with such a name in the storage directory + for (int i = 1; Files.exists(path); i++) { + name = baseName + " (" + i + ")" + ext; // and add an index to the base name + path = Paths.get(storagePathBuilder.getFileLocation(name)); + } + + return name; + } + + // get file URL + public String getFileUri(final String fileName, final Boolean forDocumentServer) { + try { + String serverPath = storagePathBuilder.getServerUrl(forDocumentServer); // get server URL + String hostAddress = storagePathBuilder.getStorageLocation(); // get the storage directory + String filePathDownload = !fileName.contains(InetAddress.getLocalHost().getHostAddress()) ? fileName + : fileName.substring(fileName.indexOf(InetAddress.getLocalHost() + .getHostAddress()) + InetAddress.getLocalHost().getHostAddress().length() + 1); + if (!filesStorage.isEmpty() && filePathDownload.contains(filesStorage)) { + filePathDownload = filePathDownload.substring(filesStorage.length() + 1); + } + + String filePath = serverPath + "/download?fileName=" + URLEncoder + .encode(filePathDownload, java.nio.charset.StandardCharsets.UTF_8.toString()) + "&userAddress" + + URLEncoder.encode(hostAddress, java.nio.charset.StandardCharsets.UTF_8.toString()); + return filePath; + } catch (UnsupportedEncodingException | UnknownHostException e) { + return ""; + } + } + + // get file URL + public String getHistoryFileUrl(final String fileName, final Integer version, final String file, + final Boolean forDocumentServer) { + try { + String serverPath = storagePathBuilder.getServerUrl(forDocumentServer); // get server URL + String hostAddress = storagePathBuilder.getStorageLocation(); // get the storage directory + String filePathDownload = !fileName.contains(InetAddress.getLocalHost().getHostAddress()) ? fileName + : fileName.substring(fileName.indexOf(InetAddress.getLocalHost().getHostAddress()) + + InetAddress.getLocalHost().getHostAddress().length() + 1); + String userAddress = forDocumentServer ? "&userAddress" + URLEncoder + .encode(hostAddress, java.nio.charset.StandardCharsets.UTF_8.toString()) : ""; + String filePath = serverPath + "/downloadhistory?fileName=" + URLEncoder + .encode(filePathDownload, java.nio.charset.StandardCharsets.UTF_8.toString()) + + "&ver=" + version + "&file=" + file + + userAddress; + return filePath; + } catch (UnsupportedEncodingException | UnknownHostException e) { + return ""; + } + } + + // get the callback URL + public String getCallback(final String fileName) { + String serverPath = storagePathBuilder.getServerUrl(true); + String storageAddress = storagePathBuilder.getStorageLocation(); + try { + String query = trackUrl + "?fileName=" + + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()) + + "&userAddress=" + URLEncoder + .encode(storageAddress, java.nio.charset.StandardCharsets.UTF_8.toString()); + return serverPath + query; + } catch (UnsupportedEncodingException e) { + return ""; + } + } + + // get URL to download a file + public String getDownloadUrl(final String fileName, final Boolean isServer) { + String serverPath = storagePathBuilder.getServerUrl(isServer); + String storageAddress = storagePathBuilder.getStorageLocation(); + try { + String userAddress = isServer ? "&userAddress=" + URLEncoder + .encode(storageAddress, java.nio.charset.StandardCharsets.UTF_8.toString()) : ""; + String query = downloadUrl + "?fileName=" + + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()) + + userAddress; + + return serverPath + query; + } catch (UnsupportedEncodingException e) { + return ""; + } + } + + // get file information + public ArrayList> getFilesInfo() { + ArrayList> files = new ArrayList<>(); + + // run through all the stored files + for (File file : storageMutator.getStoredFiles()) { + Map map = new LinkedHashMap<>(); // write all the parameters to the map + map.put("version", storagePathBuilder.getFileVersion(file.getName(), false)); + map.put("id", serviceConverter + .generateRevisionId(storagePathBuilder.getStorageLocation() + + "/" + file.getName() + "/" + + Paths.get(storagePathBuilder.getFileLocation(file.getName())) + .toFile() + .lastModified())); + map.put("contentLength", new BigDecimal(String.valueOf((file.length() / Double.valueOf(KILOBYTE_SIZE)))) + .setScale(2, RoundingMode.HALF_UP) + " KB"); + map.put("pureContentLength", file.length()); + map.put("title", file.getName()); + map.put("updated", String.valueOf(new Date(file.lastModified()))); + files.add(map); + } + + return files; + } + + // get file information by its ID + public ArrayList> getFilesInfo(final String fileId) { + ArrayList> file = new ArrayList<>(); + + for (Map map : getFilesInfo()) { + if (map.get("id").equals(fileId)) { + file.add(map); + break; + } + } + + return file; + } + + // get the path to the file version by the history path and file version + public String versionDir(final String path, final Integer version, final boolean historyPath) { + if (!historyPath) { + return storagePathBuilder.getHistoryDir(storagePathBuilder.getFileLocation(path)) + version; + } + return path + File.separator + version; + } + + // create demo document + public String createDemo(final String fileExt, final Boolean sample, final String uid, final String uname) { + String demoName = (sample ? "sample." : "new.") + + fileExt; // create sample or new template file with the necessary extension + String demoPath = + "assets" + + File.separator + + "document-templates" + + File.separator + + (sample ? "sample" : "new") + + File.separator + + demoName; + + // get a file name with an index if the file with such a name already exists + String fileName = getCorrectName(demoName); + + InputStream stream = Thread.currentThread() + .getContextClassLoader() + .getResourceAsStream(demoPath); // get the input file stream + + if (stream == null) { + return null; + } + + storageMutator.createFile(Path.of(storagePathBuilder + .getFileLocation(fileName)), stream); // create a file in the specified directory + storageMutator.createMeta(fileName, uid, uname); // create meta information of the demo file + + return fileName; + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/document/DocumentManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/document/DocumentManager.java new file mode 100644 index 0000000..6b8eb25 --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/document/DocumentManager.java @@ -0,0 +1,42 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.document; + +import java.util.ArrayList; +import java.util.Map; + +// specify the document manager functions +public interface DocumentManager { + + // get a file name with an index if the file with such a name already exists + String getCorrectName(String fileName); + String getFileUri(String fileName, Boolean forDocumentServer); // get file URL + String getHistoryFileUrl(String fileName, Integer version, String file, Boolean forDocumentServer); // get file URL + String getCallback(String fileName); // get the callback URL + String getDownloadUrl(String fileName, Boolean forDocumentServer); // get URL to download a file + ArrayList> getFilesInfo(); // get file information + ArrayList> getFilesInfo(String fileId); // get file information by its ID + + // get the path to the file version by the history path and file version + String versionDir(String path, Integer version, boolean historyPath); + + // create demo document + String createDemo(String fileExt, Boolean sample, String uid, String uname) throws Exception; + String getCreateUrl(String fileName, Boolean sample); // get URL to the created file +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/history/DefaultHistoryManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/history/DefaultHistoryManager.java new file mode 100644 index 0000000..2511246 --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/history/DefaultHistoryManager.java @@ -0,0 +1,183 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.history; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.onlyoffice.integration.documentserver.managers.document.DocumentManager; +import com.onlyoffice.integration.documentserver.managers.jwt.JwtManager; +import com.onlyoffice.integration.documentserver.models.filemodel.Document; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import com.onlyoffice.integration.documentserver.util.file.FileUtility; +import lombok.SneakyThrows; +import org.json.simple.JSONArray; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.io.File; +import java.io.FileInputStream; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Scanner; + +// todo: Rebuild completely +@Component +public class DefaultHistoryManager implements HistoryManager { + + @Autowired + private FileStoragePathBuilder storagePathBuilder; + + @Autowired + private DocumentManager documentManager; + + @Autowired + private JwtManager jwtManager; + + @Autowired + private FileUtility fileUtility; + + @Autowired + private JSONParser parser; + + @Autowired + private ObjectMapper objectMapper; + + // todo: Refactoring + @SneakyThrows + public String[] getHistory(final Document document) { // get document history + + // get history directory + String histDir = storagePathBuilder.getHistoryDir(storagePathBuilder.getFileLocation(document.getTitle())); + Integer curVer = storagePathBuilder.getFileVersion(histDir, false); // get current file version + + if (curVer > 0) { // check if the current file version is greater than 0 + List hist = new ArrayList<>(); + Map histData = new HashMap<>(); + + for (Integer i = 1; i <= curVer; i++) { // run through all the file versions + Map obj = new HashMap(); + Map dataObj = new HashMap(); + String verDir = documentManager + .versionDir(histDir, i, true); // get the path to the given file version + + String key = i == curVer ? document.getKey() : readFileToEnd(new File(verDir + + File.separator + "key.txt")); // get document key + obj.put("key", key); + obj.put("version", i); + + if (i == 1) { // check if the version number is equal to 1 + String createdInfo = readFileToEnd(new File(histDir + + File.separator + "createdInfo.json")); // get file with meta data + JSONObject json = (JSONObject) parser.parse(createdInfo); // and turn it into json object + + // write meta information to the object (user information and creation date) + obj.put("created", json.get("created")); + Map user = new HashMap(); + user.put("id", json.get("id")); + user.put("name", json.get("name")); + obj.put("user", user); + } + + dataObj.put("fileType", fileUtility + .getFileExtension(document.getTitle()).replace(".", "")); + dataObj.put("key", key); + dataObj.put("url", i == curVer ? document.getUrl() + : documentManager.getHistoryFileUrl(document.getTitle(), i, "prev" + fileUtility + .getFileExtension(document.getTitle()), true)); + if (!document.getDirectUrl().equals("")) { + dataObj.put("directUrl", i == curVer ? document.getDirectUrl() + : documentManager.getHistoryFileUrl(document.getTitle(), i, "prev" + fileUtility + .getFileExtension(document.getTitle()), false)); + } + dataObj.put("version", i); + + if (i > 1) { //check if the version number is greater than 1 + // if so, get the path to the changes.json file + JSONObject changes = (JSONObject) parser.parse(readFileToEnd(new File(documentManager + .versionDir(histDir, i - 1, true) + File.separator + "changes.json"))); + JSONObject change = (JSONObject) ((JSONArray) changes.get("changes")).get(0); + + // write information about changes to the object + obj.put("changes", changes.get("changes")); + obj.put("serverVersion", changes.get("serverVersion")); + obj.put("created", change.get("created")); + obj.put("user", change.get("user")); + + // get the history data from the previous file version + Map prev = (Map) histData.get(Integer.toString(i - 2)); + Map prevInfo = new HashMap(); + prevInfo.put("fileType", prev.get("fileType")); + prevInfo.put("key", prev.get("key")); // write key and URL information about previous file version + prevInfo.put("url", prev.get("url")); + if (!document.getDirectUrl().equals("")) { + prevInfo.put("directUrl", prev.get("directUrl")); + } + + // write information about previous file version to the data object + dataObj.put("previous", prevInfo); + // write the path to the diff.zip archive with differences in this file version + Integer verdiff = i - 1; + dataObj.put("changesUrl", documentManager + .getHistoryFileUrl(document.getTitle(), verdiff, "diff.zip", true)); + } + + if (jwtManager.tokenEnabled()) { + dataObj.put("token", jwtManager.createToken(dataObj)); + } + + hist.add(obj); + histData.put(Integer.toString(i - 1), dataObj); + } + + // write history information about the current file version to the history object + Map histObj = new HashMap(); + histObj.put("currentVersion", curVer); + histObj.put("history", hist); + + try { + return new String[]{objectMapper.writeValueAsString(histObj), + objectMapper.writeValueAsString(histData)}; + } catch (JsonProcessingException e) { + e.printStackTrace(); + } + } + return new String[]{"", ""}; + } + + // read a file + private String readFileToEnd(final File file) { + String output = ""; + try { + try (FileInputStream is = new FileInputStream(file)) { + Scanner scanner = new Scanner(is); // read data from the source + scanner.useDelimiter("\\A"); + while (scanner.hasNext()) { + output += scanner.next(); + } + scanner.close(); + } + } catch (Exception e) { + } + return output; + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/history/HistoryManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/history/HistoryManager.java new file mode 100644 index 0000000..2be05ff --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/history/HistoryManager.java @@ -0,0 +1,26 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.history; + +import com.onlyoffice.integration.documentserver.models.filemodel.Document; + +// specify the history manager functions +public interface HistoryManager { + String[] getHistory(Document document); // get document history +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/jwt/DefaultJwtManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/jwt/DefaultJwtManager.java new file mode 100644 index 0000000..a7161d7 --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/jwt/DefaultJwtManager.java @@ -0,0 +1,135 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.jwt; + +import com.fasterxml.jackson.databind.ObjectMapper; +import org.json.simple.JSONObject; +import org.json.simple.parser.JSONParser; +import org.primeframework.jwt.Signer; +import org.primeframework.jwt.Verifier; +import org.primeframework.jwt.domain.JWT; +import org.primeframework.jwt.hmac.HMACSigner; +import org.primeframework.jwt.hmac.HMACVerifier; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.util.LinkedHashMap; +import java.util.Map; + +@Component +public class DefaultJwtManager implements JwtManager { + @Value("${files.docservice.secret}") + private String tokenSecret; + @Value("${files.docservice.token-use-for-request}") + private String tokenUseForRequest; + @Autowired + private ObjectMapper objectMapper; + @Autowired + private JSONParser parser; + + // create document token + @Override + public String createToken(final Map payloadClaims) { + try { + // build a HMAC signer using a SHA-256 hash + Signer signer = HMACSigner.newSHA256Signer(tokenSecret); + JWT jwt = new JWT(); + for (String key : payloadClaims.keySet()) { // run through all the keys from the payload + jwt.addClaim(key, payloadClaims.get(key)); // and write each claim to the jwt + } + return JWT.getEncoder().encode(jwt, signer); // sign and encode the JWT to a JSON string representation + } catch (Exception e) { + return ""; + } + } + + // check if the token is enabled + @Override + public boolean tokenEnabled() { + return tokenSecret != null && !tokenSecret.isEmpty(); + } + + @Override + public boolean tokenUseForRequest() { + return Boolean.parseBoolean(tokenUseForRequest) && !tokenUseForRequest.isEmpty(); + } + + // read document token + @Override + public JWT readToken(final String token) { + try { + // build a HMAC verifier using the token secret + Verifier verifier = HMACVerifier.newVerifier(tokenSecret); + + // verify and decode the encoded string JWT to a rich object + return JWT.getDecoder().decode(token, verifier); + } catch (Exception exception) { + return null; + } + } + + // parse the body + @Override + public JSONObject parseBody(final String payload, final String header) { + JSONObject body; + try { + Object obj = parser.parse(payload); // get body parameters by parsing the payload + body = (JSONObject) obj; + } catch (Exception ex) { + throw new RuntimeException("{\"error\":1,\"message\":\"JSON Parsing error\"}"); + } + if (tokenEnabled() && tokenUseForRequest()) { // check if the token is enabled + String token = (String) body.get("token"); // get token from the body + if (token == null) { // if token is empty + if (header != null && header.trim()!="") { // and the header is defined + + // get token from the header (it is placed after the Bearer prefix if it exists) + token = header.startsWith("Bearer ") ? header.substring("Bearer ".length()) : header; + } + } + if (token == null || token.trim()=="") { + throw new RuntimeException("{\"error\":1,\"message\":\"JWT expected\"}"); + } + + JWT jwt = readToken(token); // read token + if (jwt == null) { + throw new RuntimeException("{\"error\":1,\"message\":\"JWT validation failed\"}"); + } + if (jwt.getObject("payload") != null) { // get payload from the token and check if it is not empty + try { + @SuppressWarnings("unchecked") LinkedHashMap jwtPayload = + (LinkedHashMap) jwt.getObject("payload"); + + jwt.claims = jwtPayload; + } catch (Exception ex) { + throw new RuntimeException("{\"error\":1,\"message\":\"Wrong payload\"}"); + } + } + try { + Object obj = parser.parse(objectMapper.writeValueAsString(jwt.claims)); + body = (JSONObject) obj; + } catch (Exception ex) { + throw new RuntimeException("{\"error\":1,\"message\":\"Parsing error\"}"); + } + } + + return body; + } +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/jwt/JwtManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/jwt/JwtManager.java new file mode 100644 index 0000000..78b100d --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/jwt/JwtManager.java @@ -0,0 +1,33 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.jwt; + +import org.json.simple.JSONObject; +import org.primeframework.jwt.domain.JWT; + +import java.util.Map; + +// specify the jwt manager functions +public interface JwtManager { + boolean tokenEnabled(); // check if the token is enabled + boolean tokenUseForRequest(); // check if the token is enabled + String createToken(Map payloadClaims); // create document token + JWT readToken(String token); // read document token + JSONObject parseBody(String payload, String header); // parse the body +} diff --git a/src/main/java/com/onlyoffice/integration/documentserver/managers/template/SampleTemplateManager.java b/src/main/java/com/onlyoffice/integration/documentserver/managers/template/SampleTemplateManager.java new file mode 100644 index 0000000..aaff9cb --- /dev/null +++ b/src/main/java/com/onlyoffice/integration/documentserver/managers/template/SampleTemplateManager.java @@ -0,0 +1,70 @@ +/** + * + * (c) Copyright Ascensio System SIA 2023 + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +package com.onlyoffice.integration.documentserver.managers.template; + +import com.onlyoffice.integration.documentserver.models.enums.DocumentType; +import com.onlyoffice.integration.documentserver.models.filemodel.Template; +import com.onlyoffice.integration.documentserver.managers.document.DocumentManager; +import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder; +import com.onlyoffice.integration.documentserver.util.file.FileUtility; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.stereotype.Component; + +import java.util.List; + +@Component +@Qualifier("sample") +public class SampleTemplateManager implements TemplateManager { + @Autowired + private DocumentManager documentManager; + + @Autowired + private FileStoragePathBuilder storagePathBuilder; + + @Autowired + private FileUtility fileUtility; + + // create a template document with the specified name + public List