diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/commands-jar.bak b/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/commands-jar.bak deleted file mode 100644 index 31520bf947a..00000000000 Binary files a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/commands-jar.bak and /dev/null differ diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/npe-command-jar.bak b/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/npe-command-jar.bak deleted file mode 100644 index b9c4f3b27d8..00000000000 Binary files a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/npe-command-jar.bak and /dev/null differ diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/platformCommands-jar.bak b/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/platformCommands-jar.bak deleted file mode 100644 index b3ffbc6c75f..00000000000 Binary files a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/platformCommands-jar.bak and /dev/null differ diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/session-commands.jar.bak b/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/session-commands.jar.bak deleted file mode 100644 index 44e9a5fc876..00000000000 Binary files a/bonita-integration-tests/bonita-integration-tests-client/src/main/resources/session-commands.jar.bak and /dev/null differ diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/CommandIT.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/CommandIT.java index 8dc1758809a..7fa6667302c 100644 --- a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/CommandIT.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/CommandIT.java @@ -13,17 +13,15 @@ **/ package org.bonitasoft.engine.command; +import static org.bonitasoft.engine.commons.io.IOUtil.generateJar; import static org.junit.Assert.*; import java.io.IOException; -import java.io.InputStream; import java.io.Serializable; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.io.IOUtils; -import org.bonitasoft.engine.CommonAPIIT; import org.bonitasoft.engine.TestWithTechnicalUser; import org.bonitasoft.engine.api.CommandAPI; import org.bonitasoft.engine.exception.AlreadyExistsException; @@ -62,13 +60,10 @@ public void executeUnknownCommand() throws BonitaException { @Test public void executeCommandWithParameters() throws BonitaException, IOException { - final InputStream stream = CommonAPIIT.class.getResourceAsStream("/commands-jar.bak"); - assertNotNull(stream); - final byte[] byteArray = IOUtils.toByteArray(stream); - stream.close(); + final byte[] byteArray = generateJar(IntegerCommand.class); getCommandAPI().addDependency("commands", byteArray); getCommandAPI().register("intReturn", "Retrieving the integer value", - "org.bonitasoft.engine.command.IntergerCommand"); + "org.bonitasoft.engine.command.IntegerCommand"); final Map parameters = new HashMap<>(); parameters.put("int", 83); final Integer actual = (Integer) getCommandAPI().execute("intReturn", parameters); @@ -79,10 +74,7 @@ public void executeCommandWithParameters() throws BonitaException, IOException { @Test(expected = CommandParameterizationException.class) public void commandThrowsCommandParameterizationException() throws BonitaException, IOException { - final InputStream stream = CommonAPIIT.class.getResourceAsStream("/commands-jar.bak"); - assertNotNull(stream); - final byte[] byteArray = IOUtils.toByteArray(stream); - stream.close(); + final byte[] byteArray = generateJar(ParameterizationExceptionCommand.class); getCommandAPI().addDependency("commands", byteArray); getCommandAPI().register("except", "Throws ParameterizationException", "org.bonitasoft.engine.command.ParameterizationExceptionCommand"); @@ -98,10 +90,7 @@ public void commandThrowsCommandParameterizationException() throws BonitaExcepti @Test(expected = CommandExecutionException.class) public void commandThrowsCommandExecutionException() throws BonitaException, IOException { - final InputStream stream = CommonAPIIT.class.getResourceAsStream("/commands-jar.bak"); - assertNotNull(stream); - final byte[] byteArray = IOUtils.toByteArray(stream); - stream.close(); + final byte[] byteArray = generateJar(ExecutionExceptionCommand.class); getCommandAPI().addDependency("commands", byteArray); getCommandAPI().register("except", "Throws ExecutionExceptionCommand", "org.bonitasoft.engine.command.ExecutionExceptionCommand"); @@ -376,13 +365,10 @@ public void searchCommandsWithApostrophe() throws BonitaException { @Test public void executeCommandById() throws BonitaException, IOException { - final InputStream stream = CommonAPIIT.class.getResourceAsStream("/commands-jar.bak"); - assertNotNull(stream); - final byte[] byteArray = IOUtils.toByteArray(stream); - stream.close(); + final byte[] byteArray = generateJar(IntegerCommand.class); getCommandAPI().addDependency("commands", byteArray); final CommandDescriptor command = getCommandAPI() - .register("intReturn", "Retrieving the integer value", "org.bonitasoft.engine.command.IntergerCommand"); + .register("intReturn", "Retrieving the integer value", "org.bonitasoft.engine.command.IntegerCommand"); final CommandDescriptor commandById = getCommandAPI().get(command.getId()); assertEquals(commandById.getId(), command.getId()); @@ -398,10 +384,7 @@ public void executeCommandById() throws BonitaException, IOException { @Test(expected = BonitaRuntimeException.class) public void executeCommandThrowsANPE() throws BonitaException, IOException { - final InputStream stream = CommonAPIIT.class.getResourceAsStream("/npe-command-jar.bak"); - assertNotNull(stream); - final byte[] byteArray = IOUtils.toByteArray(stream); - stream.close(); + final byte[] byteArray = generateJar(NPECommand.class); getCommandAPI().addDependency("commands", byteArray); getCommandAPI().register("NPEReturns", "Throws a NPE", "org.bonitasoft.engine.command.NPECommand"); try { diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/TenantCommand.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/ExecutionExceptionCommand.java similarity index 63% rename from bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/TenantCommand.java rename to bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/ExecutionExceptionCommand.java index 5446a418253..ada744f8e16 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/TenantCommand.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/ExecutionExceptionCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019 Bonitasoft S.A. + * Copyright (C) 2011 Bonitasoft S.A. * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation @@ -13,16 +13,20 @@ **/ package org.bonitasoft.engine.command; +import java.io.Serializable; +import java.util.Map; + +import org.bonitasoft.engine.service.ServiceAccessor; + /** - * Class to be subclassed by implementors of a tenant scope {@link Command}. It is design to be executed by the - * {@link org.bonitasoft.engine.api.CommandAPI}. - * * @author Matthieu Chaffotte - * @see org.bonitasoft.engine.api.CommandAPI - * @since 6.0.0 - * @deprecated since 9.0.0, use {@link RuntimeCommand} instead */ -@Deprecated(forRemoval = true, since = "9.0.0") -public abstract class TenantCommand extends RuntimeCommand { +public class ExecutionExceptionCommand extends RuntimeCommand { + + @Override + public Serializable execute(final Map parameters, final ServiceAccessor serviceAccessor) + throws SCommandParameterizationException, SCommandExecutionException { + throw new SCommandExecutionException("fail"); + } } diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/PlatformCommand.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/IntegerCommand.java similarity index 64% rename from bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/PlatformCommand.java rename to bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/IntegerCommand.java index 71af25b0aaf..c1a3a23481e 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/PlatformCommand.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/IntegerCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019 Bonitasoft S.A. + * Copyright (C) 2012 Bonitasoft S.A. * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation @@ -13,16 +13,20 @@ **/ package org.bonitasoft.engine.command; +import java.io.Serializable; +import java.util.Map; + +import org.bonitasoft.engine.service.ServiceAccessor; + /** - * Class to be subclassed by implementors of a platform scope {@link Command}. It is design to be executed by the - * {@link org.bonitasoft.engine.api.PlatformCommandAPI}. - * - * @see org.bonitasoft.engine.api.PlatformCommandAPI * @author Matthieu Chaffotte - * @since 6.0.0 - * @deprecated since 9.0.0, use {@link RuntimeCommand} instead */ -@Deprecated(forRemoval = true, since = "9.0.0") -public abstract class PlatformCommand extends RuntimeCommand { +public class IntegerCommand extends RuntimeCommand { + + @Override + public Serializable execute(final Map parameters, final ServiceAccessor serviceAccessor) + throws SCommandParameterizationException, SCommandExecutionException { + return parameters.get("int"); + } } diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/PlatformInitServiceAccessor.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/NPECommand.java similarity index 66% rename from bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/PlatformInitServiceAccessor.java rename to bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/NPECommand.java index 76b85a03987..5a4afc5a286 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/PlatformInitServiceAccessor.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/NPECommand.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019 Bonitasoft S.A. + * Copyright (C) 2024 Bonitasoft S.A. * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation @@ -11,16 +11,17 @@ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301, USA. **/ -package org.bonitasoft.engine.service.impl; +package org.bonitasoft.engine.command; + +import java.io.Serializable; +import java.util.Map; import org.bonitasoft.engine.service.ServiceAccessor; -/** - * Access all Platform init (bootstrap) services - * - * @deprecated since 9.0.0, use {@link ServiceAccessor} instead - */ -@Deprecated(forRemoval = true, since = "9.0.0") -public interface PlatformInitServiceAccessor extends ServiceAccessor { +public class NPECommand extends RuntimeCommand { + public Serializable execute(Map parameters, ServiceAccessor serviceAccessor) + throws SCommandParameterizationException, SCommandExecutionException { + throw new NullPointerException(); + } } diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/PlatformServiceAccessor.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/ParameterizationExceptionCommand.java similarity index 58% rename from bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/PlatformServiceAccessor.java rename to bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/ParameterizationExceptionCommand.java index a3b864c48b1..a02694b1041 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/PlatformServiceAccessor.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/command/ParameterizationExceptionCommand.java @@ -1,5 +1,5 @@ /** - * Copyright (C) 2019 Bonitasoft S.A. + * Copyright (C) 2012 Bonitasoft S.A. * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble * This library is free software; you can redistribute it and/or modify it under the terms * of the GNU Lesser General Public License as published by the Free Software Foundation @@ -11,21 +11,22 @@ * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301, USA. **/ -package org.bonitasoft.engine.service; +package org.bonitasoft.engine.command; + +import java.io.Serializable; +import java.util.Map; + +import org.bonitasoft.engine.service.ServiceAccessor; /** - * Accessor for tenant level engine services. - *

- * All server side services of the platform can be accessed using this class. Using server side services instead of an - * API might cause unexpected behaviors and - * damage your data. - * * @author Matthieu Chaffotte - * @author Elias Ricken de Medeiros - * @author Zhao Na - * @deprecated since 9.0.0, use {@link ServiceAccessor} instead */ -@Deprecated(forRemoval = true, since = "9.0.0") -public interface PlatformServiceAccessor extends ServiceAccessor { +public class ParameterizationExceptionCommand extends RuntimeCommand { + + @Override + public Serializable execute(final Map parameters, final ServiceAccessor serviceAccessor) + throws SCommandParameterizationException, SCommandExecutionException { + throw new SCommandParameterizationException("parameters are null"); + } } diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/login/PlatformLoginAPIIT.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/login/PlatformLoginAPIIT.java index 37248f08074..0df92f66888 100644 --- a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/login/PlatformLoginAPIIT.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/login/PlatformLoginAPIIT.java @@ -62,7 +62,7 @@ private void deleteSession(final long sessionId) throws Exception { // register and execute a command to delete a session platformCommandAPI.register(COMMAND_NAME, "Deletes a platform session based on its sessionId", "org.bonitasoft.engine.command.DeletePlatformSessionCommand"); - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("sessionId", sessionId); platformCommandAPI.execute(COMMAND_NAME, parameters); platformCommandAPI.unregister(COMMAND_NAME); diff --git a/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/platform/TenantManagementIT.java b/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/platform/TenantManagementIT.java index 36a3af2a387..76e92f7714b 100644 --- a/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/platform/TenantManagementIT.java +++ b/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/platform/TenantManagementIT.java @@ -14,32 +14,19 @@ package org.bonitasoft.engine.platform; import static org.assertj.core.api.Assertions.assertThat; -import static org.junit.Assert.fail; import org.bonitasoft.engine.bpm.CommonBPMServicesTest; -import org.bonitasoft.engine.builder.BuilderFactory; -import org.bonitasoft.engine.platform.exception.STenantUpdateException; import org.bonitasoft.engine.platform.model.STenant; -import org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilder; -import org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilderFactory; import org.bonitasoft.engine.test.util.TestUtil; import org.junit.After; -import org.junit.Before; import org.junit.Test; public class TenantManagementIT extends CommonBPMServicesTest { private final static String STATUS_DEACTIVATED = "DEACTIVATED"; - private PlatformService platformService; - - @Before - public void setup() { - platformService = getServiceAccessor().getPlatformService(); - } - @After - public void cleanUpOpenTransaction() throws Exception { + public void cleanUpOpenTransaction() { TestUtil.closeTransactionIfOpen(getTransactionService()); } @@ -60,40 +47,4 @@ public void tenantBuilderShouldBuildValidTenant() { assertThat(tenant.getDescription()).isEqualTo(description); } - @Test - public void updateTenantShouldUpdateAllFields() throws Exception { - getTransactionService().begin(); - - final String newDescription = "newDescription"; - - final STenantUpdateBuilderFactory updateBuilderFactory = BuilderFactory.get(STenantUpdateBuilderFactory.class); - final STenantUpdateBuilder updateDescriptor = updateBuilderFactory.createNewInstance(); - updateDescriptor.setDescription(newDescription); - - platformService.updateTenant(platformService.getDefaultTenant(), updateDescriptor.done()); - getTransactionService().complete(); - - getTransactionService().begin(); - final STenant readTenant = platformService.getDefaultTenant(); - getTransactionService().complete(); - - assertThat(readTenant.getDescription()).isEqualTo(newDescription); - } - - @Test(expected = STenantUpdateException.class) - public void updateInexistantTenantShouldFail() throws Exception { - final STenant tenant = STenant.builder().name("tenant1").createdBy("mycreatedBy") - .created(System.currentTimeMillis()).status(STATUS_DEACTIVATED).defaultTenant(false).build(); - - getTransactionService().begin(); - final STenantUpdateBuilderFactory updateBuilderFactory = BuilderFactory.get(STenantUpdateBuilderFactory.class); - final STenantUpdateBuilder updateDescriptor = updateBuilderFactory.createNewInstance(); - try { - platformService.updateTenant(tenant, updateDescriptor.done()); - fail("Tenant update should not work on inexistant tenant"); - } finally { - getTransactionService().complete(); - } - } - } diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/CommandAPI.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/CommandAPI.java index abc4a7a2c86..e5d19f5ad01 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/CommandAPI.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/CommandAPI.java @@ -41,12 +41,9 @@ *

*

* A command is composed of a jar containing at least one class that implements - * org.bonitasoft.engine.command.TenantCommand. - * org.bonitasoft.engine.command.system.CommandWithParameters can be used to handle parameter more easily. - * The behavior of the command must be - * defined in the - * execute method of this class.
- * TenantCommand is a class available only in bonita-server.jar. In order to create the jar you will need to have a + * org.bonitasoft.engine.command.RuntimeCommand. + * The behavior of the command must be defined in the execute method of this class.
+ * RuntimeCommand is a class available only in bonita-server.jar. In order to create the jar you will need to have a * dependency on that jar. *

* The jar containing the command class must be added to the engine using the {@link CommandAPI#addDependency} method @@ -66,7 +63,7 @@ *

  * Code example:
* - * In this example we deploy a command named "myCommandName". The class that implements TenantCommand is org.bonitasoft.engine.command.IntegerCommand and + * In this example we deploy a command named "myCommandName". The class that implements RuntimeCommand is org.bonitasoft.engine.command.IntegerCommand and * is contained in the jar we deploy using CommandAPI.addDependency. *
*
diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/PlatformCommandAPI.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/PlatformCommandAPI.java index a13847965fd..fd7f6e7d40a 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/PlatformCommandAPI.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/PlatformCommandAPI.java @@ -34,7 +34,7 @@ * These commands are executed in a platform scope, see {@link CommandAPI} for an explanation of how to deploy, execute, * ... a command. The only * difference between the {@link CommandAPI} and the {@link PlatformCommandAPI} is that a platform command must extend - * {@code org.bonitasoft.engine.command.PlatformCommand}. + * {@code org.bonitasoft.engine.command.RuntimeCommand}. * * @author Matthieu Chaffotte * @author Emmanuel Duchastenier diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/BusinessObjectModelValidationException.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/BusinessObjectModelValidationException.java index 0611c72ecd1..a62683445b1 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/BusinessObjectModelValidationException.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/BusinessObjectModelValidationException.java @@ -13,6 +13,10 @@ **/ package org.bonitasoft.engine.bdm; +import java.io.Serial; + +import org.bonitasoft.engine.api.result.Status; +import org.bonitasoft.engine.api.result.Status.Level; import org.bonitasoft.engine.bdm.validator.ValidationStatus; /** @@ -20,6 +24,9 @@ */ public class BusinessObjectModelValidationException extends Exception { + @Serial + private static final long serialVersionUID = 1L; + private final ValidationStatus validationStatus; public BusinessObjectModelValidationException(final ValidationStatus validationStatus) { @@ -29,13 +36,9 @@ public BusinessObjectModelValidationException(final ValidationStatus validationS @Override public String getMessage() { final StringBuilder sb = new StringBuilder(); - for (final String errorMessage : validationStatus.getErrors()) { - sb.append("\n- "); - sb.append(errorMessage); - } + validationStatus.getStatuses().stream().filter(status -> Level.ERROR.equals(status.getLevel())) + .map(Status::getMessage).forEach(s -> sb.append("\n- ").append(s)); return sb.toString(); } - private static final long serialVersionUID = 1L; - } diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/platform/command/PlatformCommandDescriptor.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/platform/command/PlatformCommandDescriptor.java deleted file mode 100644 index 14f6e8d16ed..00000000000 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/platform/command/PlatformCommandDescriptor.java +++ /dev/null @@ -1,56 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.platform.command; - -import org.bonitasoft.engine.bpm.BonitaObject; - -/** - * Describes a Platform command. Actions related to platform commands are managed by the - * {@link org.bonitasoft.engine.api.PlatformCommandAPI} - * - * @author Zhang Bole - * @see org.bonitasoft.engine.api.PlatformCommandAPI - * @since 6.0.0 - */ -public interface PlatformCommandDescriptor extends BonitaObject { - - /** - * Retrieves the command identifier - * - * @return a long indicating the command identifier - */ - long getId(); - - /** - * Retrieves the command name - * - * @return a String containing the command name - */ - String getName(); - - /** - * Retrieves the command description - * - * @return a String containing the command description - */ - String getDescription(); - - /** - * Retrieves the complete name of the class that implements the command - * - * @return a String containing the complete name of the class that implements the command - */ - String getImplementation(); - -} diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/platform/command/impl/PlatformCommandDescriptorImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/platform/command/impl/PlatformCommandDescriptorImpl.java deleted file mode 100644 index e46e2d0fd25..00000000000 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/platform/command/impl/PlatformCommandDescriptorImpl.java +++ /dev/null @@ -1,79 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.platform.command.impl; - -import org.bonitasoft.engine.platform.command.PlatformCommandDescriptor; - -/** - * @author Zhang Bole - * @author Matthieu Chaffotte - */ -public class PlatformCommandDescriptorImpl implements PlatformCommandDescriptor { - - private static final long serialVersionUID = 5126055774577086808L; - - private long id; - - private String name; - - private String description; - - private String implementation; - - public PlatformCommandDescriptorImpl() { - super(); - } - - PlatformCommandDescriptorImpl(final PlatformCommandDescriptor command) { - name = command.getName(); - description = command.getDescription(); - implementation = command.getImplementation(); - } - - @Override - public long getId() { - return id; - } - - @Override - public String getName() { - return name; - } - - @Override - public String getDescription() { - return description; - } - - @Override - public String getImplementation() { - return implementation; - } - - public void setId(final long id) { - this.id = id; - } - - public void setName(final String name) { - this.name = name; - } - - public void setDescription(final String description) { - this.description = description; - } - - public void setImplementation(final String implementation) { - this.implementation = implementation; - } -} diff --git a/bpm/bonita-common/src/test/java/org/bonitasoft/engine/bdm/validator/rule/BusinessObjectValidationRuleTest.java b/bpm/bonita-common/src/test/java/org/bonitasoft/engine/bdm/validator/rule/BusinessObjectValidationRuleTest.java index 8df109f7e39..c985d8bec66 100644 --- a/bpm/bonita-common/src/test/java/org/bonitasoft/engine/bdm/validator/rule/BusinessObjectValidationRuleTest.java +++ b/bpm/bonita-common/src/test/java/org/bonitasoft/engine/bdm/validator/rule/BusinessObjectValidationRuleTest.java @@ -92,7 +92,7 @@ private void checkQualifiedNameValidationStatus(final String qualifiedName, fina } @Test - public void shoudCheckRule_returns_valid_status() { + public void shouldCheckRule_returns_valid_status() { final BusinessObject bo = aValidBusinesObject(); ValidationStatus validationStatus = businessObjectValidationRule.validate(bo); diff --git a/bpm/bonita-common/src/testFixtures/java/org/bonitasoft/engine/bdm/validator/assertion/ValidationStatusAssert.java b/bpm/bonita-common/src/testFixtures/java/org/bonitasoft/engine/bdm/validator/assertion/ValidationStatusAssert.java index 987044d9ebd..3732b59af8a 100644 --- a/bpm/bonita-common/src/testFixtures/java/org/bonitasoft/engine/bdm/validator/assertion/ValidationStatusAssert.java +++ b/bpm/bonita-common/src/testFixtures/java/org/bonitasoft/engine/bdm/validator/assertion/ValidationStatusAssert.java @@ -13,8 +13,11 @@ **/ package org.bonitasoft.engine.bdm.validator.assertion; +import java.util.Objects; + import org.assertj.core.api.AbstractAssert; import org.assertj.core.api.Assertions; +import org.bonitasoft.engine.api.result.Status; import org.bonitasoft.engine.bdm.validator.ValidationStatus; public class ValidationStatusAssert extends AbstractAssert { @@ -48,7 +51,10 @@ public ValidationStatusAssert isNotOk(String description) { } public ValidationStatusAssert hasError(String errorMessage) { - Assertions.assertThat(actual.getErrors()).contains(errorMessage); + Assertions.assertThat( + actual.getStatuses().stream().filter(status -> Objects.equals(Status.Level.ERROR, status.getLevel())) + .map(Status::getMessage).toList()) + .contains(errorMessage); return this; } } diff --git a/bpm/bonita-core/bonita-home-server/src/main/java/org/bonitasoft/engine/home/BonitaHomeServer.java b/bpm/bonita-core/bonita-home-server/src/main/java/org/bonitasoft/engine/home/BonitaHomeServer.java index bf2b1b1e153..127edd48e0d 100644 --- a/bpm/bonita-core/bonita-home-server/src/main/java/org/bonitasoft/engine/home/BonitaHomeServer.java +++ b/bpm/bonita-core/bonita-home-server/src/main/java/org/bonitasoft/engine/home/BonitaHomeServer.java @@ -19,7 +19,6 @@ import static org.bonitasoft.engine.home.FolderMgr.getPlatformTempFolder; import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.net.URI; @@ -215,27 +214,6 @@ public void deleteTenant(final long tenantId) throws BonitaHomeNotSetException, getTenantStorage().getProfileMD5(tenantId).delete(); } - public void modifyTechnicalUser(long tenantId, String userName, String password) throws IOException { - List tenantEngineConf = getConfigurationService().getTenantEngineConf(tenantId); - for (BonitaConfiguration bonitaConfiguration : tenantEngineConf) { - if (bonitaConfiguration.getResourceName().equals("bonita-tenant-community-custom.properties")) { - Properties properties = new Properties(); - properties.load(new ByteArrayInputStream(bonitaConfiguration.getResourceContent())); - if (userName != null) { - properties.setProperty("bonita.runtime.admin.username", userName); - } - if (password != null) { - properties.setProperty("bonita.runtime.admin.password", password); - } - ByteArrayOutputStream out = new ByteArrayOutputStream(); - properties.store(out, ""); - bonitaConfiguration.setResourceContent(out.toByteArray()); - break; - } - } - getConfigurationService().storeTenantEngineConf(tenantEngineConf, tenantId); - } - public File getSecurityScriptsFolder(long tenantId) throws BonitaHomeNotSetException, IOException { final Folder localFolder = getFolder(getPlatformTempFolder(), "security-scripts").createIfNotExists(); final Folder tenantSecurityScriptsFolder = getFolder(localFolder, String.valueOf(tenantId)).createIfNotExists(); diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/CommandAPIImpl.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/CommandAPIImpl.java index 94cbef73307..59b0435a997 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/CommandAPIImpl.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/CommandAPIImpl.java @@ -355,7 +355,7 @@ public SearchResult searchCommands(final SearchOptions search } } - // Utility classes to factorize how we fetch a TenantCommand + // Utility classes to factorize how we fetch a RuntimeCommand private abstract static class SCommandFetcher { abstract SCommand fetch(final CommandService commandService) throws SCommandNotFoundException; diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/ProcessStarter.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/ProcessStarter.java index 05d8c9453eb..6749c4b3e47 100755 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/ProcessStarter.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/ProcessStarter.java @@ -120,8 +120,6 @@ public ProcessInstance start() } else { throw new ProcessExecutionException(e); } - } catch (final SBonitaException e) { - throw new ProcessExecutionException(e); } } diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/system/CommandWithParameters.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/system/CommandWithParameters.java deleted file mode 100644 index 15a8e16d1fd..00000000000 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/command/system/CommandWithParameters.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.command.system; - -import java.io.Serializable; -import java.util.Map; - -import org.bonitasoft.engine.command.RuntimeCommand; -import org.bonitasoft.engine.command.SCommandParameterizationException; -import org.bonitasoft.engine.command.TenantCommand; - -/** - * @author Elias Ricken de Medeiros - * @author Celine Souchet - * @deprecated since 9.0.0, use {@link RuntimeCommand} instead - */ -@Deprecated(forRemoval = true, since = "9.0.0") -public abstract class CommandWithParameters extends TenantCommand { - - @Deprecated - protected Long getLongMandadoryParameter(final Map parameters, final String field) - throws SCommandParameterizationException { - return getLongMandatoryParameter(parameters, field); - } - - @Deprecated - protected Integer getIntegerMandadoryParameter(final Map parameters, final String field) - throws SCommandParameterizationException { - return getIntegerMandatoryParameter(parameters, field); - } - - @Deprecated - protected String getStringMandadoryParameter(final Map parameters, final String field) - throws SCommandParameterizationException { - return getStringMandatoryParameter(parameters, field); - } - -} diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/ServiceAccessor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/ServiceAccessor.java index 7f8edcafed3..69232b49978 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/ServiceAccessor.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/ServiceAccessor.java @@ -289,8 +289,6 @@ public interface ServiceAccessor { TransactionService getTransactionService(); - TenantServiceAccessor getTenantServiceAccessor(); - PlatformSessionService getPlatformSessionService(); PlatformCommandService getPlatformCommandService(); diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/TenantServiceAccessor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/TenantServiceAccessor.java deleted file mode 100644 index 7bb0c1df9c7..00000000000 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/TenantServiceAccessor.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.service; - -/** - * Accessor for tenant level engine services. - *

- * All server side services of a tenant can be accessed using this class. Using server side services instead of an API - * might cause unexpected behaviors and - * damage your data. - * - * @author Matthieu Chaffotte - * @author Yanyan Liu - * @author Hongwen Zang - * @author Celine Souchet - * @deprecated since 9.0.0, use {@link ServiceAccessor} instead - */ -@Deprecated(forRemoval = true, since = "9.0.0") -public interface TenantServiceAccessor extends ServiceAccessor { - -} diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/TenantServiceSingleton.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/TenantServiceSingleton.java deleted file mode 100644 index a48dd925a08..00000000000 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/TenantServiceSingleton.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.service; - -import org.bonitasoft.engine.service.impl.ServiceAccessorFactory; - -/** - * @deprecated use {@link ServiceAccessorSingleton} instead - * @author Matthieu Chaffotte - */ -@Deprecated(since = "9.0.0", forRemoval = true) -public final class TenantServiceSingleton { - - private static TenantServiceAccessor instance = null; - - private TenantServiceSingleton() { - super(); - } - - private static TenantServiceAccessor getTenant() { - try { - return ServiceAccessorFactory.getInstance().createTenantServiceAccessor(); - } catch (final Exception e) { - throw new RuntimeException(e); - } - } - - public static TenantServiceAccessor getInstance() { - if (instance == null) { - instance = getTenant(); - } - return instance; - } - -} diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessorFactory.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessorFactory.java index b5a4aa98fa4..d1477e9631f 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessorFactory.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessorFactory.java @@ -15,14 +15,11 @@ import java.io.IOException; -import org.bonitasoft.engine.commons.exceptions.SBonitaException; import org.bonitasoft.engine.exception.BonitaHomeConfigurationException; import org.bonitasoft.engine.exception.BonitaHomeNotSetException; import org.bonitasoft.engine.home.BonitaHomeServer; import org.bonitasoft.engine.service.APIAccessResolver; -import org.bonitasoft.engine.service.PlatformServiceAccessor; import org.bonitasoft.engine.service.ServiceAccessor; -import org.bonitasoft.engine.service.TenantServiceAccessor; import org.bonitasoft.engine.sessionaccessor.SessionAccessor; /** @@ -52,16 +49,6 @@ public synchronized ServiceAccessor createServiceAccessor() throws BonitaHomeCon return getServiceAccessors().getServiceAccessor(); } - /** - * @deprecated since 9.0.0, use {@link #createServiceAccessor()} instead - */ - @Deprecated(forRemoval = true, since = "9.0.0") - public synchronized PlatformServiceAccessor createPlatformServiceAccessor() - throws BonitaHomeNotSetException, IOException, BonitaHomeConfigurationException, - ReflectiveOperationException { - return getServiceAccessors().getPlatformServiceAccessor(); - } - private synchronized ServiceAccessors getServiceAccessors() throws BonitaHomeConfigurationException, IOException, ReflectiveOperationException { if (serviceAccessors == null) { @@ -71,16 +58,6 @@ private synchronized ServiceAccessors getServiceAccessors() throws BonitaHomeCon return serviceAccessors; } - /** - * @deprecated since 9.0.0, use {@link #createServiceAccessor()} instead - */ - @Deprecated(forRemoval = true, since = "9.0.0") - public TenantServiceAccessor createTenantServiceAccessor() - throws SBonitaException, BonitaHomeNotSetException, IOException, - BonitaHomeConfigurationException, ReflectiveOperationException { - return getServiceAccessors().getTenantServiceAccessor(); - } - public SessionAccessor createSessionAccessor() throws BonitaHomeNotSetException, IOException, BonitaHomeConfigurationException, ReflectiveOperationException { diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessors.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessors.java index fb8df466473..db32efa2299 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessors.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/ServiceAccessors.java @@ -13,9 +13,7 @@ **/ package org.bonitasoft.engine.service.impl; -import org.bonitasoft.engine.service.PlatformServiceAccessor; import org.bonitasoft.engine.service.ServiceAccessor; -import org.bonitasoft.engine.service.TenantServiceAccessor; /** * This is the main entry point to the engine services @@ -24,25 +22,7 @@ */ public interface ServiceAccessors { - /** - * @deprecated since 9.0.0, use {@link #getServiceAccessor()} instead - */ - @Deprecated(forRemoval = true, since = "9.0.0") - PlatformInitServiceAccessor getPlatformInitServiceAccessor(); - ServiceAccessor getServiceAccessor(); - /** - * @deprecated since 9.0.0, use {@link #getServiceAccessor()} instead - */ - @Deprecated(forRemoval = true, since = "9.0.0") - PlatformServiceAccessor getPlatformServiceAccessor(); - - /** - * @deprecated since 9.0.0, use {@link #getServiceAccessor()} instead - */ - @Deprecated(forRemoval = true, since = "9.0.0") - TenantServiceAccessor getTenantServiceAccessor(); - void destroy(); } diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringPlatformInitServiceAccessor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringPlatformInitServiceAccessor.java deleted file mode 100644 index 295d6eb684a..00000000000 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringPlatformInitServiceAccessor.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.service.impl; - -/** - * Uses spring to access platform init services - * - * @deprecated since 9.0.0, use {@link SpringServiceAccessor} instead - */ -@Deprecated(forRemoval = true, since = "9.0.0") -public class SpringPlatformInitServiceAccessor extends SpringServiceAccessor { - - public SpringPlatformInitServiceAccessor(final SpringBeanAccessor beanAccessor) { - super(beanAccessor); - } - -} diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringPlatformServiceAccessor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringPlatformServiceAccessor.java deleted file mode 100644 index daab65dff2f..00000000000 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringPlatformServiceAccessor.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.service.impl; - -import org.bonitasoft.engine.dependency.DependencyService; -import org.bonitasoft.engine.service.ServiceAccessor; - -/** - * Uses spring to access platform services - * - * @deprecated since 9.0.0, use {@link SpringServiceAccessor} instead - */ -@Deprecated(forRemoval = true, since = "9.0.0") -public class SpringPlatformServiceAccessor extends SpringServiceAccessor { - - public SpringPlatformServiceAccessor(final SpringBeanAccessor beanAccessor) { - super(beanAccessor); - } - - /** - * @deprecated use {@link ServiceAccessor#getPlatformDependencyService()} instead - */ - @Override - @Deprecated(since = "9.0.0") - public DependencyService getDependencyService() { - return beanAccessor.getService("platformDependencyService", DependencyService.class); - } - -} diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessor.java index 2c4ec1a4278..daec2ed6dd2 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessor.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessor.java @@ -95,11 +95,8 @@ import org.bonitasoft.engine.search.descriptor.SearchEntitiesDescriptor; import org.bonitasoft.engine.service.BroadcastService; import org.bonitasoft.engine.service.InstallationService; -import org.bonitasoft.engine.service.PlatformServiceAccessor; import org.bonitasoft.engine.service.ServiceAccessor; import org.bonitasoft.engine.service.ServicesResolver; -import org.bonitasoft.engine.service.TenantServiceAccessor; -import org.bonitasoft.engine.service.TenantServiceSingleton; import org.bonitasoft.engine.services.QueriableLoggerService; import org.bonitasoft.engine.session.SessionService; import org.bonitasoft.engine.sessionaccessor.SessionAccessor; @@ -117,8 +114,7 @@ import org.springframework.context.ApplicationContext; import org.springframework.core.env.Environment; -public class SpringServiceAccessor - implements ServiceAccessor, TenantServiceAccessor, PlatformServiceAccessor, PlatformInitServiceAccessor { +public class SpringServiceAccessor implements ServiceAccessor { protected final SpringBeanAccessor beanAccessor; @@ -588,11 +584,6 @@ public PlatformService getPlatformService() { return beanAccessor.getService(PlatformService.class); } - @Override - public TenantServiceAccessor getTenantServiceAccessor() { - return TenantServiceSingleton.getInstance(); - } - @Override public PlatformCommandService getPlatformCommandService() { return beanAccessor.getService("platformCommandService", PlatformCommandService.class); diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessors.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessors.java index 623779fe6cb..21aa22c38cd 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessors.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringServiceAccessors.java @@ -13,56 +13,37 @@ **/ package org.bonitasoft.engine.service.impl; -import org.bonitasoft.engine.service.PlatformServiceAccessor; import org.bonitasoft.engine.service.ServiceAccessor; -import org.bonitasoft.engine.service.TenantServiceAccessor; /** * @author Baptiste Mesta. */ public class SpringServiceAccessors implements ServiceAccessors { - private SpringBeanAccessor platform; + private SpringBeanAccessor springBeanAccessor; //---- Initialize spring contexts protected synchronized SpringBeanAccessor getBeanAccessor() { - if (platform == null) { - platform = createBeanAccessor(); + if (springBeanAccessor == null) { + springBeanAccessor = createBeanAccessor(); } - return platform; + return springBeanAccessor; } protected SpringBeanAccessor createBeanAccessor() { return new SpringBeanAccessor(); } - //---- Wrap context with service accessors - - @Override - public PlatformInitServiceAccessor getPlatformInitServiceAccessor() { - return new SpringPlatformInitServiceAccessor(getBeanAccessor()); - } - @Override public ServiceAccessor getServiceAccessor() { return new SpringServiceAccessor(getBeanAccessor()); } - @Override - public PlatformServiceAccessor getPlatformServiceAccessor() { - return new SpringPlatformServiceAccessor(getBeanAccessor()); - } - - @Override - public TenantServiceAccessor getTenantServiceAccessor() { - return new SpringTenantServiceAccessor(getBeanAccessor()); - } - @Override public void destroy() { - if (platform != null) { - platform.destroy(); - platform = null; + if (springBeanAccessor != null) { + springBeanAccessor.destroy(); + springBeanAccessor = null; } } } diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringTenantServiceAccessor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringTenantServiceAccessor.java deleted file mode 100644 index 59fd0ebbe18..00000000000 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/service/impl/SpringTenantServiceAccessor.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.service.impl; - -import org.bonitasoft.engine.dependency.DependencyService; - -/** - * Uses spring to access tenant services - * - * @deprecated since 9.0.0, use {@link SpringServiceAccessor} instead - */ -@Deprecated(forRemoval = true, since = "9.0.0") -public class SpringTenantServiceAccessor extends SpringServiceAccessor { - - public SpringTenantServiceAccessor(final SpringBeanAccessor beanAccessor) { - super(beanAccessor); - } - - @Override - public DependencyService getDependencyService() { - return beanAccessor.getService("dependencyService", DependencyService.class); - } - -} diff --git a/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/api/impl/MaintenanceAPIImplTest.java b/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/api/impl/MaintenanceAPIImplTest.java index 0eb4614d233..0af15476ff2 100644 --- a/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/api/impl/MaintenanceAPIImplTest.java +++ b/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/api/impl/MaintenanceAPIImplTest.java @@ -21,7 +21,7 @@ import org.bonitasoft.engine.platform.model.SPlatform; import org.bonitasoft.engine.platform.model.STenant; import org.bonitasoft.engine.recorder.model.EntityUpdateDescriptor; -import org.bonitasoft.engine.service.TenantServiceAccessor; +import org.bonitasoft.engine.service.ServiceAccessor; import org.bonitasoft.engine.tenant.TenantStateManager; import org.bonitasoft.engine.transaction.TransactionService; import org.junit.Before; @@ -39,7 +39,7 @@ public class MaintenanceAPIImplTest { public static final long TENANT_ID = 56423L; @Mock - private TenantServiceAccessor serviceAccessor; + private ServiceAccessor serviceAccessor; @Mock private PlatformService platformService; @Mock @@ -107,7 +107,7 @@ public void update_maintenance_msg_should_pass_message_to_platform_service() thr //then ArgumentCaptor captor = ArgumentCaptor.forClass(EntityUpdateDescriptor.class);; verify(platformService).updatePlatform(captor.capture()); - assertThat(captor.getValue().getFields().containsValue(msg)); + assertThat(captor.getValue().getFields()).containsValue(msg); } @Test @@ -119,7 +119,7 @@ public void enable_maintenance_mode_msg_should_update_platform_service() throws //then ArgumentCaptor captor = ArgumentCaptor.forClass(EntityUpdateDescriptor.class);; verify(platformService).updatePlatform(captor.capture()); - assertThat(captor.getValue().getFields().containsValue(true)); + assertThat(captor.getValue().getFields()).containsValue(true); } @Test @@ -131,6 +131,6 @@ public void disable_maintenance_mode_msg_should_update_platform_service() throws //then ArgumentCaptor captor = ArgumentCaptor.forClass(EntityUpdateDescriptor.class);; verify(platformService).updatePlatform(captor.capture()); - assertThat(captor.getValue().getFields().containsValue(false)); + assertThat(captor.getValue().getFields()).containsValue(false); } } diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/bpm/flownode/IFlowNodeItem.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/bpm/flownode/IFlowNodeItem.java index 79925d3f39e..30ec4eb1aa5 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/bpm/flownode/IFlowNodeItem.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/bpm/flownode/IFlowNodeItem.java @@ -33,11 +33,6 @@ public interface IFlowNodeItem extends IItem, ItemHasUniqueId, ItemHasDualName, String ATTRIBUTE_PROCESS_ID = "processId"; - /** - * @see IFlowNodeItem#ATTRIBUTE_ROOT_CASE_ID - * @deprecated since 6.4.0 - */ - @Deprecated String ATTRIBUTE_CASE_ID = "caseId"; /** diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractFlowNodeDatastore.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractFlowNodeDatastore.java index 631d23941af..24ef982ff3b 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractFlowNodeDatastore.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractFlowNodeDatastore.java @@ -106,8 +106,6 @@ public CONSOLE_ITEM get(final APIID id) { return convertEngineToConsoleItem(flowNodeInstance); } catch (final NotFoundException e) { throw new APIItemNotFoundException(FlowNodeDefinition.TOKEN, id); - } catch (final BonitaException e) { - throw new APIException(e); } } diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractHumanTaskDatastore.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractHumanTaskDatastore.java index ce6c8cff629..0611aa2abbe 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractHumanTaskDatastore.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/AbstractHumanTaskDatastore.java @@ -275,8 +275,6 @@ public CONSOLE_ITEM get(final APIID id) { return convertEngineToConsoleItem(humanTaskInstance); } catch (final ActivityInstanceNotFoundException e) { throw new APIItemNotFoundException(HumanTaskDefinition.TOKEN, id); - } catch (final BonitaException e) { - throw new APIException(e); } } diff --git a/services/bonita-builder/src/main/resources/org/bonitasoft/engine/builder/builder-factories.properties b/services/bonita-builder/src/main/resources/org/bonitasoft/engine/builder/builder-factories.properties index 7b660b371ea..4092ff702ed 100644 --- a/services/bonita-builder/src/main/resources/org/bonitasoft/engine/builder/builder-factories.properties +++ b/services/bonita-builder/src/main/resources/org/bonitasoft/engine/builder/builder-factories.properties @@ -83,7 +83,6 @@ org.bonitasoft.engine.identity.model.builder.SUserMembershipUpdateBuilderFactory org.bonitasoft.engine.identity.model.builder.SUserUpdateBuilderFactory = org.bonitasoft.engine.identity.model.builder.impl.SUserUpdateBuilderFactoryImpl org.bonitasoft.engine.platform.command.model.SPlatformCommandLogBuilderFactory = org.bonitasoft.engine.platform.command.model.impl.SPlatformCommandLogBuilderFactoryImpl org.bonitasoft.engine.platform.command.model.SPlatformCommandUpdateBuilderFactory = org.bonitasoft.engine.platform.command.model.impl.SPlatformCommandUpdateBuilderFactoryImpl -org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilderFactory = org.bonitasoft.engine.platform.model.builder.impl.STenantUpdateBuilderFactoryImpl org.bonitasoft.engine.platform.session.model.builder.SPlatformSessionBuilderFactory = org.bonitasoft.engine.platform.session.model.builder.impl.SPlatformSessionBuilderFactoryImpl org.bonitasoft.engine.profile.builder.SProfileMemberUpdateBuilderFactory = org.bonitasoft.engine.profile.builder.impl.SProfileMemberUpdateBuilderFactoryImpl org.bonitasoft.engine.profile.builder.SProfileUpdateBuilderFactory = org.bonitasoft.engine.profile.builder.impl.SProfileUpdateBuilderFactoryImpl diff --git a/services/bonita-cache/src/main/java/org/bonitasoft/engine/cache/ehcache/EhCacheCacheService.java b/services/bonita-cache/src/main/java/org/bonitasoft/engine/cache/ehcache/EhCacheCacheService.java index b309a6d3777..bc2dc4551fb 100644 --- a/services/bonita-cache/src/main/java/org/bonitasoft/engine/cache/ehcache/EhCacheCacheService.java +++ b/services/bonita-cache/src/main/java/org/bonitasoft/engine/cache/ehcache/EhCacheCacheService.java @@ -74,7 +74,7 @@ protected Set getCacheConfigurationNames() { protected CacheConfiguration getEhCacheConfiguration( final org.bonitasoft.engine.cache.CacheConfiguration cacheConfig) { final CacheConfiguration ehCacheConfig = new CacheConfiguration(); - ehCacheConfig.setMaxElementsInMemory(cacheConfig.getMaxElementsInMemory()); + ehCacheConfig.setMaxEntriesLocalHeap(cacheConfig.getMaxElementsInMemory()); ehCacheConfig.setMaxElementsOnDisk(cacheConfig.getMaxElementsOnDisk()); ehCacheConfig.setOverflowToDisk(!cacheConfig.isInMemoryOnly()); ehCacheConfig.setEternal(cacheConfig.isEternal()); diff --git a/services/bonita-external-identity-mapping/src/main/java/org/bonitasoft/engine/external/identity/mapping/model/SExternalIdentityMapping.java b/services/bonita-external-identity-mapping/src/main/java/org/bonitasoft/engine/external/identity/mapping/model/SExternalIdentityMapping.java index adb224dc220..d32ef5f92a5 100644 --- a/services/bonita-external-identity-mapping/src/main/java/org/bonitasoft/engine/external/identity/mapping/model/SExternalIdentityMapping.java +++ b/services/bonita-external-identity-mapping/src/main/java/org/bonitasoft/engine/external/identity/mapping/model/SExternalIdentityMapping.java @@ -54,8 +54,11 @@ public static class SExternalIdentityMappingBuilder { private long tenantId; private String kind; private String externalId; + @Builder.Default private long userId = -1; + @Builder.Default private long groupId = -1; + @Builder.Default private long roleId = -1; @Transient private transient String displayNamePart1; diff --git a/services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/recorder/SelectDescriptorBuilder.java b/services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/recorder/SelectDescriptorBuilder.java index ecf8d218efc..5c45ec43e8b 100644 --- a/services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/recorder/SelectDescriptorBuilder.java +++ b/services/bonita-identity/src/main/java/org/bonitasoft/engine/identity/recorder/SelectDescriptorBuilder.java @@ -13,10 +13,10 @@ **/ package org.bonitasoft.engine.identity.recorder; -import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.bonitasoft.engine.identity.model.SContactInfo; @@ -47,8 +47,8 @@ public static SelectListDescriptor getChildrenOfGroup(final SGroup group } public static SelectListDescriptor getChildrenOfGroup(final SGroup group, final QueryOptions queryOptions) { - final Map parameters = Collections.singletonMap("groupPath", (Object) group.getPath()); - return new SelectListDescriptor("getChildrenOfGroup", parameters, SGroup.class, queryOptions); + final Map parameters = Collections.singletonMap("groupPath", group.getPath()); + return new SelectListDescriptor<>("getChildrenOfGroup", parameters, SGroup.class, queryOptions); } public static SelectListDescriptor getChildrenOfGroup(final SGroup group, final String field, @@ -60,7 +60,7 @@ public static SelectListDescriptor getChildrenOfGroup(final SGroup group public static SelectByIdDescriptor getElementById(final Class clazz, final String elementName, final long id) { - return new SelectByIdDescriptor(clazz, id); + return new SelectByIdDescriptor<>(clazz, id); } public static SelectListDescriptor getElements(final Class clazz, @@ -74,7 +74,7 @@ public static SelectListDescriptor getElements(f final String elementName, final QueryOptions queryOptions) { final Map parameters = Collections.emptyMap(); - return new SelectListDescriptor("get" + elementName + "s", parameters, clazz, queryOptions); + return new SelectListDescriptor<>("get" + elementName + "s", parameters, clazz, queryOptions); } public static SelectListDescriptor getElements(final Class clazz, @@ -87,139 +87,134 @@ public static SelectListDescriptor getElements(f public static SelectListDescriptor getElementsByIds(final Class clazz, final String elementName, final Collection ids) { - final Map parameters = Collections.singletonMap("ids", (Object) ids); + final Map parameters = Collections.singletonMap("ids", ids); final int maxResults = ids != null ? ids.size() : 0; - return new SelectListDescriptor("get" + elementName + "sByIds", parameters, clazz, + return new SelectListDescriptor<>("get" + elementName + "sByIds", parameters, clazz, new QueryOptions(0, maxResults)); } public static SelectOneDescriptor getGroupByName(final String groupName) { - final Map parameters = Collections.singletonMap("name", (Object) groupName); - return new SelectOneDescriptor("getGroupByName", parameters, SGroup.class); + final Map parameters = Collections.singletonMap("name", groupName); + return new SelectOneDescriptor<>("getGroupByName", parameters, SGroup.class); } public static SelectOneDescriptor getGroupByPath(final String parentPath, final String groupName) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("name", groupName); parameters.put("parentPath", parentPath); - return new SelectOneDescriptor("getGroupByNameAndPath", parameters, SGroup.class); + return new SelectOneDescriptor<>("getGroupByNameAndPath", parameters, SGroup.class); } public static SelectByIdDescriptor getLightElementById(final Class clazz, final String elementName, final long id) { - return new SelectByIdDescriptor(clazz, id); + return new SelectByIdDescriptor<>(clazz, id); } public static SelectOneDescriptor getLightUserMembership(final long userId, final long groupId, final long roleId) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("userId", userId); parameters.put("roleId", roleId); parameters.put("groupId", groupId); - return new SelectOneDescriptor("getLightUserMembershipWithIds", parameters, + return new SelectOneDescriptor<>("getLightUserMembershipWithIds", parameters, SUserMembership.class); } public static SelectOneDescriptor getCustomUserInfoDefinitionByName(final String name) { - final Map parameters = Collections.singletonMap("name", (Object) name); - return new SelectOneDescriptor("getCustomUserInfoDefinitionByName", parameters, + final Map parameters = Collections.singletonMap("name", name); + return new SelectOneDescriptor<>("getCustomUserInfoDefinitionByName", parameters, SCustomUserInfoDefinition.class); } public static SelectOneDescriptor getNumberOfElement(final String elementName, final Class clazz) { final Map emptyMap = Collections.emptyMap(); - return new SelectOneDescriptor("getNumberOf" + elementName, emptyMap, clazz, Long.class); + return new SelectOneDescriptor<>("getNumberOf" + elementName, emptyMap, clazz, Long.class); } public static SelectOneDescriptor getNumberOfGroupChildren(final String groupParentPath) { - final Map parameters = Collections.singletonMap("parentPath", (Object) groupParentPath); - return new SelectOneDescriptor("getNumberOfGroupChildren", parameters, SGroup.class, Long.class); + final Map parameters = Collections.singletonMap("parentPath", groupParentPath); + return new SelectOneDescriptor<>("getNumberOfGroupChildren", parameters, SGroup.class, Long.class); } public static SelectOneDescriptor getNumberOfUserMembershipsOfUser(final long userId) { - final Map parameters = Collections.singletonMap("userId", (Object) userId); - return new SelectOneDescriptor("getNumberOfUserMembershipsOfUser", parameters, SUserMembership.class, + final Map parameters = Collections.singletonMap("userId", userId); + return new SelectOneDescriptor<>("getNumberOfUserMembershipsOfUser", parameters, SUserMembership.class, Long.class); } public static SelectOneDescriptor getNumberOfUsersByGroup(final long groupId) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("groupId", groupId); - return new SelectOneDescriptor("getNumberOfUsersByGroup", parameters, SUser.class, Long.class); + return new SelectOneDescriptor<>("getNumberOfUsersByGroup", parameters, SUser.class, Long.class); } public static SelectOneDescriptor getNumberOfUsersByMembership(final long groupId, final long roleId) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("roleId", roleId); parameters.put("groupId", groupId); - return new SelectOneDescriptor("getNumberOfUsersByMembership", parameters, SUser.class, Long.class); + return new SelectOneDescriptor<>("getNumberOfUsersByMembership", parameters, SUser.class, Long.class); } public static SelectOneDescriptor getNumberOfUsersByRole(final long roleId) { - final Map parameters = Collections.singletonMap("roleId", (Object) roleId); - return new SelectOneDescriptor("getNumberOfUsersByRole", parameters, SUser.class, Long.class); + final Map parameters = Collections.singletonMap("roleId", roleId); + return new SelectOneDescriptor<>("getNumberOfUsersByRole", parameters, SUser.class, Long.class); } public static SelectOneDescriptor getRoleByName(final String roleName) { - final Map parameters = Collections.singletonMap("name", (Object) roleName); - return new SelectOneDescriptor("getRoleByName", parameters, SRole.class); + final Map parameters = Collections.singletonMap("name", roleName); + return new SelectOneDescriptor<>("getRoleByName", parameters, SRole.class); } public static SelectOneDescriptor getUserByUserName(final String userName) { - final Map parameters = Collections.singletonMap("userName", (Object) userName); - return new SelectOneDescriptor("getUserByUserName", parameters, SUser.class); + final Map parameters = Collections.singletonMap("userName", userName); + return new SelectOneDescriptor<>("getUserByUserName", parameters, SUser.class); } public static SelectOneDescriptor getUserContactInfo(final long userId, final boolean isPersonal) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("userId", userId); parameters.put("personal", isPersonal); - return new SelectOneDescriptor("getUserContactInfo", parameters, SContactInfo.class); + return new SelectOneDescriptor<>("getUserContactInfo", parameters, SContactInfo.class); } public static SelectOneDescriptor getUserMembership(final long userId, final long groupId, final long roleId) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("userId", userId); parameters.put("roleId", roleId); parameters.put("groupId", groupId); - return new SelectOneDescriptor("getUserMembershipWithIds", parameters, SUserMembership.class); + return new SelectOneDescriptor<>("getUserMembershipWithIds", parameters, SUserMembership.class); } public static SelectListDescriptor getUserMembershipsByGroup(final long groupId, final int startIndex, final int maxResults) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("groupId", groupId); - return new SelectListDescriptor("getUserMembershipsByGroup", parameters, SUserMembership.class, + return new SelectListDescriptor<>("getUserMembershipsByGroup", parameters, SUserMembership.class, new QueryOptions(startIndex, maxResults)); } public static SelectListDescriptor getUserMembershipsByRole(final long roleId, final int startIndex, final int maxResults) { - final Map parameters = Collections.singletonMap("roleId", (Object) roleId); - return new SelectListDescriptor("getUserMembershipsByRole", parameters, SUserMembership.class, + final Map parameters = Collections.singletonMap("roleId", roleId); + return new SelectListDescriptor<>("getUserMembershipsByRole", parameters, SUserMembership.class, new QueryOptions(startIndex, maxResults)); } - public static SelectListDescriptor getUserMembershipsOfUser(final long userId) { - return getUserMembershipsOfUser(userId, - new QueryOptions(Arrays.asList(new OrderByOption(SUserMembership.class, "id", OrderByType.ASC)))); - } - public static SelectListDescriptor getUserMembershipsOfUser(final long userId, final int fromIndex, final int numberOfMemberships) { final QueryOptions queryOptions = new QueryOptions(fromIndex, numberOfMemberships, - Arrays.asList(new OrderByOption(SUserMembership.class, "id", + List.of(new OrderByOption(SUserMembership.class, "id", OrderByType.ASC))); return getUserMembershipsOfUser(userId, queryOptions); } public static SelectListDescriptor getUserMembershipsOfUser(final long userId, final QueryOptions queryOptions) { - final Map parameters = Collections.singletonMap("userId", (Object) userId); - return new SelectListDescriptor("getUserMembershipsOfUser", parameters, SUserMembership.class, + final Map parameters = Collections.singletonMap("userId", userId); + return new SelectListDescriptor<>("getUserMembershipsOfUser", parameters, SUserMembership.class, queryOptions); } @@ -233,13 +228,13 @@ public static SelectListDescriptor getUserMembershipsOfUser(fin public static SelectListDescriptor getUserMembershipsWithGroup(final QueryOptions queryOptions) { final Map parameters = Collections.emptyMap(); - return new SelectListDescriptor("getUserMembershipsWithGroup", parameters, + return new SelectListDescriptor<>("getUserMembershipsWithGroup", parameters, SUserMembership.class, queryOptions); } public static SelectListDescriptor getUserMembershipsWithRole(final QueryOptions queryOptions) { final Map parameters = Collections.emptyMap(); - return new SelectListDescriptor("getUserMembershipsWithRole", parameters, + return new SelectListDescriptor<>("getUserMembershipsWithRole", parameters, SUserMembership.class, queryOptions); } @@ -250,9 +245,9 @@ public static SelectListDescriptor getUsersByGroup(final long groupId, fi } private static SelectListDescriptor getUsersByGroup(final long groupId, final QueryOptions queryOptions) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("groupId", groupId); - return new SelectListDescriptor("getUsersInGroup", parameters, SUser.class, queryOptions); + return new SelectListDescriptor<>("getUsersInGroup", parameters, SUser.class, queryOptions); } public static SelectListDescriptor getActiveUsersByGroup(final long groupId, final int fromIndex, @@ -269,7 +264,7 @@ public static SelectListDescriptor getInactiveUsersByGroup(final long gro private static SelectListDescriptor getInactiveUsersByGroup(final long groupId, final QueryOptions queryOptions) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("groupId", groupId); parameters.put("enabled", false); return new SelectListDescriptor<>("getUsersInGroupWithEnabledParameter", parameters, SUser.class, queryOptions); @@ -277,7 +272,7 @@ private static SelectListDescriptor getInactiveUsersByGroup(final long gr private static SelectListDescriptor getActiveUsersByGroup(final long groupId, final QueryOptions queryOptions) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("groupId", groupId); parameters.put("enabled", true); return new SelectListDescriptor<>("getUsersInGroupWithEnabledParameter", parameters, SUser.class, queryOptions); @@ -306,9 +301,9 @@ public static SelectListDescriptor getUsersByGroup(final long groupId, fi public static SelectListDescriptor getUsersWithManager(final long managerUserId, final QueryOptions queryOptions) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("managerUserId", managerUserId); - return new SelectListDescriptor("getUsersWithManager", parameters, SUser.class, queryOptions); + return new SelectListDescriptor<>("getUsersWithManager", parameters, SUser.class, queryOptions); } public static SelectListDescriptor getActiveUsersWithManager(long managerUserId, QueryOptions queryOptions) { @@ -341,10 +336,10 @@ public static SelectListDescriptor getUsersByMembership(final long groupI private static SelectListDescriptor getUsersByMembership(final long groupId, final long roleId, final QueryOptions queryOptions) { - final Map parameters = new HashMap(); + final Map parameters = new HashMap<>(); parameters.put("roleId", roleId); parameters.put("groupId", groupId); - return new SelectListDescriptor("getUsersByMembership", parameters, SUser.class, queryOptions); + return new SelectListDescriptor<>("getUsersByMembership", parameters, SUser.class, queryOptions); } public static SelectListDescriptor getUsersByMembership(final long groupId, final long roleId, diff --git a/services/bonita-log/src/main/java/org/bonitasoft/engine/queriablelogger/model/SQueriableLogParameter.java b/services/bonita-log/src/main/java/org/bonitasoft/engine/queriablelogger/model/SQueriableLogParameter.java index 11965d92b57..c10109bc853 100644 --- a/services/bonita-log/src/main/java/org/bonitasoft/engine/queriablelogger/model/SQueriableLogParameter.java +++ b/services/bonita-log/src/main/java/org/bonitasoft/engine/queriablelogger/model/SQueriableLogParameter.java @@ -45,6 +45,7 @@ public class SQueriableLogParameter implements PersistentObject { @Id private long tenantId; @Id + @Builder.Default private long id = -1; @Column(name = "B_LOG_ID") private long queriableLogId; diff --git a/services/bonita-page/src/main/java/org/bonitasoft/engine/page/AbstractSPage.java b/services/bonita-page/src/main/java/org/bonitasoft/engine/page/AbstractSPage.java index e6ef7a18d58..e193d3f65bc 100644 --- a/services/bonita-page/src/main/java/org/bonitasoft/engine/page/AbstractSPage.java +++ b/services/bonita-page/src/main/java/org/bonitasoft/engine/page/AbstractSPage.java @@ -17,6 +17,7 @@ import javax.persistence.IdClass; import javax.persistence.MappedSuperclass; +import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; import lombok.experimental.SuperBuilder; @@ -41,7 +42,9 @@ public class AbstractSPage implements PersistentObject { private long installationDate; private long installedBy; private boolean provided; + @Builder.Default private boolean editable = true; + @Builder.Default private boolean removable = true; private long lastModificationDate; private long lastUpdatedBy; diff --git a/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPage.java b/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPage.java index 7fab67e84ab..cd8531b06f0 100644 --- a/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPage.java +++ b/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPage.java @@ -73,12 +73,7 @@ public SPage(final String name, final String description, final String displayNa } public SPage(final SPage sPage) { - this(sPage.getName(), sPage.getDescription(), sPage.getDisplayName(), sPage.getInstallationDate(), - sPage.getInstalledBy(), sPage.isProvided(), sPage.isEditable(), sPage - .getLastModificationDate(), - sPage.getLastUpdatedBy(), sPage.getContentName()); - setContentType(sPage.getContentType()); - setProcessDefinitionId(sPage.getProcessDefinitionId()); + super(sPage); } public SPage(final String name, final long installationDate, final long installedBy, final boolean provided, diff --git a/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPageMapping.java b/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPageMapping.java index a367370d118..06905bee875 100644 --- a/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPageMapping.java +++ b/services/bonita-page/src/main/java/org/bonitasoft/engine/page/SPageMapping.java @@ -68,6 +68,7 @@ public class SPageMapping implements PersistentObject { private String pageAuthorizRules; @Transient + @Builder.Default private List authorizationRules = new ArrayList<>(); private void parseRules() { diff --git a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/PlatformService.java b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/PlatformService.java index a9b8a65f220..5cd2921bfcf 100644 --- a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/PlatformService.java +++ b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/PlatformService.java @@ -27,7 +27,6 @@ public interface PlatformService { String PLATFORM = "PLATFORM"; - String TENANT = "TENANT"; /** * Retrieve the platform from the cache @@ -40,19 +39,6 @@ public interface PlatformService { */ SPlatform getPlatform() throws SPlatformNotFoundException; - /** - * Update a sTenant from given sTenant and new content. - * - * @param tenant - * sTenant - * @param descriptor - * new content - * @throws STenantUpdateException - * occurs when an exception is thrown during sTenant update - * @since 6.0 - */ - void updateTenant(STenant tenant, EntityUpdateDescriptor descriptor) throws STenantUpdateException; - /** * Get tenant by its id * diff --git a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/exception/STenantUpdateException.java b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/exception/STenantUpdateException.java index 0bf4e6b15f8..636c2638ad5 100644 --- a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/exception/STenantUpdateException.java +++ b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/exception/STenantUpdateException.java @@ -24,14 +24,6 @@ public class STenantUpdateException extends SBonitaException { private static final long serialVersionUID = 7615655279956204016L; - public STenantUpdateException(final String message) { - super(message); - } - - public STenantUpdateException(final Throwable e) { - super(e); - } - public STenantUpdateException(final String message, final Throwable e) { super(message, e); } diff --git a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/impl/PlatformServiceImpl.java b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/impl/PlatformServiceImpl.java index 2f6a749a750..caa40ca5c8b 100644 --- a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/impl/PlatformServiceImpl.java +++ b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/impl/PlatformServiceImpl.java @@ -38,7 +38,6 @@ @Slf4j public class PlatformServiceImpl implements PlatformService { - private static final String TENANT = "TENANT"; private static final String QUERY_GET_DEFAULT_TENANT = "getDefaultTenant"; private final PersistenceService platformPersistenceService; @@ -122,16 +121,6 @@ public long getDefaultTenantId() throws STenantNotFoundException { return defaultTenantId; } - @Override - public void updateTenant(final STenant tenant, final EntityUpdateDescriptor descriptor) - throws STenantUpdateException { - try { - recorder.recordUpdate(UpdateRecord.buildSetFields(tenant, descriptor), TENANT); - } catch (final SRecorderException e) { - throw new STenantUpdateException("Problem while updating tenant: " + tenant, e); - } - } - @Override public void activateTenant(final long tenantId) throws STenantNotFoundException, STenantActivationException { final STenant tenant = getDefaultTenant(); diff --git a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/STenantUpdateBuilder.java b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/STenantUpdateBuilder.java deleted file mode 100644 index b0221026885..00000000000 --- a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/STenantUpdateBuilder.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.platform.model.builder; - -import org.bonitasoft.engine.recorder.model.EntityUpdateDescriptor; - -/** - * @author Celine Souchet - */ -public interface STenantUpdateBuilder { - - EntityUpdateDescriptor done(); - - STenantUpdateBuilder setName(String name); - - STenantUpdateBuilder setDescription(String description); - - STenantUpdateBuilder setIconPath(String iconPath); - - STenantUpdateBuilder setIconName(String iconName); - - STenantUpdateBuilder setStatus(String status); - - STenantUpdateBuilder setSecurityActivated(boolean securityActivated); - -} diff --git a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/STenantUpdateBuilderFactory.java b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/STenantUpdateBuilderFactory.java deleted file mode 100644 index 8219e9a3eb5..00000000000 --- a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/STenantUpdateBuilderFactory.java +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.platform.model.builder; - -/** - * @author Celine Souchet - */ -public interface STenantUpdateBuilderFactory { - - final static String NAME = "name"; - - final static String DESCRIPTION = "description"; - - final static String ICON_NAME = "iconName"; - - final static String ICON_PATH = "iconPath"; - - final static String STATUS = "status"; - - final static String SECURITY_ACTIVATED = "securityActivated"; - - STenantUpdateBuilder createNewInstance(); - -} diff --git a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/impl/STenantUpdateBuilderFactoryImpl.java b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/impl/STenantUpdateBuilderFactoryImpl.java deleted file mode 100644 index 8fb8b935d39..00000000000 --- a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/impl/STenantUpdateBuilderFactoryImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.platform.model.builder.impl; - -import org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilder; -import org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilderFactory; -import org.bonitasoft.engine.recorder.model.EntityUpdateDescriptor; - -/** - * @author Celine Souchet - */ -public class STenantUpdateBuilderFactoryImpl implements STenantUpdateBuilderFactory { - - @Override - public STenantUpdateBuilder createNewInstance() { - final EntityUpdateDescriptor descriptor = new EntityUpdateDescriptor(); - return new STenantUpdateBuilderImpl(descriptor); - } - -} diff --git a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/impl/STenantUpdateBuilderImpl.java b/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/impl/STenantUpdateBuilderImpl.java deleted file mode 100644 index e84b6699ffd..00000000000 --- a/services/bonita-platform/src/main/java/org/bonitasoft/engine/platform/model/builder/impl/STenantUpdateBuilderImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -/** - * Copyright (C) 2019 Bonitasoft S.A. - * Bonitasoft, 32 rue Gustave Eiffel - 38000 Grenoble - * This library is free software; you can redistribute it and/or modify it under the terms - * of the GNU Lesser General Public License as published by the Free Software Foundation - * version 2.1 of the License. - * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; - * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License along with this - * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth - * Floor, Boston, MA 02110-1301, USA. - **/ -package org.bonitasoft.engine.platform.model.builder.impl; - -import org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilder; -import org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilderFactory; -import org.bonitasoft.engine.recorder.model.EntityUpdateDescriptor; - -/** - * @author Celine Souchet - */ -public class STenantUpdateBuilderImpl implements STenantUpdateBuilder { - - protected final EntityUpdateDescriptor descriptor; - - public STenantUpdateBuilderImpl(final EntityUpdateDescriptor descriptor) { - this.descriptor = descriptor; - } - - @Override - public STenantUpdateBuilder setName(final String name) { - descriptor.addField(STenantUpdateBuilderFactory.NAME, name); - return this; - } - - @Override - public STenantUpdateBuilder setDescription(final String description) { - descriptor.addField(STenantUpdateBuilderFactory.DESCRIPTION, description); - return this; - } - - @Override - public STenantUpdateBuilder setIconPath(final String iconPath) { - descriptor.addField(STenantUpdateBuilderFactory.ICON_PATH, iconPath); - return this; - } - - @Override - public STenantUpdateBuilder setIconName(final String iconName) { - descriptor.addField(STenantUpdateBuilderFactory.ICON_NAME, iconName); - return this; - } - - @Override - public STenantUpdateBuilder setStatus(final String status) { - descriptor.addField(STenantUpdateBuilderFactory.STATUS, status); - return this; - } - - @Override - public STenantUpdateBuilder setSecurityActivated(final boolean securityActivated) { - descriptor.addField(STenantUpdateBuilderFactory.SECURITY_ACTIVATED, securityActivated); - return this; - } - - @Override - public EntityUpdateDescriptor done() { - return descriptor; - } - -} diff --git a/services/bonita-platform/src/test/java/org/bonitasoft/engine/platform/PlatformServiceImplTest.java b/services/bonita-platform/src/test/java/org/bonitasoft/engine/platform/PlatformServiceImplTest.java index db171726162..493eb734157 100644 --- a/services/bonita-platform/src/test/java/org/bonitasoft/engine/platform/PlatformServiceImplTest.java +++ b/services/bonita-platform/src/test/java/org/bonitasoft/engine/platform/PlatformServiceImplTest.java @@ -16,8 +16,6 @@ import static org.hamcrest.core.IsEqual.equalTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.anyString; -import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; import static org.mockito.Mockito.*; @@ -29,11 +27,7 @@ import org.bonitasoft.engine.platform.impl.PlatformServiceImpl; import org.bonitasoft.engine.platform.model.SPlatform; import org.bonitasoft.engine.platform.model.STenant; -import org.bonitasoft.engine.platform.model.builder.STenantUpdateBuilder; -import org.bonitasoft.engine.platform.model.builder.impl.STenantUpdateBuilderImpl; import org.bonitasoft.engine.recorder.Recorder; -import org.bonitasoft.engine.recorder.model.EntityUpdateDescriptor; -import org.bonitasoft.engine.recorder.model.UpdateRecord; import org.bonitasoft.engine.services.PersistenceService; import org.bonitasoft.engine.services.UpdateDescriptor; import org.junit.Rule; @@ -111,22 +105,6 @@ public final void isPlatformCreated() throws SBonitaException { assertTrue(platformServiceImpl.isPlatformCreated()); } - @Test - public void updateTheTenantUsingTheSameName() throws SBonitaException { - // Given - final STenant tenant = buildTenant(15, "tenantName"); - final STenantUpdateBuilder updateDescriptor = new STenantUpdateBuilderImpl(new EntityUpdateDescriptor()); - updateDescriptor.setName("tenant1"); - final EntityUpdateDescriptor descriptor = updateDescriptor.done(); - final UpdateRecord updateRecord = UpdateRecord.buildSetFields(tenant, descriptor); - - // When - platformServiceImpl.updateTenant(tenant, updateDescriptor.done()); - - // Then - verify(recorder).recordUpdate(eq(updateRecord), anyString()); - } - @Test public void pause_should_update_tenant_state_to_PAUSED() throws SBonitaException { doReturn(new STenant()).when(persistenceService) diff --git a/services/bonita-transaction/src/main/java/org/bonitasoft/engine/transaction/XAResourceRetriever.java b/services/bonita-transaction/src/main/java/org/bonitasoft/engine/transaction/XAResourceRetriever.java index 5805ce8dd84..7894ad64079 100644 --- a/services/bonita-transaction/src/main/java/org/bonitasoft/engine/transaction/XAResourceRetriever.java +++ b/services/bonita-transaction/src/main/java/org/bonitasoft/engine/transaction/XAResourceRetriever.java @@ -43,9 +43,8 @@ private Optional getMethodByReflection(Transaction transaction) { try { return Optional.of(transaction.getClass().getMethod("getResources")); } catch (Exception e) { - log.warn( - "Unable to find method to retrieve resources attached to the current transaction, we will not try to reattempts to find the methode until next restart of the server ", - e); + log.warn("Unable to find method to retrieve resources attached to the current transaction, " + + "we will not try to reattempt to find the method until next restart of the server", e); return Optional.empty(); } } @@ -54,9 +53,8 @@ protected Set getResources(Transaction transaction, Method getResour try { return ((Map) getResources.invoke(transaction)).keySet(); } catch (Exception e) { - log.warn( - "Unable to retrieve resources attached to the current transaction, we will not try to reattempts to retrieve those resources until next restart of the server ", - e); + log.warn("Unable to retrieve resources attached to the current transaction, " + + "we will not try to reattempt to retrieve those resources until next restart of the server", e); cache.put(transaction.getClass().getName(), Optional.empty()); return Collections.emptySet();