From 30c0bb5a6683a4f0f1576d7b7a43e8f90c6c7ee6 Mon Sep 17 00:00:00 2001 From: Adrien Kantcheff <5028967+akantcheff@users.noreply.github.com> Date: Thu, 12 Oct 2023 15:23:40 +0200 Subject: [PATCH] refactor(engine): remove deprecated methods and classes (#2741) - complete @Deprecated - remove TestProcess.setEnable - remove SAPMonoDestinationDataProvider - remove ArchivedDocument attributes - remove StartedByDelegate functions - remove search on process label field - remove BusinessDataAPI accessor - remove PageResourceServlet - remove search on archive human task processInstanceId - remove ProcessInstanceSearchDescriptor USER_ID GROUP_ID ROLE_ID - remove usage of deprecated CANCELLING_SUBTASKS_STATE - remove TokenGenerator.setTokenToResponseCookie - remove ProfileAPIDelegateExt.importProfilesUsingSpecifiedPolicy - remove LoginManager.login(HttpServletRequestAccessor, HttpServletResponse, UserLogger, Credentials) - remove KubernetesConfigExt - remove DateUtil - remove CommentImpl constructor - remove ExpressionException - remove FileOperations functions - remove FailedJob.getNumberOfFailures - remove ForbiddenOperationException - remove IncorrectOperationStructureException - remove OperationExecutionException - remove SCommentService.getComments(long) - remove GetActivityInstance - remove ProcessInstanceService7_7_4.java --- .../engine/activity/HumanTasksIT.java | 4 +- .../engine/process/document/DocumentIT.java | 4 +- .../bonitasoft/engine/job/JobExecutionIT.java | 9 +- .../test/toolkit/bpm/TestProcess.java | 8 - .../test/toolkit/bpm/TestProcessFactory.java | 2 +- .../rest/server/api/bpm/cases/APICaseIT.java | 7 +- .../server/api/bpm/process/APIProcessIT.java | 10 +- .../org/bonitasoft/engine/api/APIClient.java | 2 +- .../engine/api/TenantAPIAccessor.java | 2 +- .../SAPMonoDestinationDataProvider.java | 85 ---- .../bonitasoft/engine/api/APIAccessor.java | 2 +- .../engine/api/BusinessDataAPI.java | 6 +- .../engine/api/ProcessRuntimeAPI.java | 2 +- .../bdm/validator/ValidationStatus.java | 4 +- .../engine/bpm/comment/impl/CommentImpl.java | 15 - .../engine/bpm/document/ArchivedDocument.java | 44 -- .../document/impl/ArchivedDocumentImpl.java | 30 -- .../engine/bpm/flownode/ActivityStates.java | 2 +- .../flownode/ArchivedFlowNodeInstance.java | 8 - ...ivedHumanTaskInstanceSearchDescriptor.java | 7 +- .../engine/bpm/flownode/FlowNodeInstance.java | 8 - .../ArchivedFlowNodeInstanceImpl.java | 11 - .../impl/internal/FlowNodeInstanceImpl.java | 11 - .../bpm/process/ArchivedProcessInstance.java | 12 - ...ProcessDeploymentInfoSearchDescriptor.java | 8 - .../engine/bpm/process/ProcessInstance.java | 12 - .../ProcessInstanceSearchDescriptor.java | 24 -- .../internal/ArchivedProcessInstanceImpl.java | 11 - .../impl/internal/ProcessInstanceImpl.java | 11 - .../application/ApplicationCreator.java | 1 + .../application/ApplicationField.java | 3 +- .../application/ApplicationUpdater.java | 1 + .../expression/ExpressionException.java | 31 -- .../bonitasoft/engine/io/FileOperations.java | 43 +- .../org/bonitasoft/engine/job/FailedJob.java | 6 - .../engine/job/impl/FailedJobImpl.java | 7 - .../ForbiddenOperationException.java | 38 -- .../IncorrectOperationStructureException.java | 39 -- .../OperationExecutionException.java | 37 -- .../process/comment/api/SCommentService.java | 14 - .../comment/api/impl/SCommentServiceImpl.java | 14 - .../installer/detector/BdmDetector.java | 16 +- .../detector/CustomPageDetector.java | 12 +- .../installer/detector/ProcessDetector.java | 7 +- .../activity/GetActivityInstance.java | 50 --- ...chArchivedHumanTaskInstanceDescriptor.java | 2 - .../SearchProcessDefinitionsDescriptor.java | 4 - ...chivedHumanTaskInstanceDescriptorTest.java | 10 - .../impl/ProcessInstanceService7_7_4.java | 396 ------------------ .../auth/ConsumerNotFoundException.java | 4 +- .../common/server/login/LoginManager.java | 11 - .../server/login/filter/TokenGenerator.java | 20 +- .../server/page/PageResourceServlet.java | 91 ---- .../utils/BonitaHomeFolderAccessor.java | 4 +- .../console/common/server/utils/DateUtil.java | 82 ---- .../model/application/ApplicationItem.java | 13 +- .../web/rest/model/portal/page/PageItem.java | 11 +- .../document/api/impl/DocumentDatastore.java | 12 +- .../server/api/tenant/APITenantAdmin.java | 2 +- ...vedHumanTaskSearchDescriptorConverter.java | 2 +- .../utils/SearchOptionsBuilderUtil.java | 10 +- .../src/main/webapp/WEB-INF/web.xml | 15 - .../server/page/PageResourceServletTest.java | 65 --- 63 files changed, 102 insertions(+), 1332 deletions(-) delete mode 100644 bpm/bonita-common/src/main/java/com/bonitasoft/engine/connector/SAPMonoDestinationDataProvider.java delete mode 100644 bpm/bonita-common/src/main/java/org/bonitasoft/engine/expression/ExpressionException.java delete mode 100644 bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/ForbiddenOperationException.java delete mode 100644 bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/IncorrectOperationStructureException.java delete mode 100644 bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/OperationExecutionException.java delete mode 100644 bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/transaction/activity/GetActivityInstance.java delete mode 100644 bpm/bonita-core/bonita-process-instance/src/main/java/org/bonitasoft/engine/core/process/instance/impl/ProcessInstanceService7_7_4.java delete mode 100644 bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/page/PageResourceServlet.java delete mode 100644 bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/DateUtil.java delete mode 100644 bpm/bonita-web-server/src/test/java/org/bonitasoft/console/common/server/page/PageResourceServletTest.java diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/activity/HumanTasksIT.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/activity/HumanTasksIT.java index 5a3569ba363..88be4073403 100644 --- a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/activity/HumanTasksIT.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/activity/HumanTasksIT.java @@ -438,9 +438,9 @@ public void setState() throws Exception { assertEquals(ActivityStates.INITIALIZING_STATE, step1.getState()); // test set state by stateName - getProcessAPI().setActivityStateByName(activityInstanceId, ActivityStates.CANCELLING_SUBTASKS_STATE); + getProcessAPI().setActivityStateByName(activityInstanceId, ActivityStates.EXECUTING_STATE); step1 = getProcessAPI().getHumanTaskInstance(activityInstanceId); - assertEquals(ActivityStates.CANCELLING_SUBTASKS_STATE, step1.getState()); + assertEquals(ActivityStates.EXECUTING_STATE, step1.getState()); getProcessAPI().setActivityStateByName(activityInstanceId, ActivityStates.SKIPPED_STATE); // will skip task and finish process diff --git a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/process/document/DocumentIT.java b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/process/document/DocumentIT.java index 17cda0cf7de..67a6bdbdedf 100644 --- a/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/process/document/DocumentIT.java +++ b/bonita-integration-tests/bonita-integration-tests-client/src/test/java/org/bonitasoft/engine/process/document/DocumentIT.java @@ -688,7 +688,7 @@ public void searchArchivedDocuments() throws Exception { assertEquals(1, documentSearch.getCount()); ArchivedDocument archivedDocument = documentSearch.getResult().get(0); assertEquals(processInstance.getId(), archivedDocument.getProcessInstanceId()); - assertEquals(user.getId(), archivedDocument.getDocumentAuthor()); + assertEquals(user.getId(), archivedDocument.getAuthor()); // search with term: searchOptionsBuilder = new SearchOptionsBuilder(0, 45); @@ -701,7 +701,7 @@ public void searchArchivedDocuments() throws Exception { assertThat( getProcessAPI().searchArchivedDocuments(new SearchOptionsBuilder(0, 45).searchTerm("doc1").done()) .getResult().get(0) - .getDocumentContentFileName()).isEqualTo("doc1.jpg"); + .getContentFileName()).isEqualTo("doc1.jpg"); } finally { disableAndDeleteProcess(processInstance.getProcessDefinitionId()); diff --git a/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/job/JobExecutionIT.java b/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/job/JobExecutionIT.java index 5ae38714d7a..b10b2dbc52e 100644 --- a/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/job/JobExecutionIT.java +++ b/bonita-integration-tests/bonita-integration-tests-local/src/test/java/org/bonitasoft/engine/job/JobExecutionIT.java @@ -42,7 +42,6 @@ // because of waituntil but its the only class where we use failed jobs... so i don't want to add a handler and so on // only for jobs -@SuppressWarnings("deprecation") public class JobExecutionIT extends CommonAPILocalIT { private static final String THROWS_EXCEPTION_JOB = "ThrowsExceptionJob"; @@ -68,7 +67,7 @@ public void after() throws Exception { @Test public void getFailedJobs_should_return_zero_when_there_are_no_failed_jobs() { final List failedJobs = getProcessAPI().getFailedJobs(0, 100); - assertThat(failedJobs).hasSize(0); + assertThat(failedJobs).isEmpty(); } @Test @@ -80,7 +79,7 @@ public void retryAJob_should_execute_again_a_failed_job_and_clean_related_job_lo getCommandAPI().execute("except", emptyMap()); final FailedJob failedJob = waitForFailedJob(); assertThat(failedJob.getJobName()).isEqualTo(THROWS_EXCEPTION_JOB); - assertThat(failedJob.getRetryNumber()).isEqualTo(0); + assertThat(failedJob.getNumberOfFailures()).isEqualTo(1); assertThat(failedJob.getDescription()).isEqualTo("Throw an exception when 'throwException'=true"); final List jobDescriptors = searchJobDescriptors(1); @@ -178,7 +177,7 @@ protected boolean check() { }.waitUntil(); final FailedJob failedJob = getFailingJob(); assertThat(failedJob).isNotNull(); - assertThat(failedJob.getRetryNumber()).isEqualTo(0); + assertThat(failedJob.getNumberOfFailures()).isPositive(); return failedJob; } @@ -197,7 +196,7 @@ protected boolean check() { private FailedJob getFailedJob() { final FailedJob failedJob = getFailingJob(); - if (failedJob != null && failedJob.getRetryNumber() == 0) { + if (failedJob != null && failedJob.getNumberOfFailures() > 0) { return failedJob; } return null; diff --git a/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcess.java b/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcess.java index 214c2252879..9a670e5fa7e 100644 --- a/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcess.java +++ b/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcess.java @@ -211,14 +211,6 @@ public void delete(final TestUser initiator) { delete(initiator.getSession()); } - /** - * Deprecated, use {@link #enable()} or {@link #disable()} - */ - @Deprecated - public TestProcess setEnable(final boolean enabled) { - return setEnable(TestToolkitCtx.getInstance().getInitiator(), enabled); - } - public TestProcess enable() { return setEnable(TestToolkitCtx.getInstance().getInitiator(), true); } diff --git a/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcessFactory.java b/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcessFactory.java index c27e0c298d1..54cf3d0ad11 100644 --- a/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcessFactory.java +++ b/bonita-integration-tests/bonita-integration-tests-web/src/main/java/org/bonitasoft/test/toolkit/bpm/TestProcessFactory.java @@ -183,7 +183,7 @@ public static TestHumanTask createActivityWithVariables(TestUser initiator) thro .addEndEvent("Finish"); final TestProcess testProcess = new TestProcess(processDefinitionBuidler); getInstance().getProcessList().put(processName, testProcess); - return testProcess.addActor(initiator).setEnable(true).startCase().getNextHumanTask().assignTo(initiator); + return testProcess.addActor(initiator).enable().startCase().getNextHumanTask().assignTo(initiator); } /** diff --git a/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/cases/APICaseIT.java b/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/cases/APICaseIT.java index 37f5eaff5a1..a423deb8d80 100644 --- a/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/cases/APICaseIT.java +++ b/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/cases/APICaseIT.java @@ -254,8 +254,7 @@ private void checkSearchResults(final ItemSearchResult caseItems, fina @Test public void we_can_start_a_case() throws Exception { - final TestProcess process = TestProcessFactory.getDefaultHumanTaskProcess().addActor(getInitiator()) - .setEnable(true); + final TestProcess process = TestProcessFactory.getDefaultHumanTaskProcess().addActor(getInitiator()).enable(); final CaseItem item = apiCase.runAdd(aCaseItem().withProcessId(process.getId()).build()); @@ -266,7 +265,7 @@ public void we_can_start_a_case() throws Exception { @Test public void we_can_start_a_case_with_user() throws Exception { final TestProcess process = TestProcessFactory.getDefaultHumanTaskProcess() - .addActor(TestUserFactory.getRidleyScott()).setEnable(true); + .addActor(TestUserFactory.getRidleyScott()).enable(); final CaseItem item = apiCase.runAdd(aCaseItem().withProcessId(process.getId()) .withUserId(TestUserFactory.getRidleyScott().getId()).build()); @@ -298,7 +297,7 @@ public void we_can_start_a_case_with_variables() throws Exception { private TestProcess createProcessWithVariables(final ProcessVariable... processVariables) { return TestProcessFactory.createProcessWithVariables("processWithVariables", processVariables) - .addActor(getInitiator()).setEnable(true); + .addActor(getInitiator()).enable(); } private Serializable getProcessDataInstanceValue(final String dataName, final long processInstanceId) diff --git a/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/process/APIProcessIT.java b/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/process/APIProcessIT.java index bfe8432b237..451c91cc832 100644 --- a/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/process/APIProcessIT.java +++ b/bonita-integration-tests/bonita-integration-tests-web/src/test/java/org/bonitasoft/web/rest/server/api/bpm/process/APIProcessIT.java @@ -108,7 +108,7 @@ public void testAddProcessItem() throws Exception { public void testUpdateProcessItem() throws Exception { final APIID processDefinitionId = APIID.makeAPIID(TestProcessFactory.getDefaultHumanTaskProcess() .addActor(getInitiator()) - .setEnable(true) + .enable() .getId()); // assert process is well enabled @@ -161,7 +161,7 @@ public void testGetProcessItem() throws Exception { public void testSearchProcessItemForUser() throws Exception { final APIID processDefinitionId = APIID.makeAPIID(TestProcessFactory.getDefaultHumanTaskProcess() .addActor(getInitiator()) - .setEnable(true) + .enable() .getId()); // Set the filters @@ -227,9 +227,9 @@ public void testGetLastProcessVersion() throws Exception { TestProcessFactory.getInstance().add(p3); // map actor John Carpenter on the created processes, then set enable - p1.addActor(TestUserFactory.getJohnCarpenter()).setEnable(true); - p2.addActor(TestUserFactory.getJohnCarpenter()).setEnable(true); - p3.addActor(TestUserFactory.getJohnCarpenter()).setEnable(true); + p1.addActor(TestUserFactory.getJohnCarpenter()).enable(); + p2.addActor(TestUserFactory.getJohnCarpenter()).enable(); + p3.addActor(TestUserFactory.getJohnCarpenter()).enable(); // Set the filters final HashMap filters = new HashMap<>(); diff --git a/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/APIClient.java b/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/APIClient.java index 0f274b55291..c1950dbd3ca 100644 --- a/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/APIClient.java +++ b/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/APIClient.java @@ -292,7 +292,7 @@ public PermissionAPI getPermissionAPI() { * @since 7.2 * @deprecated as of 7.3, see {@link BusinessDataAPI} for replacements */ - @Deprecated + @Deprecated(since = "7.3") public BusinessDataAPI getBusinessDataAPI() { return getAPI(BusinessDataAPI.class); } diff --git a/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/TenantAPIAccessor.java b/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/TenantAPIAccessor.java index 3bee0153856..16bddb9aa7e 100644 --- a/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/TenantAPIAccessor.java +++ b/bpm/bonita-client/src/main/java/org/bonitasoft/engine/api/TenantAPIAccessor.java @@ -116,7 +116,7 @@ public static TenantAdministrationAPI getTenantAdministrationAPI(final APISessio /** * @deprecated as of 7.3, see {@link BusinessDataAPI} for replacements */ - @Deprecated + @Deprecated(since = "7.3") public static BusinessDataAPI getBusinessDataAPI(APISession session) throws BonitaHomeNotSetException, ServerAPIException, UnknownAPITypeException { diff --git a/bpm/bonita-common/src/main/java/com/bonitasoft/engine/connector/SAPMonoDestinationDataProvider.java b/bpm/bonita-common/src/main/java/com/bonitasoft/engine/connector/SAPMonoDestinationDataProvider.java deleted file mode 100644 index 06dd4c3af8e..00000000000 --- a/bpm/bonita-common/src/main/java/com/bonitasoft/engine/connector/SAPMonoDestinationDataProvider.java +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (C) 2020 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 com.bonitasoft.engine.connector; - -import java.util.Properties; - -import com.sap.conn.jco.ext.DestinationDataEventListener; -import com.sap.conn.jco.ext.DestinationDataProvider; - -/** - * Used by SAP connector in order to synchronize SAP {@code com.sap.conn.jco.ext.DestinationDataProvider} used - * Warning: Internal use only! - * This class is subject to change without notice - * - * @deprecated use {@link org.bonitasoft.engine.connector.sap.SAPMonoDestinationDataProvider} instead. - */ -public class SAPMonoDestinationDataProvider implements DestinationDataProvider { - - private static SAPMonoDestinationDataProvider destinationDataProvider = null; - private org.bonitasoft.engine.connector.sap.SAPMonoDestinationDataProvider delegate; - - private SAPMonoDestinationDataProvider( - final org.bonitasoft.engine.connector.sap.SAPMonoDestinationDataProvider delegate) { - super(); - this.delegate = delegate; - } - - /** - * BE CAREFUL: only one destinationName is possible - * - * @param destinationName - * @return - */ - public static synchronized SAPMonoDestinationDataProvider getInstance(final String destinationName) - throws IllegalStateException { - if (destinationDataProvider == null) { - destinationDataProvider = new SAPMonoDestinationDataProvider( - org.bonitasoft.engine.connector.sap.SAPMonoDestinationDataProvider.getInstance(destinationName)); - } - return destinationDataProvider; - } - - @Override - public Properties getDestinationProperties(final String destinationName) { - return delegate.getDestinationProperties(destinationName); - } - - @Override - public void setDestinationDataEventListener(final DestinationDataEventListener eventListener) { - delegate.setDestinationDataEventListener(eventListener); - } - - @Override - public boolean supportsEvents() { - return delegate.supportsEvents(); - } - - public void changeProperties(final Properties properties) { - delegate.changeProperties(properties); - } - - public String getDestinationName() { - return delegate.getDestinationName(); - } - - /** - * Use it carefully!!! If someone retrieved an Instance and you clear it it will break everything, currently usage - * planned only for test purpose. - */ - public static void clear() { - org.bonitasoft.engine.connector.sap.SAPMonoDestinationDataProvider.clear(); - } - -} diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/APIAccessor.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/APIAccessor.java index 1dd625dda4b..95ccadc9889 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/APIAccessor.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/APIAccessor.java @@ -79,7 +79,7 @@ public interface APIAccessor extends Serializable { * @return an BusinessDataAPI * @deprecated as of 7.3, see {@link BusinessDataAPI} for replacements */ - @Deprecated + @Deprecated(since = "7.3") BusinessDataAPI getBusinessDataAPI(); } diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/BusinessDataAPI.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/BusinessDataAPI.java index e30c378cbea..c0b50f1e88e 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/BusinessDataAPI.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/BusinessDataAPI.java @@ -35,7 +35,7 @@ * "yourBusinessDataName_ref" key (business data name as declared in * the process definition followed by "_ref" suffix). */ -@Deprecated +@Deprecated(since = "7.3") public interface BusinessDataAPI { /** @@ -53,7 +53,7 @@ public interface BusinessDataAPI { * If the specified business data value cannot be found. * @deprecated See deprecated comment of {@link BusinessDataAPI} */ - @Deprecated + @Deprecated(since = "7.3") BusinessDataReference getProcessBusinessDataReference(String businessDataName, long processInstanceId) throws DataNotFoundException; @@ -69,7 +69,7 @@ BusinessDataReference getProcessBusinessDataReference(String businessDataName, l * @return the paginated references of the business data * @deprecated See deprecated comment of {@link BusinessDataAPI} */ - @Deprecated + @Deprecated(since = "7.3") List getProcessBusinessDataReferences(long processInstanceId, int startIndex, int maxResults); diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/ProcessRuntimeAPI.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/ProcessRuntimeAPI.java index fdbb899f11d..dc30f8dc803 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/ProcessRuntimeAPI.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/api/ProcessRuntimeAPI.java @@ -2573,7 +2573,7 @@ Map evaluateExpressionsOnCompletedActivityInstance(long ac * @since 6.1 * @deprecated since 7.9, use {@link #replayFailedJob(long)} instead, parameters should not be modified. */ - @Deprecated + @Deprecated(since = "7.9", forRemoval = true) void replayFailedJob(final long jobDescriptorId, Map parameters) throws ExecutionException; /** diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/validator/ValidationStatus.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/validator/ValidationStatus.java index e721bf4eec3..c6d11cf2061 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/validator/ValidationStatus.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bdm/validator/ValidationStatus.java @@ -73,7 +73,7 @@ public void addValidationStatus(final ValidationStatus status) { /** * @Deprecated since release 7.7.0, replaced by {@link #getStatuses()} */ - @Deprecated + @Deprecated(since = "7.7.0", forRemoval = true) public List getErrors() { return statusList.stream().filter(status -> Objects.equals(Status.Level.ERROR, status.getLevel())) .map(Status::getMessage).collect(Collectors.toList()); @@ -82,7 +82,7 @@ public List getErrors() { /** * @Deprecated since release 7.7.0, replaced by {@link #getStatuses()} */ - @Deprecated + @Deprecated(since = "7.7.0", forRemoval = true) public List getWarnings() { return statusList.stream().filter(status -> Objects.equals(Status.Level.WARNING, status.getLevel())) .map(Status::getMessage).collect(Collectors.toList()); diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/comment/impl/CommentImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/comment/impl/CommentImpl.java index 6010ef8027e..e33a8968bcc 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/comment/impl/CommentImpl.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/comment/impl/CommentImpl.java @@ -39,21 +39,6 @@ public CommentImpl() { super(); } - /** - * @deprecated As of 6.1 use {@link #CommentImpl()} and the setters - */ - @Deprecated - public CommentImpl(final long id, final long tenantId, final long userId, final long processInstanceId, - final long postDate, final String content) { - super(); - this.id = id; - this.tenantId = tenantId; - this.userId = userId; - this.processInstanceId = processInstanceId; - this.postDate = postDate; - this.content = content; - } - @Override public Long getUserId() { return userId; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/ArchivedDocument.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/ArchivedDocument.java index 9d08063f658..b5bf6c1e3d6 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/ArchivedDocument.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/ArchivedDocument.java @@ -13,8 +13,6 @@ **/ package org.bonitasoft.engine.bpm.document; -import java.util.Date; - import org.bonitasoft.engine.bpm.ArchivedElement; /** @@ -23,46 +21,4 @@ */ public interface ArchivedDocument extends ArchivedElement, Document { - /** - * @return - * @deprecated 6.4.0 use {@link Document#getUrl()} - */ - @Deprecated - String getDocumentURL(); - - /** - * @return - * @deprecated 6.4.0 use {@link Document#hasContent()} - */ - @Deprecated - boolean getDocumentHasContent(); - - /** - * @return - * @deprecated 6.4.0 use {@link Document#getAuthor()} - */ - @Deprecated - long getDocumentAuthor(); - - /** - * @return - * @deprecated 6.4.0 use {@link org.bonitasoft.engine.bpm.document.Document#getContentMimeType()} - */ - @Deprecated - String getDocumentContentMimeType(); - - /** - * @return - * @deprecated 6.4.0 use {@link org.bonitasoft.engine.bpm.document.Document#getContentFileName()} - */ - @Deprecated - String getDocumentContentFileName(); - - /** - * @return - * @deprecated 6.4.0 use {@link org.bonitasoft.engine.bpm.document.Document#getCreationDate()} - */ - @Deprecated - Date getDocumentCreationDate(); - } diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/impl/ArchivedDocumentImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/impl/ArchivedDocumentImpl.java index f76fd50d8fb..db04fd8d40d 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/impl/ArchivedDocumentImpl.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/document/impl/ArchivedDocumentImpl.java @@ -36,36 +36,6 @@ public ArchivedDocumentImpl(final String name) { setName(name); } - @Override - public String getDocumentURL() { - return getUrl(); - } - - @Override - public boolean getDocumentHasContent() { - return hasContent(); - } - - @Override - public long getDocumentAuthor() { - return getAuthor(); - } - - @Override - public String getDocumentContentMimeType() { - return getContentMimeType(); - } - - @Override - public String getDocumentContentFileName() { - return getFileName(); - } - - @Override - public Date getDocumentCreationDate() { - return getCreationDate(); - } - @Override public Date getArchiveDate() { return archiveDate; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ActivityStates.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ActivityStates.java index d97e8e4ae85..0689959a998 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ActivityStates.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ActivityStates.java @@ -79,7 +79,7 @@ public class ActivityStates { * * @deprecated this should not be used anymore client-side. */ - @Deprecated + @Deprecated(since = "7.12.0") public static final String CANCELLING_SUBTASKS_STATE = "cancelling subtasks"; /** diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedFlowNodeInstance.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedFlowNodeInstance.java index 9d57b3cf344..be9bb5bc1f5 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedFlowNodeInstance.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedFlowNodeInstance.java @@ -60,14 +60,6 @@ public interface ArchivedFlowNodeInstance extends NamedElement, BaseElement, Arc */ long getExecutedBySubstitute(); - /** - * @return The identifier of the substitute user (as Process manager or Administrator) who executed the flow node. - * @since 6.0.1 - * @deprecated since 6.3.0, use {@link ArchivedFlowNodeInstance#getExecutedBySubstitute()} - */ - @Deprecated - long getExecutedByDelegate(); - String getDescription(); long getFlownodeDefinitionId(); diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedHumanTaskInstanceSearchDescriptor.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedHumanTaskInstanceSearchDescriptor.java index 2b486d13558..56ed88235f3 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedHumanTaskInstanceSearchDescriptor.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/ArchivedHumanTaskInstanceSearchDescriptor.java @@ -20,6 +20,10 @@ */ public final class ArchivedHumanTaskInstanceSearchDescriptor { + private ArchivedHumanTaskInstanceSearchDescriptor() { + // Utility class + } + public static final String NAME = "name"; public static final String PRIORITY = "priority"; @@ -32,9 +36,6 @@ public final class ArchivedHumanTaskInstanceSearchDescriptor { public static final String PROCESS_DEFINITION_ID = "processDefinitionId"; - @Deprecated - public static final String PROCESS_INSTANCE_ID = "processInstanceId"; - public static final String ORIGINAL_HUMAN_TASK_ID = "sourceObjectId"; public static final String ROOT_PROCESS_INSTANCE_ID = "rootProcessInstanceId"; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/FlowNodeInstance.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/FlowNodeInstance.java index 6875ef5c483..951c68b191d 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/FlowNodeInstance.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/FlowNodeInstance.java @@ -125,14 +125,6 @@ public interface FlowNodeInstance extends DescriptionElement, BaseElement { */ long getExecutedBySubstitute(); - /** - * @return The identifier of the substitute user (as Process manager or Administrator) who executed the flow node. - * @since 6.0.1 - * @deprecated since 6.3.0, use {@link FlowNodeInstance#getExecutedBySubstitute()} - */ - @Deprecated - long getExecutedByDelegate(); - /** * Returns the ID of the flow node definition of this instance. * diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/ArchivedFlowNodeInstanceImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/ArchivedFlowNodeInstanceImpl.java index a6f244390c7..6ffe9d2fc19 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/ArchivedFlowNodeInstanceImpl.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/ArchivedFlowNodeInstanceImpl.java @@ -183,17 +183,6 @@ public void setExecutedBySubstitute(long executedBySubstitute) { this.executedBySubstitute = executedBySubstitute; } - @Deprecated - @Override - public long getExecutedByDelegate() { - return getExecutedBySubstitute(); - } - - @Deprecated - public void setExecutedByDelegate(long executedBySubstitute) { - setExecutedBySubstitute(executedBySubstitute); - } - @Override public long getFlownodeDefinitionId() { return flownodeDefinitionId; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/FlowNodeInstanceImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/FlowNodeInstanceImpl.java index 688556863b8..d19117b2813 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/FlowNodeInstanceImpl.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/flownode/impl/internal/FlowNodeInstanceImpl.java @@ -164,17 +164,6 @@ public void setExecutedBySubstitute(long executedBySubstitute) { this.executedBySubstitute = executedBySubstitute; } - @Deprecated - @Override - public long getExecutedByDelegate() { - return getExecutedBySubstitute(); - } - - @Deprecated - public void setExecutedByDelegate(long executedByDelegate) { - setExecutedBySubstitute(executedByDelegate); - } - @Override public long getFlownodeDefinitionId() { return flownodeDefinitionId; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ArchivedProcessInstance.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ArchivedProcessInstance.java index 0f97664decd..c3221414b66 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ArchivedProcessInstance.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ArchivedProcessInstance.java @@ -77,18 +77,6 @@ public interface ArchivedProcessInstance extends NamedElement, BaseElement, Arch */ long getStartedBySubstitute(); - /** - * Get the identifier of the substitute user (as Process manager or Administrator) who started this process - * instance. - * - * @return The identifier of the substitute user (as Process manager or Administrator) who started this process - * instance. - * @since 6.0.1 - * @deprecated As of version 6.3.0, replaced by {@link ArchivedProcessInstance#getStartedBySubstitute()} - */ - @Deprecated - long getStartedByDelegate(); - /** * Get the date when this process instance was finished. * It equals to null, if this process instance is not finished. diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessDeploymentInfoSearchDescriptor.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessDeploymentInfoSearchDescriptor.java index 4c121bcb103..13a6118f72a 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessDeploymentInfoSearchDescriptor.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessDeploymentInfoSearchDescriptor.java @@ -87,12 +87,4 @@ public class ProcessDeploymentInfoSearchDescriptor { */ public static final String CATEGORY_ID = "categoryId"; - /** - * This field doesn't exist on a process definition. - * - * @deprecated since 6.3.5 - */ - @Deprecated - public static final String LABEL = "label"; - } diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstance.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstance.java index e9aca8b3eb8..cb3a9d3d471 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstance.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstance.java @@ -65,18 +65,6 @@ public interface ProcessInstance extends NamedElement, BaseElement { */ long getStartedBySubstitute(); - /** - * Get the identifier of the substitute user (as Process manager or Administrator) who started this process - * instance. - * - * @return The identifier of the substitute user (as Process manager or Administrator) who started this process - * instance. - * @since 6.0.1 - * @deprecated since 6.3.0, use {@link ProcessInstance#getStartedBySubstitute()} - */ - @Deprecated - long getStartedByDelegate(); - /** * Get the date when this process instance was finished. * It equals to null, if this process instance is not finished. diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstanceSearchDescriptor.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstanceSearchDescriptor.java index b23cf0bef75..2e397524657 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstanceSearchDescriptor.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/ProcessInstanceSearchDescriptor.java @@ -77,30 +77,6 @@ public class ProcessInstanceSearchDescriptor { */ public static final String LAST_UPDATE = "lastUpdate"; - /** - * The field corresponding to the identifier of the user who supervised the process instance. - * - * @deprecated use PROCESS_SUPERVISOR_USER_ID instead - */ - @Deprecated - public static final String USER_ID = "userId"; - - /** - * The field corresponding to the identifier of the group who supervised the process instance. - * - * @deprecated use PROCESS_SUPERVISOR_GROUP_ID instead - */ - @Deprecated - public static final String GROUP_ID = "groupId"; - - /** - * The field corresponding to the identifier of the role who supervised the process instance. - * - * @deprecated use PROCESS_SUPERVISOR_ROLE_ID instead - */ - @Deprecated - public static final String ROLE_ID = "roleId"; - /** * The field corresponding to the identifier of the user who supervised the process instance. */ diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ArchivedProcessInstanceImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ArchivedProcessInstanceImpl.java index 9254c06a93b..1740405d397 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ArchivedProcessInstanceImpl.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ArchivedProcessInstanceImpl.java @@ -115,17 +115,6 @@ public void setStartedBySubstitute(final long startedBySubstitute) { this.startedBySubstitute = startedBySubstitute; } - @Deprecated - @Override - public long getStartedByDelegate() { - return getStartedBySubstitute(); - } - - @Deprecated - public void setStartedByDelegate(final long startedByDelegate) { - setStartedBySubstitute(startedByDelegate); - } - @Override public Date getEndDate() { return endDate; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ProcessInstanceImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ProcessInstanceImpl.java index 0cb9d233761..670cd10dc7b 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ProcessInstanceImpl.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/bpm/process/impl/internal/ProcessInstanceImpl.java @@ -109,17 +109,6 @@ public void setStartedBySubstitute(final long startedBySubstitute) { this.startedBySubstitute = startedBySubstitute; } - @Deprecated - @Override - public long getStartedByDelegate() { - return getStartedBySubstitute(); - } - - @Deprecated - public void setStartedByDelegate(long startedByDelegate) { - setStartedBySubstitute(startedByDelegate); - } - @Override public Date getEndDate() { return endDate; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationCreator.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationCreator.java index 0552a28f064..c3e75b750ed 100755 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationCreator.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationCreator.java @@ -82,6 +82,7 @@ public ApplicationCreator setDescription(final String description) { * @see Application * @deprecated since 7.13.0, use {@link #setIcon(String, byte[])} */ + @Deprecated(since = "7.13.0") public ApplicationCreator setIconPath(final String iconPath) { fields.put(ApplicationField.ICON_PATH, iconPath); return this; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationField.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationField.java index 6025417e9e7..0d5df503bcf 100755 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationField.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationField.java @@ -57,8 +57,9 @@ public enum ApplicationField { * References the {@link Application} icon path * * @see Application - * @deprecated since 7.13.0, use ICON_CONTENT and ICON_FILE_NAME instead + * @deprecated since 7.13.0, use {@link #ICON_CONTENT} and {@link #ICON_FILE_NAME} instead */ + @Deprecated(since = "7.13.0") ICON_PATH, /** diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationUpdater.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationUpdater.java index 23a880e1b40..f6be4131963 100755 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationUpdater.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/business/application/ApplicationUpdater.java @@ -107,6 +107,7 @@ public ApplicationUpdater setDescription(final String description) { * @see Application * @deprecated since 7.13.0, use {@link #setIcon(String, byte[])} */ + @Deprecated(since = "7.13.0") public ApplicationUpdater setIconPath(final String iconPath) { fields.put(ApplicationField.ICON_PATH, iconPath); return this; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/expression/ExpressionException.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/expression/ExpressionException.java deleted file mode 100644 index 88996018155..00000000000 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/expression/ExpressionException.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.expression; - -import org.bonitasoft.engine.exception.BonitaException; - -/** - * @deprecated As of 6.0 not thrown anymore - * @author Matthieu Chaffotte - */ -@Deprecated -public class ExpressionException extends BonitaException { - - private static final long serialVersionUID = -7949849096175026857L; - - public ExpressionException(final Throwable cause) { - super(cause); - } - -} diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/io/FileOperations.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/io/FileOperations.java index 7935f84d251..2915b23798c 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/io/FileOperations.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/io/FileOperations.java @@ -16,16 +16,19 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static java.nio.file.StandardCopyOption.REPLACE_EXISTING; -import java.io.*; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.InputStream; import java.nio.file.FileSystem; import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; import java.util.UUID; -import java.util.zip.ZipEntry; import java.util.zip.ZipFile; -import java.util.zip.ZipInputStream; /** * @author Baptiste Mesta @@ -38,6 +41,16 @@ private FileOperations() { // private constructor } + /** + * Retrieve the content of a file inside a ZIP file. + * + * @param zip ZIP file to parse + * @param filePath path of the file to search inside the ZIP + * @return the bytes read from the searched file + * @throws FileNotFoundException if the ZIP file does not contain the searched file + * @throws java.util.zip.ZipException if a ZIP format error has occurred (e.g. the input zip file is not a ZIP) + * @throws IOException if an I/O error has occurred + */ public static byte[] getFileFromZip(File zip, String filePath) throws IOException { try (var zipFile = new ZipFile(zip)) { var entry = zipFile.getEntry(filePath); @@ -60,30 +73,6 @@ public static void updateFileContent(File zip, String filePath, InputStream newC } } - /** - * @deprecated use {@link FileOperations#getFileFromZip(File, String)} instead. - */ - @Deprecated - public static byte[] getFileFromZip(byte[] content, String filePath) throws IOException { - return getFileFromZip(new ByteArrayInputStream(content), filePath); - } - - /** - * @deprecated use {@link FileOperations#getFileFromZip(File, String)} instead. - */ - @Deprecated - public static byte[] getFileFromZip(InputStream inputStream, String filePath) throws IOException { - try (ZipInputStream zipInputStream = new ZipInputStream(inputStream)) { - ZipEntry zipEntry; - while ((zipEntry = zipInputStream.getNextEntry()) != null) { - if (zipEntry.getName().equals(filePath) && !zipEntry.isDirectory()) { - return zipInputStream.readAllBytes(); - } - } - throw new FileNotFoundException(String.format("Entry %s not found in zip", filePath)); - } - } - public static String read(File file) throws IOException { return Files.readString(file.toPath(), UTF_8); } diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/FailedJob.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/FailedJob.java index c44ee23197a..56c3ff9bd71 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/FailedJob.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/FailedJob.java @@ -32,12 +32,6 @@ public interface FailedJob extends Serializable { */ String getLastMessage(); - /** - * @deprecated since 7.9, use {@link #getNumberOfFailures()} instead - */ - @Deprecated - long getRetryNumber(); - /** * @return the number of times a job failed before replaying it manually */ diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/impl/FailedJobImpl.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/impl/FailedJobImpl.java index 2a3e91354cd..f2ebd28611d 100644 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/impl/FailedJobImpl.java +++ b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/job/impl/FailedJobImpl.java @@ -30,8 +30,6 @@ public class FailedJobImpl implements FailedJob { private String description; - private long retryNumber; - private Date lastUpdateDate; private String lastMessage; @@ -81,11 +79,6 @@ public String getLastMessage() { return lastMessage; } - @Override - public long getRetryNumber() { - return retryNumber; - } - @Override public int getNumberOfFailures() { return numberOfFailures; diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/ForbiddenOperationException.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/ForbiddenOperationException.java deleted file mode 100644 index 721b387f5c8..00000000000 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/ForbiddenOperationException.java +++ /dev/null @@ -1,38 +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.operation; - -import org.bonitasoft.engine.exception.BonitaException; - -/** - * @author Baptiste Mesta - * @deprecated not used anymore - */ -@Deprecated -public class ForbiddenOperationException extends BonitaException { - - private static final long serialVersionUID = -317301483399066500L; - - public ForbiddenOperationException(final String message) { - super(message); - } - - public ForbiddenOperationException(final Throwable cause) { - super(cause); - } - - public ForbiddenOperationException(final String message, final Throwable cause) { - super(message, cause); - } -} diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/IncorrectOperationStructureException.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/IncorrectOperationStructureException.java deleted file mode 100644 index 4f5144e59eb..00000000000 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/IncorrectOperationStructureException.java +++ /dev/null @@ -1,39 +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.operation; - -import org.bonitasoft.engine.exception.BonitaException; - -/** - * @author Zhang Bole - * @deprecated not used anymore - */ -@Deprecated -public class IncorrectOperationStructureException extends BonitaException { - - private static final long serialVersionUID = 7138323724652814335L; - - public IncorrectOperationStructureException(final String message, final Throwable cause) { - super(message, cause); - } - - public IncorrectOperationStructureException(final String message) { - super(message); - } - - public IncorrectOperationStructureException(final Throwable cause) { - super(cause); - } - -} diff --git a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/OperationExecutionException.java b/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/OperationExecutionException.java deleted file mode 100644 index 8e02c46253e..00000000000 --- a/bpm/bonita-common/src/main/java/org/bonitasoft/engine/operation/OperationExecutionException.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.operation; - -import org.bonitasoft.engine.exception.BonitaException; - -/** - * @author Zhang Bole - */ -public class OperationExecutionException extends BonitaException { - - private static final long serialVersionUID = -3001419030791619121L; - - public OperationExecutionException(final String message, final Throwable cause) { - super(message, cause); - } - - public OperationExecutionException(final String message) { - super(message); - } - - public OperationExecutionException(final Throwable cause) { - super(cause); - } - -} diff --git a/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/SCommentService.java b/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/SCommentService.java index c7e3af39287..468c7da1182 100644 --- a/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/SCommentService.java +++ b/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/SCommentService.java @@ -78,20 +78,6 @@ public interface SCommentService { */ SComment addSystemComment(long processInstanceId, String comment) throws SCommentAddException; - /** - * Get the first 20 comments for the given processInstance - * - * @param processInstanceId - * identifier of processInstance - * @return a list of SComment object - * @throws SBonitaReadException - * in case of read error - * @see {@link QueryOptions#DEFAULT_NUMBER_OF_RESULTS} - * @deprecated use {@link #getComments(long, QueryOptions)} instead - */ - @Deprecated - List getComments(long processInstanceId) throws SBonitaReadException; - /** * Get comments for the given processInstance * diff --git a/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/impl/SCommentServiceImpl.java b/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/impl/SCommentServiceImpl.java index 6f5ccff683e..d37ea1bad30 100644 --- a/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/impl/SCommentServiceImpl.java +++ b/bpm/bonita-core/bonita-process-comment/src/main/java/org/bonitasoft/engine/core/process/comment/api/impl/SCommentServiceImpl.java @@ -13,7 +13,6 @@ **/ package org.bonitasoft.engine.core.process.comment.api.impl; -import java.util.Arrays; import java.util.Collections; import java.util.List; import java.util.Map; @@ -32,7 +31,6 @@ import org.bonitasoft.engine.core.process.comment.model.SHumanComment; import org.bonitasoft.engine.core.process.comment.model.SSystemComment; import org.bonitasoft.engine.core.process.comment.model.archive.SAComment; -import org.bonitasoft.engine.persistence.OrderByOption; import org.bonitasoft.engine.persistence.OrderByType; import org.bonitasoft.engine.persistence.QueryOptions; import org.bonitasoft.engine.persistence.ReadPersistenceService; @@ -95,18 +93,6 @@ public long getNumberOfComments(final QueryOptions options) throws SBonitaReadEx return persistenceService.getNumberOfEntities(SComment.class, options, null); } - @Deprecated - @Override - public List getComments(final long processInstanceId) throws SBonitaReadException { - final Map parameters = Collections.singletonMap("processInstanceId", - (Object) processInstanceId); - final OrderByOption orderByOption = new OrderByOption(SComment.class, "id", OrderByType.ASC); - final QueryOptions queryOptions = new QueryOptions(Arrays.asList(orderByOption)); - final SelectListDescriptor selectDescriptor = new SelectListDescriptor("getSComments", - parameters, SComment.class, queryOptions); - return persistenceService.selectList(selectDescriptor); - } - @Override public List getComments(final long processInstanceId, final QueryOptions queryOptions) throws SBonitaReadException { diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/BdmDetector.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/BdmDetector.java index 0b3872bfc13..534d360c340 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/BdmDetector.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/BdmDetector.java @@ -16,9 +16,7 @@ import static java.nio.charset.StandardCharsets.UTF_8; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; -import java.nio.file.Files; import org.bonitasoft.engine.io.FileOperations; import org.springframework.stereotype.Component; @@ -30,16 +28,12 @@ public class BdmDetector implements ArtifactDetector { public boolean isCompliant(File file) { byte[] bdm; try { - try { - bdm = FileOperations.getFileFromZip(Files.readAllBytes(file.toPath()), "bom.xml"); - } catch (FileNotFoundException e) { - return false; - } - // The bdm doesn't contain its namespace, so we can't perform the usual xml validation. - // So we look for the tag 'businessObjectModel', better than nothing: - return new String(bdm, UTF_8).contains(" getPageProperties(File file) { try { - byte[] fileFromZip = getFileFromZip(Files.readAllBytes(file.toPath()), PAGE_PROPERTIES_FILE); + byte[] fileFromZip = FileOperations.getFileFromZip(file, PAGE_PROPERTIES_FILE); Properties properties = new Properties(); properties.load(new ByteArrayInputStream(fileFromZip)); return Optional.of(properties); @@ -51,7 +51,7 @@ private Optional getPageProperties(File file) { public boolean isFilePresent(File file, String filename) { try { - getFileFromZip(Files.readAllBytes(file.toPath()), filename); + FileOperations.getFileFromZip(file, filename); return true; } catch (IOException e) { return false; diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/ProcessDetector.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/ProcessDetector.java index fff4870e497..3428259b009 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/ProcessDetector.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/application/installer/detector/ProcessDetector.java @@ -13,13 +13,12 @@ **/ package org.bonitasoft.engine.api.impl.application.installer.detector; -import static org.bonitasoft.engine.io.FileOperations.getFileFromZip; import static org.bonitasoft.engine.io.FileOperations.isBarFile; import java.io.File; import java.io.IOException; -import java.nio.file.Files; +import org.bonitasoft.engine.io.FileOperations; import org.springframework.stereotype.Component; @Component @@ -35,9 +34,9 @@ public ProcessDetector() { public boolean isCompliant(File file) { if (isBarFile(file.getName())) { try { - return super.isCompliant( - getFileFromZip(Files.readAllBytes(file.toPath()), PROCESS_DESIGN_DEFINITION)); + return super.isCompliant(FileOperations.getFileFromZip(file, PROCESS_DESIGN_DEFINITION)); } catch (IOException ignored) { + return false; } } return false; diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/transaction/activity/GetActivityInstance.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/transaction/activity/GetActivityInstance.java deleted file mode 100644 index af761945462..00000000000 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/api/impl/transaction/activity/GetActivityInstance.java +++ /dev/null @@ -1,50 +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.api.impl.transaction.activity; - -import org.bonitasoft.engine.commons.exceptions.SBonitaException; -import org.bonitasoft.engine.commons.transaction.TransactionContentWithResult; -import org.bonitasoft.engine.core.process.instance.api.ActivityInstanceService; -import org.bonitasoft.engine.core.process.instance.model.SActivityInstance; - -/** - * @author Baptiste Mesta - * @author Celine Souchet - * @deprecated since 6.3.0 - */ -@Deprecated -public class GetActivityInstance implements TransactionContentWithResult { - - private SActivityInstance activity; - - private final ActivityInstanceService activityInstanceService; - - private final long activityInstanceId; - - public GetActivityInstance(final ActivityInstanceService activityInstanceService, final long activityInstanceId) { - this.activityInstanceService = activityInstanceService; - this.activityInstanceId = activityInstanceId; - } - - @Override - public void execute() throws SBonitaException { - activity = activityInstanceService.getActivityInstance(activityInstanceId); - } - - @Override - public SActivityInstance getResult() { - return activity; - } - -} diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptor.java index dd50b692e57..13f50bea07d 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptor.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptor.java @@ -43,8 +43,6 @@ public SearchArchivedHumanTaskInstanceDescriptor() { new FieldDescriptor(SAHumanTaskInstance.class, keyProvider.getPriorityKey())); entityKeys.put(ArchivedHumanTaskInstanceSearchDescriptor.PROCESS_DEFINITION_ID, new FieldDescriptor(SAHumanTaskInstance.class, keyProvider.getProcessDefinitionKey())); - entityKeys.put(ArchivedHumanTaskInstanceSearchDescriptor.PROCESS_INSTANCE_ID, - new FieldDescriptor(SAHumanTaskInstance.class, keyProvider.getRootProcessInstanceKey())); entityKeys.put(ArchivedHumanTaskInstanceSearchDescriptor.ROOT_PROCESS_INSTANCE_ID, new FieldDescriptor(SAHumanTaskInstance.class, keyProvider.getRootProcessInstanceKey())); entityKeys.put(ArchivedHumanTaskInstanceSearchDescriptor.PARENT_PROCESS_INSTANCE_ID, diff --git a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchProcessDefinitionsDescriptor.java b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchProcessDefinitionsDescriptor.java index 3cdbb87ef18..f64d50e58b0 100644 --- a/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchProcessDefinitionsDescriptor.java +++ b/bpm/bonita-core/bonita-process-engine/src/main/java/org/bonitasoft/engine/search/descriptor/SearchProcessDefinitionsDescriptor.java @@ -60,10 +60,6 @@ public SearchProcessDefinitionsDescriptor() { searchEntityKeys.put(ProcessDeploymentInfoSearchDescriptor.DEPLOYED_BY, new FieldDescriptor(SProcessDefinitionDeployInfo.class, SProcessDefinitionDeployInfo.DEPLOYED_BY_KEY)); - searchEntityKeys.put(ProcessDeploymentInfoSearchDescriptor.LABEL, - new FieldDescriptor(SProcessDefinitionDeployInfo.class, - SProcessDefinitionDeployInfo.LABEL)); - searchEntityKeys.put(ProcessDeploymentInfoSearchDescriptor.PROCESS_ID, new FieldDescriptor(SProcessDefinitionDeployInfo.class, SProcessDefinitionDeployInfo.PROCESS_ID_KEY)); diff --git a/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptorTest.java b/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptorTest.java index 76d751cfa29..feb405988a5 100644 --- a/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptorTest.java +++ b/bpm/bonita-core/bonita-process-engine/src/test/java/org/bonitasoft/engine/search/descriptor/SearchArchivedHumanTaskInstanceDescriptorTest.java @@ -20,16 +20,6 @@ public class SearchArchivedHumanTaskInstanceDescriptorTest { - @Test - public void getEntityKey_should_map_process_instance_to_the_logical_group_2_which_is_the_root_process_instance() { - final SearchArchivedHumanTaskInstanceDescriptor descriptor = new SearchArchivedHumanTaskInstanceDescriptor(); - - final FieldDescriptor fieldDescriptor = descriptor.getEntityKeys() - .get(ArchivedHumanTaskInstanceSearchDescriptor.PROCESS_INSTANCE_ID); - - assertThat(fieldDescriptor.getValue()).isEqualTo("logicalGroup2"); - } - @Test public void getEntityKey_should_map_root_process_instance_to_the_logical_group_2_which_is_the_root_process_instance() { final SearchArchivedHumanTaskInstanceDescriptor descriptor = new SearchArchivedHumanTaskInstanceDescriptor(); diff --git a/bpm/bonita-core/bonita-process-instance/src/main/java/org/bonitasoft/engine/core/process/instance/impl/ProcessInstanceService7_7_4.java b/bpm/bonita-core/bonita-process-instance/src/main/java/org/bonitasoft/engine/core/process/instance/impl/ProcessInstanceService7_7_4.java deleted file mode 100644 index 55f5bce82fb..00000000000 --- a/bpm/bonita-core/bonita-process-instance/src/main/java/org/bonitasoft/engine/core/process/instance/impl/ProcessInstanceService7_7_4.java +++ /dev/null @@ -1,396 +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.core.process.instance.impl; - -import static org.bonitasoft.engine.classloader.ClassLoaderIdentifier.identifier; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import lombok.extern.slf4j.Slf4j; -import org.bonitasoft.engine.archive.ArchiveService; -import org.bonitasoft.engine.builder.BuilderFactory; -import org.bonitasoft.engine.classloader.ClassLoaderService; -import org.bonitasoft.engine.commons.exceptions.SBonitaException; -import org.bonitasoft.engine.commons.exceptions.SObjectModificationException; -import org.bonitasoft.engine.commons.exceptions.SObjectNotFoundException; -import org.bonitasoft.engine.core.connector.ConnectorInstanceService; -import org.bonitasoft.engine.core.connector.exception.SConnectorInstanceDeletionException; -import org.bonitasoft.engine.core.contract.data.ContractDataService; -import org.bonitasoft.engine.core.document.api.DocumentService; -import org.bonitasoft.engine.core.document.model.SLightDocument; -import org.bonitasoft.engine.core.document.model.archive.SAMappedDocument; -import org.bonitasoft.engine.core.process.comment.api.SCommentService; -import org.bonitasoft.engine.core.process.comment.model.archive.SAComment; -import org.bonitasoft.engine.core.process.definition.ProcessDefinitionService; -import org.bonitasoft.engine.core.process.instance.api.ActivityInstanceService; -import org.bonitasoft.engine.core.process.instance.api.RefBusinessDataService; -import org.bonitasoft.engine.core.process.instance.api.event.EventInstanceService; -import org.bonitasoft.engine.core.process.instance.api.exceptions.SAProcessInstanceNotFoundException; -import org.bonitasoft.engine.core.process.instance.api.exceptions.SFlowNodeDeletionException; -import org.bonitasoft.engine.core.process.instance.api.exceptions.SFlowNodeReadException; -import org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceHierarchicalDeletionException; -import org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceModificationException; -import org.bonitasoft.engine.core.process.instance.api.exceptions.SProcessInstanceReadException; -import org.bonitasoft.engine.core.process.instance.model.SConnectorInstance; -import org.bonitasoft.engine.core.process.instance.model.archive.SAActivityInstance; -import org.bonitasoft.engine.core.process.instance.model.archive.SAConnectorInstance; -import org.bonitasoft.engine.core.process.instance.model.archive.SAFlowNodeInstance; -import org.bonitasoft.engine.core.process.instance.model.archive.SAProcessInstance; -import org.bonitasoft.engine.core.process.instance.model.archive.builder.SAProcessInstanceBuilderFactory; -import org.bonitasoft.engine.data.instance.api.DataInstanceContainer; -import org.bonitasoft.engine.data.instance.api.DataInstanceService; -import org.bonitasoft.engine.data.instance.exception.SDataInstanceException; -import org.bonitasoft.engine.data.instance.exception.SDeleteDataInstanceException; -import org.bonitasoft.engine.data.instance.model.archive.SADataInstance; -import org.bonitasoft.engine.dependency.model.ScopeType; -import org.bonitasoft.engine.persistence.FilterOption; -import org.bonitasoft.engine.persistence.OrderByOption; -import org.bonitasoft.engine.persistence.OrderByType; -import org.bonitasoft.engine.persistence.QueryOptions; -import org.bonitasoft.engine.persistence.ReadPersistenceService; -import org.bonitasoft.engine.persistence.SBonitaReadException; -import org.bonitasoft.engine.recorder.Recorder; -import org.bonitasoft.engine.recorder.SRecorderException; -import org.bonitasoft.engine.recorder.model.DeleteRecord; - -/** - * This implementation only override the delete of archive process instances behavior. - * This behavior is the same as 7.7.4 and before - * It is not used by default but is a fallback in case the trigger of events on archived elements deletion is important - * It will most likely be deleted in 7.9.0 - */ -@Slf4j -@Deprecated -public class ProcessInstanceService7_7_4 extends ProcessInstanceServiceImpl { - - private static final int BATCH_SIZE = 100; - - private Recorder recorder; - private ReadPersistenceService persistenceRead; - private ActivityInstanceService activityService; - private DataInstanceService dataInstanceService; - private ArchiveService archiveService; - private ConnectorInstanceService connectorInstanceService; - private ClassLoaderService classLoaderService; - private DocumentService documentService; - private SCommentService commentService; - private RefBusinessDataService refBusinessDataService; - - public ProcessInstanceService7_7_4(final Recorder recorder, final ReadPersistenceService persistenceRead, - final ActivityInstanceService activityService, final EventInstanceService bpmEventInstanceService, - final DataInstanceService dataInstanceService, final ArchiveService archiveService, - final ProcessDefinitionService processDefinitionService, - final ConnectorInstanceService connectorInstanceService, final ClassLoaderService classLoaderService, - final DocumentService documentService, - final SCommentService commentService, final RefBusinessDataService refBusinessDataService, - ContractDataService contractDataService) { - super(recorder, persistenceRead, activityService, bpmEventInstanceService, dataInstanceService, - archiveService, processDefinitionService, - connectorInstanceService, classLoaderService, documentService, commentService, refBusinessDataService, - contractDataService); - this.recorder = recorder; - this.persistenceRead = persistenceRead; - this.activityService = activityService; - this.dataInstanceService = dataInstanceService; - this.archiveService = archiveService; - this.connectorInstanceService = connectorInstanceService; - this.classLoaderService = classLoaderService; - this.documentService = documentService; - this.commentService = commentService; - this.refBusinessDataService = refBusinessDataService; - log.warn( - "You are using a deprecated implementation of the ProcessInstanceService, This implementation will most likely be deleted in 7.9."); - } - - @Override - public int deleteArchivedProcessInstances(List sourceProcessInstanceIds) throws SBonitaException { - final List saProcessInstances = getArchivedProcessInstancesInAllStates( - sourceProcessInstanceIds); - return deleteArchivedParentProcessInstancesAndElements(saProcessInstances); - - } - - private int deleteArchivedParentProcessInstancesAndElements(final List saProcessInstances) - throws SFlowNodeReadException, - SProcessInstanceHierarchicalDeletionException, SProcessInstanceModificationException { - int nbDeleted = 0; - HashSet sourceProcessInstanceIds = new HashSet<>(); - for (final SAProcessInstance saProcessInstance : saProcessInstances) { - sourceProcessInstanceIds.add(saProcessInstance.getSourceObjectId()); - deleteArchivedParentProcessInstanceAndElements(saProcessInstance); - nbDeleted++; - } - for (Long sourceProcessInstanceId : sourceProcessInstanceIds) { - try { - refBusinessDataService.deleteArchivedRefBusinessDataInstance(sourceProcessInstanceId); - } catch (SObjectModificationException e) { - throw new SProcessInstanceModificationException(e); - } - } - return nbDeleted; - } - - private void deleteArchivedParentProcessInstanceAndElements(final SAProcessInstance saProcessInstance) - throws SFlowNodeReadException, - SProcessInstanceHierarchicalDeletionException, SProcessInstanceModificationException { - checkIfCallerIsNotActive(saProcessInstance.getCallerId()); - try { - deleteArchivedProcessInstanceElements(saProcessInstance.getSourceObjectId(), - saProcessInstance.getProcessDefinitionId()); - deleteArchivedProcessInstance(saProcessInstance); - } catch (final SProcessInstanceModificationException e) { - getArchivedProcessInstanceAndLogWhenNotFound(saProcessInstance, e); - } - } - - private void getArchivedProcessInstanceAndLogWhenNotFound(final SAProcessInstance saProcessInstance, - final SProcessInstanceModificationException e) - throws SProcessInstanceModificationException { - try { - final SAProcessInstance saProcessInstance2 = getArchivedProcessInstance(saProcessInstance.getId()); - if (saProcessInstance2 != null) { - // archived process is still here, that's not normal. The problem must be raised: - throw e; - } - log.warn(new SAProcessInstanceNotFoundException(saProcessInstance.getId()).getMessage()); - } catch (final SProcessInstanceReadException e1) { - log.warn(e.getMessage()); - } - } - - private void deleteArchivedProcessInstanceElements(final long processInstanceId, final long processDefinitionId) - throws SProcessInstanceModificationException { - final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - try { - final ClassLoader localClassLoader = classLoaderService - .getClassLoader(identifier(ScopeType.valueOf("PROCESS"), processDefinitionId)); - Thread.currentThread().setContextClassLoader(localClassLoader); - deleteArchivedFlowNodeInstances(processInstanceId); - deleteLocalArchivedDataInstances(processInstanceId, DataInstanceContainer.PROCESS_INSTANCE.toString()); - deleteArchivedDocuments(processInstanceId); - deleteArchivedConnectorInstances(processInstanceId, SConnectorInstance.PROCESS_TYPE); - deleteArchivedComments(processInstanceId); - deleteArchivedChildrenProcessInstanceAndElements(processInstanceId, processDefinitionId); - } catch (final SBonitaException e) { - throw new SProcessInstanceModificationException(e); - } finally { - Thread.currentThread().setContextClassLoader(contextClassLoader); - } - } - - private void deleteArchivedComments(final long processInstanceId) throws SBonitaException { - final List filters = Collections - .singletonList(new FilterOption(SAComment.class, SAComment.PROCESSINSTANCEID_KEY, processInstanceId)); - final List orderByOptions = Collections - .singletonList(new OrderByOption(SAComment.class, SAComment.ID_KEY, OrderByType.ASC)); - List searchArchivedComments; - // fromIndex always will be zero because the elements will be deleted - final QueryOptions queryOptions = new QueryOptions(0, 100, orderByOptions, filters, null); - do { - searchArchivedComments = commentService.searchArchivedComments(queryOptions); - for (final SAComment saComment : searchArchivedComments) { - archiveService.recordDelete(new DeleteRecord(saComment)); - } - } while (!searchArchivedComments.isEmpty()); - } - - private void deleteArchivedDocuments(final long instanceId) throws SObjectModificationException { - final FilterOption filterOption = new FilterOption(SAMappedDocument.class, "processInstanceId", instanceId); - final List filters = new ArrayList(); - filters.add(filterOption); - final QueryOptions queryOptions = new QueryOptions(0, 100, null, filters, null); - try { - List documentMappings; - do { - documentMappings = persistenceRead.searchEntity(SAMappedDocument.class, queryOptions, null); - for (final SAMappedDocument documentMapping : documentMappings) { - removeArchivedDocument(documentMapping); - } - } while (!documentMappings.isEmpty()); - } catch (final SBonitaException e) { - throw new SObjectModificationException(e); - } - } - - private void deleteArchivedChildrenProcessInstanceAndElements(final long processInstanceId, - final long processDefinitionId) throws SBonitaException { - List childrenProcessInstanceIds; - do { - // from index always will be zero because elements will be deleted - childrenProcessInstanceIds = getArchivedChildrenSourceObjectIdsFromRootProcessInstance(processInstanceId, 0, - BATCH_SIZE, OrderByType.ASC); - deleteArchivedChildrenProcessInstancesAndElements(processDefinitionId, childrenProcessInstanceIds); - } while (!childrenProcessInstanceIds.isEmpty()); - } - - private void deleteArchivedChildrenProcessInstancesAndElements(final long processDefinitionId, - final List childrenProcessInstanceIds) - throws SBonitaException { - for (final Long childProcessInstanceId : childrenProcessInstanceIds) { - deleteArchivedProcessInstanceElements(childProcessInstanceId, processDefinitionId); - deleteArchivedProcessInstancesOfProcessInstance(childProcessInstanceId); - refBusinessDataService.deleteArchivedRefBusinessDataInstance(childProcessInstanceId); - } - } - - private void deleteArchivedProcessInstancesOfProcessInstance(final long processInstanceId) throws SBonitaException { - // fromIndex variable is not updated because the elements will be deleted, so we always need to start from zero; - final SAProcessInstanceBuilderFactory processInstanceBuilderFact = BuilderFactory - .get(SAProcessInstanceBuilderFactory.class); - final FilterOption filterOption = new FilterOption(SAProcessInstance.class, - processInstanceBuilderFact.getSourceObjectIdKey(), processInstanceId); - final OrderByOption orderBy = new OrderByOption(SAProcessInstance.class, processInstanceBuilderFact.getIdKey(), - OrderByType.ASC); - final QueryOptions queryOptions = new QueryOptions(0, 100, Collections.singletonList(orderBy), - Collections.singletonList(filterOption), null); - - List archProcessInstances; - do { - archProcessInstances = searchArchivedProcessInstances(queryOptions); - for (final SAProcessInstance saProcessInstance : archProcessInstances) { - deleteArchivedProcessInstance(saProcessInstance); - } - } while (!archProcessInstances.isEmpty()); // never will be null as the persistence service sends an empty list if there are no results - } - - private void deleteArchivedFlowNodeInstances(final long processInstanceId) throws SFlowNodeDeletionException { - try { - deleteArchivedFlowNodeInstancesAndElements(processInstanceId); - } catch (final SFlowNodeDeletionException e) { - throw e; - } catch (final SBonitaException e) { - throw new SFlowNodeDeletionException(e); - } - } - - private void deleteArchivedFlowNodeInstancesAndElements(final long processInstanceId) throws SBonitaException { - Set sourceActivityIds = new HashSet(); - List saFlowNodeInstances; - do { - saFlowNodeInstances = activityService.getArchivedFlowNodeInstances(processInstanceId, 0, BATCH_SIZE); - sourceActivityIds = deleteArchivedFlowNodeInstancesAndElements(sourceActivityIds, saFlowNodeInstances); - } while (!saFlowNodeInstances.isEmpty()); - } - - private Set deleteArchivedFlowNodeInstancesAndElements(final Set sourceActivityIds, - final List saFlowNodeInstances) - throws SBonitaException { - Set newSourceActivityIds = new HashSet(sourceActivityIds); - for (final SAFlowNodeInstance saFlowNodeInstance : saFlowNodeInstances) { - newSourceActivityIds = deleteArchivedFlowNodeInstanceAndElements(newSourceActivityIds, saFlowNodeInstance); - } - return newSourceActivityIds; - } - - private Set deleteArchivedFlowNodeInstanceAndElements(final Set sourceActivityIds, - final SAFlowNodeInstance saFlowNodeInstance) - throws SBonitaException { - final Set newSourceActivityIds = new HashSet(sourceActivityIds); - if (saFlowNodeInstance instanceof SAActivityInstance - && !sourceActivityIds.contains(saFlowNodeInstance.getSourceObjectId())) { - newSourceActivityIds.add(saFlowNodeInstance.getSourceObjectId()); - deleteArchivedFlowNodeInstanceElements((SAActivityInstance) saFlowNodeInstance); - } - deleteArchivedFlowNodeInstance(saFlowNodeInstance); - return newSourceActivityIds; - } - - public void deleteArchivedFlowNodeInstance(final SAFlowNodeInstance saFlowNodeInstance) - throws SFlowNodeDeletionException { - try { - recorder.recordDelete(new DeleteRecord(saFlowNodeInstance), "ARCHIVED_FLOWNODE_INSTANCE"); - } catch (final SRecorderException e) { - throw new SFlowNodeDeletionException(e); - } - } - - private void deleteArchivedFlowNodeInstanceElements(final SAActivityInstance saActivityInstance) - throws SBonitaException { - deleteLocalArchivedDataInstances(saActivityInstance.getSourceObjectId(), - DataInstanceContainer.ACTIVITY_INSTANCE.toString()); - deleteArchivedConnectorInstances(saActivityInstance.getSourceObjectId(), SConnectorInstance.FLOWNODE_TYPE); - } - - private void deleteSADataInstance(final SADataInstance dataInstance) throws SDeleteDataInstanceException { - try { - recorder.recordDelete(new DeleteRecord(dataInstance), "DATA_INSTANCE"); - } catch (final SRecorderException e) { - throw new SDeleteDataInstanceException("Impossible to delete data instance", e); - } - } - - private void deleteLocalArchivedDataInstances(final long containerId, final String containerType) - throws SDataInstanceException { - List sDataInstances; - do { - sDataInstances = dataInstanceService.getLocalSADataInstances(containerId, containerType, 0, 100); - for (final SADataInstance sDataInstance : sDataInstances) { - deleteSADataInstance(sDataInstance); - } - } while (!sDataInstances.isEmpty()); - } - - private void deleteArchivedConnectorInstances(final long containerId, final String containerType) - throws SBonitaException { - final ReadPersistenceService persistenceService = archiveService.getDefinitiveArchiveReadPersistenceService(); - final List filters = buildFiltersForConnectors(containerId, containerType); - final OrderByOption orderBy = new OrderByOption(SAConnectorInstance.class, SConnectorInstance.ID_KEY, - OrderByType.ASC); - final QueryOptions queryOptions = new QueryOptions(0, 100, Collections.singletonList(orderBy), filters, null); - List connectorInstances; - do { - connectorInstances = connectorInstanceService.searchArchivedConnectorInstance(queryOptions, - persistenceService); - for (final SAConnectorInstance sConnectorInstance : connectorInstances) { - deleteArchivedConnectorInstance(sConnectorInstance); - } - } while (!connectorInstances.isEmpty()); - } - - private void deleteArchivedConnectorInstance(final SAConnectorInstance sConnectorInstance) - throws SConnectorInstanceDeletionException { - try { - recorder.recordDelete(new DeleteRecord(sConnectorInstance), "CONNECTOR_INSTANCE"); - } catch (final SRecorderException e) { - throw new SConnectorInstanceDeletionException(e); - } - } - - private List buildFiltersForConnectors(final long containerId, final String containerType) { - final List filters = new ArrayList<>(2); - filters.add(new FilterOption(SAConnectorInstance.class, SConnectorInstance.CONTAINER_ID_KEY, containerId)); - filters.add(new FilterOption(SAConnectorInstance.class, SConnectorInstance.CONTAINER_TYPE_KEY, containerType)); - return filters; - } - - private void removeArchivedDocument(final SAMappedDocument mappedDocument) - throws SRecorderException, SBonitaReadException, SObjectNotFoundException { - // Delete document itself and the mapping - delete(mappedDocument); - delete(documentService.getDocument(mappedDocument.getDocumentId())); - } - - private void delete(final SLightDocument document) throws SRecorderException { - recorder.recordDelete(new DeleteRecord(document), "SDocument"); - } - - private void delete(final SAMappedDocument mappedDocument) throws SRecorderException { - recorder.recordDelete(new DeleteRecord(mappedDocument), "SADocumentMapping"); - } - -} diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/auth/ConsumerNotFoundException.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/auth/ConsumerNotFoundException.java index add85b49bfb..a3572c92497 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/auth/ConsumerNotFoundException.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/auth/ConsumerNotFoundException.java @@ -19,10 +19,10 @@ * This class cannot be removed without the risk of breaking * old {@link AuthenticationManager} implementations that may still use it * - * @deprecated since 7.16.0 + * @deprecated since 8.0.0 * @author Chong Zhao */ -@Deprecated +@Deprecated(since = "8.0.0") public class ConsumerNotFoundException extends ServletException { /** diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/LoginManager.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/LoginManager.java index 951b2bb2e82..33d110665a2 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/LoginManager.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/LoginManager.java @@ -61,17 +61,6 @@ public void login(final HttpServletRequest request, final HttpServletResponse re loginInternal(requestAccessor, response, getUserLogger(), userCredentials); } - /** - * @deprecated use {@link LoginManager#login(HttpServletRequest, HttpServletResponse)} instead. It also deals with - * the cookies creation (CSRF and tenant) - */ - @Deprecated - public void login(HttpServletRequestAccessor request, HttpServletResponse response, UserLogger userLoger, - Credentials credentials) - throws AuthenticationFailedException, ServletException, LoginFailedException { - loginInternal(request, response, userLoger, credentials); - } - public void loginInternal(HttpServletRequestAccessor request, HttpServletResponse response, UserLogger userLoger, Credentials credentials) throws AuthenticationFailedException, ServletException, LoginFailedException { diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/filter/TokenGenerator.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/filter/TokenGenerator.java index 04b1846b33a..402415b4416 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/filter/TokenGenerator.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/login/filter/TokenGenerator.java @@ -13,12 +13,10 @@ **/ package org.bonitasoft.console.common.server.login.filter; -import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import org.bonitasoft.console.common.server.api.token.APIToken; -import org.bonitasoft.console.common.server.login.PortalCookies; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,25 +30,11 @@ public class TokenGenerator { public static final String API_TOKEN = "api_token"; public static final String X_BONITA_API_TOKEN = "X-Bonita-API-Token"; - /** - * set the CSRF security token to the HTTP response as cookie. - * - * @deprecated use - * {@link PortalCookies#addCSRFTokenCookieToResponse(HttpServletRequest, HttpServletResponse, Object)} - * instead - */ - @Deprecated - public void setTokenToResponseCookie(HttpServletRequest request, HttpServletResponse res, - Object apiTokenFromClient) { - PortalCookies portalCookies = new PortalCookies(); - portalCookies.addCSRFTokenCookieToResponse(request, res, apiTokenFromClient); - } - /** * generate and store the CSRF security inside HTTP session * or retrieve it token from the HTTP session * - * @param req the HTTP session + * @param session the HTTP session * @return the CSRF security token */ public String createOrLoadToken(final HttpSession session) { @@ -69,7 +53,7 @@ public String createOrLoadToken(final HttpSession session) { * set the CSRF security token to the HTTP response as HTTP Header. * * @param res the http response - * @param apiTokenFromClient the security token to set + * @param token the security token to set */ public void setTokenToResponseHeader(final HttpServletResponse res, final String token) { if (res.containsHeader(X_BONITA_API_TOKEN)) { diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/page/PageResourceServlet.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/page/PageResourceServlet.java deleted file mode 100644 index f4f1af54952..00000000000 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/page/PageResourceServlet.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (C) 2022 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.console.common.server.page; - -import java.io.File; -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.bonitasoft.console.common.server.preferences.constants.WebBonitaConstantsUtils; -import org.bonitasoft.console.common.server.servlet.ResourceServlet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * @author Anthony Birembaut - * This servlet is deprecated. - * You can now access your resources through their relative URL. - * see the custom page documentation. - */ -@Deprecated -public class PageResourceServlet extends ResourceServlet { - - /** - * UID - */ - private static final long serialVersionUID = 6745970275852563050L; - - /** - * Logger - */ - private final static Logger LOGGER = LoggerFactory.getLogger(PageResourceServlet.class.getName()); - - /** - * theme name : the theme folder's name - */ - protected final static String PAGE_PARAM_NAME = "page"; - - /** - * resources subfolder name - */ - protected final static String RESOURCES_SUBFOLDER_NAME = "resources"; - - /** - * {@inheritDoc} - */ - @Override - protected void doGet(final HttpServletRequest request, final HttpServletResponse response) - throws ServletException, IOException { - if (LOGGER.isInfoEnabled()) { - LOGGER.info("This servlet is deprecated. " + - "You can now access your resources through their relative URL." + - "see the custom page documentation."); - } - super.doGet(request, response); - } - - @Override - protected String getResourceParameterName() { - return PAGE_PARAM_NAME; - } - - @Override - protected File getResourcesParentFolder() { - return WebBonitaConstantsUtils.getTenantInstance().getPagesFolder(); - } - - @Override - protected String getSubFolderName() { - return RESOURCES_SUBFOLDER_NAME; - } - - @Override - protected String getDefaultResourceName() { - return null; - } - -} diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/BonitaHomeFolderAccessor.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/BonitaHomeFolderAccessor.java index 4ea928536fa..f38420a3bdb 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/BonitaHomeFolderAccessor.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/BonitaHomeFolderAccessor.java @@ -45,9 +45,9 @@ public BonitaHomeFolderAccessor() { * @param tempFileKey * @return * @throws IOException - * @deprecated use retrieveTempFileContent instead to avoid creating additional temp file + * @deprecated use {@link #retrieveUploadedTempContent(String)} instead to avoid creating additional temp file */ - @Deprecated + @Deprecated(since = "9.0.0") public File getTempFile(final String tempFileKey) throws IOException { try { FileContent fileContent = retrieveUploadedTempContent(tempFileKey); diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/DateUtil.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/DateUtil.java deleted file mode 100644 index 6f81f62481f..00000000000 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/console/common/server/utils/DateUtil.java +++ /dev/null @@ -1,82 +0,0 @@ -/** - * Copyright (C) 2022 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.console.common.server.utils; - -import java.text.DateFormat; -import java.text.ParseException; -import java.util.Calendar; -import java.util.Date; -import java.util.Locale; - -// TODO Delete this class while no longer used -/** - * @author Haojie Yuan - * @deprecated Use DateFormat instead - */ -@Deprecated -public class DateUtil { - - /** - * @deprecated Use DateFormat instead - */ - @Deprecated - public static String formatDate(final Date date) { - String dateStr = null; - if (date != null) { - final DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.ENGLISH); - dateStr = df.format(date); - } - return dateStr; - } - - /** - * @deprecated Use DateFormat instead - */ - @Deprecated - public static String parseDate(final Date date) { - String dateStr = null; - if (date != null) { - final DateFormat time = DateFormat.getTimeInstance(DateFormat.MEDIUM, Locale.ENGLISH); - final DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM, Locale.ENGLISH); - dateStr = time.format(date) + ", " + df.format(date); - } - return dateStr; - } - - /** - * @deprecated Use DateFormat instead - */ - @Deprecated - public static String convertLongToDate(final long time) { - final Date date = new Date(); - date.setTime(time); - return formatDate(date); - } - - /** - * @deprecated Use DateFormat instead - */ - @Deprecated - public static String getYear(final String date) throws ParseException { - String year = null; // February 27, 2012 - if (date != null && !date.isEmpty()) { - final DateFormat df = DateFormat.getDateInstance(DateFormat.LONG, Locale.ENGLISH); - final Calendar cal = Calendar.getInstance(Locale.ENGLISH); - cal.setTime(df.parse(date)); - year = String.valueOf(cal.get(Calendar.YEAR)); - } - return year; - } - -} diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/application/ApplicationItem.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/application/ApplicationItem.java index d0fe48f36d1..80095c0fb89 100755 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/application/ApplicationItem.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/application/ApplicationItem.java @@ -33,7 +33,10 @@ public class ApplicationItem extends Item implements ItemHasUniqueId, ItemHasIco public static final String ATTRIBUTE_DESCRIPTION = "description"; - @Deprecated + /** + * @deprecated since 7.13.0, see {@link #getIconPath()} & {@link #setIconPath(String)} + */ + @Deprecated(since = "7.13.0") public static final String ATTRIBUTE_ICON_PATH = "iconPath"; public static final String ATTRIBUTE_CREATION_DATE = "creationDate"; @@ -118,17 +121,17 @@ public void setDescription(final String description) { } /** - * @deprecated since 7.13, use getIcon instead + * @deprecated since 7.13, use {@link #getIcon()} instead */ - @Deprecated + @Deprecated(since = "7.13.0") public String getIconPath() { return getAttributeValue(ATTRIBUTE_ICON_PATH); } /** - * @deprecated since 7.13, use setIcon instead + * @deprecated since 7.13, use {@link #setIcon(String)} instead */ - @Deprecated + @Deprecated(since = "7.13.0") public void setIconPath(final String iconPath) { setAttribute(ATTRIBUTE_ICON_PATH, iconPath); } diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/portal/page/PageItem.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/portal/page/PageItem.java index 266910649ba..505ba6497cd 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/portal/page/PageItem.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/model/portal/page/PageItem.java @@ -50,10 +50,10 @@ public class PageItem extends Item implements ItemHasUniqueId { public static final String ATTRIBUTE_CONTENT_TYPE = "contentType"; /** - * @param isHidden - * @deprecated Since 7.14.0 + * @deprecated Since 7.14.0, parameter "isHidden" for page search is deprecated and will be removed in a future + * release */ - @Deprecated + @Deprecated(since = "7.14.0", forRemoval = true) public static final String ATTRIBUTE_IS_HIDDEN = "isHidden"; public static final String ATTRIBUTE_IS_EDITABLE = "isEditable"; @@ -208,6 +208,11 @@ public APIID getUpdatedByUserId() { return getAttributeValueAsAPIID(ATTRIBUTE_UPDATED_BY_USER_ID); } + /** + * @deprecated Since 7.14.0, parameter "isHidden" for page search is deprecated and will be removed in a future + * release + */ + @Deprecated(since = "7.14.0", forRemoval = true) public boolean isHidden() { return Boolean.parseBoolean(getAttributeValue(ATTRIBUTE_IS_HIDDEN)); } diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/document/api/impl/DocumentDatastore.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/document/api/impl/DocumentDatastore.java index fec1ff2d3bc..07c79dbb517 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/document/api/impl/DocumentDatastore.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/document/api/impl/DocumentDatastore.java @@ -243,13 +243,13 @@ private ArchivedDocumentItem buildArchivedDocumentItem(final String caseName, fi item.setDocumentSourceObjectId(String.valueOf(document.getSourceObjectId())); item.setCaseId(String.valueOf(document.getProcessInstanceId())); item.setDocumentName(document.getName()); - item.setDocumentAuthor(document.getDocumentAuthor()); - item.setDocumentFileName(document.getDocumentContentFileName()); - item.setDocumentCreationDate(parseDate(document.getDocumentCreationDate())); - item.setDocumentMIMEType(document.getDocumentContentMimeType()); - item.setDocumentHasContent(String.valueOf(document.getDocumentHasContent())); + item.setDocumentAuthor(document.getAuthor()); + item.setDocumentFileName(document.getContentFileName()); + item.setDocumentCreationDate(parseDate(document.getCreationDate())); + item.setDocumentMIMEType(document.getContentMimeType()); + item.setDocumentHasContent(String.valueOf(document.hasContent())); item.setDocumentStorageId(document.getContentStorageId()); - item.setDocumentURL(document.getDocumentURL()); + item.setDocumentURL(document.getUrl()); item.setProcessDisplayName(processDisplayName); item.setProcessVersion(version); item.setCaseName(caseName); diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java index fa3cf3e5792..fa6eb09e9a4 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/api/tenant/APITenantAdmin.java @@ -27,7 +27,7 @@ /** * @author Julien Reboul - * @deprecated since 9.0.0, use {{@link org.bonitasoft.web.rest.server.api.system.MaintenanceController}} instead. + * @deprecated since 9.0.0, use {@link org.bonitasoft.web.rest.server.api.system.MaintenanceController} instead. */ @Deprecated(since = "9.0.0", forRemoval = true) public class APITenantAdmin extends ConsoleAPI diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/archive/converter/ArchivedHumanTaskSearchDescriptorConverter.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/archive/converter/ArchivedHumanTaskSearchDescriptorConverter.java index 9625ce4bef7..472c63e8c4e 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/archive/converter/ArchivedHumanTaskSearchDescriptorConverter.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/datastore/bpm/flownode/archive/converter/ArchivedHumanTaskSearchDescriptorConverter.java @@ -31,7 +31,7 @@ public class ArchivedHumanTaskSearchDescriptorConverter extends ArchivedActivity static { mapping.put(ArchivedFlowNodeItem.ATTRIBUTE_CASE_ID, - ArchivedHumanTaskInstanceSearchDescriptor.PROCESS_INSTANCE_ID); + ArchivedActivityInstanceSearchDescriptor.ROOT_PROCESS_INSTANCE_ID); mapping.put(ArchivedFlowNodeItem.ATTRIBUTE_ROOT_CASE_ID, ArchivedActivityInstanceSearchDescriptor.ROOT_PROCESS_INSTANCE_ID); mapping.put(ArchivedFlowNodeItem.ATTRIBUTE_PARENT_CASE_ID, diff --git a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/framework/utils/SearchOptionsBuilderUtil.java b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/framework/utils/SearchOptionsBuilderUtil.java index 7989881be8c..58e56585afe 100644 --- a/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/framework/utils/SearchOptionsBuilderUtil.java +++ b/bpm/bonita-web-server/src/main/java/org/bonitasoft/web/rest/server/framework/utils/SearchOptionsBuilderUtil.java @@ -19,14 +19,18 @@ /** * @author Haojie Yuan */ -public class SearchOptionsBuilderUtil { +public final class SearchOptionsBuilderUtil { + + private SearchOptionsBuilderUtil() { + // Utility class + } /** * build SearchOptionsBuilder * - * @deprecated use org.bonitasoft.web.rest.server.credentials.utils.SearchOptionsCreator + * @deprecated use {@link org.bonitasoft.web.rest.server.datastore.utils.SearchOptionsCreator} instead */ - @Deprecated + @Deprecated(since = "6.0") public static SearchOptionsBuilder buildSearchOptions(final int pageIndex, final int numberOfResults, final String sort, final String search) { final SearchOptionsBuilder builder = new SearchOptionsBuilder(computeIndex(pageIndex, numberOfResults), diff --git a/bpm/bonita-web-server/src/main/webapp/WEB-INF/web.xml b/bpm/bonita-web-server/src/main/webapp/WEB-INF/web.xml index 873292120ab..ef2dfb96356 100644 --- a/bpm/bonita-web-server/src/main/webapp/WEB-INF/web.xml +++ b/bpm/bonita-web-server/src/main/webapp/WEB-INF/web.xml @@ -275,7 +275,6 @@ CacheFilter /login.jsp - /portal/pageResource /platformloginservice /platformlogoutservice /API/system/i18ntranslation @@ -527,13 +526,6 @@ CustomPageServlet org.bonitasoft.console.common.server.page.CustomPageServlet - - - pageResource - org.bonitasoft.console.common.server.page.PageResourceServlet - pageDownload org.bonitasoft.console.common.server.page.PageDownloadServlet @@ -737,13 +729,6 @@ CustomPageServlet /portal/custom-page/* - - - pageResource - /portal/pageResource - pageDownload /portal/pageDownload diff --git a/bpm/bonita-web-server/src/test/java/org/bonitasoft/console/common/server/page/PageResourceServletTest.java b/bpm/bonita-web-server/src/test/java/org/bonitasoft/console/common/server/page/PageResourceServletTest.java deleted file mode 100644 index 84ec4841830..00000000000 --- a/bpm/bonita-web-server/src/test/java/org/bonitasoft/console/common/server/page/PageResourceServletTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright (C) 2022 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.console.common.server.page; - -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.spy; -import static org.mockito.Mockito.when; - -import java.io.File; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import javax.servlet.http.HttpSession; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnitRunner; - -/** - * @author Julien Mege - */ - -@RunWith(MockitoJUnitRunner.class) -public class PageResourceServletTest { - - @Mock - private HttpServletRequest req; - - @Mock - private HttpServletResponse res; - - @Mock - HttpSession httpSession; - - @Test - public void should_verify_authorisation_for_the_given_location_param() throws Exception { - - final PageResourceServlet pageResourceServlet = spy(new PageResourceServlet()); - when(req.getParameter(pageResourceServlet.getResourceParameterName())).thenReturn("name"); - when(req.getMethod()).thenReturn("GET"); - - when(pageResourceServlet.getResourcesParentFolder()).thenReturn(new File(".")); - - when(req.getParameter("location")).thenReturn("../../../file.txt"); - try { - pageResourceServlet.service(req, res); - } catch (final ServletException e) { - assertTrue(e.getMessage().startsWith("For security reasons, access to this file paths")); - } - } - -}