From 06e2167da12af5a2713deb4ea0f63eb4b78cc0c7 Mon Sep 17 00:00:00 2001 From: "support.ontimize" Date: Wed, 25 Aug 2021 10:49:15 +0200 Subject: [PATCH 1/7] New develop version: 3.2.0-SNAPSHOT --- ontimize-jee-dms-common/pom.xml | 2 +- ontimize-jee-dms-rest/pom.xml | 2 +- ontimize-jee-dms-server/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ontimize-jee-dms-common/pom.xml b/ontimize-jee-dms-common/pom.xml index d50b58d..a49128b 100644 --- a/ontimize-jee-dms-common/pom.xml +++ b/ontimize-jee-dms-common/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms - 3.1.0 + 3.2.0-SNAPSHOT ontimize-jee-dms-common diff --git a/ontimize-jee-dms-rest/pom.xml b/ontimize-jee-dms-rest/pom.xml index c0b4e02..58bfdf5 100644 --- a/ontimize-jee-dms-rest/pom.xml +++ b/ontimize-jee-dms-rest/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms - 3.1.0 + 3.2.0-SNAPSHOT ontimize-jee-dms-rest diff --git a/ontimize-jee-dms-server/pom.xml b/ontimize-jee-dms-server/pom.xml index f7b71f0..2daaa10 100644 --- a/ontimize-jee-dms-server/pom.xml +++ b/ontimize-jee-dms-server/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms - 3.1.0 + 3.2.0-SNAPSHOT ontimize-jee-dms-server diff --git a/pom.xml b/pom.xml index 914dd6f..54b4749 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms pom - 3.1.0 + 3.2.0-SNAPSHOT com.ontimize.jee ontimize-jee From 8c7186ffb29ceb0dfa32b76b324d57ef0ed54421 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Wed, 25 Aug 2021 11:03:22 +0200 Subject: [PATCH 2/7] Updated developers (same contributors that exist in github) --- ontimize-jee-dms-common/pom.xml | 12 ------------ ontimize-jee-dms-rest/pom.xml | 12 ------------ ontimize-jee-dms-server/pom.xml | 12 ------------ pom.xml | 12 ------------ 4 files changed, 48 deletions(-) diff --git a/ontimize-jee-dms-common/pom.xml b/ontimize-jee-dms-common/pom.xml index a49128b..763186e 100644 --- a/ontimize-jee-dms-common/pom.xml +++ b/ontimize-jee-dms-common/pom.xml @@ -18,24 +18,12 @@ Ontimize EE DMS (Common module) https://www.ontimize.com - - Daniel Graña Cousido - daniel.grana@imatia.com - Imatia Innovation - http://imatia.com - Enrique Álvarez Pereira enrique.alvarez@imatia.com Imatia Innovation http://imatia.com - - Faustino Lage Rego - faustino.lage@imatia.com - Imatia Innovation - http://imatia.com - Gonzalo Martínez Fernández gonzalo.martinez@imatia.com diff --git a/ontimize-jee-dms-rest/pom.xml b/ontimize-jee-dms-rest/pom.xml index 58bfdf5..41db125 100644 --- a/ontimize-jee-dms-rest/pom.xml +++ b/ontimize-jee-dms-rest/pom.xml @@ -18,24 +18,12 @@ Ontimize EE DMS (REST module) https://www.ontimize.com - - Daniel Graña Cousido - daniel.grana@imatia.com - Imatia Innovation - http://imatia.com - Enrique Álvarez Pereira enrique.alvarez@imatia.com Imatia Innovation http://imatia.com - - Faustino Lage Rego - faustino.lage@imatia.com - Imatia Innovation - http://imatia.com - Gonzalo Martínez Fernández gonzalo.martinez@imatia.com diff --git a/ontimize-jee-dms-server/pom.xml b/ontimize-jee-dms-server/pom.xml index 2daaa10..cbc667b 100644 --- a/ontimize-jee-dms-server/pom.xml +++ b/ontimize-jee-dms-server/pom.xml @@ -18,24 +18,12 @@ Ontimize EE DMS (Server module) https://www.ontimize.com - - Daniel Graña Cousido - daniel.grana@imatia.com - Imatia Innovation - http://imatia.com - Enrique Álvarez Pereira enrique.alvarez@imatia.com Imatia Innovation http://imatia.com - - Faustino Lage Rego - faustino.lage@imatia.com - Imatia Innovation - http://imatia.com - Gonzalo Martínez Fernández gonzalo.martinez@imatia.com diff --git a/pom.xml b/pom.xml index 54b4749..fa9ed01 100644 --- a/pom.xml +++ b/pom.xml @@ -21,24 +21,12 @@ Ontimize EE DMS is a system that allows you to store files and keep track of the versions of those files. https://www.ontimize.com - - Daniel Graña Cousido - daniel.grana@imatia.com - Imatia Innovation - http://imatia.com - Enrique Álvarez Pereira enrique.alvarez@imatia.com Imatia Innovation http://imatia.com - - Faustino Lage Rego - faustino.lage@imatia.com - Imatia Innovation - http://imatia.com - Gonzalo Martínez Fernández gonzalo.martinez@imatia.com From b4a280a4e9f03998b60d448bb1351eb68efb2169 Mon Sep 17 00:00:00 2001 From: Enrique Alvarez Pereira Date: Wed, 12 Jan 2022 11:41:19 +0100 Subject: [PATCH 3/7] Modified gpg sign plugin version, added gitaction and removed desktopclient module --- .../workflows/deploy-mvn-central-snapshot.yml | 27 +++++ ontimize-jee-dms-desktopclient/pom.xml | 86 -------------- .../ontimize-dms-i18n/bundle_en_US.properties | 112 ------------------ pom.xml | 2 +- 4 files changed, 28 insertions(+), 199 deletions(-) create mode 100644 .github/workflows/deploy-mvn-central-snapshot.yml delete mode 100644 ontimize-jee-dms-desktopclient/pom.xml delete mode 100644 ontimize-jee-dms-desktopclient/src/main/resources/ontimize-dms-i18n/bundle_en_US.properties diff --git a/.github/workflows/deploy-mvn-central-snapshot.yml b/.github/workflows/deploy-mvn-central-snapshot.yml new file mode 100644 index 0000000..f61c58b --- /dev/null +++ b/.github/workflows/deploy-mvn-central-snapshot.yml @@ -0,0 +1,27 @@ +name: Generate a version in MVNCentral +on: + push: + branches: + - 'develop' +jobs: + Generate-a-snapshot-in-MVNCentral: + runs-on: ubuntu-latest + steps: + - name : Checkout repository code + uses: actions/checkout@v2 + - name: Setup Java JDK and Maven + uses: ontimize/setup-java-maven-gitAction@v2.4.2 + with: + distribution: 'temurin' + java-version: '11' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Publish to Apache Maven Central + run: mvn -U clean deploy -Pgenerate-version + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} diff --git a/ontimize-jee-dms-desktopclient/pom.xml b/ontimize-jee-dms-desktopclient/pom.xml deleted file mode 100644 index 90a1253..0000000 --- a/ontimize-jee-dms-desktopclient/pom.xml +++ /dev/null @@ -1,86 +0,0 @@ - - 4.0.0 - - com.ontimize.jee.dms - ontimize-jee-dms - 2.1.3-SNAPSHOT - - - ontimize-jee-dms-desktopclient - - - 3.0.9-SNAPSHOT - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - - - - - - - com.ontimize.jee - ontimize-jee-desktopclient - - - - ${project.groupId} - ontimize-jee-dms-common - - - - - com.google.api-client - google-api-client - 1.18.0-rc - - - commons-logging - commons-logging - - - - - com.google.api-client - google-api-client-gson - 1.18.0-rc - - - com.google.api-client - google-api-client-jackson2 - 1.18.0-rc - - - com.google.apis - google-api-services-drive - v2-rev135-1.18.0-rc - - - com.google.apis - google-api-services-oauth2 - v2-rev74-1.18.0-rc - - - - com.dropbox.core - dropbox-core-sdk - 1.7.7 - - - com.fasterxml.jackson.core - jackson-core - - - - - \ No newline at end of file diff --git a/ontimize-jee-dms-desktopclient/src/main/resources/ontimize-dms-i18n/bundle_en_US.properties b/ontimize-jee-dms-desktopclient/src/main/resources/ontimize-dms-i18n/bundle_en_US.properties deleted file mode 100644 index d7adc2a..0000000 --- a/ontimize-jee-dms-desktopclient/src/main/resources/ontimize-dms-i18n/bundle_en_US.properties +++ /dev/null @@ -1,112 +0,0 @@ - -CATEGORY_NAME = Category - -DOC_DESCRIPTION = Description - -DOC_KEYWORDS = Keywords - -DOC_NAME = Name - -DOC_PROPERTY_KEY = Property - -DOC_PROPERTY_VALUE = Value - -FILE_ADDED_DATE = Creation date - -FILE_ADDED_USER_ID = User - -FILE_DESCRIPTION = Description - -FILE_NAME = Name - -FILE_PATH = Path - -FILE_SIZE = Size - -IS_ACTIVE = Active - -THUMBNAIL = Thumbnail - -VERSION = Version - -dms.ADD_URL = Add URL -dms.CANCEL = Cancel -dms.COME_BACK = Back -dms.DISK_FILE = Disf file -dms.DOCUMENT_ID_MANDATORY = The document identifier is required -dms.DOWNLOAD_MANAGER_TIP = Show transfer manager -dms.DOWNLOAD_MANAGER_TITLE = Transfer manager -dms.DROP_BOX = Drop Box -dms.EXIT = Close -dms.E_ACTIVE_VERSION_NOT_FOUND = Active version not found. -dms.E_CATEGORY_ID_MANDATORY = The category identifier is required. -dms.E_CATEGORY_NAME_MANDATORY = The category name is required. -dms.E_CREATING_FILE_VERSION = Error creating file version. -dms.E_DOCUMENT_NOT_FOUND = Document not found. -dms.E_ERROR_CREATING_FILE = Unexpected error creating file. -dms.E_FILE_ALREADY_EXISTS = The file already exists. -dms.E_FILE_ID_IS_MANDATORY = The file id is required. -dms.E_FILE_NAME_MANDATORY = The file name is required. -dms.E_FILE_NOT_FOUND = File not found. -dms.E_FILE_VERSION_ID_IS_MANDATORY = The version id is required. -dms.E_FILE_VERSION_NOT_FOUND = File version not found. -dms.E_INPUTSTREAM_IS_MANDATORY = The file is required. -dms.E_NO_DATA_TO_UPDATE = No data to update. -dms.E_NO_FILE_SEQUENCE = No file sequence. -dms.E_NO_FILE_VERSION = No file version. -dms.E_PROPERTY_KEY_MANDATORY = The property key is required. -dms.E_VERSION_ALREADY_EXISTS = This version already exists. -dms.FILENAME = Name -dms.GOOGLE_DRIVE = Google Drive -dms.HOSTING_SERVICE_FILE = Hosting service -dms.PAUSE = Pause -dms.PROGRESS = Progress -dms.REMOVE = Remove -dms.RESUME = Resume -dms.SCANNER_OR_CAMERA_FILE = Scanner or camera -dms.SIZE = size -dms.SYNC_STATUS = Status -dms.URL = URL -dms.URL_DESCRIPTION = Description -dms.WEB_FILE = Web file http/ftp -dms.addMultipleFiles = Add file -dms.all_files = All files -dms.cancel = Cancelar -dms.categorynameinput = Add a category name -dms.deleteCategory = Delete category -dms.descriptioninput = Add a file description -dms.e_invalidurl = Invalid url -dms.fileNameInput = Add a file name -dms.formDriveLoginService = Get files from google drive -dms.formDropboxLoginService = Get files from Dropbox -dms.formMultipleFiles = Attach file -dms.gfile_datemodification = Modification date -dms.gfile_description = Description -dms.gfile_name = Name -dms.gfile_size = Size -dms.gfile_usermodification = User modification -dms.isnewversionquestion = There is a file with the same name, \u00BFis it a new version? -dms.newCategory = New category -dms.open_file = Select -dms.questiondeletecategory = If You delete the category will apear in "Uncategorized" and the child categories will go to the root, \u00BFcontinue? -dms.questiondeletecategorytitle = Delete category -dms.scanner_acquisition = Add from scanner or camera -dms.transfermanager = Transfer manager -dms.uncategorized = Uncategorized - -task.DOWNLOAD_MANAGER_TITLE = Download manager -task.NAME = Name -task.DESC = Size -task.PROGRESS = Progress -task.PAUSE = Pause -task.RESUME = Resume -task.CANCEL = Cancel -task.CLEAN = Clean -task.CLEAN_ALL = Clean all -task.HIDE = Hide -task.TIP_PAUSE = Pause the download. -task.TIP_RESUME = Resume the download. -task.TIP_CANCEL = Cancel the download. -task.TIP_CLEAN = Clean the download. -task.TIP_CLEAN_ALL = Clean the download manager. -task.TIP_HIDE = Hide the download manager. diff --git a/pom.xml b/pom.xml index fa9ed01..8808d62 100644 --- a/pom.xml +++ b/pom.xml @@ -149,7 +149,7 @@ org.apache.maven.plugins maven-gpg-plugin - 1.5 + 3.0.1 sign-artifacts From 15f313b99d68b6c41e043bae435e45f98c454712 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Tue, 16 May 2023 14:22:54 +0200 Subject: [PATCH 4/7] Update ontimize/setup-java-maven-gitAction to v3 version --- .github/workflows/deploy-mvn-central-snapshot.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy-mvn-central-snapshot.yml b/.github/workflows/deploy-mvn-central-snapshot.yml index f61c58b..32bf3d1 100644 --- a/.github/workflows/deploy-mvn-central-snapshot.yml +++ b/.github/workflows/deploy-mvn-central-snapshot.yml @@ -8,9 +8,9 @@ jobs: runs-on: ubuntu-latest steps: - name : Checkout repository code - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Setup Java JDK and Maven - uses: ontimize/setup-java-maven-gitAction@v2.4.2 + uses: ontimize/setup-java-maven-gitAction@v3 with: distribution: 'temurin' java-version: '11' From a8ace3c3d2b5520d60351a478718671c315bc870 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pablo=20Mart=C3=ADnez=20Kirsten?= Date: Thu, 30 May 2024 17:12:29 +0200 Subject: [PATCH 5/7] Allows the use of the nameConvention used in the application to manage the DMS columns. --- .gitignore | 1 + .../server/dms/rest/DMSRestController.java | 5 +- .../server/dms/rest/IDMSNameConverter.java | 3 + .../dms/AbstractDMSServiceHelper.java | 6 +- .../server/services/dms/DMSColumnHelper.java | 69 ++++++++++--------- .../dms/DMSServiceCategoryHelper.java | 14 ++-- .../dms/DMSServiceDocumentHelper.java | 24 +++---- .../services/dms/DMSServiceFileHelper.java | 52 +++++++------- 8 files changed, 90 insertions(+), 84 deletions(-) diff --git a/.gitignore b/.gitignore index 29e72f3..55f7b96 100644 --- a/.gitignore +++ b/.gitignore @@ -205,3 +205,4 @@ fabric.properties hs_err_pid* # End of https://www.toptal.com/developers/gitignore/api/java,eclipse,intellij +.idea/ diff --git a/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/DMSRestController.java b/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/DMSRestController.java index bde8c96..c160de5 100644 --- a/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/DMSRestController.java +++ b/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/DMSRestController.java @@ -16,6 +16,7 @@ import javax.servlet.http.HttpServletResponse; +import com.ontimize.jee.server.dao.common.INameConvention; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -295,10 +296,10 @@ public ResponseEntity fileUpdate(@RequestBody UpdateFileParameter updateFi Map av = new HashMap<>(); if (data.containsKey("name")) { if (file.isDirectory()) { - av.put(DMSNaming.CATEGORY_CATEGORY_NAME, data.get("name")); + av.put(this.dmsNameConverter.getNameConvention().convertName(DMSNaming.CATEGORY_CATEGORY_NAME), data.get("name")); this.getService().categoryUpdate(file.getId(), av); } else { - av.put(DMSNaming.DOCUMENT_FILE_NAME, data.get("name")); + av.put(this.dmsNameConverter.getNameConvention().convertName(DMSNaming.DOCUMENT_FILE_NAME), data.get("name")); this.getService().fileUpdate(file.getId(), av, this.getService().fileGetContent(file.getId())); } return new ResponseEntity<>(HttpStatus.OK); diff --git a/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/IDMSNameConverter.java b/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/IDMSNameConverter.java index 197e571..bf38a8b 100644 --- a/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/IDMSNameConverter.java +++ b/ontimize-jee-dms-rest/src/main/java/com/ontimize/jee/server/dms/rest/IDMSNameConverter.java @@ -3,6 +3,7 @@ import java.util.List; import java.util.Map; +import com.ontimize.jee.server.dao.common.INameConvention; import com.ontimize.jee.server.dms.model.OFile; public interface IDMSNameConverter { @@ -23,4 +24,6 @@ public interface IDMSNameConverter { public List getCategoryColumns(List columns); + public INameConvention getNameConvention(); + } diff --git a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/AbstractDMSServiceHelper.java b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/AbstractDMSServiceHelper.java index a2248e2..7bea606 100644 --- a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/AbstractDMSServiceHelper.java +++ b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/AbstractDMSServiceHelper.java @@ -7,6 +7,7 @@ * Abstract class implemented bu DMS helpers (docFelper, fileHelper, versionHelper). This ensure to * set a default configuration to columnHelper, that manages all relative about columns naming. */ + public abstract class AbstractDMSServiceHelper implements InitializingBean { @Autowired(required = false) @@ -14,12 +15,9 @@ public abstract class AbstractDMSServiceHelper implements InitializingBean { @Override public void afterPropertiesSet() throws Exception { - if (this.columnHelper == null) { - this.columnHelper = new DMSColumnHelper(); - } } - protected DMSColumnHelper getColumnHelper() { + public DMSColumnHelper getColumnHelper() { return this.columnHelper; } diff --git a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSColumnHelper.java b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSColumnHelper.java index c51bdb4..9b6ba0e 100644 --- a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSColumnHelper.java +++ b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSColumnHelper.java @@ -14,6 +14,8 @@ import com.ontimize.jee.common.tools.EntityResultTools; import com.ontimize.jee.common.tools.MapTools; import com.ontimize.jee.common.tools.ObjectTools; +import com.ontimize.jee.server.dao.common.INameConvention; + /** * This class will manage all behaviour around DMS columns naming.
@@ -24,63 +26,68 @@ * Moreove this allows to have column extensions, indicating extends columns for each dao (document, * file, version, ....) */ -public class DMSColumnHelper { +public class DMSColumnHelper{ private Map columnsMapping; - public DMSColumnHelper() { - this.initColumnsMapping(); + private INameConvention nameConvention; + + public DMSColumnHelper(INameConvention nameConvention) { + this.nameConvention = nameConvention; + initColumnsMapping(); } + protected void initColumnsMapping() { + if (this.columnsMapping == null) { this.columnsMapping = new HashMap<>(); } - this.addColumnMapping(DMSNaming.DOCUMENT_ID_DMS_DOCUMENT, DMSNaming.DOCUMENT_ID_DMS_DOCUMENT); - this.addColumnMapping(DMSNaming.DOCUMENT_UPDATE_DATE, DMSNaming.DOCUMENT_UPDATE_DATE); - this.addColumnMapping(DMSNaming.DOCUMENT_UPDATE_BY, DMSNaming.DOCUMENT_UPDATE_BY); - this.addColumnMapping(DMSNaming.DOCUMENT_DOCUMENT_NAME, DMSNaming.DOCUMENT_DOCUMENT_NAME); - this.addColumnMapping(DMSNaming.DOCUMENT_OWNER_ID, DMSNaming.DOCUMENT_OWNER_ID); - this.addColumnMapping(DMSNaming.DOCUMENT_DOCUMENT_DESCRIPTION, DMSNaming.DOCUMENT_DOCUMENT_DESCRIPTION); - this.addColumnMapping(DMSNaming.DOCUMENT_DOCUMENT_KEYWORDS, DMSNaming.DOCUMENT_DOCUMENT_KEYWORDS); + this.addColumnMapping(DMSNaming.DOCUMENT_ID_DMS_DOCUMENT, this.nameConvention.convertName(DMSNaming.DOCUMENT_ID_DMS_DOCUMENT)); + this.addColumnMapping(DMSNaming.DOCUMENT_UPDATE_DATE, this.nameConvention.convertName(DMSNaming.DOCUMENT_UPDATE_DATE)); + this.addColumnMapping(DMSNaming.DOCUMENT_UPDATE_BY, this.nameConvention.convertName(DMSNaming.DOCUMENT_UPDATE_BY)); + this.addColumnMapping(DMSNaming.DOCUMENT_DOCUMENT_NAME, this.nameConvention.convertName(DMSNaming.DOCUMENT_DOCUMENT_NAME)); + this.addColumnMapping(DMSNaming.DOCUMENT_OWNER_ID, this.nameConvention.convertName(DMSNaming.DOCUMENT_OWNER_ID)); + this.addColumnMapping(DMSNaming.DOCUMENT_DOCUMENT_DESCRIPTION, this.nameConvention.convertName(DMSNaming.DOCUMENT_DOCUMENT_DESCRIPTION)); + this.addColumnMapping(DMSNaming.DOCUMENT_DOCUMENT_KEYWORDS, this.nameConvention.convertName(DMSNaming.DOCUMENT_DOCUMENT_KEYWORDS)); this.addColumnMapping(DMSNaming.DOCUMENT_FILE_ID_DMS_DOCUMENT_FILE, - DMSNaming.DOCUMENT_FILE_ID_DMS_DOCUMENT_FILE); - this.addColumnMapping(DMSNaming.DOCUMENT_FILE_NAME, DMSNaming.DOCUMENT_FILE_NAME); - this.addColumnMapping(DMSNaming.DOCUMENT_FILE_TYPE, DMSNaming.DOCUMENT_FILE_TYPE); + this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_ID_DMS_DOCUMENT_FILE)); + this.addColumnMapping(DMSNaming.DOCUMENT_FILE_NAME, this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_NAME)); + this.addColumnMapping(DMSNaming.DOCUMENT_FILE_TYPE, this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_TYPE)); this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION, - DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION); - this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_FILE_PATH, DMSNaming.DOCUMENT_FILE_VERSION_FILE_PATH); - this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_VERSION, DMSNaming.DOCUMENT_FILE_VERSION_VERSION); + this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION)); + this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_FILE_PATH, this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_FILE_PATH)); + this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_VERSION, this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_VERSION)); this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_FILE_DESCRIPTION, - DMSNaming.DOCUMENT_FILE_VERSION_FILE_DESCRIPTION); - this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_FILE_SIZE, DMSNaming.DOCUMENT_FILE_VERSION_FILE_SIZE); - this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE, DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE); - this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_THUMBNAIL, DMSNaming.DOCUMENT_FILE_VERSION_THUMBNAIL); + this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_FILE_DESCRIPTION)); + this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_FILE_SIZE, this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_FILE_SIZE)); + this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE, this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE)); + this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_THUMBNAIL, this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_THUMBNAIL)); this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_FILE_ADDED_DATE, - DMSNaming.DOCUMENT_FILE_VERSION_FILE_ADDED_DATE); + this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_FILE_ADDED_DATE)); this.addColumnMapping(DMSNaming.DOCUMENT_FILE_VERSION_FILE_ADDED_USER, - DMSNaming.DOCUMENT_FILE_VERSION_FILE_ADDED_USER); + this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_FILE_ADDED_USER)); this.addColumnMapping(DMSNaming.RELATED_DOCUMENT_ID_DMS_RELATED_DOCUMENT, - DMSNaming.RELATED_DOCUMENT_ID_DMS_RELATED_DOCUMENT); + this.nameConvention.convertName(DMSNaming.RELATED_DOCUMENT_ID_DMS_RELATED_DOCUMENT)); this.addColumnMapping(DMSNaming.RELATED_DOCUMENT_ID_DMS_DOCUMENT_MASTER, - DMSNaming.RELATED_DOCUMENT_ID_DMS_DOCUMENT_MASTER); + this.nameConvention.convertName(DMSNaming.RELATED_DOCUMENT_ID_DMS_DOCUMENT_MASTER)); this.addColumnMapping(DMSNaming.RELATED_DOCUMENT_ID_DMS_DOCUMENT_CHILD, - DMSNaming.RELATED_DOCUMENT_ID_DMS_DOCUMENT_CHILD); + this.nameConvention.convertName(DMSNaming.RELATED_DOCUMENT_ID_DMS_DOCUMENT_CHILD)); this.addColumnMapping(DMSNaming.DOCUMENT_PROPERTY_ID_DMS_DOCUMENT_PROPERTY, - DMSNaming.DOCUMENT_PROPERTY_ID_DMS_DOCUMENT_PROPERTY); + this.nameConvention.convertName(DMSNaming.DOCUMENT_PROPERTY_ID_DMS_DOCUMENT_PROPERTY)); this.addColumnMapping(DMSNaming.DOCUMENT_PROPERTY_DOCUMENT_PROPERTY_KEY, - DMSNaming.DOCUMENT_PROPERTY_DOCUMENT_PROPERTY_KEY); + this.nameConvention.convertName(DMSNaming.DOCUMENT_PROPERTY_DOCUMENT_PROPERTY_KEY)); this.addColumnMapping(DMSNaming.DOCUMENT_PROPERTY_DOCUMENT_PROPERTY_VALUE, - DMSNaming.DOCUMENT_PROPERTY_DOCUMENT_PROPERTY_VALUE); + this.nameConvention.convertName(DMSNaming.DOCUMENT_PROPERTY_DOCUMENT_PROPERTY_VALUE)); - this.addColumnMapping(DMSNaming.CATEGORY_ID_CATEGORY, DMSNaming.CATEGORY_ID_CATEGORY); - this.addColumnMapping(DMSNaming.CATEGORY_CATEGORY_NAME, DMSNaming.CATEGORY_CATEGORY_NAME); - this.addColumnMapping(DMSNaming.CATEGORY_ID_CATEGORY_PARENT, DMSNaming.CATEGORY_ID_CATEGORY_PARENT); + this.addColumnMapping(DMSNaming.CATEGORY_ID_CATEGORY, this.nameConvention.convertName(DMSNaming.CATEGORY_ID_CATEGORY)); + this.addColumnMapping(DMSNaming.CATEGORY_CATEGORY_NAME, this.nameConvention.convertName(DMSNaming.CATEGORY_CATEGORY_NAME)); + this.addColumnMapping(DMSNaming.CATEGORY_ID_CATEGORY_PARENT, this.nameConvention.convertName(DMSNaming.CATEGORY_ID_CATEGORY_PARENT)); } public Map getColumnsMapping() { diff --git a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceCategoryHelper.java b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceCategoryHelper.java index 1c88874..2eda41f 100644 --- a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceCategoryHelper.java +++ b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceCategoryHelper.java @@ -9,6 +9,7 @@ import java.util.List; import java.util.Map; +import com.ontimize.jee.server.dao.common.INameConvention; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -37,6 +38,9 @@ public class DMSServiceCategoryHelper extends AbstractDMSServiceHelper { private static final Logger logger = LoggerFactory.getLogger(DMSServiceCategoryHelper.class); + @Autowired + private INameConvention nameConvention; + @Autowired DefaultOntimizeDaoHelper daoHelper; @@ -64,7 +68,7 @@ public DMSCategory categoryGetForDocument(Serializable idDocument, List attri if (attribs == null) { attribs = new ArrayList<>(); } - attribs = this.getColumnHelper().translate(attribs); + ListTools.safeAdd((List) attribs, this.getColumnHelper().getCategoryIdColumn()); ListTools.safeAdd((List) attribs, this.getColumnHelper().getCategoryNameColumn()); ListTools.safeAdd((List) attribs, this.getColumnHelper().getCategoryParentColumn()); @@ -72,7 +76,7 @@ public DMSCategory categoryGetForDocument(Serializable idDocument, List attri Map filter = EntityResultTools.keysvalues(this.getColumnHelper().getDocumentIdColumn(), idDocument); EntityResult er = this.daoHelper.query(this.categoryDao, filter, attribs); - return this.convertCategoryResultSet(idDocument, this.getColumnHelper().translateResult(er)); + return this.convertCategoryResultSet(idDocument, er); } /** @@ -207,14 +211,14 @@ private void expandCategory(DMSCategory root, EntityResult er, Serializable idDo */ private List removeCategoriesForParentId(EntityResult er, DMSCategory parentCategory, Serializable idDocument) { - List listIdParentCategory = (List) er.get(DMSNaming.CATEGORY_ID_CATEGORY_PARENT); + List listIdParentCategory = (List) er.get(this.nameConvention.convertName(DMSNaming.CATEGORY_ID_CATEGORY_PARENT)); List res = new ArrayList<>(); if (listIdParentCategory != null) { for (int i = 0; i < listIdParentCategory.size(); i++) { if (ObjectTools.safeIsEquals(listIdParentCategory.get(i), parentCategory.getIdCategory())) { Map recordValues = er.getRecordValues(i); - Serializable idCategory = recordValues.remove(DMSNaming.CATEGORY_ID_CATEGORY); - String categoryName = (String) recordValues.remove(DMSNaming.CATEGORY_CATEGORY_NAME); + Serializable idCategory = recordValues.remove(this.nameConvention.convertName(DMSNaming.CATEGORY_ID_CATEGORY)); + String categoryName = (String) recordValues.remove(this.nameConvention.convertName(DMSNaming.CATEGORY_CATEGORY_NAME)); res.add(new DMSCategory(idDocument, idCategory, categoryName, recordValues, parentCategory)); er.deleteRecord(i); i--; diff --git a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceDocumentHelper.java b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceDocumentHelper.java index b4d89ae..5354296 100644 --- a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceDocumentHelper.java +++ b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceDocumentHelper.java @@ -67,9 +67,7 @@ public class DMSServiceDocumentHelper extends AbstractDMSServiceHelper { * @return the entity result */ public EntityResult documentQuery(List attributes, Map criteria) { - return this.getColumnHelper() - .translateResult(this.daoHelper.query(this.documentDao, this.getColumnHelper().translate(criteria), - this.getColumnHelper().translate(attributes))); + return this.daoHelper.query(this.documentDao, criteria, attributes); } /** @@ -86,7 +84,7 @@ public DocumentIdentifier documentInsert(Map av) { ((Map) av).put(this.getColumnHelper().getDocumentOwnerColumn(), Integer.valueOf(1)); } - EntityResult res = this.daoHelper.insert(this.documentDao, this.getColumnHelper().translate(av)); + EntityResult res = this.daoHelper.insert(this.documentDao, av); DocumentIdentifier result = new DocumentIdentifier( (Serializable) res.get(this.getColumnHelper().getDocumentIdColumn())); @@ -102,7 +100,7 @@ public void documentUpdate(Serializable documentId, Map attributesValues) CheckingTools.failIfNull(documentId, DMSNaming.ERROR_DOCUMENT_ID_MANDATORY); Map kv = new HashMap<>(); kv.put(this.getColumnHelper().getDocumentIdColumn(), documentId); - this.daoHelper.update(this.documentDao, this.getColumnHelper().translate(attributesValues), kv); + this.daoHelper.update(this.documentDao, attributesValues, kv); } /** @@ -233,7 +231,7 @@ public String documentGetProperty(Serializable documentId, String propertyKey) { public Map documentGetProperties(Serializable documentId, Map kv) { CheckingTools.failIfNull(documentId, DMSNaming.ERROR_DOCUMENT_ID_MANDATORY); ((Map) kv).put(this.getColumnHelper().getDocumentIdColumn(), documentId); - EntityResult rs = this.daoHelper.query(this.documentPropertyDao, this.getColumnHelper().translate(kv), + EntityResult rs = this.daoHelper.query(this.documentPropertyDao, kv, this.getColumnHelper().getPropertyColumns()); Map res = new HashMap<>(); int nregs = rs.calculateRecordNumber(); @@ -255,9 +253,8 @@ public Map documentGetProperties(Serializable documentId, Map kv, List attributes) { CheckingTools.failIfNull(documentId, DMSNaming.ERROR_DOCUMENT_ID_MANDATORY); ((Map) kv).put(this.getColumnHelper().getDocumentIdColumn(), documentId); - return this.getColumnHelper() - .translateResult(this.daoHelper.query(this.documentFileDao, this.getColumnHelper().translate(kv), - this.getColumnHelper().translate(attributes))); + return this.daoHelper.query(this.documentFileDao,kv, + attributes); } /** @@ -272,9 +269,7 @@ public EntityResult documentGetAllFiles(Serializable documentId, Map kv, L throws DmsException { CheckingTools.failIfNull(documentId, DMSNaming.ERROR_DOCUMENT_ID_MANDATORY); ((Map) kv).put(this.getColumnHelper().getDocumentIdColumn(), documentId); - return this.getColumnHelper() - .translateResult(this.daoHelper.query(this.documentFileDao, this.getColumnHelper().translate(kv), - this.getColumnHelper().translate(attributes), "allfiles")); + return this.daoHelper.query(this.documentFileDao, kv, attributes, "allfiles"); } /** @@ -286,9 +281,8 @@ public EntityResult getRelatedDocument(Serializable documentId) { CheckingTools.failIfNull(documentId, DMSNaming.ERROR_DOCUMENT_ID_MANDATORY); Map kv = new HashMap<>(); kv.put(this.getColumnHelper().getDocumentRelatedMasterColumn(), documentId); - return this.getColumnHelper() - .translateResult(this.daoHelper.query(this.relatedDocumentDao, kv, - this.getColumnHelper().getDocumentRelatedColumns())); + return this.daoHelper.query(this.relatedDocumentDao, kv, + this.getColumnHelper().getDocumentRelatedColumns()); } /** diff --git a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceFileHelper.java b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceFileHelper.java index 72380a4..318d3ca 100644 --- a/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceFileHelper.java +++ b/ontimize-jee-dms-server/src/main/java/com/ontimize/jee/server/services/dms/DMSServiceFileHelper.java @@ -17,6 +17,7 @@ import java.util.Map.Entry; import java.util.Vector; +import com.ontimize.jee.server.dao.common.INameConvention; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.slf4j.Logger; @@ -50,6 +51,9 @@ public class DMSServiceFileHelper extends AbstractDMSServiceHelper { @Autowired DefaultOntimizeDaoHelper daoHelper; + @Autowired + private INameConvention nameConvention; + /** The Constant logger. */ private static final Logger logger = LoggerFactory.getLogger(DMSServiceFileHelper.class); @@ -126,13 +130,13 @@ public Path fileGetPathOfVersion(Serializable fileVersionId) throws DmsException * @throws DmsException */ public DocumentIdentifier fileInsert(Serializable documentId, Map av, InputStream is) throws DmsException { - String fileName = (String) av.get(DMSNaming.DOCUMENT_FILE_NAME); + String fileName = (String) av.get(nameConvention.convertName(DMSNaming.DOCUMENT_FILE_NAME)); CheckingTools.failIfNull(fileName, DMSNaming.ERROR_FILE_NAME_MANDATORY); CheckingTools.failIfNull(documentId, DMSNaming.ERROR_DOCUMENT_ID_MANDATORY); // insertamos en la tabla de ficheros Map avFile = new HashMap<>(); - avFile.putAll(this.getColumnHelper().translate(av));// Pass other columns (extended implementations) + avFile.putAll(av);// Pass other columns (extended implementations) avFile.put(this.getColumnHelper().getFileNameColumn(), fileName); avFile.put(this.getColumnHelper().getDocumentIdColumn(), documentId); EntityResult res = this.daoHelper.insert(this.documentFileDao, avFile); @@ -179,7 +183,7 @@ public DocumentIdentifier fileUpdate(Serializable fileId, Map attributesVa } else { // En este caso hay que crear una nueva versi�n // Si viene el nombre del fichero lo actualizamos en la tabla de ficheros - String fileName = (String) attributesValues.remove(DMSNaming.DOCUMENT_FILE_NAME); + String fileName = (String) attributesValues.remove(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_NAME)); if (fileName != null) { Map kv = new HashMap<>(); kv.put(this.getColumnHelper().getFileIdColumn(), fileId); @@ -219,9 +223,7 @@ public DocumentIdentifier fileVersionOverrideContent(Serializable versionId, Inp */ public EntityResult fileQuery(Map criteria, List attributes) { // TODO anadir filtro de dueno? - return this.getColumnHelper() - .translateResult(this.daoHelper.query(this.documentFileDao, this.getColumnHelper().translate(criteria), - this.getColumnHelper().translate(attributes))); + return this.daoHelper.query(this.documentFileDao, criteria, attributes); } /* @@ -237,9 +239,9 @@ public EntityResult fileQuery(Map criteria, List attributes) { public void fileDelete(Serializable fileId) throws DmsException { CheckingTools.failIfNull(fileId, DMSNaming.ERROR_FILE_ID_MANDATORY); EntityResult res = this.fileGetVersions(fileId, new HashMap<>(), - EntityResultTools.attributes(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION)); + EntityResultTools.attributes(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION))); List fileVersionIds = (List) res - .get(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION); + .get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION)); // borramos las versiones, sin borrar los ficheros List toDelete = this.deleteFileVersionsWithoutDeleteFiles(fileId, fileVersionIds); @@ -264,9 +266,7 @@ public void fileDelete(Serializable fileId) throws DmsException { public EntityResult fileVersionQuery(Serializable fileVersionId, List attributes) { HashMap kv = new HashMap<>(); kv.put(this.getColumnHelper().getVersionIdColumn(), fileVersionId); - return this.getColumnHelper() - .translateResult(this.daoHelper.query(this.documentFileVersionDao, kv, - this.getColumnHelper().translate(attributes))); + return this.daoHelper.query(this.documentFileVersionDao, kv, attributes); } /** @@ -278,10 +278,8 @@ public EntityResult fileVersionQuery(Serializable fileVersionId, List attribu */ public EntityResult fileGetVersions(Serializable fileId, Map kv, List attributes) { CheckingTools.failIfNull(fileId, DMSNaming.ERROR_FILE_ID_MANDATORY); - ((Map) kv).put(DMSNaming.DOCUMENT_FILE_ID_DMS_DOCUMENT_FILE, fileId); - return this.getColumnHelper() - .translateResult(this.daoHelper.query(this.documentFileVersionDao, this.getColumnHelper().translate(kv), - this.getColumnHelper().translate(attributes))); + ((Map) kv).put(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_ID_DMS_DOCUMENT_FILE), fileId); + return this.daoHelper.query(this.documentFileVersionDao, kv, attributes); } /** @@ -515,16 +513,16 @@ protected Number getCurrentFileVersionAndDeprecate(Serializable fileId) { Map kv = new HashMap<>(); kv.put(this.getColumnHelper().getFileIdColumn(), fileId); EntityResult er = this.fileQuery(kv, EntityResultTools.attributes( - DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION, DMSNaming.DOCUMENT_FILE_VERSION_VERSION)); + this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION), this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_VERSION))); CheckingTools.failIf(er.calculateRecordNumber() > 1, DMSNaming.ERROR_ACTIVE_VERSION_NOT_FOUND); // Si existe la marcamos como no activa y sumamos 1 a la versi�n que vamos a insertar if (er.calculateRecordNumber() == 1) { Map record = er.getRecordValues(0); Serializable oldVersionId = (Serializable) record - .get(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION); + .get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_ID_DMS_DOCUMENT_FILE_VERSION)); if (oldVersionId != null) { - Number oldVersion = (Number) record.get(DMSNaming.DOCUMENT_FILE_VERSION_VERSION); + Number oldVersion = (Number) record.get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_VERSION)); fileVersion = Long.valueOf(oldVersion.longValue() + 1); kv = new HashMap<>(); @@ -596,13 +594,13 @@ protected Serializable createNewVersionForFile(Serializable fileId, Map at Serializable fileVersion = null; // Si recibimos la versi�n por parte del usuario utilizamos esa, siempre y cuando no exista ya - if (attributes.containsKey(DMSNaming.DOCUMENT_FILE_VERSION_VERSION)) { - fileVersion = (Serializable) attributes.get(DMSNaming.DOCUMENT_FILE_VERSION_VERSION); + if (attributes.containsKey(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_VERSION))) { + fileVersion = (Serializable) attributes.get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_VERSION)); // Check if conflict Map kvCheck = new HashMap<>(); - kvCheck.put(DMSNaming.DOCUMENT_FILE_VERSION_VERSION, fileVersion); + kvCheck.put(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_VERSION), fileVersion); EntityResult resVersions = this.fileGetVersions(fileId, kvCheck, - EntityResultTools.attributes(DMSNaming.DOCUMENT_FILE_VERSION_VERSION)); + EntityResultTools.attributes(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_VERSION))); CheckingTools.failIf(resVersions.calculateRecordNumber() > 0, DMSNaming.ERROR_VERSION_ALREADY_EXISTS); } else { fileVersion = this.getCurrentFileVersionAndDeprecate(fileId); @@ -616,15 +614,15 @@ protected Serializable createNewVersionForFile(Serializable fileId, Map at avVersion.put(this.getColumnHelper().getVersionAddedUserColumn(), this.getUser()); // TODO pendiente de tener la // informaci�n en el userinfo avVersion.put(this.getColumnHelper().getVersionDescriptionColumn(), - attributes.get(DMSNaming.DOCUMENT_FILE_VERSION_FILE_DESCRIPTION)); + attributes.get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_FILE_DESCRIPTION))); avVersion.put(this.getColumnHelper().getVersionPathColumn(), - attributes.get(DMSNaming.DOCUMENT_FILE_VERSION_FILE_PATH)); + attributes.get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_FILE_PATH))); avVersion.put(this.getColumnHelper().getVersionActiveColumn(), - attributes.containsKey(DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE) - ? attributes.get(DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE) : OntimizeDMSEngine.ACTIVE); + attributes.containsKey(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE)) + ? attributes.get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_IS_ACTIVE)) : OntimizeDMSEngine.ACTIVE); avVersion.put(this.getColumnHelper().getVersionVersionColumn(), fileVersion); MapTools.safePut(avVersion, this.getColumnHelper().getVersionThumbnailColumn(), - attributes.get(DMSNaming.DOCUMENT_FILE_VERSION_THUMBNAIL)); + attributes.get(this.nameConvention.convertName(DMSNaming.DOCUMENT_FILE_VERSION_THUMBNAIL))); EntityResult resVersion = this.daoHelper.insert(this.documentFileVersionDao, avVersion); Serializable versionId = (Serializable) resVersion.get(this.getColumnHelper().getVersionIdColumn()); CheckingTools.failIfNull(versionId, DMSNaming.ERROR_CREATING_FILE_VERSION); From dea4e1e7f08a0fa43d784f00c5393307e7323570 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xo=C3=A1n=20Loureiro=20Santamar=C3=ADa?= Date: Wed, 12 Mar 2025 10:57:07 +0100 Subject: [PATCH 6/7] Add new Github actions for deploying versions and prepare releases by PR --- .../workflows/deploy-mvn-central-release.yml | 80 +++++++++++++++++++ .../deploy-mvn-central-snapshot-manual.yml | 35 ++++++++ .../workflows/deploy-mvn-central-snapshot.yml | 25 +++--- .github/workflows/prepare-release-by-PR.yml | 65 +++++++++++++++ 4 files changed, 193 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/deploy-mvn-central-release.yml create mode 100644 .github/workflows/deploy-mvn-central-snapshot-manual.yml create mode 100644 .github/workflows/prepare-release-by-PR.yml diff --git a/.github/workflows/deploy-mvn-central-release.yml b/.github/workflows/deploy-mvn-central-release.yml new file mode 100644 index 0000000..2dd28ab --- /dev/null +++ b/.github/workflows/deploy-mvn-central-release.yml @@ -0,0 +1,80 @@ +name: Generate a RELEASE in Maven Central +on: + pull_request: + types: [closed] + branches: [main] + workflow_dispatch: + inputs: + RELEASE_BRANCH: + description: 'Release branch' + type: choice + required: true + default: 'main' + options: + - main +jobs: + Generate-a-RELEASE-in-Maven-Central: + runs-on: ubuntu-latest + if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true && contains(join(github.event.pull_request.labels.*.name, ', '), 'release')) + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CI_COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }} + CI_COMMIT_MAIL: ${{ secrets.CI_COMMIT_MAIL }} + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + steps: + - name: Get input parameters + run: | + echo "BRANCH=${{ github.event.inputs.RELEASE_BRANCH || github.ref }}" >> $GITHUB_ENV + - name: Checkout repository code + uses: actions/checkout@v4 + with: + ref: ${{ env.BRANCH }} + fetch-depth: 0 + - name: Setup Java JDK and Maven + uses: ontimize/setup-java-maven-gitAction@v4 + with: + distribution: 'temurin' + java-version: '11' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Perform MVN deploy action + run: | + mvn -B -U -Dmaven.test.failure.ignore=true -DskipTests=true clean deploy -Pgenerate-version + - name: Set author identity + run: | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ secrets.CI_COMMIT_MAIL }}" + - name: Annotate master version with a tag + id: tag + run: | + version=$(mvn help:evaluate -q -Dexpression=project.version -DforceStdout) + git tag -a $version -m "Version $version" + git push origin $version + echo "version=$version" >> $GITHUB_OUTPUT + - name: Create sync branch + run: | + version=${{ steps.tag.outputs.version }} + git checkout -b sync/$version + mvn -B build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion}.0-SNAPSHOT versions:commit + version_dev=$(mvn help:evaluate -q -Dexpression=project.version -DforceStdout) + git add . + git commit -m "New develop version → $version_dev" + git push origin sync/$version + - name: Create pull request + run: | + version=${{ steps.tag.outputs.version }} + gh pr create -B develop -H sync/$version --title "Backmerge from main into develop" --body "Created by a GitHub Action → Resync develop branch with main branch and increase project version" + - name: Create release on Github + uses: ncipollo/release-action@2792aea87063cfd0d27953ac38e3ab45afacc154 + with: + commit: ${{ env.BRANCH }} + tag: ${{ steps.tag.outputs.version }} + name: ${{ steps.tag.outputs.version }} + token: ${{ secrets.GITHUB_TOKEN }} + body: | + Check out the [changelog](CHANGELOG.md) for version ${{ steps.tag.outputs.version }} diff --git a/.github/workflows/deploy-mvn-central-snapshot-manual.yml b/.github/workflows/deploy-mvn-central-snapshot-manual.yml new file mode 100644 index 0000000..6cb0c73 --- /dev/null +++ b/.github/workflows/deploy-mvn-central-snapshot-manual.yml @@ -0,0 +1,35 @@ +name: Manual deploy a snapshot in MVNCentral +on: + workflow_dispatch: + inputs: + version-suffix: + description: 'The suffix to add to Framework version' + required: true +concurrency: + group: autodeploy-${{ github.ref }} + cancel-in-progress: false +jobs: + Manual-deploy-a-snapshot-in-MVNCentral: + runs-on: ubuntu-latest + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + steps: + - name : Checkout repository code + uses: actions/checkout@v4 + - name: Setup Java JDK and Maven + uses: ontimize/setup-java-maven-gitAction@v4 + with: + distribution: 'temurin' + java-version: '11' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Publish to Apache Maven Central + run: | + mvn -B build-helper:parse-version versions:set \ + -DnewVersion="\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.incrementalVersion}-${{github.event.inputs.version-suffix}}-SNAPSHOT" + mvn -B -U clean deploy -Pgenerate-version diff --git a/.github/workflows/deploy-mvn-central-snapshot.yml b/.github/workflows/deploy-mvn-central-snapshot.yml index 32bf3d1..578969d 100644 --- a/.github/workflows/deploy-mvn-central-snapshot.yml +++ b/.github/workflows/deploy-mvn-central-snapshot.yml @@ -1,16 +1,21 @@ name: Generate a version in MVNCentral -on: - push: - branches: - - 'develop' +on: + pull_request: + types: [closed] + branches: [develop] jobs: Generate-a-snapshot-in-MVNCentral: + if: github.event.pull_request.merged runs-on: ubuntu-latest + env: + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} steps: - name : Checkout repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup Java JDK and Maven - uses: ontimize/setup-java-maven-gitAction@v3 + uses: ontimize/setup-java-maven-gitAction@v4 with: distribution: 'temurin' java-version: '11' @@ -18,10 +23,6 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_CENTRAL_TOKEN gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} - gpg-passphrase: MAVEN_GPG_PASSPHRASE + gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: Publish to Apache Maven Central - run: mvn -U clean deploy -Pgenerate-version - env: - MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} + run: mvn -B -U clean deploy -Pgenerate-version diff --git a/.github/workflows/prepare-release-by-PR.yml b/.github/workflows/prepare-release-by-PR.yml new file mode 100644 index 0000000..bd8bb51 --- /dev/null +++ b/.github/workflows/prepare-release-by-PR.yml @@ -0,0 +1,65 @@ +name: Prepare a release by a pull request +on: + workflow_dispatch: + inputs: + version: + description: 'Optional. Enter a new custom version instead of default existing one.' + type: string + required: false +jobs: + Prepare-a-release-by-a-pull-request: + runs-on: ubuntu-latest + env: + #GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }} # If you want to be able to trigger actions that come from another action. Github has this behavior disabled by default. + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CI_COMMIT_AUTHOR: ${{ secrets.CI_COMMIT_AUTHOR }} + CI_COMMIT_MAIL: ${{ secrets.CI_COMMIT_MAIL }} + ARTIFACTORY_USER: ${{ secrets.ARTIFACTORY_USER }} + ARTIFACTORY_PASS: ${{ secrets.ARTIFACTORY_PASS }} + steps: + - name: Checkout repository code + uses: actions/checkout@v4 + - name: Setup Java JDK and Maven + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '11' + - name: Get framework version to release + id: version + run: | + var_version="" + if ${{ github.event.inputs.version != '' }}; then + var_version=${{ github.event.inputs.version }} + else + var_version=$(mvn help:evaluate -q -Dexpression=project.version -DforceStdout) + fi + echo "version=$var_version" >> $GITHUB_OUTPUT + - name: Set author identity + run: | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ secrets.CI_COMMIT_MAIL }}" + - name: Prepare version to release + id: tag + run: | + version=$(echo "${{ steps.version.outputs.version }}" | sed 's/-SNAPSHOT//' ) + git checkout -b release/$version + mvn -B versions:use-releases + if ${{ github.event.inputs.version != '' }}; then + mvn -B versions:set -DnewVersion=$version versions:commit + fi + mvn -B versions:set -DnewVersion=$version -DremoveSnapshot versions:commit + mvn -B -N versions:update-child-modules versions:commit + git ls-files | grep -e 'pom.xml' | xargs git add || true + echo "version=$version" >> $GITHUB_OUTPUT + - name: Commit file changes + run: | + version=${{ steps.tag.outputs.version }} + git commit -m "New release → $version" + - name: Push new branch + run: | + version=${{ steps.tag.outputs.version }} + git push origin release/$version + - name: Create pull request + run: | + version=${{ steps.tag.outputs.version }} + gh pr create -B main -H release/$version --title "Merge release/$version into main" --body "Created by a GitHub Action → Prepare a release by a pull request" --label "release" From ecf35896a5c145bda0666e43d027012391569145 Mon Sep 17 00:00:00 2001 From: supportontimize Date: Wed, 12 Mar 2025 10:00:38 +0000 Subject: [PATCH 7/7] =?UTF-8?q?New=20release=20=E2=86=92=203.2.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ontimize-jee-dms-common/pom.xml | 2 +- ontimize-jee-dms-rest/pom.xml | 2 +- ontimize-jee-dms-server/pom.xml | 2 +- pom.xml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ontimize-jee-dms-common/pom.xml b/ontimize-jee-dms-common/pom.xml index 763186e..9199682 100644 --- a/ontimize-jee-dms-common/pom.xml +++ b/ontimize-jee-dms-common/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms - 3.2.0-SNAPSHOT + 3.2.0 ontimize-jee-dms-common diff --git a/ontimize-jee-dms-rest/pom.xml b/ontimize-jee-dms-rest/pom.xml index 41db125..599038c 100644 --- a/ontimize-jee-dms-rest/pom.xml +++ b/ontimize-jee-dms-rest/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms - 3.2.0-SNAPSHOT + 3.2.0 ontimize-jee-dms-rest diff --git a/ontimize-jee-dms-server/pom.xml b/ontimize-jee-dms-server/pom.xml index cbc667b..6267e58 100644 --- a/ontimize-jee-dms-server/pom.xml +++ b/ontimize-jee-dms-server/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms - 3.2.0-SNAPSHOT + 3.2.0 ontimize-jee-dms-server diff --git a/pom.xml b/pom.xml index 8808d62..ab8d594 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ com.ontimize.jee.dms ontimize-jee-dms pom - 3.2.0-SNAPSHOT + 3.2.0 com.ontimize.jee ontimize-jee