From ff6f5cf34d90c2c42dd4acc9d4b890873bac2fd8 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 31 Mar 2024 22:37:53 +0300 Subject: [PATCH 01/97] AMP-30677-Ant to maven migration --- amp/403.jsp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amp/403.jsp b/amp/403.jsp index 8e5bc988bcc..623ee187d6d 100644 --- a/amp/403.jsp +++ b/amp/403.jsp @@ -1,9 +1,10 @@ 403 Forbidden +

Forbidden

You don't have permission to access this page.

- \ No newline at end of file + From f75a97d896901993e45f4c18f2daeb0b9f5b743c Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 31 Mar 2024 22:46:08 +0300 Subject: [PATCH 02/97] AMP-30677-Ant to maven migration --- .../modules/activity/preview/containers/APDocumentPage.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amp/TEMPLATE/reamp/modules/activity/preview/containers/APDocumentPage.jsx b/amp/TEMPLATE/reamp/modules/activity/preview/containers/APDocumentPage.jsx index 7e6a6a46e9c..18d3c0c8f84 100644 --- a/amp/TEMPLATE/reamp/modules/activity/preview/containers/APDocumentPage.jsx +++ b/amp/TEMPLATE/reamp/modules/activity/preview/containers/APDocumentPage.jsx @@ -2,7 +2,8 @@ import { bindActionCreators } from 'redux'; import { connect } from 'react-redux'; import { APDocument } from 'amp-ui'; import * as ResourceAction from '../actions/ResourceAction'; -import RepositoryManager from '../utils/jspManager'; +import RepositoryManager from "amp/modules/activity/preview/utils/RepositoryManager"; +// import RepositoryManager from '../utils/jspManager'; const mapStateToProps = (state) => { return { From a2d2dc035e0e31fc560b04c1cdab47d8a579542f Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 12:17:34 +0300 Subject: [PATCH 03/97] AMP-30677- Add configuration for Tests --- amp/Dockerfile | 2 +- amp/pom.xml | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/amp/Dockerfile b/amp/Dockerfile index df24de00517..c8a1ad6a78c 100644 --- a/amp/Dockerfile +++ b/amp/Dockerfile @@ -116,7 +116,7 @@ COPY --from=compile-reamp /tmp/amp/TEMPLATE/reamp TEMPLATE/reamp COPY --from=compile-reampv2 /tmp/amp/TEMPLATE/reampv2/build TEMPLATE/reampv2/build ARG BUILD_SOURCE RUN --mount=type=cache,target=/root/.m2 \ - mvn -B test war:exploded -DfailIfNoTests=false \ + mvn -B test war:exploded \ -DbuildSource=$BUILD_SOURCE \ -Djdbc.user=amp -Djdbc.password=amp122006 -Djdbc.db=amp -Djdbc.host=db \ -Djdbc.port=5432 -DdbName=postgresql -Djdbc.driverClassName=org.postgresql.Driver \ diff --git a/amp/pom.xml b/amp/pom.xml index 966c7a473f4..1a24c451fe8 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -31,12 +31,12 @@ ${project.basedir}/META-INF ${project.basedir}/src/main/webapp/WEB-INF/classes ${project.basedir}/src - ${project.basedir}/test + ${project.basedir}/src/test ${project.basedir}/etc deployConfigs - ${project.basedir}/jsp - ${project.basedir}/jackrabbit - ${project.basedir}/src/main/webapp/WEB-INF/amp-test + ${project.basedir}/src/main/webapp/WEB-INF/jsp + ${project.basedir}/src/main/webapp/WEB-INF/jackrabbit + ${project.basedir}/src/test ${project.basedir}/src/main/webapp/WEB-INF/amp-selenium-test @@ -2127,10 +2127,12 @@ ${project.build.testSourceDirectory} - **/Test*.java - **/*Test.java - **/*Testcases.java - **/*Test*.java + + + + + **/* + From ad42e089d02aa8f2c3e5b41e7fa9cb4982ee8ce1 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 12:21:30 +0300 Subject: [PATCH 04/97] AMP-30677- Add configuration for Tests --- amp/Dockerfile | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/amp/Dockerfile b/amp/Dockerfile index c8a1ad6a78c..084672dc76d 100644 --- a/amp/Dockerfile +++ b/amp/Dockerfile @@ -117,13 +117,20 @@ COPY --from=compile-reampv2 /tmp/amp/TEMPLATE/reampv2/build TEMPLATE/reampv2/bui ARG BUILD_SOURCE RUN --mount=type=cache,target=/root/.m2 \ mvn -B test war:exploded \ - -DbuildSource=$BUILD_SOURCE \ - -Djdbc.user=amp -Djdbc.password=amp122006 -Djdbc.db=amp -Djdbc.host=db \ - -Djdbc.port=5432 -DdbName=postgresql -Djdbc.driverClassName=org.postgresql.Driver \ - -Dskip.npm -Dskip.installnodenpm \ + -DbuildSource="$BUILD_SOURCE" \ + -Djdbc.user=amp \ + -Djdbc.password=amp122006 \ + -Djdbc.db=amp \ + -Djdbc.host=db \ + -Djdbc.port=5432 \ + -DdbName=postgresql \ + -Djdbc.driverClassName=org.postgresql.Driver \ + -Dskip.npm \ + -Dskip.installnodenpm \ && mv target/amp exploded \ && rm -rf target + FROM tomcat:8.5.79-jdk8 RUN apt-get update \ From 392afb1720c696cd432729950c6e20fa3e64d9fe Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 12:31:46 +0300 Subject: [PATCH 05/97] AMP-30677- Add configuration for Tests --- .../activity/ActivityExporterTest.java | 29 ++++++------ .../DiscriminatedFieldAccessorTest.java | 8 ++-- .../ampapi/endpoints/activity/EditorTest.java | 1 + .../activity/FieldsEnumeratorTest.java | 46 +++++++++---------- 4 files changed, 43 insertions(+), 41 deletions(-) diff --git a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/ActivityExporterTest.java b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/ActivityExporterTest.java index 187d4a7137c..8fcf63aafa4 100644 --- a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/ActivityExporterTest.java +++ b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/ActivityExporterTest.java @@ -11,8 +11,9 @@ import org.digijava.module.aim.dbentity.AmpActivityVersion; import org.digijava.module.aim.dbentity.AmpTheme; import org.hamcrest.Matcher; +import org.hamcrest.MatcherAssert; import org.hamcrest.Matchers; -import org.junit.Before; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.util.*; @@ -27,7 +28,7 @@ public class ActivityExporterTest { private List fields; - @Before + @BeforeEach public void setUp() { TestTranslatorService translatorService = new TestTranslatorService(); @@ -51,7 +52,7 @@ public void testProjectName() { Map jsonActivity = createExporter().export(activity); - assertThat(jsonActivity, hasEntry("project_title", "test"));// fixme there are 100+ fields with null values! + MatcherAssert.assertThat(jsonActivity, hasEntry("project_title", "test"));// fixme there are 100+ fields with null values! } @Test @@ -87,14 +88,13 @@ public void testPrograms() { Map jsonActivity = createExporter().export(activity); - assertThat(jsonActivity, - (Matcher) allOf( - hasEntry(equalTo("primary_programs"), - contains(actProgram(axe1.getAmpThemeId(), 100F))), - hasEntry(equalTo("secondary_programs"), - containsInAnyOrder( - actProgram(instReform.getAmpThemeId(), 78F), - actProgram(edReform.getAmpThemeId(), 22F))))); + MatcherAssert.assertThat(jsonActivity, (Matcher) allOf( + hasEntry(equalTo("primary_programs"), + contains(actProgram(axe1.getAmpThemeId(), 100F))), + hasEntry(equalTo("secondary_programs"), + containsInAnyOrder( + actProgram(instReform.getAmpThemeId(), 78F), + actProgram(edReform.getAmpThemeId(), 22F))))); } /** @@ -116,10 +116,9 @@ public void testFilters() { Map jsonActivity = exporter.export(activity); - assertThat(jsonActivity, - allOf( - hasEntry("description", "desc"), - not(hasEntry("project_title", "test")))); + MatcherAssert.assertThat(jsonActivity, allOf( + hasEntry("description", "desc"), + not(hasEntry("project_title", "test")))); } private ActivityExporter createExporter() { diff --git a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/DiscriminatedFieldAccessorTest.java b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/DiscriminatedFieldAccessorTest.java index 2933c22798d..48a0632a54b 100644 --- a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/DiscriminatedFieldAccessorTest.java +++ b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/DiscriminatedFieldAccessorTest.java @@ -4,10 +4,9 @@ import org.dgfoundation.amp.testutils.TransactionUtil; import org.digijava.kernel.request.TLSUtils; import org.hamcrest.Matcher; -import org.junit.BeforeClass; +import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; -import javax.validation.ConstraintViolationException; import java.lang.reflect.Field; import java.util.*; @@ -19,6 +18,7 @@ /** * @author Octavian Ciubotaru */ + public class DiscriminatedFieldAccessorTest { @@ -51,7 +51,7 @@ public String getValue() { private static Field attributes; private static Field categories; - @BeforeClass + @BeforeAll public static void setUp() throws Exception { TransactionUtil.setUpWorkspaceEmptyPrefixes(); TLSUtils.getRequest().setAttribute(WORKSPACE_PREFIX, ""); @@ -72,6 +72,7 @@ public void testCollectionReadFromNull() { }); } + @org.junit.Test @Test public void testCollectionWriteWriteToNull() { assertThrows(RuntimeException.class,()-> { @@ -84,6 +85,7 @@ public void testCollectionWriteWriteToNull() { }); } + @org.junit.Test @Test public void testDiscriminatedRead() { Obj obj = new Obj(); diff --git a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/EditorTest.java b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/EditorTest.java index e3e1e35adad..dbd9f3990aa 100644 --- a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/EditorTest.java +++ b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/EditorTest.java @@ -17,6 +17,7 @@ */ public class EditorTest { + @org.junit.Test @Test public void testParallel() { diff --git a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/FieldsEnumeratorTest.java b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/FieldsEnumeratorTest.java index 282f3d91311..f1a6c5d0210 100644 --- a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/FieldsEnumeratorTest.java +++ b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/activity/FieldsEnumeratorTest.java @@ -27,8 +27,10 @@ import org.digijava.module.aim.dbentity.AmpActivityVersion; import org.digijava.module.aim.dbentity.AmpContact; import org.digijava.module.aim.validator.groups.Submit; -import org.junit.Before; +import org.hamcrest.MatcherAssert; import org.junit.Rule; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; @@ -44,7 +46,6 @@ import static org.digijava.kernel.ampapi.endpoints.activity.TestFMService.HIDDEN_FM_PATH; import static org.digijava.kernel.ampapi.endpoints.activity.TestFMService.VISIBLE_FM_PATH; import static org.hamcrest.Matchers.*; -import static org.junit.Assert.*; import static org.junit.jupiter.api.Assertions.assertThrows; import static org.mockito.Matchers.any; import static org.mockito.Mockito.mock; @@ -61,7 +62,8 @@ public class FieldsEnumeratorTest { private FeatureManagerService fmService; private FieldInfoProvider provider; - @Rule public MockitoRule rule = MockitoJUnit.rule(); + @Rule + public MockitoRule rule = MockitoJUnit.rule(); @Mock private TranslatorService throwingTranslatorService; @Mock private TranslatorService emptyTranslatorService; @@ -73,7 +75,7 @@ public class FieldsEnumeratorTest { private ValueConverter valueConverter; - @Before + @BeforeEach public void setUp() throws Exception { translatorService = new TestTranslatorService(); fmService = new TestFMService(); @@ -93,7 +95,7 @@ public void setUp() throws Exception { @Test public void testEmpty() { List fields = fieldsFor(Object.class); - assertTrue(fields.isEmpty()); + Assertions.assertTrue(fields.isEmpty()); } private static class NotAnnotated { @@ -104,7 +106,7 @@ private static class NotAnnotated { @Test public void testNotAnnotated() { List fields = fieldsFor(NotAnnotated.class); - assertTrue(fields.isEmpty()); + Assertions.assertTrue(fields.isEmpty()); } private static class OneFieldClass { @@ -259,7 +261,7 @@ public void testInvisibleField() { new FieldsEnumerator(provider, invisibleFmService, translatorService, name -> true) .getAllAvailableFields(OneFieldClass.class); - assertEquals(Collections.emptyList(), actual); + Assertions.assertEquals(Collections.emptyList(), actual); } private static class Composition { @@ -639,8 +641,8 @@ public void testDefaultTranslation() { List fields = new FieldsEnumerator(provider, fmService, emptyTranslatorService, name -> true) .getAllAvailableFields(OneFieldClass.class); - assertEquals(1, fields.size()); - assertEquals("One Field", fields.get(0).getFieldLabel().get(TrnUtil.DEFAULT, "en")); + Assertions.assertEquals(1, fields.size()); + Assertions.assertEquals("One Field", fields.get(0).getFieldLabel().get(TrnUtil.DEFAULT, "en")); } @Test @@ -663,7 +665,7 @@ public void testNonEmptyChildren() { try { List actual = fieldsFor(Composition.class); String actualJson = new ObjectMapper().writeValueAsString(actual); - assertEquals(originalJson, actualJson); + Assertions.assertEquals(originalJson, actualJson); } catch (JsonProcessingException e) { throw new RuntimeException(e); } @@ -680,7 +682,7 @@ public void testEmptyChildren() { try { List actual = fieldsFor(NestedField.class); String actualJson = new ObjectMapper().writeValueAsString(actual); - assertEquals(originalJson, actualJson); + Assertions.assertEquals(originalJson, actualJson); } catch (JsonProcessingException e) { throw new RuntimeException(e); } @@ -718,7 +720,7 @@ public void testFieldsWithPossibleValuesPredicate() { List fieldPaths = fieldsEnumerator.findFieldPaths(fieldFilter, fields); - assertThat(fieldPaths, hasItems( + MatcherAssert.assertThat(fieldPaths, hasItems( "team", // ref by type "primary_sectors~sector", // nested ref by type "approval_status", // ref by possible value @@ -732,8 +734,8 @@ public void testFieldsDependingOnPredicate() { List fieldPaths = fieldsEnumerator.findFieldPaths(fieldFilter, fields); - assertThat(fieldPaths, hasItems("primary_sectors~sector")); - assertThat(fieldPaths, not(hasItems("team", "approval_status", "fundings~commitments~pledge"))); + MatcherAssert.assertThat(fieldPaths, hasItems("primary_sectors~sector")); + MatcherAssert.assertThat(fieldPaths, not(hasItems("team", "approval_status", "fundings~commitments~pledge"))); } private static class ObjWithImportableCollectionWithoutId { @@ -774,7 +776,7 @@ private static class ObjWithPrimitiveCollections { @Test public void testEnumerationDoesNotFailForCollectionsOfPrimitives() { List fields = fieldsEnumerator.getAllAvailableFields(ObjWithPrimitiveCollections.class); - assertThat(fields.size(), is(2)); + MatcherAssert.assertThat(fields.size(), is(2)); } private static class ObjWithObjId { @@ -835,21 +837,21 @@ public void testTwoIdsNotAllowed() { public void testActivityCollectionFields() { APIField apiField = fieldsEnumerator.getMetaModel(AmpActivityFields.class); List nullableAPIFields = getAPIFieldWithNullCollections(new AmpActivityVersion(), apiField); - assertEquals(nullableAPIFields, Collections.emptyList()); + Assertions.assertEquals(nullableAPIFields, Collections.emptyList()); } @Test public void testContactCollectionFields() { APIField apiField = fieldsEnumerator.getMetaModel(AmpContact.class); List nullableAPIFields = getAPIFieldWithNullCollections(new AmpContact(), apiField); - assertEquals(nullableAPIFields, Collections.emptyList()); + Assertions.assertEquals(nullableAPIFields, Collections.emptyList()); } @Test public void testResourceCollectionFields() { APIField apiField = fieldsEnumerator.getMetaModel(AmpResource.class); List nullableAPIFields = getAPIFieldWithNullCollections(new AmpResource(), apiField); - assertEquals(nullableAPIFields, Collections.emptyList()); + Assertions.assertEquals(nullableAPIFields, Collections.emptyList()); } private List getAPIFieldWithNullCollections(Object object, APIField field) { @@ -909,7 +911,7 @@ public void testTreeValidatorVisibleAndUniqueValidatorHidden() { APIField apiField = ValidatorUtil.getMetaData(AmpActivityFields.class, ImmutableSet.of("/Activity Form/Sectors/Primary Sectors/uniqueSectorsValidator")); - assertThat(apiField.getChildren(), hasItem(allOf( + MatcherAssert.assertThat(apiField.getChildren(), hasItem(allOf( hasProperty("fieldName", equalTo("primary_sectors")), hasProperty("uniqueConstraint", equalTo("sector")), hasProperty("treeCollectionConstraint", equalTo(true)) @@ -922,7 +924,7 @@ public void testTreeValidatorAndUniqueValidatorHidden() { ImmutableSet.of("/Activity Form/Sectors/Primary Sectors/uniqueSectorsValidator", "/Activity Form/Sectors/Primary Sectors/treeSectorsValidator")); - assertThat(apiField.getChildren(), hasItem(allOf( + MatcherAssert.assertThat(apiField.getChildren(), hasItem(allOf( hasProperty("fieldName", equalTo("primary_sectors")), hasProperty("uniqueConstraint", nullValue()), hasProperty("treeCollectionConstraint", equalTo(false)) @@ -1027,9 +1029,7 @@ private List fieldsFor(Class theClass) { } private void assertEqualsDigest(List expected, List actual) { - assertEquals( - expected.stream().map(this::digest).collect(Collectors.toList()), - actual.stream().map(this::digest).collect(Collectors.toList())); + Assertions.assertEquals(expected.stream().map(this::digest).collect(Collectors.toList()), actual.stream().map(this::digest).collect(Collectors.toList())); } private UnwrappedTranslationsByWorkspacePrefix fieldLabelFor(String baseText) { From 0059b3790cb36dc4dcf3c7ba27cca85d99eca859 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:07:52 +0300 Subject: [PATCH 06/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/amp/pom.xml b/amp/pom.xml index 1a24c451fe8..32425b30ca6 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -1244,7 +1244,11 @@ - + + org.junit.vintage + junit-vintage-engine + test + From 0a01aad5273c9af2d0b1fbeae8596e122c86fbd7 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:10:17 +0300 Subject: [PATCH 07/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/amp/pom.xml b/amp/pom.xml index 32425b30ca6..7d34221e90e 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -69,6 +69,10 @@ amp https://artifactory.dgdev.org/artifactory/amp/ + + central + https://repo.maven.apache.org/maven2 + From 3f1f7da9272a5e0fb5dc58df6138d3bf4c7023e0 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:13:18 +0300 Subject: [PATCH 08/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/pom.xml b/amp/pom.xml index 7d34221e90e..a135839d352 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -70,7 +70,7 @@ https://artifactory.dgdev.org/artifactory/amp/ - central + maven https://repo.maven.apache.org/maven2 From 257b8f3b53022d8ff745770f2b6e40faf67a3045 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:15:19 +0300 Subject: [PATCH 09/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/pom.xml b/amp/pom.xml index a135839d352..854bfb2d8fa 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -71,7 +71,7 @@ maven - https://repo.maven.apache.org/maven2 + https://repo1.maven.apache.org/maven2 From 7e82bd7e95a078a3c7192db20a1c852322b2c47b Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:17:21 +0300 Subject: [PATCH 10/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/amp/pom.xml b/amp/pom.xml index 854bfb2d8fa..a865d4b4faf 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -1251,6 +1251,7 @@ org.junit.vintage junit-vintage-engine + 5.8.2 test From 2f5ac44ce2f4fee698267b5fe0c5673ced8de5fb Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:18:04 +0300 Subject: [PATCH 11/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/amp/pom.xml b/amp/pom.xml index a865d4b4faf..84ebe0af3aa 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -69,10 +69,7 @@ amp https://artifactory.dgdev.org/artifactory/amp/ - - maven - https://repo1.maven.apache.org/maven2 - + From 783a90115503e10dcc32951f238b9ba53786c150 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:25:33 +0300 Subject: [PATCH 12/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/amp/pom.xml b/amp/pom.xml index 84ebe0af3aa..946cea847e0 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -69,7 +69,6 @@ amp https://artifactory.dgdev.org/artifactory/amp/ - @@ -1245,12 +1244,7 @@ - - org.junit.vintage - junit-vintage-engine - 5.8.2 - test - + @@ -2130,6 +2124,13 @@ org.apache.maven.plugins maven-surefire-plugin 3.0.0-M2 + + + org.apache.maven.surefire + surefire-junit47 + 2.18.1 + + ${project.build.testSourceDirectory} From 3c531d33f830780e0a1c56c5f25e631ec35e9988 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:26:38 +0300 Subject: [PATCH 13/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/pom.xml b/amp/pom.xml index 946cea847e0..135435d3adf 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -2123,7 +2123,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M2 + 3.0.0-M1 org.apache.maven.surefire From dace7623edbe51e92c8e1b37585cabdb4e3ced41 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:29:02 +0300 Subject: [PATCH 14/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/pom.xml b/amp/pom.xml index 135435d3adf..0f15e1c9b58 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -2123,7 +2123,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.0.0-M1 + 3.0.0-M5 org.apache.maven.surefire From e4f624ad38e2d4446697cdf5b95acc80b05659ce Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:40:34 +0300 Subject: [PATCH 15/97] AMP-30677- Add configuration for Tests --- amp/pom.xml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/amp/pom.xml b/amp/pom.xml index 0f15e1c9b58..07b6bdc636e 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -2124,13 +2124,7 @@ org.apache.maven.plugins maven-surefire-plugin 3.0.0-M5 - - - org.apache.maven.surefire - surefire-junit47 - 2.18.1 - - + ${project.build.testSourceDirectory} From c2421cc0a90d310c1239095336886fd77ff9d0d5 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 2 Apr 2024 13:55:09 +0300 Subject: [PATCH 16/97] AMP-30677- Add configuration for Tests --- amp/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/Dockerfile b/amp/Dockerfile index 084672dc76d..e4d4dd47f55 100644 --- a/amp/Dockerfile +++ b/amp/Dockerfile @@ -116,7 +116,7 @@ COPY --from=compile-reamp /tmp/amp/TEMPLATE/reamp TEMPLATE/reamp COPY --from=compile-reampv2 /tmp/amp/TEMPLATE/reampv2/build TEMPLATE/reampv2/build ARG BUILD_SOURCE RUN --mount=type=cache,target=/root/.m2 \ - mvn -B test war:exploded \ + mvn -X -B test war:exploded \ -DbuildSource="$BUILD_SOURCE" \ -Djdbc.user=amp \ -Djdbc.password=amp122006 \ From fd18ccb2f7ad18699f0cf136115cc9f7723ab0cf Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 3 Apr 2024 09:56:14 +0300 Subject: [PATCH 17/97] AMP-30677- Add configuration for Tests --- amp/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/Dockerfile b/amp/Dockerfile index e4d4dd47f55..c94ab272c30 100644 --- a/amp/Dockerfile +++ b/amp/Dockerfile @@ -116,7 +116,7 @@ COPY --from=compile-reamp /tmp/amp/TEMPLATE/reamp TEMPLATE/reamp COPY --from=compile-reampv2 /tmp/amp/TEMPLATE/reampv2/build TEMPLATE/reampv2/build ARG BUILD_SOURCE RUN --mount=type=cache,target=/root/.m2 \ - mvn -X -B test war:exploded \ + mvn -B test war:exploded -DfailIfNoTests=false \ -DbuildSource="$BUILD_SOURCE" \ -Djdbc.user=amp \ -Djdbc.password=amp122006 \ From cd9ea7386213a2207c32c5fc7f5ddfe910e11f3b Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 21:42:34 +0300 Subject: [PATCH 18/97] AMP-30858- Create data importer for Burkina --- amp/TEMPLATE/ampTemplate/layout/tabLayout.jsp | 2 +- .../view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/TEMPLATE/ampTemplate/layout/tabLayout.jsp b/amp/TEMPLATE/ampTemplate/layout/tabLayout.jsp index a75584b55df..56e52a9d11a 100644 --- a/amp/TEMPLATE/ampTemplate/layout/tabLayout.jsp +++ b/amp/TEMPLATE/ampTemplate/layout/tabLayout.jsp @@ -102,7 +102,7 @@ - + diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js index 190577c860e..f536da3d642 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js @@ -33,7 +33,7 @@ Owner of DHTMLgoodies.com - var imageFolder = '/jsp/aim/view/images/images_dhtmlsuite/'; // Path to images + var imageFolder = '/src/main/webapp/WEB-INF/jsp/aim/view/images/images_dhtmlsuite/'; // Path to images var folderImage = 'dhtmlgoodies_folder.gif'; var plusImage = 'dhtmlgoodies_plus.gif'; var minusImage = 'dhtmlgoodies_minus.gif'; From 08110e1d90f36ae7987b8c3dad501b53d99df870 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 21:46:13 +0300 Subject: [PATCH 19/97] AMP-30858- Create data importer for Burkina --- .../view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js index f536da3d642..a0321a6bb5f 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js @@ -33,7 +33,7 @@ Owner of DHTMLgoodies.com - var imageFolder = '/src/main/webapp/WEB-INF/jsp/aim/view/images/images_dhtmlsuite/'; // Path to images + var imageFolder = '/WEB-INF/jsp/aim/view/images/images_dhtmlsuite/'; // Path to images var folderImage = 'dhtmlgoodies_folder.gif'; var plusImage = 'dhtmlgoodies_plus.gif'; var minusImage = 'dhtmlgoodies_minus.gif'; From ced98f246ef3c05f9bdc7d9e329407783d4f1100 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 21:59:17 +0300 Subject: [PATCH 20/97] AMP-30858- Create data importer for Burkina --- amp/src/main/webapp/WEB-INF/applicationContext.xml | 1 + .../scripts/separateFiles/dhtmlSuite-folder-tree-static.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/amp/src/main/webapp/WEB-INF/applicationContext.xml b/amp/src/main/webapp/WEB-INF/applicationContext.xml index 4532c6a9064..7c7ccda809f 100644 --- a/amp/src/main/webapp/WEB-INF/applicationContext.xml +++ b/amp/src/main/webapp/WEB-INF/applicationContext.xml @@ -37,6 +37,7 @@ + diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js index a0321a6bb5f..0faf1c5d85f 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js @@ -54,9 +54,9 @@ Owner of DHTMLgoodies.com var start = document.cookie.indexOf(name+"="); var len = start+name.length+1; if ((!start) && (name != document.cookie.substring(0,name.length))) return null; - if (start == -1) return null; + if (start === -1) return null; var end = document.cookie.indexOf(";",len); - if (end == -1) end = document.cookie.length; + if (end === -1) end = document.cookie.length; return unescape(document.cookie.substring(len,end)); } // This function has been slightly modified From 3dba787a3a46c92f7a5bed16c0afe76cf4e4940f Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 22:32:38 +0300 Subject: [PATCH 21/97] AMP-30858- Create data importer for Burkina --- amp/TEMPLATE/ampTemplate/layout/mainLayout.jsp | 2 +- amp/src/main/webapp/WEB-INF/jsp/um/view/viewEditUser.jsp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/amp/TEMPLATE/ampTemplate/layout/mainLayout.jsp b/amp/TEMPLATE/ampTemplate/layout/mainLayout.jsp index 95154585650..b33399423af 100644 --- a/amp/TEMPLATE/ampTemplate/layout/mainLayout.jsp +++ b/amp/TEMPLATE/ampTemplate/layout/mainLayout.jsp @@ -49,7 +49,7 @@ -<% if(org.digijava.kernel.util.SiteUtils.isEffectiveLangRTL() == true) {%> +<% if(org.digijava.kernel.util.SiteUtils.isEffectiveLangRTL()) {%> <% } %> diff --git a/amp/src/main/webapp/WEB-INF/jsp/um/view/viewEditUser.jsp b/amp/src/main/webapp/WEB-INF/jsp/um/view/viewEditUser.jsp index 7281ad1c18d..01282677ab7 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/um/view/viewEditUser.jsp +++ b/amp/src/main/webapp/WEB-INF/jsp/um/view/viewEditUser.jsp @@ -437,11 +437,11 @@ function validateUserInfo(){ - + - + From efe24d1ad6ef8333fe8367202cc02a81555b4f59 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 22:44:57 +0300 Subject: [PATCH 22/97] AMP-30858- Create data importer for Burkina --- .../module/aim/dbentity/AmpActivityVersion.hbm.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index aff68019d33..321906f4472 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -134,7 +134,7 @@ - + - + &activityFields; - + @@ -313,15 +313,15 @@ AMP_ACTIVITY_VERSION_seq - + --> - &activityFields; + &activityFields; - + From 38579aa718455a9603429c17a96b45b35d061c49 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 22:46:43 +0300 Subject: [PATCH 23/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 321906f4472..16223bcecb4 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -140,7 +140,6 @@ - From f208f1bf574e5d18885af00a110f681bfc9eec59 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 22:51:55 +0300 Subject: [PATCH 24/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 16223bcecb4..ae0a9075ccf 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -134,12 +134,13 @@ - + + From 9db86131aa5fde666d1a5c365f153ecfd5c8f8ce Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 4 Apr 2024 23:53:46 +0300 Subject: [PATCH 25/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml index ae0efa5e3aa..99a5e1b0a29 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml @@ -43,12 +43,12 @@ column="amp_org_id" /> - + - + From a9944e21257a343590039ff3878c8e64bf549fed Mon Sep 17 00:00:00 2001 From: brianbrix Date: Fri, 5 Apr 2024 00:16:04 +0300 Subject: [PATCH 26/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../aim/dbentity/IndicatorActivity.java | 81 +++-- .../module/aim/util/ActivityUtil.java | 276 +++++++++--------- .../dbentity/AmpApplicationSettings.hbm.xml | 4 +- 3 files changed, 174 insertions(+), 187 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/dbentity/IndicatorActivity.java b/amp/src/main/java/org/digijava/module/aim/dbentity/IndicatorActivity.java index 2ae5ed974bf..4b04b641572 100644 --- a/amp/src/main/java/org/digijava/module/aim/dbentity/IndicatorActivity.java +++ b/amp/src/main/java/org/digijava/module/aim/dbentity/IndicatorActivity.java @@ -14,7 +14,7 @@ /** * Project Indicator. * This is connection between indicator and activity. Most fields are in parent class. - * Check hibernate mapping in IndicatorConnection.hbm.xml + * Check hibernate mapping in IndicatorConnection.hbm.xml * @see IndicatorConnection * @author Irakli Kobiashvili * @@ -23,13 +23,13 @@ public class IndicatorActivity extends IndicatorConnection implements Versionabl //IATI-check: to be ignored private static final long serialVersionUID = 2L; - + /** * Activity */ @InterchangeableBackReference private AmpActivityVersion activity; - + /** * Indicator risk. * Actually risk is in each connection of indicator and activity. @@ -76,70 +76,58 @@ public boolean equalsForVersioning(Object obj) { @Override public Object getValue() { - String value = ""; + StringBuilder value = new StringBuilder(); if (getIndicator() != null) - value += getIndicator().getName(); + value.append(getIndicator().getName()); if (risk != null) - value += risk.getRatingName(); + value.append(risk.getRatingName()); if (values != null){ ArrayList list = new ArrayList(values); - Collections.sort(list, new Comparator() { - @Override - public int compare(AmpIndicatorValue arg0, - AmpIndicatorValue arg1) { - return arg0.getValueType() - arg1.getValueType(); - } - }); - - Iterator it = list.iterator(); - while (it.hasNext()) { - AmpIndicatorValue ind = (AmpIndicatorValue) it - .next(); - value += ind.getValueType() + "" + ind.getValue() + "" + ind.getValueDate(); + list.sort(Comparator.comparingInt(AmpIndicatorValue::getValueType)); + + for (AmpIndicatorValue ind : list) { + value.append(ind.getValueType()).append(ind.getValue()).append(ind.getValueDate()); } } if (logFrame != null) { - value += logFrame.getValue(); + value.append(logFrame.getValue()); } - return value; + return value.toString(); } @Override public Output getOutput() { Output out = new Output(); - out.setOutputs(new ArrayList()); + out.setOutputs(new ArrayList<>()); out.getOutputs().add( new Output(null, new String[] { "Name" }, new Object[] { this.getIndicator() != null ? this.getIndicator().getName() : "Empty Name" })); if (risk != null) out.getOutputs().add(new Output(null, new String[] {" Risk rating"}, new Object[] {risk.getRatingName()})); if (values != null){ - Iterator it = values.iterator(); - while (it.hasNext()) { - AmpIndicatorValue ind = (AmpIndicatorValue) it - .next(); + for (AmpIndicatorValue ind : values) { String typeString = ""; switch (ind.getValueType()) { - case AmpIndicatorValue.BASE: - typeString += "Base Value"; - break; - case AmpIndicatorValue.ACTUAL: - typeString += "Actual Value"; - break; - case AmpIndicatorValue.REVISED: - typeString += "Revised Value"; - break; - case AmpIndicatorValue.TARGET: - typeString += "Target Value"; - break; - default: - typeString += "Unknown Value"; - break; + case AmpIndicatorValue.BASE: + typeString += "Base Value"; + break; + case AmpIndicatorValue.ACTUAL: + typeString += "Actual Value"; + break; + case AmpIndicatorValue.REVISED: + typeString += "Revised Value"; + break; + case AmpIndicatorValue.TARGET: + typeString += "Target Value"; + break; + default: + typeString += "Unknown Value"; + break; } //typeString += ": "; out.getOutputs().add( - new Output(null, new String[] {typeString}, new Object[]{ind.getValue()})); + new Output(null, new String[]{typeString}, new Object[]{ind.getValue()})); } } if (logFrame != null) { @@ -153,12 +141,11 @@ public Object prepareMerge(AmpActivityVersion newActivity) throws CloneNotSuppor IndicatorActivity aux = (IndicatorActivity) clone(); aux.activity = newActivity; aux.setId(null); - + if (aux.values != null && aux.values.size() > 0){ HashSet set = new HashSet(); - Iterator i = aux.values.iterator(); - while (i.hasNext()) { - AmpIndicatorValue ampIndicatorValue = (AmpIndicatorValue) i.next().clone(); + for (AmpIndicatorValue value : aux.values) { + AmpIndicatorValue ampIndicatorValue = (AmpIndicatorValue) value.clone(); ampIndicatorValue.setIndValId(null); ampIndicatorValue.setIndicatorConnection(aux); set.add(ampIndicatorValue); @@ -188,5 +175,5 @@ public List getValuesSorted() { return new ArrayList(tree.values()); } - + } diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 338d9b51c7a..9bfac670da0 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -546,7 +546,7 @@ public static AmpOrganisation getAmpOrganisation(Long actId, Long orgRoleId) { AmpOrganisation organisation = null; try { session = PersistenceManager.getSession(); - String rewrittenColumns = SQLUtils.rewriteQuery("amp_organisation", "ao", + String rewrittenColumns = SQLUtils.rewriteQuery("amp_organisation", "ao", new HashMap(){{ put("name", InternationalizedModelDescription.getForProperty(AmpOrganisation.class, "name").getSQLFunctionCall("ao.amp_org_id")); put("description", InternationalizedModelDescription.getForProperty(AmpOrganisation.class, "description").getSQLFunctionCall("ao.amp_org_id")); @@ -605,7 +605,7 @@ public static Collection getAllComponents(Long id) { AmpComponentFunding cf = (AmpComponentFunding) compFundIterator.next(); FundingDetail fd = new FundingDetail(); fd.setAdjustmentTypeName(cf.getAdjustmentType()); - + fd.setCurrencyCode(cf.getCurrency().getCurrencyCode()); fd.setCurrencyName(cf.getCurrency().getCurrencyName()); fd.setTransactionAmount(FormatHelper.formatNumber(cf.getTransactionAmount().doubleValue())); @@ -664,7 +664,7 @@ public static Collection getFundingComponentActivity(Long c Query qry = PersistenceManager.getSession().createQuery(qryStr); return qry.list(); } - + public static Collection getOldActivities(Session session,int size,Date date){ List colAv; Collection colAll = new ArrayList(); @@ -699,10 +699,10 @@ public static Collection getOldActivities(Session session,in // function for getting fundings for components and ids ends here - - + + /** - * checks whether the 'name' activity title exists as a translation in any language + * checks whether the 'name' activity title exists as a translation in any language * in any latest version of an activity * excluding the activity group of the current activity * @param name title of the activity @@ -747,18 +747,18 @@ public void execute(Connection conn) throws SQLException { if (result.getId() == -1l) return null; return result; - + } - + public static List getSortedActivitiesByDonors (List acts, boolean acs) { List retVal = new ArrayList(); Map donorNameActivityMap = new HashMap (); List noFundingActivities = null; for (AmpActivityVersion actItem : acts) { - if (actItem.getFunding() != null && !actItem.getFunding().isEmpty()) { + if (actItem.getFunding() != null && !actItem.getFunding().isEmpty()) { StringBuilder donorNames = new StringBuilder(); - + List organizations = new ArrayList<>(actItem.getFunding()); if (organizations != null && organizations.size() > 1) { organizations.sort(Comparator.comparing(o -> o.getAmpDonorOrgId().getName())); @@ -777,14 +777,14 @@ public static List getSortedActivitiesByDonors (List keys = donorNameActivityMap.keySet(); List sortedKeys = new ArrayList (keys); Collections.sort(sortedKeys); if (!acs) { Collections.reverse(sortedKeys); } - + for (String key : sortedKeys) { retVal.add(donorNameActivityMap.get(key)); } @@ -792,16 +792,16 @@ public static List getSortedActivitiesByDonors (List getIPAContracts(Long activityId) { - + String queryString = "select con from " + IPAContract.class.getName() + " con " + "where (con.activity=:activityId)"; Query qry = PersistenceManager.getSession().createQuery(queryString).setParameter("activityId",activityId, LongType.INSTANCE ); @@ -820,21 +820,21 @@ public static List getIPAContracts(Long activityId) { c.setTotalDisbursements(td); c.setExecutionRate(ActivityUtil.computeExecutionRateFromTotalAmount(c, c.getTotalAmountCurrency().getCurrencyCode())); c.setFundingTotalDisbursements(ActivityUtil.computeFundingDisbursementIPA(c, cc)); - c.setFundingExecutionRate(ActivityUtil.computeExecutionRateFromContractTotalValue(c, cc)); + c.setFundingExecutionRate(ActivityUtil.computeExecutionRateFromContractTotalValue(c, cc)); } return contrcats ; - } + } public static double computeFundingDisbursementIPA(IPAContract contract, String cc){ - - ArrayList disbs1 = (ArrayList) DbUtil.getDisbursementsFundingOfIPAContract(contract); + + ArrayList disbs1 = (ArrayList) DbUtil.getDisbursementsFundingOfIPAContract(contract); //if there is no disbursement global currency saved in db we'll use the default from edit activity form - + if(contract.getTotalAmountCurrency()!=null) cc=contract.getTotalAmountCurrency().getCurrencyCode(); double td=0; - double usdAmount=0; - double finalAmount=0; + double usdAmount=0; + double finalAmount=0; for(Iterator j=disbs1.iterator();j.hasNext();) { @@ -861,12 +861,12 @@ public static double computeFundingDisbursementIPA(IPAContract contract, String // contract.setFundingExecutionRate(ActivityUtil.computeExecutionRateFromContractTotalValue(contract, cc)); return td; } - + public static double computeExecutionRateFromContractTotalValue(IPAContract c, String currCode){ - double usdAmount1=0; - double finalAmount1=0; + double usdAmount1=0; + double finalAmount1=0; try { - if(c.getContractTotalValue()!=null && c.getTotalAmountCurrency().getCurrencyCode()!=null) + if(c.getContractTotalValue()!=null && c.getTotalAmountCurrency().getCurrencyCode()!=null) usdAmount1 = CurrencyWorker.convertToUSD(c.getContractTotalValue().doubleValue(),c.getTotalAmountCurrency().getCurrencyCode()); else usdAmount1 = 0.0; } catch (AimException e) { @@ -878,8 +878,8 @@ public static double computeExecutionRateFromContractTotalValue(IPAContract c, S } catch (AimException e) { // TODO Auto-generated catch block e.printStackTrace(); - } - + } + double execRate=0; if(finalAmount1!=0) execRate=c.getFundingTotalDisbursements()/finalAmount1; @@ -888,10 +888,10 @@ public static double computeExecutionRateFromContractTotalValue(IPAContract c, S } public static double computeExecutionRateFromTotalAmount(IPAContract c, String currCode){ - double usdAmount1=0; - double finalAmount1=0; + double usdAmount1=0; + double finalAmount1=0; try { - if(c.getTotalAmount()!=null && c.getTotalAmountCurrency()!=null ) + if(c.getTotalAmount()!=null && c.getTotalAmountCurrency()!=null ) usdAmount1 = CurrencyWorker.convertToUSD(c.getTotalAmount().doubleValue(),c.getTotalAmountCurrency().getCurrencyCode()); else usdAmount1=0.0; } catch (AimException e) { @@ -901,8 +901,8 @@ public static double computeExecutionRateFromTotalAmount(IPAContract c, String c finalAmount1 = CurrencyWorker.convertFromUSD(usdAmount1,currCode); } catch (AimException e) { e.printStackTrace(); - } - + } + double execRate=0; if(finalAmount1!=0) execRate=c.getTotalDisbursements()/finalAmount1; @@ -918,7 +918,7 @@ public static Set fetchLongs(final String usedQuery) { Set ampActivityIds = new TreeSet(); List res; - + if (usedQuery.contains(":")) { // slower but always works res = PersistenceManager.getSession().doReturningWork(new ReturningWork>() { @@ -936,7 +936,7 @@ public static Set fetchLongs(final String usedQuery) } return ampActivityIds; } - + /** * returns a set of all ampActivityIds passed by the workspace filter * @param session @@ -944,10 +944,10 @@ public static Set fetchLongs(final String usedQuery) public static Set getAllLegalAmpActivityIds() { return fetchLongs(WorkspaceFilter.getWorkspaceFilterQuery(TLSUtils.getRequest().getSession())); } - + public static List getLastUpdatedActivities() { String workspaceQuery = Util.toCSStringForIN(getAllLegalAmpActivityIds()); - + List res = new ArrayList(); Session session = null; Query qry = null; @@ -970,7 +970,7 @@ public static List getLastUpdatedActivities() { } return res; } - + /* * this function is so incredibly slow that you should NEVER use it. Left it here because it is used by one very old (most probably unused) page */ @@ -978,12 +978,12 @@ public static List getAllActivitiesList() { String queryString = "select ampAct from " + AmpActivityVersion.class.getName() + " ampAct"; return PersistenceManager.getSession().createQuery(queryString).list(); } - + public static List getActivitiesWhichMatchDate(String dateField, Date value) { Date minDate = new Date(value.getTime() - 24 * 3600l * 1000l); Date maxDate = new Date(value.getTime() + 24 * 3600l * 1000l); String queryString = String.format( - "select ampAct from %s ampAct WHERE (ampAct.team IS NOT NULL) AND " + + "select ampAct from %s ampAct WHERE (ampAct.team IS NOT NULL) AND " + "(ampAct.%s >= :minDate) AND (ampAct.%s <= :maxDate)", AmpActivityVersion.class.getName(), dateField, dateField); List aavs = PersistenceManager.getSession() @@ -1035,7 +1035,7 @@ public static List getAllActivitiesByName(String name) { .setParameter("name", "%" + name + "%", StringType.INSTANCE) .list(); } - + private static AmpActivityGroup getActivityGroups(Session session, Long actId) { String queryString = "select group from " + AmpActivityGroup.class.getName() + " group " + "where group.ampActivityLastVersion.ampActivityId=:actId"; @@ -1070,7 +1070,7 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = " + ampAct.getAmpActivityId(); SQLUtils.executeQuery(con, deleteActivityTeam ); } - + public static void removeMergeSources(Long ampActivityId,Session session){ String queryString1 = "select act from " + AmpActivityVersion.class.getName() + " act where (act.mergeSource1=:activityId)"; String queryString2 = "select act from " + AmpActivityVersion.class.getName() + " act where (act.mergeSource2=:activityId)"; @@ -1078,24 +1078,24 @@ public static void removeMergeSources(Long ampActivityId,Session session){ Query qry2 = session.createQuery(queryString2); qry1.setParameter("activityId", ampActivityId, LongType.INSTANCE); qry2.setParameter("activityId", ampActivityId, LongType.INSTANCE); - + Collection col =qry1.list(); - if (col != null && col.size() > 0) { + if (col != null && !col.isEmpty()) { for (AmpActivityVersion actVersion : (Iterable) col) { actVersion.setMergeSource1(null); session.update(actVersion); } } col =qry2.list(); - if (col != null && col.size() > 0) { + if (col != null && !col.isEmpty()) { for (AmpActivityVersion actVersion : (Iterable) col) { actVersion.setMergeSource2(null); session.update(actVersion); } } - + } - + /** * @deprecated * @@ -1121,7 +1121,7 @@ public static List getActivities(Set ampActIds){ .setCacheable(false).list(); } } - + public static void deleteActivityIndicatorsSession(Long ampActivityId,Session session) throws Exception{ Collection col = null; Query qry = null; @@ -1136,11 +1136,11 @@ public static void deleteActivityIndicatorsSession(Long ampActivityId,Session se IndicatorActivity indAct = (IndicatorActivity) o; session.delete(indAct); } - + } public static void deleteActivityIndicators(Collection activityInd, AmpActivityVersion activity, Session session) throws Exception { - + if (activityInd != null && activityInd.size() > 0) { for (Object indAct : activityInd) { @@ -1305,13 +1305,13 @@ public static List getActivityProgramsByProgramType(Long act " ap join ap.programSetting s where (ap.activity=:actId) and (s.name=:settingName)"; return PersistenceManager.getSession().createQuery(queryString).setParameter("actId",actId, LongType.INSTANCE).setParameter("settingName",settingName,StringType.INSTANCE).list(); } - + public static class HelperAmpActivityNameComparator implements Comparator { public int compare(Object obj1, Object obj2) { AmpActivityVersion act1 = (AmpActivityVersion) obj1; AmpActivityVersion act2 = (AmpActivityVersion) obj2; - return (act1.getName()!=null && act2.getName()!=null)?act1.getName().compareTo(act2.getName()):0; + return (act1.getName()!=null && act2.getName()!=null)?act1.getName().compareTo(act2.getName()):0; } } @@ -1321,7 +1321,7 @@ public int compare(Object obj1, Object obj2) { * @param user,actId * @return ampId * @author dare - * @param session + * @param session */ public static String generateAmpId(User user, Long actId, Session session) { String globSetting = "numeric";// TODO This should come from global settings @@ -1331,26 +1331,26 @@ public static String generateAmpId(User user, Long actId, Session session) { else return combinedAmpId(actId); } - + /** * combines countryId, current member id and last activityId+1 and makes ampId * @param user,actId - * @return + * @return * @author dare - * @param session + * @param session */ private static String numericAmpId(User user, Long actId, Session session){ String countryCode = FeaturesUtil.getGlobalSettingValue(org.digijava.module.aim.helper.Constants.GLOBAL_DEFAULT_COUNTRY); String userId = user.getId().toString(); - Country country = (Country) session.load(Country.class, countryCode); + Country country = (Country) session.load(Country.class, countryCode); String countryId = "0"; if (country != null){ countryId = country.getCountryId().toString(); } - + String lastId = null; if (actId != null){ - lastId = actId.toString(); + lastId = actId.toString(); } return countryId + userId + lastId; } @@ -1358,7 +1358,7 @@ private static String numericAmpId(User user, Long actId, Session session){ /** * combines countryIso and last activityId+1 and makes ampId * @param actId - * @return + * @return * @author dare */ private static String combinedAmpId(Long actId){ @@ -1366,18 +1366,18 @@ private static String combinedAmpId(Long actId){ String countryCode = FeaturesUtil.getGlobalSettingValue(org.digijava.module.aim.helper.Constants.GLOBAL_DEFAULT_COUNTRY); String lastId = null; if (actId != null){ - lastId = actId.toString(); - } - retVal = countryCode.toUpperCase() + "/" + lastId; + lastId = actId.toString(); + } + retVal = countryCode.toUpperCase() + "/" + lastId; return retVal; } - + public static List getActivitiesRelatedToAmpTeamMember(Session session, Long ampTeamMemberId) { String queryStr = "SELECT a FROM " + AmpActivityVersion.class.getName() + " a left join a.member m WHERE " + "(a.activityCreator=:atmId) OR (a.modifiedBy=:atmId) OR (a.approvedBy = :atmId) OR (m.ampTeamMemId = :atmId) OR (a.modifiedBy = :atmId)"; return session.createQuery(queryStr).setLong("atmId", ampTeamMemberId).list(); } - + public static String collectionToCSV(Collection activities) { if (activities == null) return null; @@ -1389,13 +1389,13 @@ public static String collectionToCSV(Collection activities) else ret += "' '" + ", "; } - return ret.substring(0, ret.length() - 2); + return ret.substring(0, ret.length() - 2); } - + /** * @author Dare * @param partOfName - * @return Array of Strings,which have a look like: activity_name(activity_id) + * @return Array of Strings,which have a look like: activity_name(activity_id) */ public static String[] loadActivitiesNamesAndIds(TeamMember member) throws DgException{ Session session=null; @@ -1405,7 +1405,7 @@ public static String[] loadActivitiesNamesAndIds(TeamMember member) throws DgExc String [] retValue=null; try { session=PersistenceManager.getRequestDBSession(); - + Set relatedTeams=TeamUtil.getRelatedTeamsForMember(member); Set teamAO = TeamUtil.getComputedOrgs(relatedTeams); String activityNameString = AmpActivityVersion.hqlStringForName("a"); @@ -1414,7 +1414,7 @@ public static String[] loadActivitiesNamesAndIds(TeamMember member) throws DgExc queryString = "select " + activityNameString + ", a.ampActivityId from " + AmpActivity.class.getName() + " a left outer join a.orgrole r left outer join a.funding f " + " where a.team in (" + Util.toCSStringForIN(relatedTeams) + ") or (r.organisation in (" + Util.toCSStringForIN(teamAO) + ") or f.ampDonorOrgId in (" + Util.toCSStringForIN(teamAO) + ")) order by " + activityNameString; - } else + } else { // not computed (e.g. team) workspace queryString = "select " + activityNameString + ", a.ampActivityId from " + AmpActivity.class.getName() + " a where a.team in (" + Util.toCSString(relatedTeams) + ") "; @@ -1422,20 +1422,20 @@ public static String[] loadActivitiesNamesAndIds(TeamMember member) throws DgExc // queryString += " and approvalStatus in (" + Util.toCSString(activityStatus) + ") "; // } queryString += " order by " + activityNameString; - } - - query=session.createQuery(queryString); - activities=query.list(); - }catch(Exception ex) { - logger.error("couldn't load Activities" + ex.getMessage()); - ex.printStackTrace(); - } + } + + query=session.createQuery(queryString); + activities=query.list(); + }catch(Exception ex) { + logger.error("couldn't load Activities" + ex.getMessage()); + ex.printStackTrace(); + } if (activities != null){ - retValue=new String[activities.size()]; + retValue=new String[activities.size()]; int i=0; for (Object rawRow : activities) { Object[] row = (Object[])rawRow; //:) - String nameRow=(String)row[0]; + String nameRow=(String)row[0]; if(nameRow != null){ nameRow = nameRow.replace('\n', ' '); nameRow = nameRow.replace('\r', ' '); @@ -1443,7 +1443,7 @@ public static String[] loadActivitiesNamesAndIds(TeamMember member) throws DgExc } ////System.out.println(nameRow); retValue[i]=nameRow+"("+row[1]+")"; - i++; + i++; } } return retValue; @@ -1462,12 +1462,12 @@ public static String[] searchActivitiesNamesAndIds(TeamMember member, String sea Set teamAO = TeamUtil.getComputedOrgs(relatedTeams); String activityName = AmpActivityVersion.hqlStringForName("gr.ampActivityLastVersion"); - queryString ="select " + activityName + ", gr.ampActivityLastVersion.ampActivityId from "+ AmpActivityGroup.class.getName()+" gr "; + queryString ="select " + activityName + ", gr.ampActivityLastVersion.ampActivityId from "+ AmpActivityGroup.class.getName()+" gr "; if (teamAO != null && !teamAO.isEmpty()) { queryString +=" left outer join gr.ampActivityLastVersion.orgrole r left outer join gr.ampActivityLastVersion.funding f "+ " where gr.ampActivityLastVersion.team in (" + Util.toCSStringForIN(relatedTeams) + ") " + " or (r.organisation in (" + Util.toCSStringForIN(teamAO) + ") or f.ampDonorOrgId in (" + Util.toCSStringForIN(teamAO) + ")) "; - + } else { // none computed workspace queryString += " where gr.ampActivityLastVersion.team in (" @@ -1499,22 +1499,22 @@ public static String[] searchActivitiesNamesAndIds(TeamMember member, String sea } return retValue; } - - /** + + /** * @param actId * @return activity name * @author dare */ public static String getActivityName(Long actId){ String activityName = AmpActivityVersion.hqlStringForName("gr.ampActivityLastVersion"); - String queryString = "select " + activityName + " from "+ AmpActivityGroup.class.getName()+" gr where gr.ampActivityLastVersion.ampActivityId = " + actId; - return PersistenceManager.getSession().createQuery(queryString).uniqueResult().toString(); + String queryString = "select " + activityName + " from "+ AmpActivityGroup.class.getName()+" gr where gr.ampActivityLastVersion.ampActivityId = " + actId; + return PersistenceManager.getSession().createQuery(queryString).uniqueResult().toString(); } - + /** * @author Marcelo - * @param - * @return Array of Strings, which have budget_code_project_id's + * @param + * @return Array of Strings, which have budget_code_project_id's */ public static String[] getBudgetCodes() throws DgException{ Session session=null; @@ -1524,18 +1524,18 @@ public static String[] getBudgetCodes() throws DgException{ String [] retValue=null; try { session=PersistenceManager.getRequestDBSession(); - queryString = "select distinct a.budgetCodeProjectID from " + AmpActivityVersion.class.getName() + " a"; - query=session.createQuery(queryString); - activities=query.list(); - }catch(Exception ex) { - logger.error("couldn't load Activities" + ex.getMessage()); - ex.printStackTrace(); - } + queryString = "select distinct a.budgetCodeProjectID from " + AmpActivityVersion.class.getName() + " a"; + query=session.createQuery(queryString); + activities=query.list(); + }catch(Exception ex) { + logger.error("couldn't load Activities" + ex.getMessage()); + ex.printStackTrace(); + } if (activities != null){ - //filtering null and blank values + //filtering null and blank values ArrayList codes = new ArrayList(); for (Object rawRow : activities) { - String val = (String)rawRow; + String val = (String)rawRow; if(val!=null && val.trim().compareTo("")!=0){ codes.add(val); } @@ -1552,7 +1552,7 @@ public static String[] getBudgetCodes() throws DgException{ } return retValue; } - + public static ArrayList getAllActivitiesAdmin(String searchTerm, Set frozenActivityIds, ActivityForm.DataFreezeFilter dataFreezeFilter) { try { Session session = PersistenceManager.getSession(); @@ -1561,7 +1561,7 @@ public static ArrayList getAllActivitiesAdmin(String searchTerm && (frozenActivityIds == null || frozenActivityIds.isEmpty())) { return new ArrayList<>(); } - + boolean isSearchByName = searchTerm != null && (!searchTerm.trim().isEmpty()); String activityName = AmpActivityVersion.hqlStringForName("f"); @@ -1592,7 +1592,7 @@ public static ArrayList getAllActivitiesAdmin(String searchTerm + "FROM " + AmpActivity.class.getName() + " as f left join f.team as ampTeam left join f.ampActivityGroup as ampGroup WHERE " + nameSearchQuery + " ((f.deleted = false) or (f.deleted is null))" + dataFreezeQuery; - + Query qry = session.createQuery(queryString); if (isSearchByName) { qry.setParameter("searchTerm", "%" + searchTerm + "%",StringType.INSTANCE); @@ -1627,7 +1627,7 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception Session session = PersistenceManager.getSession(); AmpActivityGroup ampActivityGroup = getActivityGroups(session, ampActId); Set activityversions = ampActivityGroup.getActivities(); - if (activityversions != null && activityversions.size() > 0) { + if (activityversions != null && !activityversions.isEmpty()) { for (AmpActivityVersion ampActivityVersion : activityversions) { deleteFullActivityContent(ampActivityVersion, session); @@ -1640,21 +1640,21 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception } session.delete(ampActivityGroup); } - + public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ ActivityUtil.deleteActivityContent(ampAct,session); Long ampActId = ampAct.getAmpActivityId(); //This is not deleting AmpMEIndicators, just indicators, ME is deprecated. ActivityUtil.deleteActivityIndicators(DbUtil.getActivityMEIndValue(ampActId), ampAct, session); } - + public static void deleteAllActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ ActivityUtil.deleteActivityContent(ampAct,session); Long ampActId = ampAct.getAmpActivityId(); ActivityUtil.removeMergeSources(ampActId, session); ActivityUtil.deleteActivityIndicatorsSession(ampActId, session); } - + public static Integer activityExists (Long versionId,Session session) throws Exception{ Integer retVal = null; try { @@ -1663,11 +1663,11 @@ public static Integer activityExists (Long versionId,Session session) throws Exc retVal= longValue.intValue(); } catch (Exception e) { e.printStackTrace(); - } - return retVal; + } + return retVal; } - - + + /** * returns a subset of activities which can/should be validated by a team member * @param tm @@ -1684,7 +1684,7 @@ public static Set getActivitiesWhichShouldBeValidated(TeamMember tm, Colle "AND (a.approval_status = 'started' OR a.approval_status='edited' OR a.approval_status='rejected') AND (a.draft IS NULL OR a.draft IS FALSE)"; // AND (a.amp_team_id = " + tm.getTeamId() + ")"; if (!crossTeamValidationEnabled) query += " AND (a.amp_team_id = " + tm.getTeamId() + ")"; - + List validated_activity_ids = PersistenceManager.getSession().createNativeQuery(query).list(); for(BigInteger bi:validated_activity_ids) result.add(bi.longValue()); @@ -1696,10 +1696,10 @@ public static Set getActivitiesWhichShouldBeValidated(TeamMember tm, Colle } } - + public static ArrayList getIssues(Long actId) { ArrayList col = new ArrayList<>(); - + AmpActivityVersion activity = null; try { Session session = PersistenceManager.getRequestDBSession(); @@ -1715,11 +1715,11 @@ public static ArrayList getIssues(Long a } - + public static void changeActivityArchiveStatus(Collection activityIds, boolean status) { try { Session session = PersistenceManager.getRequestDBSession(); - String qryString = "update " + AmpActivityVersion.class.getName() + + String qryString = "update " + AmpActivityVersion.class.getName() + " av set av.archived=:archived where av.ampActivityId in (" + Util.toCSStringForIN(activityIds) + ")"; Query query = session.createQuery(qryString); query.setParameter("archived", status, BooleanType.INSTANCE); @@ -1729,8 +1729,8 @@ public static void changeActivityArchiveStatus(Collection activityIds, boo catch (Exception e) { e.printStackTrace(); } - } - + } + public static AmpStructureImg getStructureImage(Long structureId, Long imgId) { return DbUtil.getStructureImage(structureId, imgId); } @@ -1779,7 +1779,7 @@ public static Period getProjectImplementationDelay(AmpActivityVersion activity) Date toDate; if (fromDate == null) return null; - + if (activity.getActualCompletionDate() != null) toDate = activity.getActualCompletionDate(); else if (activity.getProposedCompletionDate() != null) @@ -1789,7 +1789,7 @@ else if (activity.getProposedCompletionDate() != null) return DateConversion.getPeriod(fromDate, toDate); return null; } - + /** Get the user first name and last name who modified (created) the activity. * @param actitivity * @param auditHistory @@ -1799,7 +1799,7 @@ public static String getModifiedByUserName(AmpActivityVersion actitivity, Activi AmpTeamMember modifiedBy = actitivity.getModifiedBy(); AmpTeamMember createdBy = actitivity.getActivityCreator(); AmpTeamMember approvedBy = actitivity.getApprovedBy(); - + if (modifiedBy != null) { return String.format("%s %s", modifiedBy.getUser().getFirstNames(), modifiedBy.getUser().getLastName()); } else if(auditHistory != null) { @@ -1809,10 +1809,10 @@ public static String getModifiedByUserName(AmpActivityVersion actitivity, Activi } else if (createdBy != null) { return String.format("%s %s", createdBy.getUser().getFirstNames(), createdBy.getUser().getLastName()); } - + return ""; } - + /** Get modified date * @param activity * @param auditHistory @@ -1829,10 +1829,10 @@ public static Date getModifiedByDate(AmpActivityVersion activity, ActivityHistor } else if (activity.getCreatedDate() != null) { return activity.getCreatedDate(); } - + return null; } - + /** * Get audit info about the activity from amp_audit_logger table * @param activityId @@ -1841,7 +1841,7 @@ public static Date getModifiedByDate(AmpActivityVersion activity, ActivityHistor public static ActivityHistory getModifiedByInfoFromAuditLogger(Long activityId) { ActivityHistory logActivityHistory = new ActivityHistory(); List activityLogObjects = AuditLoggerUtil.getActivityLogObjects(activityId.toString()); - + for(AmpAuditLogger aal : activityLogObjects) { if (StringUtils.isNotEmpty(aal.getEditorName())) { logActivityHistory.setModifiedBy(aal.getEditorName()); @@ -1856,7 +1856,7 @@ public static ActivityHistory getModifiedByInfoFromAuditLogger(Long activityId) } } } - + return null; } @@ -1994,13 +1994,13 @@ public static List getEditableActivityIds(TeamMember tm, String query) { public static boolean canValidateActivity(AmpActivityVersion activity, TeamMember teamMember) { boolean canValidate = false; - + if (!activity.getDraft()) { AmpApplicationSettings appSettings = AmpARFilter.getEffectiveSettings(); String validationOption = appSettings != null ? appSettings.getValidation() : null; - + boolean isTeamMemberValidator = isTeamMemberValidator(teamMember, activity); - + if (isTeamMemberValidator) { if (Constants.PROJECT_VALIDATION_FOR_ALL_EDITS.equalsIgnoreCase(validationOption)) { if (activity.getTeam() != null @@ -2017,24 +2017,24 @@ public static boolean canValidateActivity(AmpActivityVersion activity, TeamMembe } } } - + return canValidate; } - + public static boolean isTeamMemberValidator(TeamMember teamMember, AmpActivityVersion activity) { - + if (teamMember.getTeamHead()) { return true; } - + AmpApplicationSettings appSettings = AmpARFilter.getEffectiveSettings(); - + boolean crossTeamValidation = (appSettings != null && appSettings.getTeam() != null) ? appSettings.getTeam().getCrossteamvalidation() : false; - + //Check if cross team validation is enable boolean crossTeamCheck = false; - + if (activity.getTeam() != null) { if (crossTeamValidation) { crossTeamCheck = true; @@ -2044,10 +2044,10 @@ public static boolean isTeamMemberValidator(TeamMember teamMember, AmpActivityVe crossTeamCheck = teamMember.getTeamId().equals(activity.getTeam().getAmpTeamId()); } } - + return teamMember.isApprover() && crossTeamCheck; } - + return false; } diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml index 8b4d5d131d4..a42d9baf92e 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml @@ -17,11 +17,11 @@ - + + cascade="all" /> Date: Fri, 5 Apr 2024 00:28:57 +0300 Subject: [PATCH 27/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../digijava/module/aim/dbentity/AmpTeam.java | 33 ++++++++++++------- .../dbentity/AmpApplicationSettings.hbm.xml | 3 +- .../module/aim/dbentity/AmpTeam.hbm.xml | 6 +++- 3 files changed, 28 insertions(+), 14 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java index 33b6abd22c4..8e5a35f295a 100644 --- a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java +++ b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java @@ -33,32 +33,33 @@ public class AmpTeam implements Serializable, Comparable, Identifiable, FilterD @TranslatableField @PossibleValueValue private String name; - + private Boolean addActivity; private Boolean isolated;//called thus because 'private' is a reserved keyword in Java private Boolean computation; private Boolean hideDraftActivities; private Boolean useFilter; + private Set ampApplicationSettings; @TranslatableField private String description; private AmpTeamMember teamLead; // Denotes the Team Leader private AmpTeam parentTeamId; - + private Collection childrenWorkspaces; - + private String accessType; // Management or Team private AmpTeam relatedTeamId; // a donor team referring a mofed team private Set activityList; // activities assigned to donor team - + private Set organizations; // activities assigned to donor team - + private AmpCategoryValue workspaceGroup; - + private String permissionStrategy; - + private Set filterDataSet; private AmpTemplatesVisibility fmTemplate; @@ -71,12 +72,12 @@ public AmpFilterData newAmpFilterData(FilterDataSetInterface filterRelObj, String elementClassName, String value) { return new AmpTeamFilterData(filterRelObj, propertyName, propertyClassName, elementClassName, value); } - + @Override public Set getFilterDataSet() { return filterDataSet; } - + @Override public void setFilterDataSet(Set filterDataSet) { this.filterDataSet = filterDataSet; @@ -176,7 +177,7 @@ public String getAccessType() { public void setAccessType(String accessType) { this.accessType = accessType; } - + /** * @return Returns the activityList. */ @@ -209,7 +210,7 @@ public void setRelatedTeamId(AmpTeam relatedTeam) { public int compareTo(Object o) { return ampTeamId.compareTo(((AmpTeam)o).getAmpTeamId()); } - + // public String toString() { // return name; // } @@ -301,7 +302,7 @@ public static String hqlStringForName(String idSource) { return InternationalizedModelDescription.getForProperty(AmpTeam.class, "name").getSQLFunctionCall(idSource + ".ampTeamId"); } - + public boolean isSSCWorkspace () { return this.getWorkspacePrefix() != null && "SSC_".equals(this.getWorkspacePrefix().getValue()); } @@ -325,4 +326,12 @@ public void setIsolated(Boolean isolated) { this.isolated = isolated; } } + + public Set getAmpApplicationSettings() { + return ampApplicationSettings; + } + + public void setAmpApplicationSettings(Set ampApplicationSettings) { + this.ampApplicationSettings = ampApplicationSettings; + } } diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml index a42d9baf92e..04ad080664e 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml @@ -21,7 +21,8 @@ + cascade="none" /> + + + + + @@ -46,7 +50,7 @@ - + From 4d2c0c2cb96a544890b40eb54eae6156d862b193 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Fri, 5 Apr 2024 15:47:13 +0300 Subject: [PATCH 28/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../java/org/digijava/module/aim/dbentity/AmpTeam.java | 9 --------- .../module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- .../module/aim/dbentity/AmpApplicationSettings.hbm.xml | 1 - .../org/digijava/module/aim/dbentity/AmpTeam.hbm.xml | 4 ---- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java index 8e5a35f295a..4c665df759e 100644 --- a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java +++ b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpTeam.java @@ -39,7 +39,6 @@ public class AmpTeam implements Serializable, Comparable, Identifiable, FilterD private Boolean computation; private Boolean hideDraftActivities; private Boolean useFilter; - private Set ampApplicationSettings; @TranslatableField private String description; @@ -326,12 +325,4 @@ public void setIsolated(Boolean isolated) { this.isolated = isolated; } } - - public Set getAmpApplicationSettings() { - return ampApplicationSettings; - } - - public void setAmpApplicationSettings(Set ampApplicationSettings) { - this.ampApplicationSettings = ampApplicationSettings; - } } diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index ae0a9075ccf..7b574beb4b9 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -102,7 +102,7 @@ + class="org.digijava.module.aim.dbentity.AmpTeam" cascade="none" /> diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml index 04ad080664e..edcc1bc0429 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpApplicationSettings.hbm.xml @@ -22,7 +22,6 @@ class="org.digijava.module.aim.dbentity.AmpReports" cascade="none" /> - - - - - From df260cdfd07591de513ea16401e0d5888a6c84d6 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Fri, 5 Apr 2024 15:58:01 +0300 Subject: [PATCH 29/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 4 ++-- .../org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml | 2 +- .../module/calendar/dbentity/AmpCalendarAttendee.hbm.xml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 7b574beb4b9..9a689ffb485 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -105,7 +105,7 @@ class="org.digijava.module.aim.dbentity.AmpTeam" cascade="none" /> + class="org.digijava.module.aim.dbentity.AmpTeamMember" cascade="none"/> @@ -124,7 +124,7 @@ + class="org.digijava.module.aim.dbentity.AmpTeamMember" cascade="none" /> diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml index 99a5e1b0a29..da38a4586ef 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpTeamMember.hbm.xml @@ -43,7 +43,7 @@ column="amp_org_id" /> - + diff --git a/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml b/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml index cb8759a62d0..e0aeb2b349e 100644 --- a/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml @@ -11,8 +11,8 @@ - + class="org.digijava.module.aim.dbentity.AmpTeamMember" cascade="none" /> + From 4c53c3ac51781ca2a75cb63f970385f4675ad8f7 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Fri, 5 Apr 2024 15:58:15 +0300 Subject: [PATCH 30/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../module/calendar/dbentity/AmpCalendarAttendee.hbm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml b/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml index e0aeb2b349e..cb8759a62d0 100644 --- a/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendarAttendee.hbm.xml @@ -11,8 +11,8 @@ - + class="org.digijava.module.aim.dbentity.AmpTeamMember" /> + From a8f2e942cbf9c92d0a834d90acd1b2b7b34d70bf Mon Sep 17 00:00:00 2001 From: brianbrix Date: Fri, 5 Apr 2024 16:06:45 +0300 Subject: [PATCH 31/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 9a689ffb485..fc02eb8db07 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -134,7 +134,7 @@ - + Date: Sat, 6 Apr 2024 21:40:06 +0300 Subject: [PATCH 32/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/util/DbUtil.java | 62 +++++++++---------- .../aim/dbentity/IndicatorConnection.hbm.xml | 4 +- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java index 053fc8aa476..1d2c406752e 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java @@ -121,7 +121,7 @@ public static String deFilter(String text, boolean acute) { /** * Removes the team-reports and member-reports association table. - * + * * @param reportId * A Long array of the reports to be updated * @param teamId @@ -203,7 +203,7 @@ public static void removeTeamReports(Long reportId[], Long teamId) { /** * Associated the reports with the given team - * + * * @param reportId * The Long array of reportIds which are to be associated with * the given team @@ -675,7 +675,7 @@ public static List getMembersUsingReport(Long id) { /** * Loads all objects of T from database, using request session. TODO there * are several methods like this, let's refactor to one. - * + * * @param * @param object * @return @@ -688,7 +688,7 @@ public static Collection getAll(Class object) { /** * Loads all objects of T from database. Client should care about opening * and releasing session which is passed as parameter to this method. - * + * * @param * @param object * @param session @@ -840,7 +840,7 @@ public static List searchForOrganisation(String keyword, long[] /** * This function gets all organizations whose names begin with * namesFirstLetter and name or acronym contain keyword - * + * * @author Dare */ public static List searchForOrganisation(String namesFirstLetter, String keyword) { @@ -861,7 +861,7 @@ public static List searchForOrganisation(String namesFirstLette * This function gets all organizations whose names begin with * namesFirstLetter and name or acronym contain keyword and organisation * type is orgType - * + * * @author Mouhamad */ public static List searchForOrganisation(String namesFirstLetter, String keyword, Long orgType) { @@ -1144,7 +1144,7 @@ public static List getDonorOrganisationByGroupId(Long orgG } /** - * + * * @return List of Mul and Bil organization groups */ @@ -1291,7 +1291,7 @@ public static AmpSectorScheme getAmpSectorSchemeById(Long schemeId) { /** * general function to save/update object - * + * * @param object * @throws Exception */ @@ -2276,7 +2276,7 @@ public static Collection getAllGPISurveyIndicators(boolea public static Collection getActivityMEIndValue(Long ampActId) { Session session = null; Collection col = null; - Query qry = null; + Query qry; try { session = PersistenceManager.getRequestDBSession(); String queryString = "select indAct from " + IndicatorActivity.class.getName() + " indAct " @@ -2445,9 +2445,9 @@ public int compare(Object obj1, Object obj2) { /** * //for sorting users by Email - * + * * @author dare - * + * */ public static class HelperEmailComparator implements Comparator { private Order order; @@ -2535,9 +2535,9 @@ public int compare(AmpSector o1, AmpSector o2) { /** * This class is used for sorting AmpOrgGroup by code. - * + * * @author Dare Roinishvili - * + * */ public static class HelperAmpOrgGroupCodeComparator implements Comparator { Locale locale; @@ -2563,9 +2563,9 @@ public int compare(AmpOrgGroup o1, AmpOrgGroup o2) { /** * This class is used for sorting AmpOrgGroup by Type. - * + * * @author Dare Roinishvili - * + * */ public static class HelperAmpOrgGroupTypeComparator implements Comparator { public int compare(AmpOrgGroup o1, AmpOrgGroup o2) { @@ -2597,9 +2597,9 @@ public int compare(AmpOrgType o1, AmpOrgType o2) { /** * This class is used for sorting organisations by name. - * + * * @author Dare Roinishvili - * + * */ public static class HelperAmpOrganisationNameComparator implements Comparator { Locale locale; @@ -2628,9 +2628,9 @@ public int compare(AmpOrganisation o1, AmpOrganisation o2) { /** * This class is used for sorting organisations by acronym. - * + * * @author Dare Roinishvili - * + * */ public static class HelperAmpOrganisatonAcronymComparator implements Comparator { Locale locale; @@ -2668,9 +2668,9 @@ public int compare(AmpOrganisation o1, AmpOrganisation o2) { * This class is used for sorting organisation by group. such long and * complicated case is necessary because orgGroup maybe empty for * organisation - * + * * @author Dare Roinishvili - * + * */ public static class HelperAmpOrganisationGroupComparator implements Comparator { Locale locale; @@ -2724,9 +2724,9 @@ public int compare(AmpOrganisation o1, AmpOrganisation o2) { * This class is used for sorting organisation by Type. such long and * complicated case is necessary because orgType maybe empty for * organisation - * + * * @author Dare Roinisvili - * + * */ public static class HelperAmpOrganisationTypeComparator implements Comparator { Locale locale; @@ -2790,9 +2790,9 @@ public static AmpOrganisation getOrganisationByName(String name) { /** * Compares Values by type(actual,base,target) Used in Multi Program Manager * to sort them in order: base,actual,target of the same year - * + * * @author dare - * + * */ public static class IndicatorValuesComparatorByTypeAndYear implements Comparator { public int compare(AmpPrgIndicatorValue o1, AmpPrgIndicatorValue o2) { @@ -2922,9 +2922,9 @@ public int compare(Object obj1, Object obj2) { /** * //for sorting users by Email - * + * * @author dare - * + * */ public static class HelperEmailComparatorAsc implements Comparator { public int compare(Object obj1, Object obj2) { @@ -3050,13 +3050,13 @@ public static Integer countAgreementsByCode(String agreementCode) { .add(Restrictions.sqlRestriction("trim({alias}.code) = ?", agreementCode, StringType.INSTANCE)) .uniqueResult()).intValue(); } - + public static boolean hasDonorRole(Long id){ Session session = null; Query query = null; boolean result = false; try { - session = PersistenceManager.getRequestDBSession(); + session = PersistenceManager.getRequestDBSession(); String queryString = "select count(*) from " + AmpOrgRole.class.getName() + " r where (r.organisation.id = :orgId) and r.role.roleCode = :code"; query = session.createQuery(queryString); @@ -3068,7 +3068,7 @@ public static boolean hasDonorRole(Long id){ } catch (Exception e) { logger.error("Exception from hasDonorRole()", e); } - - return result; + + return result; } } diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml index 6e07d78ed78..ae8ffcf01b8 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml @@ -33,7 +33,7 @@ + class="org.digijava.module.categorymanager.dbentity.AmpCategoryValue" cascade="delete" /> @@ -45,4 +45,4 @@ - \ No newline at end of file + From 30ac5dcf1ecaf539bf78b5ae64322f444b36d977 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sat, 6 Apr 2024 22:07:08 +0300 Subject: [PATCH 33/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 4 ++-- amp/src/main/java/org/digijava/module/aim/util/DbUtil.java | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 9bfac670da0..c4739ddfa45 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1141,10 +1141,10 @@ public static void deleteActivityIndicatorsSession(Long ampActivityId,Session se public static void deleteActivityIndicators(Collection activityInd, AmpActivityVersion activity, Session session) throws Exception { - if (activityInd != null && activityInd.size() > 0) { + if (activityInd != null && !activityInd.isEmpty()) { for (Object indAct : activityInd) { - AmpIndicator ind = (AmpIndicator) session.get(AmpIndicator.class, ((IndicatorActivity) indAct).getIndicator().getIndicatorId()); + AmpIndicator ind = session.get(AmpIndicator.class, ((IndicatorActivity) indAct).getIndicator().getIndicatorId()); IndicatorActivity indConn = IndicatorUtil.findActivityIndicatorConnection(activity, ind); IndicatorUtil.removeConnection(indConn); } diff --git a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java index 1d2c406752e..3a8d7b6416c 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java @@ -2285,8 +2285,7 @@ public static Collection getActivityMEIndValue(Long ampActId) { qry.setParameter("ampActId", ampActId, LongType.INSTANCE); col = qry.list(); } catch (Exception e1) { - logger.error("could not retrieve AmpReportSector " + e1.getMessage()); - e1.printStackTrace(System.out); + logger.error("could not retrieve IndicatorActivity " + e1.getMessage(),e1); } return col; } From fd35d89747e9fbaba6f22a7ad8d213071355177f Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sat, 6 Apr 2024 22:08:55 +0300 Subject: [PATCH 34/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- .../digijava/module/aim/dbentity/IndicatorConnection.hbm.xml | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index fc02eb8db07..c48f9972077 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -134,7 +134,7 @@ - + + + From 685540ca5ee8f2a88fc429fa8ae29c06284583c2 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sat, 6 Apr 2024 22:22:34 +0300 Subject: [PATCH 35/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index c48f9972077..67b6cd94089 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -134,7 +134,7 @@ - + Date: Sat, 6 Apr 2024 22:37:45 +0300 Subject: [PATCH 36/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../digijava/module/aim/dbentity/IndicatorConnection.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml index 2aaed69a66e..9dc98f5384c 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml @@ -33,7 +33,7 @@ + class="org.digijava.module.categorymanager.dbentity.AmpCategoryValue" cascade="merge,persist" /> From b45eba0c75f03262dc10252d993e93d78361f3c6 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sat, 6 Apr 2024 23:06:12 +0300 Subject: [PATCH 37/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java | 1 + amp/src/main/java/org/digijava/module/aim/util/DbUtil.java | 1 + 2 files changed, 2 insertions(+) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index c4739ddfa45..96cb1253a8b 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1639,6 +1639,7 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception session.delete(ampAct); } session.delete(ampActivityGroup); + session.flush(); } public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ diff --git a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java index 3a8d7b6416c..4c4c9dab1f9 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java @@ -2279,6 +2279,7 @@ public static Collection getActivityMEIndValue(Long ampActId) { Query qry; try { session = PersistenceManager.getRequestDBSession(); + session.flush(); String queryString = "select indAct from " + IndicatorActivity.class.getName() + " indAct " + " where (indAct.activity=:ampActId)"; qry = session.createQuery(queryString); From 63fdfc90c56405820f498433dc2e85ca606c54f5 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sat, 6 Apr 2024 23:23:27 +0300 Subject: [PATCH 38/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- .../module/aim/dbentity/AmpMEIndicatorValue.hbm.xml | 6 +++--- .../module/aim/dbentity/IndicatorConnection.hbm.xml | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 67b6cd94089..f703494cb32 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -134,7 +134,7 @@ - + - diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml index 9dc98f5384c..a4e9cf5a439 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/IndicatorConnection.hbm.xml @@ -33,7 +33,7 @@ + class="org.digijava.module.categorymanager.dbentity.AmpCategoryValue" cascade="none" /> @@ -44,7 +44,5 @@ - - From cec8e7343b039b8f5acc72c13f585242ec3302a5 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sat, 6 Apr 2024 23:31:38 +0300 Subject: [PATCH 39/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 3 ++- .../digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 96cb1253a8b..0f82b89745b 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1639,11 +1639,12 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception session.delete(ampAct); } session.delete(ampActivityGroup); - session.flush(); } public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ ActivityUtil.deleteActivityContent(ampAct,session); + session.flush(); + Long ampActId = ampAct.getAmpActivityId(); //This is not deleting AmpMEIndicators, just indicators, ME is deprecated. ActivityUtil.deleteActivityIndicators(DbUtil.getActivityMEIndValue(ampActId), ampAct, session); diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index f703494cb32..9a689ffb485 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -134,7 +134,7 @@ - + Date: Sat, 6 Apr 2024 23:43:12 +0300 Subject: [PATCH 40/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../dbentity/AmpFundingMTEFProjection.hbm.xml | 6 +++--- .../dbentity/AmpOrgStaffInformation.hbm.xml | 6 +++--- .../module/aim/dbentity/AmpReports.hbm.xml | 16 +++++++-------- .../AmpScorecardSettingsCategoryValue.hbm.xml | 4 ++-- .../calendar/dbentity/AmpCalendar.hbm.xml | 2 +- .../dbentity/AmpCategoryValue.hbm.xml | 8 ++++---- .../dbentity/FundingPledges.hbm.xml | 20 +++++++++---------- .../dbentity/FundingPledgesDetails.hbm.xml | 10 +++++----- 8 files changed, 36 insertions(+), 36 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingMTEFProjection.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingMTEFProjection.hbm.xml index b91d91be4d5..6eece0252f2 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingMTEFProjection.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingMTEFProjection.hbm.xml @@ -22,12 +22,12 @@ + class="org.digijava.module.categorymanager.dbentity.AmpCategoryValue" cascade="none" /> - + + class="org.digijava.module.aim.dbentity.AmpRole" cascade="none" /> diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpOrgStaffInformation.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpOrgStaffInformation.hbm.xml index 3c742538b00..a40c25bf872 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpOrgStaffInformation.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpOrgStaffInformation.hbm.xml @@ -10,9 +10,9 @@ - + - + - \ No newline at end of file + diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpReports.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpReports.hbm.xml index 30e9bb8977d..0bce0fe209f 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpReports.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpReports.hbm.xml @@ -33,9 +33,9 @@ + class="org.digijava.module.categorymanager.dbentity.AmpCategoryValue" cascade="none" /> + class="org.digijava.module.categorymanager.dbentity.AmpCategoryValue" cascade="none" /> @@ -63,7 +63,7 @@ + column="cv_level_id" cascade="none" /> @@ -75,7 +75,7 @@ + column="cv_level_id" cascade="none" /> @@ -87,9 +87,9 @@ - - - + + + @@ -100,7 +100,7 @@ + column="cv_level_id" cascade="none" /> diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpScorecardSettingsCategoryValue.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpScorecardSettingsCategoryValue.hbm.xml index 4b2a866e9c3..c957495cd01 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpScorecardSettingsCategoryValue.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpScorecardSettingsCategoryValue.hbm.xml @@ -12,6 +12,6 @@ + class="org.digijava.module.categorymanager.dbentity.AmpCategoryValue" cascade="none" /> - \ No newline at end of file + diff --git a/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendar.hbm.xml b/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendar.hbm.xml index f94da3f2df9..a21167efd27 100644 --- a/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendar.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/calendar/dbentity/AmpCalendar.hbm.xml @@ -19,6 +19,6 @@ - + diff --git a/amp/src/main/resources/org/digijava/module/categorymanager/dbentity/AmpCategoryValue.hbm.xml b/amp/src/main/resources/org/digijava/module/categorymanager/dbentity/AmpCategoryValue.hbm.xml index 5effca565cd..721d73f005c 100644 --- a/amp/src/main/resources/org/digijava/module/categorymanager/dbentity/AmpCategoryValue.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/categorymanager/dbentity/AmpCategoryValue.hbm.xml @@ -11,8 +11,8 @@ - - + + @@ -28,9 +28,9 @@ - + - \ No newline at end of file + diff --git a/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledges.hbm.xml b/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledges.hbm.xml index 9e5f31d1171..eee02c74737 100644 --- a/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledges.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledges.hbm.xml @@ -10,8 +10,8 @@ - - + + @@ -26,7 +26,7 @@ - + @@ -37,18 +37,18 @@ - + - + - + @@ -63,12 +63,12 @@ - + - - + + - \ No newline at end of file + diff --git a/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledgesDetails.hbm.xml b/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledgesDetails.hbm.xml index 3f871a06b1b..2f95ae6e3ec 100644 --- a/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledgesDetails.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/fundingpledges/dbentity/FundingPledgesDetails.hbm.xml @@ -8,15 +8,15 @@ AMP_FUNDING_PLEDGES_DETAILS_seq - + - + - - + + - + From 22374b190d138a89f697419e2923d31c5e7b89e9 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sat, 6 Apr 2024 23:56:11 +0300 Subject: [PATCH 41/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../aim/dbentity/AmpActivityFields.java | 174 +++++++++--------- .../aim/dbentity/AmpActivityVersion.java | 13 +- 2 files changed, 94 insertions(+), 93 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityFields.java b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityFields.java index f27acfb991e..4974205ed00 100644 --- a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityFields.java +++ b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityFields.java @@ -57,7 +57,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl LoggerIdentifiable, Cloneable { private static final long serialVersionUID = 1L; - + protected static String [] IMPLEMENTED_ACTIONS=new String[]{GatePermConst.Actions.EDIT}; @Interchangeable(fieldTitle = "Project Impact", importable = true, @@ -84,30 +84,30 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl // @Interchangeable(fieldTitle = "Activity Budget",fmPath="/Activity Form/Identification/Activity Budget", required="/Activity Form/Identification/Required Validator for Activity Budget") @VersionableFieldSimple(fieldTitle = "Activity Budget") protected Integer budget; - + @Interchangeable(fieldTitle = "Government Agreement Number", importable = true, fmPath = "/Activity Form/Identification/Government Agreement Number") @VersionableFieldSimple(fieldTitle = "Government Agreement Number") protected String govAgreementNumber; - + @Interchangeable(fieldTitle = "Budget Code Project ID", importable = true, fmPath = "/Activity Form/Identification/Budget Code Project ID") @VersionableFieldSimple(fieldTitle = "Budget Code Project ID") protected String budgetCodeProjectID; - + //getter and setter never used @Interchangeable(fieldTitle = "Budget Sector", importable = true, fmPath = "/Activity Form/Identification/Budget Classification") @VersionableFieldSimple(fieldTitle = "Budget Sector") protected Long budgetsector; - + //getter and setter never used @Interchangeable(fieldTitle = "Budget Organization", importable = true, fmPath = "/Activity Form/Identification/Budget Classification") @VersionableFieldSimple(fieldTitle = "Budget Organization") protected Long budgetorganization; - + @Interchangeable(fieldTitle = "Budget Department", importable = true, fmPath = "/Activity Form/Identification/Budget Classification") @VersionableFieldSimple(fieldTitle = "Budget Department") protected Long budgetdepartment; - - + + //getter and setter never used @Interchangeable(fieldTitle = "Budget Program", importable = true, fmPath = "/Activity Form/Identification/Budget Classification") @VersionableFieldSimple(fieldTitle = "Budget Program") @@ -131,7 +131,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @VersionableFieldSimple(fieldTitle = "Name", mandatoryForSingleChange = true) @TranslatableField protected String name ; - + @Interchangeable(fieldTitle = "Description", importable = true, fmPath = "/Activity Form/Identification/Description", interValidators = @InterchangeableValidator(value = RequiredValidator.class, groups = Submit.class, @@ -142,11 +142,11 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @Interchangeable(fieldTitle = "Project Comments", importable = true, fmPath = "/Activity Form/Identification/Project Comments") @VersionableFieldTextEditor(fieldTitle = "Project Comments") protected String projectComments ; - + @Interchangeable(fieldTitle = "Lessons Learned", importable = true, fmPath = "/Activity Form/Identification/Lessons Learned") @VersionableFieldTextEditor(fieldTitle = "Lessons Learned") protected String lessonsLearned; - + @Interchangeable(fieldTitle = "Objective", importable = true, fmPath = "/Activity Form/Identification/Objective", interValidators = @InterchangeableValidator( value = RequiredValidator.class, @@ -154,15 +154,15 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl groups = Submit.class)) @VersionableFieldTextEditor(fieldTitle = "Objective") protected String objective ; - + @Interchangeable(fieldTitle = "Purpose", importable = true, fmPath = "/Activity Form/Identification/Purpose") @VersionableFieldTextEditor(fieldTitle = "Purpose") protected String purpose; - + @Interchangeable(fieldTitle = "Results", importable = true, fmPath = "/Activity Form/Identification/Results") @VersionableFieldTextEditor(fieldTitle = "Results") protected String results; - + @Interchangeable(fieldTitle = "Document Space", importable = true) @VersionableFieldSimple(fieldTitle = "Document Space") protected String documentSpace; @@ -193,11 +193,11 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @Interchangeable(fieldTitle = "Equal Oportunity", importable = true, fmPath = "/Activity Form/Cross Cutting Issues/Equal Opportunity") @VersionableFieldTextEditor(fieldTitle = "Equal Oportunity") protected String equalOpportunity; - + @Interchangeable(fieldTitle = "Environment", importable = true, fmPath = "/Activity Form/Cross Cutting Issues/Environment") @VersionableFieldTextEditor(fieldTitle = "Environment") protected String environment; - + @Interchangeable(fieldTitle = "Minorities", importable = true, fmPath = "/Activity Form/Cross Cutting Issues/Minorities") @VersionableFieldTextEditor(fieldTitle = "Minorities") protected String minorities; @@ -211,15 +211,15 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl fmPath = "/Activity Form/Planning/Required Validator for Original Completion Date")) @VersionableFieldSimple(fieldTitle = "Original Completion Date") protected Date originalCompDate; - + @Interchangeable(fieldTitle = "Contracting Date", importable = true, fmPath = "/Activity Form/Planning/Final Date for Contracting") @VersionableFieldSimple(fieldTitle = "Contracting Date") protected Date contractingDate; - + @Interchangeable(fieldTitle = "Disbursement Date", importable = true, fmPath = "/Activity Form/Planning/Final Date for Disbursements") @VersionableFieldSimple(fieldTitle = "Disbursement Date") protected Date disbursmentsDate; - + @VersionableCollection(fieldTitle = "Sectors") @InterchangeableDiscriminator(discriminatorField = "classificationConfig.name", configurer = AmpActivitySectorDiscriminationConfigurer.class, @@ -283,11 +283,11 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl unique = "/Activity Form/Sectors/Tag Sectors/uniqueSectorsValidator")) }) protected Set sectors = new HashSet<>(); - + // @Interchangeable(fieldTitle = "Contracts", importable = true, fmPath="/Activity Form/Contracts") @VersionableCollection(fieldTitle = "Contracts") - protected Set contracts; - + protected Set contracts=new HashSet<>(); + //TTIL @Interchangeable(fieldTitle = ActivityFieldsConstants.LOCATIONS, importable = true, fmPath = "/Activity Form/Location", @@ -304,7 +304,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl unique = "/Activity Form/Location/Locations/uniqueLocationsValidator")) @VersionableCollection(fieldTitle = ActivityFieldsConstants.LOCATIONS) protected Set locations = new HashSet<>(); - + @VersionableCollection(fieldTitle = "Org. Role") @InterchangeableDiscriminator(discriminatorField = "role.roleCode", configurer = AmpOrgRoleDiscriminationConfigurer.class, settings = { @@ -423,31 +423,31 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl unique = FMVisibility.PARENT_FM + "/Unique Orgs Validator")) }) protected Set orgrole = new HashSet<>(); - + @Interchangeable(fieldTitle = "Activity Internal IDs", importable = true, fmPath = "/Activity Form/Activity Internal IDs") @VersionableCollection(fieldTitle = "Activity Internal IDs") protected Set internalIds = new HashSet<>(); - + @Valid @FundingOrgRole(groups = API.class) @Interchangeable(fieldTitle = ActivityFieldsConstants.FUNDINGS, importable = true, fmPath = "/Activity Form/Funding") @VersionableCollection(fieldTitle = ActivityFieldsConstants.FUNDINGS) protected Set funding = new HashSet<>(); - + //TODO show this field? //TODO-reply: we should first figure out what it is /*seems obsolete*/ @VersionableCollection(fieldTitle = "Progress") protected Set progress; - + /** * Old, not used anymore * @deprecated */ @Deprecated protected Set documents ; - + @Interchangeable(fieldTitle = "Issues", importable = true, fmPath = "/Activity Form/Issues Section") @VersionableCollection(fieldTitle = "Issues") @@ -455,7 +455,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl // @Interchangeable(fieldTitle = "Regional Observations", importable = true, fmPath = "/Activity Form/Regional Observations") @VersionableCollection(fieldTitle = "Regional Observations") - protected Set regionalObservations; + protected Set regionalObservations=new HashSet<>(); @Interchangeable(fieldTitle = "Line Ministry Observations", importable = true, fmPath = "/Activity Form/Line Ministry Observations") @@ -474,7 +474,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl protected String contactName; //protected AmpTeamMember updatedBy; !!! Use modifiedBy - + @InterchangeableDiscriminator(discriminatorField = "funType", configurer = AmpFundingAmountDiscriminationConfigurer.class, settings = { @@ -487,9 +487,9 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl }) @VersionableCollection(fieldTitle = "Project Costs") protected Set costAmounts = new HashSet<>(); - + /** - * + * * @deprecated */ @Deprecated @@ -547,7 +547,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl protected String prjCoFaxNumber; // Sector Ministry contact information - + // @Interchangeable(fieldTitle = "Sector Ministry Contact First Name",fmPath="/Activity Form/Contacts/Sector Ministry Contact Information/contact first name") protected String secMiCntFirstName; // @Interchangeable(fieldTitle = "Sector Ministry Contact Last Name",fmPath="/Activity Form/Contacts/Sector Ministry Contact Information/contact lastname") @@ -562,24 +562,24 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl protected String secMiCntPhoneNumber; // @Interchangeable(fieldTitle = "Sector Ministry Contact Fax Number",fmPath="/Activity Form/Contacts/Sector Ministry Contact Information/Add Contact Fax") protected String secMiCntFaxNumber; - + @PrimaryContact(groups = API.class) @VersionableCollection(fieldTitle = "Activity Contacts") @InterchangeableDiscriminator(discriminatorField = "contactType", settings = { - @Interchangeable(fieldTitle = ActivityFieldsConstants.DONOR_CONTACT, importable = true, discriminatorOption = Constants.DONOR_CONTACT, + @Interchangeable(fieldTitle = ActivityFieldsConstants.DONOR_CONTACT, importable = true, discriminatorOption = Constants.DONOR_CONTACT, fmPath = "/Activity Form/Contacts/Donor Contact Information", validators = @Validators(unique = "/Activity Form/Contacts/Donor Contact Information")), - @Interchangeable(fieldTitle = ActivityFieldsConstants.PROJECT_COORDINATOR_CONTACT, importable = true, discriminatorOption = Constants.PROJECT_COORDINATOR_CONTACT, + @Interchangeable(fieldTitle = ActivityFieldsConstants.PROJECT_COORDINATOR_CONTACT, importable = true, discriminatorOption = Constants.PROJECT_COORDINATOR_CONTACT, fmPath = "/Activity Form/Contacts/Project Coordinator Contact Information", validators = @Validators(unique = "/Activity Form/Contacts/Project Coordinator Contact Information")), - @Interchangeable(fieldTitle = ActivityFieldsConstants.SECTOR_MINISTRY_CONTACT, importable = true, discriminatorOption = Constants.SECTOR_MINISTRY_CONTACT, + @Interchangeable(fieldTitle = ActivityFieldsConstants.SECTOR_MINISTRY_CONTACT, importable = true, discriminatorOption = Constants.SECTOR_MINISTRY_CONTACT, fmPath = "/Activity Form/Contacts/Sector Ministry Contact Information", validators = @Validators(unique = "/Activity Form/Contacts/Sector Ministry Contact Information")), - @Interchangeable(fieldTitle = ActivityFieldsConstants.MOFED_CONTACT, importable = true, discriminatorOption = Constants.MOFED_CONTACT, + @Interchangeable(fieldTitle = ActivityFieldsConstants.MOFED_CONTACT, importable = true, discriminatorOption = Constants.MOFED_CONTACT, fmPath = "/Activity Form/Contacts/Mofed Contact Information", validators = @Validators(unique = "/Activity Form/Contacts/Mofed Contact Information")), - @Interchangeable(fieldTitle = ActivityFieldsConstants.IMPL_EXECUTING_AGENCY_CONTACT, importable = true, - discriminatorOption = Constants.IMPLEMENTING_EXECUTING_AGENCY_CONTACT, + @Interchangeable(fieldTitle = ActivityFieldsConstants.IMPL_EXECUTING_AGENCY_CONTACT, importable = true, + discriminatorOption = Constants.IMPLEMENTING_EXECUTING_AGENCY_CONTACT, fmPath = "/Activity Form/Contacts/Implementing Executing Agency Contact Information", validators = @Validators(unique = "/Activity Form/Contacts/Implementing Executing Agency Contact Information")) }) @@ -588,7 +588,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @Interchangeable(fieldTitle = "Status Reason", importable = true, fmPath = "/Activity Form/Identification/Status Reason") @VersionableFieldTextEditor(fieldTitle = "Status Reason") protected String statusReason; - + @Interchangeable(fieldTitle = "Components", importable = true, fmPath = "/Activity Form/Components") @VersionableCollection(fieldTitle = ActivityFieldsConstants.COMPONENTS) protected Set components = new HashSet<>(); @@ -611,19 +611,19 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @Interchangeable(fieldTitle = "Actual Start Date", importable = true, fmPath = "/Activity Form/Planning/Actual Start Date") @VersionableFieldSimple(fieldTitle = "Actual Start Date") protected Date actualStartDate; - + @Interchangeable(fieldTitle = "Proposed Approval Date", importable = true, fmPath = "/Activity Form/Planning/Proposed Approval Date") @VersionableFieldSimple(fieldTitle = "Proposed Approval Date") protected Date proposedApprovalDate; - + @Interchangeable(fieldTitle = "Actual Approval Date", importable = true, fmPath = "/Activity Form/Planning/Actual Approval Date") @VersionableFieldSimple(fieldTitle = "Actual Approval Date") protected Date actualApprovalDate; - + @Interchangeable(fieldTitle = "Actual Completion Date", importable = true, fmPath = "/Activity Form/Planning/Actual Completion Date") @VersionableFieldSimple(fieldTitle = "Actual Completion Date") protected Date actualCompletionDate; - + @Interchangeable(fieldTitle = "Proposed Completion Date", importable = true, fmPath = "/Activity Form/Planning/Proposed Completion Date") @VersionableFieldSimple(fieldTitle = "Proposed Completion Date") protected Date proposedCompletionDate; @@ -633,12 +633,12 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl importable = true) @VersionableFieldSimple(fieldTitle = ActivityFieldsConstants.CREATED_BY, blockSingleChange = true) protected AmpTeamMember activityCreator; - + @Interchangeable(fieldTitle = ActivityFieldsConstants.CREATED_DATE, label = "Activity created on") @VersionableFieldSimple(fieldTitle = "Creation Date", blockSingleChange = true) @TimestampField protected Date createdDate; - + @Interchangeable(fieldTitle = ActivityFieldsConstants.UPDATE_DATE, label = "Activity updated on") @VersionableFieldSimple(fieldTitle = "Update Date", blockSingleChange = true) @@ -653,7 +653,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @AllowedApprover(groups = API.class) @Interchangeable(fieldTitle = ActivityFieldsConstants.APPROVED_BY, pickIdOnly = true, importable = true) protected AmpTeamMember approvedBy; - + @Interchangeable(fieldTitle = ActivityFieldsConstants.APPROVAL_DATE, importable = true) @TimestampField protected Date approvalDate; @@ -684,8 +684,8 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl // Aid Harmonization Survey Set // @Interchangeable(fieldTitle = "Surveys",fmPath="/Activity Form/Paris Indicators") @VersionableCollection(fieldTitle = "Surveys") - protected Set survey; - + protected Set survey=new HashSet<>(); + // @Interchangeable(fieldTitle = "GPI Surveys",fmPath="/Activity Form/GPI") @VersionableCollection(fieldTitle = "GPI Surveys") protected Set gpiSurvey; @@ -705,7 +705,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @VersionableFieldSimple(fieldTitle = "Archived") protected Boolean archived; - //do we want to export deleted activities? + //do we want to export deleted activities? //do we expect to import deleted activities? //commenting for now // @Interchangeable(fieldTitle = "Deleted", importable=false) @@ -713,11 +713,11 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl protected Boolean deleted; @VersionableCollection(fieldTitle = "Aid Effectiveness") - protected Set selectedEffectivenessIndicatorOptions; + protected Set selectedEffectivenessIndicatorOptions=new HashSet<>(); /** * Indicator connections. - * This field contains {@link IndicatorActivity} beans which represent activity-indicator connections + * This field contains {@link IndicatorActivity} beans which represent activity-indicator connections * and contain set of values for this connection. * Please refer to AmpActivity.hbm.xml and IndicatorConnection.hbm.xml for details. */ @@ -729,7 +729,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @Interchangeable(fieldTitle = "Activity Documents", fmPath = "/Activity Form/Related Documents", importable = true) @VersionableCollection(fieldTitle = "Activity Documents") protected Set activityDocuments = new HashSet<>(); - + /* Categories */ @InterchangeableDiscriminator(discriminatorField = "ampCategoryClass.keyName", settings = { @@ -755,26 +755,26 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl */ discriminatorOption = CategoryConstants.MODALITIES_KEY, fmPath="/Activity Form/Funding/Overview Section/Modalities", pickIdOnly=true), @Interchangeable(fieldTitle = "A C Chapter", label = "A.C. Chapter", importable = true, multipleValues = false, - discriminatorOption = CategoryConstants.ACCHAPTER_KEY, fmPath="/Activity Form/Identification/A.C. Chapter", pickIdOnly=true), + discriminatorOption = CategoryConstants.ACCHAPTER_KEY, fmPath="/Activity Form/Identification/A.C. Chapter", pickIdOnly=true), @Interchangeable(fieldTitle = "Activity Budget", importable = true, multipleValues = false, interValidators = @InterchangeableValidator(value = RequiredValidator.class, groups = Submit.class, fmPath = "/Activity Form/Identification/Required Validator for Activity Budget"), - discriminatorOption = CategoryConstants.ACTIVITY_BUDGET_KEY, fmPath="/Activity Form/Identification/Activity Budget", pickIdOnly=true), - @Interchangeable(fieldTitle = "Procurement System", importable=true, multipleValues=false, + discriminatorOption = CategoryConstants.ACTIVITY_BUDGET_KEY, fmPath="/Activity Form/Identification/Activity Budget", pickIdOnly=true), + @Interchangeable(fieldTitle = "Procurement System", importable=true, multipleValues=false, discriminatorOption = CategoryConstants.PROCUREMENT_SYSTEM_KEY, fmPath="/Activity Form/Identification/Procurement System", pickIdOnly=true), - @Interchangeable(fieldTitle = "Reporting System", importable=true, multipleValues=false, - discriminatorOption = CategoryConstants.REPORTING_SYSTEM_KEY, fmPath="/Activity Form/Identification/Reporting System", pickIdOnly=true), - @Interchangeable(fieldTitle = "Audit System", importable=true, multipleValues=false, + @Interchangeable(fieldTitle = "Reporting System", importable=true, multipleValues=false, + discriminatorOption = CategoryConstants.REPORTING_SYSTEM_KEY, fmPath="/Activity Form/Identification/Reporting System", pickIdOnly=true), + @Interchangeable(fieldTitle = "Audit System", importable=true, multipleValues=false, discriminatorOption = CategoryConstants.AUDIT_SYSTEM_KEY, fmPath="/Activity Form/Identification/Audit System", pickIdOnly=true), - @Interchangeable(fieldTitle = "Institutions", importable=true, multipleValues=false, + @Interchangeable(fieldTitle = "Institutions", importable=true, multipleValues=false, discriminatorOption = CategoryConstants.INSTITUTIONS_KEY, fmPath="/Activity Form/Identification/Institutions", pickIdOnly=true), - @Interchangeable(fieldTitle = "Project Implementing Unit", importable=true, multipleValues=false, + @Interchangeable(fieldTitle = "Project Implementing Unit", importable=true, multipleValues=false, discriminatorOption = CategoryConstants.PROJECT_IMPLEMENTING_UNIT_KEY, fmPath="/Activity Form/Identification/Project Implementing Unit", pickIdOnly=true), - @Interchangeable(fieldTitle = "Accession Instrument", importable=true, multipleValues=false, + @Interchangeable(fieldTitle = "Accession Instrument", importable=true, multipleValues=false, discriminatorOption = CategoryConstants.ACCESSION_INSTRUMENT_KEY, fmPath="/Activity Form/Identification/Accession Instrument", pickIdOnly=true), - @Interchangeable(fieldTitle = "Project Category", importable=true, multipleValues=false, + @Interchangeable(fieldTitle = "Project Category", importable=true, multipleValues=false, discriminatorOption = CategoryConstants.PROJECT_CATEGORY_KEY, fmPath="/Activity Form/Identification/Project Category", pickIdOnly=true), - @Interchangeable(fieldTitle = "Implementation Level", importable=true, multipleValues=false, + @Interchangeable(fieldTitle = "Implementation Level", importable=true, multipleValues=false, discriminatorOption = CategoryConstants.IMPLEMENTATION_LEVEL_KEY, fmPath="/Activity Form/Location/Implementation Level", pickIdOnly=true), @Interchangeable(fieldTitle = "Implementation Location", importable = true, multipleValues = false, discriminatorOption = CategoryConstants.IMPLEMENTATION_LOCATION_KEY, @@ -801,10 +801,10 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @Interchangeable(fieldTitle = "Indirect On Budget", importable = true, fmPath = "/Activity Form/Identification/Budget Extras/Indirect On Budget") @VersionableFieldSimple(fieldTitle = "Indirect On Budget") protected Boolean indirectOnBudget; - + @VersionableFieldSimple(fieldTitle = "FY") protected String FY; - + /* * This field is used for API only. The values are stored in database as a string using FY field */ @@ -816,21 +816,21 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl validators = @Validators (unique = "/Activity Form/Identification/Budget Extras/FY")) @PossibleValues(FiscalYearPossibleValuesProvider.class) protected Set fiscalYears = new HashSet<>(); - + @Interchangeable(fieldTitle = "Vote", importable = true, fmPath = "/Activity Form/Identification/Budget Extras/Vote", requiredDependencies = OnBudgetValidator.ON_BUDGET_KEY, dependencyRequired = SUBMIT) @VersionableFieldSimple(fieldTitle = "Vote") protected String vote; - + @Interchangeable(fieldTitle = "Sub Vote", label = "Sub-Vote", importable = true, fmPath = "/Activity Form/Identification/Budget Extras/Sub-Vote", requiredDependencies = OnBudgetValidator.ON_BUDGET_KEY, dependencyRequired = SUBMIT) @VersionableFieldSimple(fieldTitle = "Sub Vote") protected String subVote; - + @Interchangeable(fieldTitle = "Sub Program", label = "Sub-Program", importable = true, fmPath = "/Activity Form/Identification/Budget Extras/Sub-Program", requiredDependencies = OnBudgetValidator.ON_BUDGET_KEY, @@ -853,12 +853,12 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @VersionableFieldSimple(fieldTitle = "Ministry Code") protected String ministryCode; - + @Interchangeable(fieldTitle = "CRIS Number", importable = true, fmPath = "/Activity Form/Identification/Cris Number") @VersionableFieldSimple(fieldTitle = "CRIS Number") protected String crisNumber; - + @Interchangeable(fieldTitle = "Government Approval Procedures", importable = true, fmPath = "/Activity Form/Identification/Government Approval Procedures") @VersionableFieldSimple(fieldTitle = "Government Approval Procedures") protected Boolean governmentApprovalProcedures; @@ -960,14 +960,14 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl */ @Interchangeable(fieldTitle = "Activity Group") protected AmpActivityGroup ampActivityGroup; - + protected Date modifiedDate; @Interchangeable(fieldTitle = ActivityFieldsConstants.MODIFIED_BY, pickIdOnly = true, label = "Activity last updated by", importable = true) @VersionableFieldSimple(fieldTitle = "Modified By") protected AmpTeamMember modifiedBy; - + protected Boolean mergedActivity; protected AmpActivityVersion mergeSource1; protected AmpActivityVersion mergeSource2; @@ -975,7 +975,7 @@ public abstract class AmpActivityFields extends Permissible implements Comparabl @Interchangeable(fieldTitle = CategoryConstants.FUNDING_SOURCES_NUMBER_NAME, importable = true, fmPath = "/Activity Form/Funding/Overview Section/Total Number of Funding Sources") @VersionableFieldSimple(fieldTitle = CategoryConstants.FUNDING_SOURCES_NUMBER_NAME) protected Integer fundingSourcesNumber; - + @Interchangeable(fieldTitle = "Proposed Project Life", importable = true, fmPath = "/Activity Form/Planning/Proposed Project Life") @VersionableFieldSimple(fieldTitle = "Proposed Project Life") protected Integer proposedProjectLife; @@ -1312,7 +1312,7 @@ public int compareTo(AmpActivityVersion act) { // // AmpActivityVersion act = (AmpActivityVersion) o; - //Added cos this method is comparing by Names, + //Added cos this method is comparing by Names, //but many activities have NULL names and running script to correct records only once is temporary solution. String myName=(this.name==null)?"":this.name; String hisName=(act.getName()==null)?"":act.getName(); @@ -1860,11 +1860,11 @@ public Boolean getDraft() { public Set getActPrograms() { return actPrograms; } - + public Set getActBudgetStructure(){ return actBudgetStructure; } - + public void setActBudgetStructure(Set actBudgetStructure){ this.actBudgetStructure = actBudgetStructure; } @@ -2129,7 +2129,7 @@ public Boolean isHumanitarianAid( ) { public void setHumanitarianAid(Boolean humanitarianAid) { this.humanitarianAid = humanitarianAid; } - + public AmpTeamMember getApprovedBy() { return approvedBy; } @@ -2212,7 +2212,7 @@ public void setProjectComments(String projectComments) { // } // return res; // } - + public AmpActivityGroup getAmpActivityGroup() { return ampActivityGroup; } @@ -2314,7 +2314,7 @@ public String getContactName() { public void setContactName(String contactName) { this.contactName = contactName; } - + public Set getLineMinistryObservations() { return lineMinistryObservations; } @@ -2364,7 +2364,7 @@ public Set getGpiSurvey() { public void setGpiSurvey(Set gpiSurvey) { this.gpiSurvey = gpiSurvey; } - + public Integer getProposedProjectLife() { return proposedProjectLife; } @@ -2396,7 +2396,7 @@ public Boolean getDeleted() { public void setDeleted(Boolean deleted) { this.deleted = deleted; } - + public Set getFiscalYears() { return fiscalYears; } @@ -2412,7 +2412,7 @@ public Set getSelectedEffectivenessIndicator public void setSelectedEffectivenessIndicatorOptions(Set selectedEffectivenessIndicatorOptions) { this.selectedEffectivenessIndicatorOptions = selectedEffectivenessIndicatorOptions; } - + public AmpFundingAmount getProjectCostByType(AmpFundingAmount.FundingType type) { if (this.costAmounts != null && type != null) { for (AmpFundingAmount fa : costAmounts) { @@ -2437,14 +2437,14 @@ public Set getCostAmounts() { public void setCostAmounts(Set costAmounts) { this.costAmounts = costAmounts; } - + public String getIatiIdentifier() { return iatiIdentifier; } - + public void setIatiIdentifier(String iatiIdentifier) { this.iatiIdentifier = iatiIdentifier; } - + } diff --git a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityVersion.java b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityVersion.java index 62c2163e010..876db9d0f5b 100644 --- a/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityVersion.java +++ b/amp/src/main/java/org/digijava/module/aim/dbentity/AmpActivityVersion.java @@ -8,6 +8,7 @@ import org.digijava.module.aim.util.Output; import java.util.Date; +import java.util.HashSet; import java.util.Set; /** @@ -16,15 +17,15 @@ */ @TranslatableClass (displayName = "Activity Version") public class AmpActivityVersion extends AmpActivityFields implements Versionable{ - + /** - * + * * NOTE: * All new fields should be added in {@link AmpActivityFields} - * + * */ protected String rejectMessage; - private Set groups; + private Set groups=new HashSet<>(); public Set getGroups() { return groups; @@ -80,7 +81,7 @@ public Output getOutput() { public Object prepareMerge(AmpActivityVersion newActivity) throws Exception { throw new AssertionError("Not implemented"); } - + public static String sqlStringForName(String idSource) { return InternationalizedModelDescription.getForProperty(AmpActivityVersion.class, "name").getSQLFunctionCall(idSource); @@ -248,4 +249,4 @@ public String toString() { ", permissionMapCached=" + permissionMapCached + '}'; } -} \ No newline at end of file +} From 6a55ebe1eccbb4a18276e34f67a6de381df8b387 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 7 Apr 2024 00:06:19 +0300 Subject: [PATCH 42/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../digijava/module/aim/util/ActivityUtil.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 0f82b89745b..9859565ce0c 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1631,19 +1631,29 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception for (AmpActivityVersion ampActivityVersion : activityversions) { deleteFullActivityContent(ampActivityVersion, session); - session.delete(ampActivityVersion); +// session.delete(ampActivityVersion); + deleteActivity(session,ampActivityVersion); } } else { AmpActivityVersion ampAct = session.load(AmpActivityVersion.class, ampActId); deleteFullActivityContent(ampAct, session); - session.delete(ampAct); +// session.delete(ampAct); + deleteActivity(session,ampAct); } session.delete(ampActivityGroup); } + private static void deleteActivity(Session session, AmpActivityVersion ampAct) + { + logger.info("Deleting Real ... Activity # " + ampAct.getAmpActivityId()); + Connection con = ((SessionImplementor)session).connection(); + // delete surveys + String deleteActivitySurveyResponse = "DELETE FROM amp_activity_version WHERE amp_activity_id = " + ampAct.getAmpActivityId(); + SQLUtils.executeQuery(con, deleteActivitySurveyResponse ); + } + public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ ActivityUtil.deleteActivityContent(ampAct,session); - session.flush(); Long ampActId = ampAct.getAmpActivityId(); //This is not deleting AmpMEIndicators, just indicators, ME is deprecated. From ffa82e45324800c01aa968fdc6a52606005bbdb6 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 7 Apr 2024 00:13:02 +0300 Subject: [PATCH 43/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 9859565ce0c..a403db78c70 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1069,6 +1069,9 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess //Delete the connection with Team. String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = " + ampAct.getAmpActivityId(); SQLUtils.executeQuery(con, deleteActivityTeam ); + + String deleteActivityFunding = "DELETE FROM amp_funding WHERE amp_activity_id = " + ampAct.getAmpActivityId(); + SQLUtils.executeQuery(con, deleteActivityFunding ); } public static void removeMergeSources(Long ampActivityId,Session session){ From dc0b6a63ebdce4977db2ec42e0c0f6304a1a2a6f Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 7 Apr 2024 00:26:55 +0300 Subject: [PATCH 44/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/util/ActivityUtil.java | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index a403db78c70..fe370a32570 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1069,9 +1069,6 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess //Delete the connection with Team. String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = " + ampAct.getAmpActivityId(); SQLUtils.executeQuery(con, deleteActivityTeam ); - - String deleteActivityFunding = "DELETE FROM amp_funding WHERE amp_activity_id = " + ampAct.getAmpActivityId(); - SQLUtils.executeQuery(con, deleteActivityFunding ); } public static void removeMergeSources(Long ampActivityId,Session session){ @@ -1632,16 +1629,16 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception Set activityversions = ampActivityGroup.getActivities(); if (activityversions != null && !activityversions.isEmpty()) { for (AmpActivityVersion ampActivityVersion : activityversions) { - deleteFullActivityContent(ampActivityVersion, session); +// deleteFullActivityContent(ampActivityVersion, session); -// session.delete(ampActivityVersion); - deleteActivity(session,ampActivityVersion); + session.delete(ampActivityVersion); +// deleteActivity(session,ampActivityVersion); } } else { AmpActivityVersion ampAct = session.load(AmpActivityVersion.class, ampActId); deleteFullActivityContent(ampAct, session); -// session.delete(ampAct); - deleteActivity(session,ampAct); + session.delete(ampAct); +// deleteActivity(session,ampAct); } session.delete(ampActivityGroup); } From 2641823a16dbf14c09062d278a4796a48960343e Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 7 Apr 2024 00:34:44 +0300 Subject: [PATCH 45/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index fe370a32570..2356dffa81c 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1629,14 +1629,15 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception Set activityversions = ampActivityGroup.getActivities(); if (activityversions != null && !activityversions.isEmpty()) { for (AmpActivityVersion ampActivityVersion : activityversions) { -// deleteFullActivityContent(ampActivityVersion, session); - + deleteFullActivityContent(ampActivityVersion, session); + session.flush(); session.delete(ampActivityVersion); // deleteActivity(session,ampActivityVersion); } } else { AmpActivityVersion ampAct = session.load(AmpActivityVersion.class, ampActId); deleteFullActivityContent(ampAct, session); + session.flush(); session.delete(ampAct); // deleteActivity(session,ampAct); } From d1cd1929c0dae262401561618738a27ac230eecb Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 7 Apr 2024 00:46:30 +0300 Subject: [PATCH 46/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 1 + amp/src/main/java/org/digijava/module/aim/util/DbUtil.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 2356dffa81c..462b420ecf7 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1655,6 +1655,7 @@ private static void deleteActivity(Session session, AmpActivityVersion ampAct) public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ ActivityUtil.deleteActivityContent(ampAct,session); + session.flush(); Long ampActId = ampAct.getAmpActivityId(); //This is not deleting AmpMEIndicators, just indicators, ME is deprecated. diff --git a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java index 4c4c9dab1f9..cde4797f8b7 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/DbUtil.java @@ -2279,7 +2279,7 @@ public static Collection getActivityMEIndValue(Long ampActId) { Query qry; try { session = PersistenceManager.getRequestDBSession(); - session.flush(); +// session.flush(); String queryString = "select indAct from " + IndicatorActivity.class.getName() + " indAct " + " where (indAct.activity=:ampActId)"; qry = session.createQuery(queryString); From dcfe02661bfcd35cbbd98398cdc34a9feeb619e9 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Sun, 7 Apr 2024 00:53:10 +0300 Subject: [PATCH 47/97] AMP-30860 -Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 462b420ecf7..8b81fdaf9d1 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1655,7 +1655,7 @@ private static void deleteActivity(Session session, AmpActivityVersion ampAct) public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ ActivityUtil.deleteActivityContent(ampAct,session); - session.flush(); +// session.flush(); Long ampActId = ampAct.getAmpActivityId(); //This is not deleting AmpMEIndicators, just indicators, ME is deprecated. From 4db649d1563e18aa8459796c6617d491c2e76174 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Tue, 23 Apr 2024 22:30:51 +0300 Subject: [PATCH 48/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- ...tedStatusAfterFundingDateMatcherTests.java | 57 +++++++++---------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/performance/matcher/NoUpdatedStatusAfterFundingDateMatcherTests.java b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/performance/matcher/NoUpdatedStatusAfterFundingDateMatcherTests.java index bfd7e60b2f7..78e4a0866ba 100644 --- a/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/performance/matcher/NoUpdatedStatusAfterFundingDateMatcherTests.java +++ b/amp/src/test/java/org/digijava/kernel/ampapi/endpoints/performance/matcher/NoUpdatedStatusAfterFundingDateMatcherTests.java @@ -14,37 +14,36 @@ import org.joda.time.LocalDate; import org.junit.Before; import org.junit.jupiter.api.Test; - import static org.junit.Assert.*; /** * 3 months went by after the contract signature date and the project status was not modified from planned to ongoing - * + * * @author Viorel Chihai */ public class NoUpdatedStatusAfterFundingDateMatcherTests extends PerformanceRuleMatcherTests { - + @Before public void setUp() { super.setUp(); definition = new NoUpdatedStatusAfterFundingDateMatcherDefinition(); } - + @Test public void testValidation() { - AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", - PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, + AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", + PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, getCriticalLevel()); - + assertNotNull(definition.createMatcher(rule)); } @Test public void testPlannedStatusAfterClasificationDate() { - AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", - PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, + AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", + PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, getCriticalLevel()); - + AmpActivityVersion a = new ActivityBuilder() .addFunding( new FundingBuilder() @@ -69,16 +68,16 @@ public void testPlannedStatusAfterClasificationDate() { .getCategoryClass()) .getCategoryValue()) .getActivity(); - + assertEquals(findPerformanceIssue(rule, a).getDonors().size(), 1); } - + @Test public void testUpdatedActivityStatus() { - AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", - PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, + AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", + PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, getCriticalLevel()); - + AmpActivityVersion a = new ActivityBuilder() .addFunding( new FundingBuilder() @@ -96,16 +95,16 @@ public void testUpdatedActivityStatus() { .getCategoryClass()) .getCategoryValue()) .getActivity(); - + assertNull(findPerformanceIssue(rule, a)); } - + @Test public void testNotUpdatedActivitySatus() { - AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", - PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, + AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", + PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, getCriticalLevel()); - + AmpActivityVersion a = new ActivityBuilder() .addFunding( new FundingBuilder() @@ -123,16 +122,16 @@ public void testNotUpdatedActivitySatus() { .getCategoryClass()) .getCategoryValue()) .getActivity(); - + assertEquals(findPerformanceIssue(rule, a).getDonors().size(), 1); } - + @Test public void testActivityStatusUpdatedWihtoutTimePeriod() { - AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", - PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, + AmpPerformanceRule rule = createRule(PerformanceRuleConstants.TIME_UNIT_MONTH, "3", + PerformanceRuleConstants.FUNDING_CLASSIFICATION_DATE, Constants.ACTIVITY_STATUS_ONGOING, getCriticalLevel()); - + AmpActivityVersion a = new ActivityBuilder() .addFunding( new FundingBuilder() @@ -150,16 +149,16 @@ public void testActivityStatusUpdatedWihtoutTimePeriod() { .getCategoryClass()) .getCategoryValue()) .getActivity(); - + assertNull(findPerformanceIssue(rule, a)); } /** * @return */ - public AmpPerformanceRule createRule(String timeUnit, String timeAmount, String fundingDate, String activityStatus, + public AmpPerformanceRule createRule(String timeUnit, String timeAmount, String fundingDate, String activityStatus, AmpCategoryValue level) { - + AmpPerformanceRule rule = new AmpPerformanceRule(); AmpPerformanceRuleAttribute attr1 = new AmpPerformanceRuleAttribute(); @@ -184,5 +183,5 @@ public AmpPerformanceRule createRule(String timeUnit, String timeAmount, String return rule; } - + } From 319db49154ed041f59eff43520f17b2aa8e0ddd6 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 00:06:43 +0300 Subject: [PATCH 49/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- amp/src/main/webapp/WEB-INF/web.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/amp/src/main/webapp/WEB-INF/web.xml b/amp/src/main/webapp/WEB-INF/web.xml index 1744a46228f..fd374f3f99c 100644 --- a/amp/src/main/webapp/WEB-INF/web.xml +++ b/amp/src/main/webapp/WEB-INF/web.xml @@ -25,6 +25,11 @@ net.bull.javamelody.SessionListener + + + org.springframework.security.web.session.HttpSessionEventPublisher + + gzipRequestFilter From 11dab527ee3220dc015cc20d4449ad67cf36141f Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 00:18:48 +0300 Subject: [PATCH 50/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml index 399a516bd3d..11cfc11c384 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml @@ -12,7 +12,7 @@ + not-null="false" /> @@ -23,4 +23,4 @@ - \ No newline at end of file + From 6fb22b421bfed658671892473dfbeaef50b68862 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 00:32:34 +0300 Subject: [PATCH 51/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml index 11cfc11c384..c19aada5c34 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml @@ -11,8 +11,8 @@ + class="org.digijava.module.aim.dbentity.AmpActivityVersion" cascade="all-delete-orphan" + not-null="true" /> From c98cec6324317a3859a993bfc5a0d709cce86dd1 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 00:42:30 +0300 Subject: [PATCH 52/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- .../org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 9a689ffb485..ce671a8e85d 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -232,7 +232,7 @@ - + diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml index c19aada5c34..938f0db4e0d 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml @@ -11,7 +11,7 @@ Date: Wed, 24 Apr 2024 00:49:38 +0300 Subject: [PATCH 53/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index ce671a8e85d..8bb61a5f994 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -232,7 +232,7 @@ - + From f459b4720aeca0d7b5b22cdf686d4bae0bf0589e Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 00:50:07 +0300 Subject: [PATCH 54/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml index 938f0db4e0d..5bf7d7db299 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpGPISurvey.hbm.xml @@ -15,7 +15,7 @@ not-null="true" /> + cascade="merge" > From 717cf30eed32323e468c19a16b89ef998d6d6426 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 01:09:47 +0300 Subject: [PATCH 55/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 8bb61a5f994..e49934e581c 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -232,7 +232,7 @@ - + From c5fc8939b068b4905ff358a19bf413d33fd18872 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 01:17:54 +0300 Subject: [PATCH 56/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index e49934e581c..539b0b11de4 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -232,7 +232,7 @@ - + From e3226d21c36b81d70dbdb2cf42d1d82280db29e0 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 18:15:46 +0300 Subject: [PATCH 57/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../amp/ar/viewfetcher/SQLUtils.java | 135 ++++++++++-------- .../module/aim/util/ActivityUtil.java | 4 +- 2 files changed, 79 insertions(+), 60 deletions(-) diff --git a/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java b/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java index bc30a64d3f3..676480034d1 100644 --- a/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java +++ b/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java @@ -14,6 +14,8 @@ import org.hibernate.engine.jdbc.spi.JdbcServices; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.engine.spi.TypedValue; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.sql.*; import java.text.SimpleDateFormat; @@ -23,20 +25,21 @@ import java.util.function.Function; public class SQLUtils { - + public final static String SQL_UTILS_NULL = "###NULL###"; - + private static Logger logger = LoggerFactory.getLogger(SQLUtils.class); + /** * returns the list of all the columns of a table / view, in the same order as they appear in the table/view definition * @param tableName - the table / view whose columns to fetch * @param crashOnDuplicates - whether to throw exception in case the table/view has duplicate names * @return - * @throws SQLException + * @throws SQLException */ public static LinkedHashSet getTableColumns(final String tableName, boolean crashOnDuplicates){ return new LinkedHashSet(getTableColumnsWithTypes(tableName, crashOnDuplicates).keySet()); } - + /** * returns the list of all the columns of a table / view, in the same order as they appear in the table/view definition * @param tableName - the table / view whose columns to fetch @@ -52,7 +55,7 @@ public static LinkedHashMap getTableColumnsWithTypes(final Strin throw new RuntimeException(ex); } } - + /** * returns the list of all the columns of a table / view, in the same order as they appear in the table/view definition * @param tableName - the table / view whose columns to fetch @@ -63,7 +66,7 @@ public static LinkedHashMap getTableColumnsWithTypes(Connection String query = String.format("SELECT c.column_name, c.data_type FROM information_schema.columns As c WHERE table_schema='public' AND table_name = '%s' ORDER BY c.ordinal_position", tableName.toLowerCase()); return getStringToStringMap(jdbcConnection, tableName, query, crashOnDuplicates); } - + /** * generically builds a linkedhashmap of (colname, coltype), based on a query * @param jdbcConnection @@ -77,7 +80,7 @@ public static LinkedHashMap getStringToStringMap(Connection jdbc while (rsi.rs.next()) { String columnName = rsi.rs.getString(1); String columnType = rsi.rs.getString(2); - + if (crashOnDuplicates && res.containsKey(columnName)) throw new RuntimeException("not allowed to have duplicate column names in table " + tableName); res.put(columnName, columnType); @@ -102,12 +105,12 @@ public static LinkedHashSet getTableColumns(final String tableName) { return getTableColumns(tableName, false); } - + public static boolean tableExists(String tableName) { return !getTableColumns(tableName).isEmpty(); - } - + } + public static void executeQuery(Connection conn, String query) { try @@ -121,7 +124,23 @@ public static void executeQuery(Connection conn, String query) throw new RuntimeException(e); } } - + + public static void executePreparedQuery(Connection conn, String query, Long actId) + { + try + { + PreparedStatement statement = conn.prepareStatement(query); + statement.setLong(1, actId); + int deleted= statement.executeUpdate(); + logger.info("Deleted records :"+deleted); + statement.close(); + } + catch(SQLException e) + { + throw new RuntimeException(e); + } + } + /** * runs a query and calls the consumer for each row of the result * @param connection @@ -136,7 +155,7 @@ public static void forEachRow(Connection connection, String query, Consumer List collect(Connection connection, String query, Function List collect(Connection connection, String query, Function params) throws SQLException { //logger.info("Running raw SQL query: " + query); - + PreparedStatement ps = connection.prepareStatement(query, ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); if (params != null) { //logger.debug("the parameters are:"); - for (int i = 0; i < params.size(); i++) + for (int i = 0; i < params.size(); i++) { ps.setObject(i + 1, params.get(i).getValue(), params.get(i).getSqlType()); //logger.debug(String.format("\tvalue: %s, SQL type: %d", params.get(i).getValue(), params.get(i).getSqlType())); } } - + ResultSet rs = ps.executeQuery(); return new RsInfo(rs, ps); } - + /** * fetches an ArrayList of longs * @param connection @@ -203,7 +222,7 @@ public static List fetchLongs(Connection connection, String query) { } return res; } - + /** * fetches an ArrayList of Strings * @param connection @@ -219,10 +238,10 @@ public static List fetchStrings(Connection connection, String query) { } catch (SQLException ex) { throw new RuntimeException(ex); } - + return res; } - + /** * runs a query and returns a list of the nth elements in each of the rows * @param connection @@ -243,7 +262,7 @@ public static List fetchAsList(Connection connection, String query, int n // PersistenceManager.closeQuietly(rs); // } } - + /** * runs a query and fetches its only result as a Long * @param connection @@ -256,13 +275,13 @@ public static Long getLong(Connection connection, String query) { throw new RuntimeException("query should have returned exactly one result, but returned instead: " + res.size()); return PersistenceManager.getLong(res.get(0)); } - + public static List fetchAsList(ResultSet rs, int n, String errMsgAdd) { try { ArrayList result = new ArrayList(); - + while (rs.next()) { T elem = (T) rs.getObject(n); @@ -274,8 +293,8 @@ public static List fetchAsList(ResultSet rs, int n, String errMsgAdd) { throw new RuntimeException("Error fetching list of values" + errMsgAdd, e); } - } - + } + /** * generates a raw comma-separated-values * @param values @@ -293,7 +312,7 @@ public static String generateCSV(java.util.Collection values) } return result.toString(); } - + public static Criterion getUnaccentILikeExpression(final String propertyName, final String value, final String locale, final MatchMode matchMode) { return new Criterion(){ private static final long serialVersionUID = -8979378752879206485L; @@ -307,7 +326,7 @@ public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws String[] columns = criteriaQuery.findColumns(propertyName, criteria); String entityName = criteriaQuery.getEntityName(criteria); - + String []ids=criteriaQuery.getIdentifierColumns(criteria); if (columns.length!=1) throw new HibernateException("ilike may only be used with single-column properties"); @@ -323,21 +342,21 @@ public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws throw new HibernateException("We do not handle non-postgresql databases yet, sorry!"); } } - + @Override - public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException + public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { return new TypedValue[] { criteriaQuery.getTypedValue( criteria, propertyName, matchMode.toMatchString(value).toLowerCase() ) , criteriaQuery.getTypedValue( criteria, propertyName, matchMode.toMatchString(value).toLowerCase() )}; } }; } - - + + //ao.* from amp_organisation ao -> "ao.amp_org_id, ao.column2, getOrgName(....), ...." /** - * + * * @param tableName * @param tableAlias * @param renames Map @@ -354,7 +373,7 @@ public static String rewriteQuery(String tableName, String tableAlias, Map colNames, List> values) { if ((idColumnName == null) ^ (seqName == null)) throw new RuntimeException("idColumnName should be both null or both non-null"); - + int rowsPerInsert = 300; - int nrSegments = values.size() / rowsPerInsert + 1; + int nrSegments = values.size() / rowsPerInsert + 1; for(int i = 0; i < nrSegments; i++) { int segmentStart = i * rowsPerInsert; // inclusive int segmentEnd = Math.min(values.size(), (i + 1) * rowsPerInsert); // exclusive if (segmentStart >= segmentEnd) - break; + break; String query = buildMultiRowInsert(tableName, idColumnName, seqName, colNames, values.subList(segmentStart, segmentEnd)); SQLUtils.executeQuery(conn, query.toString()); } } - + /** * builds a statement of the form INSERT INTO $tableName$ (col1, col2, col3) VALUES (val11, val12, val13), (val21, val22, val23); * @param tableName @@ -394,10 +413,10 @@ public static void insert(Connection conn, String tableName, String idColumnName public static String buildMultiRowInsert(String tableName, String idColumnName, String seqName, Collection colNames, List> values) { if ((idColumnName == null) ^ (seqName == null)) throw new RuntimeException("idColumnName and seqName should be either both null or both nonnull"); - + if (values.isEmpty()) return null; // nothing to do - + List keys = new ArrayList<>(colNames); StringBuilder query = new StringBuilder("INSERT INTO " + tableName + " ("); boolean needComma = false; @@ -407,13 +426,13 @@ public static String buildMultiRowInsert(String tableName, String idColumnName, query.append(key); needComma = true; } - + if (idColumnName != null) { if (!keys.isEmpty()) query.append(","); query.append(idColumnName); } - + query.append(") VALUES"); boolean firstRow = true; for(List coords:values) { @@ -424,10 +443,10 @@ public static String buildMultiRowInsert(String tableName, String idColumnName, firstRow = false; } query.append(";"); - + return query.toString(); } - + /** * builds a line of type (colValue, colValue, colValue) * @param coords @@ -445,7 +464,7 @@ public static String buildCoordsLine(List coords, String idColumnName, S query.append(stringifyObject(value)); needComma = true; } - + if (idColumnName != null) { if (!coords.isEmpty()) query.append(","); @@ -454,16 +473,16 @@ public static String buildCoordsLine(List coords, String idColumnName, S query.append(")"); return query.toString(); } - - private static ThreadLocal dbDateExportFormat = new ThreadLocal<>(); + + private static ThreadLocal dbDateExportFormat = new ThreadLocal<>(); //private static SimpleDateFormat dbDateExportFormat = new SimpleDateFormat("yyyy-MM-dd"); - + private static String stringifyDate(Date obj) { - if (dbDateExportFormat.get() == null) + if (dbDateExportFormat.get() == null) dbDateExportFormat.set(new SimpleDateFormat("yyyy-MM-dd")); return "'" + dbDateExportFormat.get().format(obj) + "'"; } - + /** * returns a ready-to-be-included-into-SQL-query representation of a var * @param obj @@ -479,10 +498,10 @@ else if (obj instanceof String) // if (obj.toString().indexOf('\'') < 0) // return String.format("'%s'", obj.toString()); return String.format("'%s'", sqlEscapeStr(obj.toString())); - + //$t$blablabla$t$ - dollar-quoting //return "'" + obj.toString() + "'"; - + /*String dollarQuote = "$dAaD41$"; return dollarQuote + obj.toString() + dollarQuote;*/ } @@ -496,7 +515,7 @@ else if (obj instanceof Date) { return "'" + obj.toString() + "'"; } } - + public static String sqlEscapeStr(String input) { StringBuilder res = new StringBuilder(); for (char ch:input.toCharArray()) { @@ -509,13 +528,13 @@ else if (ch != '\'') } return res.toString(); } - + /** * flush schema changes so that they can used for introspection via {@link #getTableColumnsWithTypes(String, boolean)} and the likes * @param conn */ public static void flush(Connection conn){ - try { + try { if (!conn.getAutoCommit()) conn.commit(); } @@ -523,7 +542,7 @@ public static void flush(Connection conn){ throw new RuntimeException(e); } } - + /** * rethrows any exception as a RunTimeException - good for lambdas * @param rs @@ -541,7 +560,7 @@ public static Long getLong(ResultSet rs, String columnName) { throw AlgoUtils.translateException(e); } } - + /** * this is written lambda-free so as to maximize performance * @param conn @@ -563,7 +582,7 @@ public static Map collectKeyValue(Connection conn, String query) { } return map; } - + /** * @param conn * @param query @@ -581,7 +600,7 @@ public static Map collectKeyLongValue(Connection conn, String query) } catch (SQLException e) { throw AlgoUtils.translateException(e); } - + return map; } } diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 8b81fdaf9d1..49cf2fe68df 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1059,8 +1059,8 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess String deleteActivityGPISurveyReponse = "DELETE FROM amp_gpi_survey_response WHERE amp_gpisurvey_id in ( SELECT amp_gpisurvey_id FROM amp_gpi_survey WHERE amp_activity_id = " + ampAct.getAmpActivityId() + " ) " ; SQLUtils.executeQuery(con, deleteActivityGPISurveyReponse ); - String deleteActivityGPISurvey = "DELETE FROM amp_gpi_survey WHERE amp_activity_id = " + ampAct.getAmpActivityId(); - SQLUtils.executeQuery(con, deleteActivityGPISurvey ); + String deleteActivityGPISurvey = "DELETE FROM amp_gpi_survey WHERE amp_activity_id = ?"; + SQLUtils.executePreparedQuery(con, deleteActivityGPISurvey,ampAct.getAmpActivityId() ); // delete all previous comments String deleteActivityComments = "DELETE FROM amp_comments WHERE amp_activity_id = " + ampAct.getAmpActivityId(); From 33bcd7362002752eeb28d177bd2b05e492de7d25 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 24 Apr 2024 23:34:06 +0300 Subject: [PATCH 58/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 49cf2fe68df..8fcc60b27c0 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1654,12 +1654,13 @@ private static void deleteActivity(Session session, AmpActivityVersion ampAct) } public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ + ActivityUtil.deleteActivityIndicators(DbUtil.getActivityMEIndValue(ampAct.getAmpActivityId()), ampAct, session); + ActivityUtil.deleteActivityContent(ampAct,session); // session.flush(); - Long ampActId = ampAct.getAmpActivityId(); +// Long ampActId = ; //This is not deleting AmpMEIndicators, just indicators, ME is deprecated. - ActivityUtil.deleteActivityIndicators(DbUtil.getActivityMEIndValue(ampActId), ampAct, session); } public static void deleteAllActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ From 90d9abe4fb81ffe8e3dc3fa74f74e42442a377e0 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 00:40:45 +0300 Subject: [PATCH 59/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../module/aim/util/ActivityUtil.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 8fcc60b27c0..89efd0e9f58 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1052,8 +1052,12 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess String deleteActivitySurveyResponse = "DELETE FROM amp_ahsurvey_response WHERE amp_ahsurvey_id in ( SELECT amp_ahsurvey_id FROM amp_ahsurvey WHERE amp_activity_id = " + ampAct.getAmpActivityId() + " ) "; SQLUtils.executeQuery(con, deleteActivitySurveyResponse ); - String deleteActivitySurvey = "DELETE FROM amp_ahsurvey WHERE amp_activity_id = " + ampAct.getAmpActivityId(); - SQLUtils.executeQuery(con, deleteActivitySurvey ); +// String deleteActivitySurvey = "DELETE FROM amp_ahsurvey WHERE amp_activity_id = " + ampAct.getAmpActivityId(); + String deleteActivitySurvey = "DELETE FROM amp_ahsurvey WHERE amp_activity_id = ?"; + SQLUtils.executePreparedQuery(con, deleteActivitySurvey,ampAct.getAmpActivityId() ); + + +// SQLUtils.executeQuery(con, deleteActivitySurvey ); // delete surveys String deleteActivityGPISurveyReponse = "DELETE FROM amp_gpi_survey_response WHERE amp_gpisurvey_id in ( SELECT amp_gpisurvey_id FROM amp_gpi_survey WHERE amp_activity_id = " + ampAct.getAmpActivityId() + " ) " ; @@ -1063,12 +1067,16 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess SQLUtils.executePreparedQuery(con, deleteActivityGPISurvey,ampAct.getAmpActivityId() ); // delete all previous comments - String deleteActivityComments = "DELETE FROM amp_comments WHERE amp_activity_id = " + ampAct.getAmpActivityId(); - SQLUtils.executeQuery(con, deleteActivityComments ); +// String deleteActivityComments = "DELETE FROM amp_comments WHERE amp_activity_id = " + ampAct.getAmpActivityId(); +// SQLUtils.executeQuery(con, deleteActivityComments ); + String deleteActivityComments = "DELETE FROM amp_comments WHERE amp_activity_id = ?"; + SQLUtils.executePreparedQuery(con, deleteActivityComments,ampAct.getAmpActivityId() ); //Delete the connection with Team. - String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = " + ampAct.getAmpActivityId(); - SQLUtils.executeQuery(con, deleteActivityTeam ); +// String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = " + ampAct.getAmpActivityId(); + String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = ?"; + + SQLUtils.executePreparedQuery(con, deleteActivityTeam,ampAct.getAmpActivityId() ); } public static void removeMergeSources(Long ampActivityId,Session session){ From 9ade9c56d408ddea0767efcdaccf94b135f3b6f9 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 00:51:23 +0300 Subject: [PATCH 60/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 89efd0e9f58..e620b55eba3 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1170,7 +1170,7 @@ public static ValidationStatus getValidationStatus(AmpActivityVersion activity, boolean hasTeamLeadOrValidator = false; if (currentTeam != null) { List valids = TeamMemberUtil.getTeamHeadAndApprovers(currentTeam.getAmpTeamId()); - if (valids != null && valids.size() > 0) { + if (valids != null && !valids.isEmpty()) { hasTeamLeadOrValidator = true; } } @@ -1662,9 +1662,10 @@ private static void deleteActivity(Session session, AmpActivityVersion ampAct) } public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ + ActivityUtil.deleteActivityContent(ampAct,session); + ActivityUtil.deleteActivityIndicators(DbUtil.getActivityMEIndValue(ampAct.getAmpActivityId()), ampAct, session); - ActivityUtil.deleteActivityContent(ampAct,session); // session.flush(); // Long ampActId = ; From b0b16c165e22da20efea05548cc76e1ee618f869 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 00:54:00 +0300 Subject: [PATCH 61/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java | 1 + 1 file changed, 1 insertion(+) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index e620b55eba3..95d75b29ca9 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1156,6 +1156,7 @@ public static void deleteActivityIndicators(Collection activityInd, AmpActivityV IndicatorActivity indConn = IndicatorUtil.findActivityIndicatorConnection(activity, ind); IndicatorUtil.removeConnection(indConn); } + session.flush(); } } From 3eb3c016bb62a71df37ff5cba544e1c93b9aba02 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 01:08:17 +0300 Subject: [PATCH 62/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java | 4 ++-- .../org/digijava/module/aim/util/ActivityUtil.java | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java b/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java index 676480034d1..7c759b20e88 100644 --- a/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java +++ b/amp/src/main/java/org/dgfoundation/amp/ar/viewfetcher/SQLUtils.java @@ -125,14 +125,14 @@ public static void executeQuery(Connection conn, String query) } } - public static void executePreparedQuery(Connection conn, String query, Long actId) + public static void executePreparedQuery(Connection conn, String query, Long actId, String table) { try { PreparedStatement statement = conn.prepareStatement(query); statement.setLong(1, actId); int deleted= statement.executeUpdate(); - logger.info("Deleted records :"+deleted); + logger.info("Deleted records :"+deleted + " from "+ table); statement.close(); } catch(SQLException e) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 95d75b29ca9..c3fb4a5d4c9 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1054,7 +1054,7 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess // String deleteActivitySurvey = "DELETE FROM amp_ahsurvey WHERE amp_activity_id = " + ampAct.getAmpActivityId(); String deleteActivitySurvey = "DELETE FROM amp_ahsurvey WHERE amp_activity_id = ?"; - SQLUtils.executePreparedQuery(con, deleteActivitySurvey,ampAct.getAmpActivityId() ); + SQLUtils.executePreparedQuery(con, deleteActivitySurvey,ampAct.getAmpActivityId() ,"amp_ahsurvey"); // SQLUtils.executeQuery(con, deleteActivitySurvey ); @@ -1064,19 +1064,19 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess SQLUtils.executeQuery(con, deleteActivityGPISurveyReponse ); String deleteActivityGPISurvey = "DELETE FROM amp_gpi_survey WHERE amp_activity_id = ?"; - SQLUtils.executePreparedQuery(con, deleteActivityGPISurvey,ampAct.getAmpActivityId() ); + SQLUtils.executePreparedQuery(con, deleteActivityGPISurvey,ampAct.getAmpActivityId() ,"amp_gpi_survey"); // delete all previous comments // String deleteActivityComments = "DELETE FROM amp_comments WHERE amp_activity_id = " + ampAct.getAmpActivityId(); // SQLUtils.executeQuery(con, deleteActivityComments ); String deleteActivityComments = "DELETE FROM amp_comments WHERE amp_activity_id = ?"; - SQLUtils.executePreparedQuery(con, deleteActivityComments,ampAct.getAmpActivityId() ); + SQLUtils.executePreparedQuery(con, deleteActivityComments,ampAct.getAmpActivityId() ,"amp_comments"); //Delete the connection with Team. // String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = " + ampAct.getAmpActivityId(); String deleteActivityTeam = "DELETE FROM amp_team_activities WHERE amp_activity_id = ?"; - SQLUtils.executePreparedQuery(con, deleteActivityTeam,ampAct.getAmpActivityId() ); + SQLUtils.executePreparedQuery(con, deleteActivityTeam,ampAct.getAmpActivityId(),"amp_team_activities" ); } public static void removeMergeSources(Long ampActivityId,Session session){ @@ -1663,9 +1663,9 @@ private static void deleteActivity(Session session, AmpActivityVersion ampAct) } public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ - ActivityUtil.deleteActivityContent(ampAct,session); ActivityUtil.deleteActivityIndicators(DbUtil.getActivityMEIndValue(ampAct.getAmpActivityId()), ampAct, session); + ActivityUtil.deleteActivityContent(ampAct,session); // session.flush(); From 5ce3b60bf1fd768e0f155dac3812096775ea59a7 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 01:08:59 +0300 Subject: [PATCH 63/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 539b0b11de4..e3648a1a867 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -226,7 +226,7 @@ - + From 8e877535e33e64ce5de93e6a7b5eca2eaa817287 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 01:19:48 +0300 Subject: [PATCH 64/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/util/ActivityUtil.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index c3fb4a5d4c9..fe588890ca4 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1640,7 +1640,7 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception for (AmpActivityVersion ampActivityVersion : activityversions) { deleteFullActivityContent(ampActivityVersion, session); session.flush(); - session.delete(ampActivityVersion); + deleteActivity(session,ampActivityVersion); // deleteActivity(session,ampActivityVersion); } } else { @@ -1648,6 +1648,8 @@ public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception deleteFullActivityContent(ampAct, session); session.flush(); session.delete(ampAct); + deleteActivity(session,ampAct); + // deleteActivity(session,ampAct); } session.delete(ampActivityGroup); @@ -1658,8 +1660,10 @@ private static void deleteActivity(Session session, AmpActivityVersion ampAct) logger.info("Deleting Real ... Activity # " + ampAct.getAmpActivityId()); Connection con = ((SessionImplementor)session).connection(); // delete surveys - String deleteActivitySurveyResponse = "DELETE FROM amp_activity_version WHERE amp_activity_id = " + ampAct.getAmpActivityId(); - SQLUtils.executeQuery(con, deleteActivitySurveyResponse ); +// String deleteActivityGPISurvey = "DELETE FROM amp_gpi_survey WHERE amp_activity_id = ?"; +// SQLUtils.executePreparedQuery(con, deleteActivityGPISurvey,ampAct.getAmpActivityId() ); + String deletActivity = "DELETE FROM amp_activity_version WHERE amp_activity_id = ?"; + SQLUtils.executePreparedQuery(con, deletActivity,ampAct.getAmpActivityId(),"amp_activity_version" ); } public static void deleteFullActivityContent(AmpActivityVersion ampAct, Session session) throws Exception{ From 0dfd96a1921a1301f9ea373d116f6e1ff6112ab3 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 06:10:33 +0300 Subject: [PATCH 65/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index e3648a1a867..402f0d697c4 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -178,7 +178,7 @@ - + From 323f7b2af7f53b2c5e5f7786e96ac830e8369954 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 06:26:12 +0300 Subject: [PATCH 66/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../main/java/org/digijava/module/aim/util/ActivityUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index fe588890ca4..7adba0ac594 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1056,6 +1056,9 @@ public static void deleteActivityContent(AmpActivityVersion ampAct, Session sess String deleteActivitySurvey = "DELETE FROM amp_ahsurvey WHERE amp_activity_id = ?"; SQLUtils.executePreparedQuery(con, deleteActivitySurvey,ampAct.getAmpActivityId() ,"amp_ahsurvey"); + String deleteFunding = "DELETE FROM amp_funding WHERE amp_activity_id = ?"; + SQLUtils.executePreparedQuery(con, deleteFunding,ampAct.getAmpActivityId() ,"amp_funding"); + // SQLUtils.executeQuery(con, deleteActivitySurvey ); From bafb4693df5fba62144b2624a5c6bf09d36df445 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 06:35:24 +0300 Subject: [PATCH 67/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../aim/dbentity/AmpActivityVersion.hbm.xml | 2 +- .../module/aim/dbentity/AmpFunding.hbm.xml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml index 402f0d697c4..37b9fd68c69 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpActivityVersion.hbm.xml @@ -178,7 +178,7 @@ - + diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml index e8958086bfc..1a90f59e87c 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml @@ -42,10 +42,10 @@ - + - + @@ -59,20 +59,20 @@ - + + class="org.digijava.module.aim.dbentity.AmpRole" cascade="none" /> - + - + - + - + From 14452aaabd27385645a36ac21311c109854f2818 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 06:44:55 +0300 Subject: [PATCH 68/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpFunding.hbm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml index 1a90f59e87c..2f79f511b8e 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml @@ -65,9 +65,9 @@ - + - + From 17dc7d57e8d66d88bf707d825cbb838b37f6c27f Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 13:00:53 +0300 Subject: [PATCH 69/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../digijava/module/aim/dbentity/AmpFunding.hbm.xml | 2 +- .../module/aim/dbentity/AmpFundingDetail.hbm.xml | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml index 2f79f511b8e..5378402b124 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml @@ -67,7 +67,7 @@ - + diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml index 3e01cbda580..65e5efb40be 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml @@ -16,7 +16,7 @@ - + @@ -35,17 +35,17 @@ - + - + - + class="org.digijava.module.aim.dbentity.AmpRole" cascade="none" /> + From 0e228d66c74735f8b626acc4e3935d253c2f1659 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 13:22:53 +0300 Subject: [PATCH 70/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpFunding.hbm.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml index 5378402b124..7fba9050163 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml @@ -65,7 +65,7 @@ - + From f9db38ade650773f57c1e7490a0ff5203843cb30 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 13:30:38 +0300 Subject: [PATCH 71/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/dbentity/AmpFunding.hbm.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml index 7fba9050163..f0d95e6928e 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml @@ -65,8 +65,8 @@ - - + + From e99d50b56f5ef3fe0c40fbafdd38dfcad503c3d2 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 13:57:38 +0300 Subject: [PATCH 72/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/module/aim/util/ActivityUtil.java | 14 ++++++++------ .../module/aim/dbentity/AmpFunding.hbm.xml | 2 +- .../module/aim/dbentity/AmpFundingDetail.hbm.xml | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index 7adba0ac594..fdba22f6706 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -486,7 +486,7 @@ public static List getActivitiesByAmpIds(List ampIds } public static AmpActivityVersion loadAmpActivity(Long id){ - return (AmpActivityVersion) PersistenceManager.getSession().load(AmpActivityVersion.class, id); + return PersistenceManager.getSession().load(AmpActivityVersion.class, id); } public static List getAmpActivitySectors(Long actId) { @@ -1636,16 +1636,18 @@ public static ArrayList getAllActivitiesAdmin(String searchTerm } public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception { + logger.info("Activity id: "); Session session = PersistenceManager.getSession(); AmpActivityGroup ampActivityGroup = getActivityGroups(session, ampActId); Set activityversions = ampActivityGroup.getActivities(); if (activityversions != null && !activityversions.isEmpty()) { - for (AmpActivityVersion ampActivityVersion : activityversions) { - deleteFullActivityContent(ampActivityVersion, session); - session.flush(); - deleteActivity(session,ampActivityVersion); + session.delete(ampActivityGroup); +// for (AmpActivityVersion ampActivityVersion : activityversions) { +// deleteFullActivityContent(ampActivityVersion, session); +// session.flush(); // deleteActivity(session,ampActivityVersion); - } +//// deleteActivity(session,ampActivityVersion); +// } } else { AmpActivityVersion ampAct = session.load(AmpActivityVersion.class, ampActId); deleteFullActivityContent(ampAct, session); diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml index f0d95e6928e..665346380a3 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFunding.hbm.xml @@ -66,7 +66,7 @@ - + diff --git a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml index 65e5efb40be..7bce13f9e35 100644 --- a/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml +++ b/amp/src/main/resources/org/digijava/module/aim/dbentity/AmpFundingDetail.hbm.xml @@ -35,7 +35,7 @@ - + From 4fa69685ffcaad5eebe2964ebcc99e6e55f2d308 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 14:07:18 +0300 Subject: [PATCH 73/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java | 1 - 1 file changed, 1 deletion(-) diff --git a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java index fdba22f6706..3d953ac7d57 100644 --- a/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java +++ b/amp/src/main/java/org/digijava/module/aim/util/ActivityUtil.java @@ -1636,7 +1636,6 @@ public static ArrayList getAllActivitiesAdmin(String searchTerm } public static void deleteAmpActivityWithVersions(Long ampActId) throws Exception { - logger.info("Activity id: "); Session session = PersistenceManager.getSession(); AmpActivityGroup ampActivityGroup = getActivityGroups(session, ampActId); Set activityversions = ampActivityGroup.getActivities(); From 9c9e027b9819ac986db4cf211feef46ebeae52a1 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 14:16:02 +0300 Subject: [PATCH 74/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../webapp/WEB-INF/jackrabbit/repository.xml | 2 +- amp/src/main/webapp/WEB-INF/repository.xml | 95 ------------------- 2 files changed, 1 insertion(+), 96 deletions(-) delete mode 100644 amp/src/main/webapp/WEB-INF/repository.xml diff --git a/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml b/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml index 09ec7b9b093..73ef53cde94 100644 --- a/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml +++ b/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml @@ -92,4 +92,4 @@ - + diff --git a/amp/src/main/webapp/WEB-INF/repository.xml b/amp/src/main/webapp/WEB-INF/repository.xml deleted file mode 100644 index 09ec7b9b093..00000000000 --- a/amp/src/main/webapp/WEB-INF/repository.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - From 534f4958070d9e033e0bee354ddd9713a3c5d2ba Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 14:37:24 +0300 Subject: [PATCH 75/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/digijava/kernel/content/ContentRepositoryManager.java | 4 ++-- amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java index b34a926aa09..a12c702c119 100644 --- a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java +++ b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java @@ -100,7 +100,7 @@ public static Session getReadSession(HttpServletRequest request) { try { readSession = getOrCloseIfNotLive(readSession); if (readSession == null) { - readSession = getRepositoryInstance().login(); + readSession = getRepositoryInstance().login(new SimpleCredentials("admin", "admin".toCharArray())); } } catch (RepositoryException e) { throw new RuntimeException(e.getMessage(), e); @@ -154,7 +154,7 @@ private static SimpleCredentials getCredentials(HttpServletRequest request) { userName = teamMember.getEmail(); } - SimpleCredentials creden = new SimpleCredentials(userName, userName.toCharArray()); + SimpleCredentials creden = new SimpleCredentials("admin", "admin".toCharArray()); return creden; } diff --git a/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml b/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml index 73ef53cde94..c588b03c928 100644 --- a/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml +++ b/amp/src/main/webapp/WEB-INF/jackrabbit/repository.xml @@ -16,7 +16,7 @@ - + From bc2b46e9c756f2cd22a0aea15eae3d7189f7448f Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 15:11:09 +0300 Subject: [PATCH 76/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../org/dgfoundation/amp/ar/CellColumn.java | 98 ++++++++++--------- .../java/org/digijava/kernel/util/DgUtil.java | 35 +++---- 2 files changed, 69 insertions(+), 64 deletions(-) diff --git a/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java b/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java index 23434ef2e43..bc6140e1692 100644 --- a/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java +++ b/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java @@ -2,7 +2,7 @@ * CellColumn.java * (c) 2005 Development Gateway Foundation * @author Mihai Postelnicu - mpostelnicu@dgfoundation.org - * + * */ package org.dgfoundation.amp.ar; @@ -19,7 +19,7 @@ import java.util.Map.Entry; /** - * + * * @author Mihai Postelnicu - mpostelnicu@dgfoundation.org * @since Jun 19, 2006 a column that holds cells */ @@ -29,7 +29,8 @@ public class CellColumn extends Column { * view used for having extracted the column. Might be null! */ protected String extractorView; - + + /** * Returns the number of items in the column as the visible rows (they are already unique) so this means * the number activities that have data for this column @@ -41,7 +42,7 @@ public int getVisibleRows() { /** * Iterator for the internal list of items - * + * * @return the Iterator */ public Iterator iterator() { @@ -57,6 +58,9 @@ public CellColumn(ColumnWorker worker) { public CellColumn(String name) { super(name); } + public String getClassName() { + return this.getClass().getName(); + } public CellColumn(String name, int initialCapacity) { super(name, initialCapacity); @@ -83,23 +87,23 @@ private static void copyColumnData(CellColumn dest, Column source) dest.contentCategory = source.getContentCategory(); dest.dimensionClass = source.getDimensionClass(); dest.relatedContentPersisterClass = source.getRelatedContentPersisterClass(); - + if (source instanceof CellColumn) dest.setExtractorView(((CellColumn) source).getExtractorView()); - + dest.worker=source.getWorker(); - + dest.setDescription(source.getDescription()); dest.setExpression(source.getExpression()); dest.setTotalExpression(source.getTotalExpression()); } - - + + public Cell getByOwner(Long ownerId) { List cells = itemsMap.get(ownerId); if (cells == null || cells.isEmpty()) return null; - + return cells.get(0); // return the first one since the caller doesn't care } @@ -107,24 +111,24 @@ public Set getAllOwnerIds() { return this.itemsMap.keySet(); } - + static long calls = 0; static long iterations = 0; - + public Cell getByOwnerAndValue(Long ownerId, Object value) { calls ++; - + List list = itemsMap.get(ownerId); if (list == null) return null; - + for(Cell element:list) { iterations ++; if (value.equals(element.getValue())) return element; } - + // Iterator i = items.iterator(); // while (i.hasNext()) { // iterations ++; @@ -157,22 +161,22 @@ public final void addCellRaw(Cell c) itemsMap.get(c.getOwnerId()).add(c); items.add((K) c); } - + /* * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#filterCopy(org.dgfoundation.amp.ar.cell.Cell) */ @Override public Column filterCopy(final Cell metaCell, final Set ids) { - + CellFilterCriteria filter = new CellFilterCriteria(){ public Cell filter(Cell source){ return source.filter(metaCell, ids); - }}; + }}; return filterCopy(filter); } - + public Column filterCopy(CellFilterCriteria crit) { CellColumn dest = (CellColumn) this.newInstance(); @@ -186,7 +190,7 @@ public Column filterCopy(CellFilterCriteria crit) /* * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#process() */ @Override @@ -202,7 +206,7 @@ public Column postProcess() { if (!(objelement instanceof Column)) { Cell element = (Cell) objelement; - + // if we don't have items in the cell list, just add the // cell /*if (lc.size() == 0) @@ -229,10 +233,10 @@ public Column postProcess() { lc = new ListCell(); lc.addCell(element); }*/ - + if (element.toString().equals("Expenditure Class Unallocated") && this.getName().equals("Expenditure Class")) continue; // this is so hacky I have no words. Luckily we're dumping LegacyReports really soon (c) - + ListCell listCell = ownerToCells.get(element.getOwnerId()); if ( listCell == null ) { listCell = new ListCell(); @@ -275,7 +279,7 @@ public int getWidth() { /* * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#getSubColumn(int) */ @Override @@ -285,19 +289,19 @@ public List getSubColumns(int depth) { ret.add(this); return ret; } - + @Override public void setPositionInHeadingLayout(int totalRowSpan, int startingDepth, int startingColumn) { this.positionInHeading = new ReportHeadingLayoutCell(this, startingDepth, totalRowSpan, totalRowSpan, startingColumn, this.getWidth(), this.getName()); } - + @Override protected int getRowSpanInHeading_internal() { return 1; } - + @Override public int calculateTotalRowSpan() { @@ -314,7 +318,7 @@ public int calculateTotalRowSpan() /* * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#getOwnerIds() */ @Override @@ -332,7 +336,7 @@ public List getTrailCells() { /* * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#newInstance() */ @Override @@ -342,17 +346,17 @@ public Column newInstance() { /* * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#getColumnDepth() */ @Override public int getColumnDepth() { if (this.getName() != null && !this.getName().equals("")){ - return 1; + return 1; }else{ return 0; } - + } /** @@ -364,7 +368,7 @@ public void replaceCell(K oldCell, K newCell) { int idx = items.indexOf(oldCell); items.remove(idx); items.add(idx, newCell); - + int idx2 = itemsMap.get(oldCell.getOwnerId()).indexOf(oldCell); itemsMap.get(oldCell.getOwnerId()).remove(idx2); itemsMap.get(oldCell.getOwnerId()).add(newCell); @@ -374,7 +378,7 @@ public void replaceCell(K oldCell, K newCell) { /*; * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#cellCount() */ @Override @@ -384,7 +388,7 @@ public int getCellCount() { /* * (non-Javadoc) - * + * * @see org.dgfoundation.amp.ar.Column#getVisibleCellCount() */ @Override @@ -412,7 +416,7 @@ public boolean hasTrailCells() // public void setItemsMap(HashMap itemsMap) { // this.itemsMap = itemsMap; // } - + @Override public boolean removeEmptyChildren(boolean checkFunding) { if ( this.getOwnerIds().size() > 0 ) { @@ -421,7 +425,7 @@ public boolean removeEmptyChildren(boolean checkFunding) { else return true; } - + @Override public Column hasSorterColumn(String namePath) { if ( namePath == null ) { @@ -434,7 +438,7 @@ public Column hasSorterColumn(String namePath) { else return null; } - + @Override public void filterByIds(Set idsToRetain) { @@ -446,7 +450,7 @@ public void filterByIds(Set idsToRetain) cells.remove(); } } - + @Override public List getAllCells(List src, boolean freeze) { @@ -458,14 +462,14 @@ public List getAllCells(List src, boolean freeze) } return src; } - + @Override public void deleteByOwnerId(Set ownerId) { // pay attention when merging with AMP2.4, as the way cells are kept there has been slightly changed for(Long id:ownerId) itemsMap.remove(id); - + Iterator iter = (Iterator) items.iterator(); while (iter.hasNext()) { @@ -474,12 +478,12 @@ public void deleteByOwnerId(Set ownerId) iter.remove(); } } - + public void setExtractorView(String ev) { this.extractorView = ev; } - + /** * the view used for having extracted this column * @return @@ -488,7 +492,7 @@ public String getExtractorView() { return this.extractorView; } - + @Override public GroupColumn verticalSplitByCateg(String category, Set ids, boolean generateTotalCols, AmpReports reportMetadata) { @@ -497,13 +501,13 @@ public GroupColumn verticalSplitByCateg(String category, Set ids, boolean genera return null; // only REAL DISBURSEMENTS columns can be split by real disbursements return GroupColumn.verticalSplitByCateg_internal((CellColumn)this, category, ids, generateTotalCols, reportMetadata); } - + @Override public boolean isSortableBy() { return true; } - + public List getCells(){ return (List) items; } diff --git a/amp/src/main/java/org/digijava/kernel/util/DgUtil.java b/amp/src/main/java/org/digijava/kernel/util/DgUtil.java index 573934171d7..4ef43892ca2 100644 --- a/amp/src/main/java/org/digijava/kernel/util/DgUtil.java +++ b/amp/src/main/java/org/digijava/kernel/util/DgUtil.java @@ -72,7 +72,7 @@ import static net.bull.javamelody.internal.common.Parameters.getServletContext; public class DgUtil { - + private static Logger logger = I18NHelper.getKernelLogger(DgUtil.class); private static final int FASTSPLIT_MAXSIZE = 2048; @@ -205,7 +205,7 @@ public static void saveWorkspaceLanguagePreferences(HttpServletRequest request, } session.saveOrUpdate(ampAppSettings); } - + /** * * @param language @@ -222,7 +222,7 @@ public static void switchLanguage(Locale language, } Site currentSite = RequestUtils.getSite(request); - if (currentSite != null) { + if (currentSite != null) { if (getSupportedLanguage(language.getCode(), currentSite, isLocalTranslatorForSite(request)) == null) { // Language is not supported @@ -231,7 +231,7 @@ public static void switchLanguage(Locale language, DgUtil.setUserLanguage(request, response); return; } - + saveUserLanguagePreferences(request, language); saveWorkspaceLanguagePreferences(request, language); request.setAttribute(Constants.NAVIGATION_LANGUAGE, language); @@ -239,14 +239,14 @@ public static void switchLanguage(Locale language, setLanguageCookie(language, request, response); } } - + public static void setSessionLanguage(HttpServletRequest request, HttpServletResponse response, Locale language) { request.setAttribute(Constants.NAVIGATION_LANGUAGE, language); if (request.getSession() != null) request.getSession().setAttribute(Constants.NAVIGATION_LANGUAGE, language); setLanguageCookie(language, request, response); } - + private static void setLanguageCookie(Locale language, HttpServletRequest request, HttpServletResponse response) { SiteDomain currDomain = RequestUtils.getSiteDomain(request); Cookie cookie = new Cookie("digi_language", language.getCode()); @@ -341,19 +341,19 @@ private static Locale getLanguageFromRequest(HttpServletRequest request) { } } - + if(request.getParameter("language")!=null){ language = getSupportedLanguage(request.getParameter("language"), currentSite, isLocalTranslatorForSite(request)); } - + if (language != null) { logger.debug("Language, determined from request parameter: " + language.getCode()); return language; } - + // Determine language using cookies Cookie[] cookies = request.getCookies(); if (cookies != null) { @@ -374,7 +374,7 @@ private static Locale getLanguageFromRequest(HttpServletRequest request) { language.getCode()); return language; } - + //using session attribute if (request.getSession() != null){ language = (Locale)request.getSession().getAttribute(Constants.NAVIGATION_LANGUAGE); @@ -384,7 +384,7 @@ private static Locale getLanguageFromRequest(HttpServletRequest request) { return language; } } - + // Determine list of accepted languages from request // request.getLocales() contains at least one value: if @@ -723,7 +723,7 @@ public static void setUserLanguage(HttpServletRequest request, HttpServletRespon Locale language = DgUtil.getLanguageFromRequest(request); logger.debug("Navigation language, determined from request is: " + language == null ? null : language.getCode()); - + setSessionLanguage(request, response, language); User user = RequestUtils.getUser(request); @@ -1750,6 +1750,7 @@ public static String removeJSessionId(String calcUrl) { * @return String */ public static String htmlize(String src) { +// String.class.getName() String retVal = src. replaceAll("<", "<"). replaceAll(">", ">"). @@ -1789,7 +1790,7 @@ public static String dehtmlize(String src, boolean newLines) { } return retVal; } - + /** * precompile these patterns (a slow process) for some speedup and for copy-paste avoidance */ @@ -1802,8 +1803,8 @@ public static String dehtmlize(String src, boolean newLines) { Pattern.compile("StartFragment:[0-9]+"), // no DOTALL needed Pattern.compile("EndFragment:[0-9]+") // no DOTALL needed }; - - + + private static Set trimmableChars = new HashSet() {{add(' '); add('\n'); add('\t');}}; /** @@ -1831,7 +1832,7 @@ public static String trimChars(String src) return ""; return src.substring(begPos, endPos + 1); } - + /** * cleans a text copy-pasted from Word from all of its tags and returns the plain text * also does sanity cleanups, like replacing tabs with spaces and multiple spaces with a single one @@ -1873,4 +1874,4 @@ public static String getWebInfPathWithContext(String path){ } -} \ No newline at end of file +} From 212e4c14d594d55bca18a6d0266ebb797144e40e Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 15:26:06 +0300 Subject: [PATCH 77/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java | 6 +----- .../webapp/WEB-INF/jsp/aim/view/ar/foldable/TextCell.jsp | 8 ++++---- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java b/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java index bc6140e1692..bfe70eafdc9 100644 --- a/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java +++ b/amp/src/main/java/org/dgfoundation/amp/ar/CellColumn.java @@ -30,7 +30,6 @@ public class CellColumn extends Column { */ protected String extractorView; - /** * Returns the number of items in the column as the visible rows (they are already unique) so this means * the number activities that have data for this column @@ -58,13 +57,10 @@ public CellColumn(ColumnWorker worker) { public CellColumn(String name) { super(name); } - public String getClassName() { - return this.getClass().getName(); - } public CellColumn(String name, int initialCapacity) { super(name, initialCapacity); - itemsMap = new HashMap>(initialCapacity); + itemsMap = new HashMap<>(initialCapacity); } public CellColumn(Column source) { diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/ar/foldable/TextCell.jsp b/amp/src/main/webapp/WEB-INF/jsp/aim/view/ar/foldable/TextCell.jsp index 77fa1061abc..d10262a2b89 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/ar/foldable/TextCell.jsp +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/ar/foldable/TextCell.jsp @@ -19,14 +19,14 @@   - +<%----%> - "; YAHOO.util.Connect.asyncRequest("GET", url, queryCbObj); diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/prefilters.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/prefilters.js index 6d6870fa145..dd65572c299 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/prefilters.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/prefilters.js @@ -334,7 +334,7 @@ SaveFilters.prototype.saveFilters = function (e, obj) { //document.body.appendChild(element); } this.panel.setBody("
" + obj.filterObj.savingDataMessage + - "...
"); + "...
"); return false; }; diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js index af721598c5f..2f076c6ff2b 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js @@ -340,7 +340,7 @@ SaveReportEngine.prototype.saveAndOrOpenReport = function (openReport) { this.titlePanel.hide(); this.divEl.style.visibility = ""; this.divEl.innerHTML = this.savingMessage + - "... "; + "... "; var reportTitles = getReportTitles(); var sendData = true; diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js index 0aca46dcdf3..e0ca4859cc5 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js @@ -158,7 +158,7 @@ SaveReportEngine.prototype.saveReport = function () { this.panel.setFooter( SaveReportEngine.savingMessage + "...
Error: please enter a value in at least one language " ); } else { - this.panel.setFooter( SaveReportEngine.savingMessage + "...
" ); + this.panel.setFooter( SaveReportEngine.savingMessage + "...
" ); var postString = "dynamicSaveReport=true" + reportTitles + "&reportTitle=dummy" + diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-common.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-common.js index b1b667d8d1c..c94f9dd9251 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-common.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-common.js @@ -129,8 +129,8 @@ DHTMLSuite.config.prototype = { // this.imagePath = '../images_dhtmlsuite/'; // Path to images // this.cssPath = '../css_dhtmlsuite/'; // Path to images - this.imagePath = '/jsp/aim/view/images/images_dhtmlsuite/'; // Path to images - this.cssPath = '/jsp/aim/view/css/css_dhtmlsuite/'; // Path to images + this.imagePath = '/static/aim/view/images/images_dhtmlsuite/'; // Path to images + this.cssPath = '/static/aim/view/css/css_dhtmlsuite/'; // Path to images this.defaultCssPath = this.cssPath; this.defaultImagePath = this.imagePath; diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js index b77abd03eb8..340da44c9dc 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js @@ -47,7 +47,7 @@ DHTMLSuite.infoPanel = function() this.cookieNames = new Array(); this.currentlyExpandedPane = false; // this.layoutCSS = 'info-pane.css'; // Default css file for this widget. - this.layoutCSS = '/jsp/aim/view/css/css_dhtmlsuite/info-pane.css'; // Default css file for this widget. + this.layoutCSS = '/static/aim/view/css/css_dhtmlsuite/info-pane.css'; // Default css file for this widget. this.arrayOfPanes = new Array(); this.paneHeights = new Array(); try{ diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/tabManager/tabManager.jsp b/amp/src/main/webapp/WEB-INF/jsp/aim/view/tabManager/tabManager.jsp index 2e47e1b240a..a77e0a20c25 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/tabManager/tabManager.jsp +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/tabManager/tabManager.jsp @@ -55,7 +55,7 @@ this.hideButton(); this.disableButton(); this.setFooter(""); - this.setBody( "${pleaseWaitMsg}... " ); + this.setBody( "${pleaseWaitMsg}... " ); this.panel.show(); new GetDataManager().getData(); @@ -184,7 +184,7 @@ } SaveDataManager.prototype.saveData = function () { tabManager.disableButton(); - tabManager.setFooter( "${pleaseWaitMsg}... " ); + tabManager.setFooter( "${pleaseWaitMsg}... " ); var postString = this.createPostString(); YAHOOAmp.util.Connect.asyncRequest("POST", "/aim/tabManager.do", this, postString); diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/viewActivityDashboard.jsp b/amp/src/main/webapp/WEB-INF/jsp/aim/view/viewActivityDashboard.jsp index 57a1a214464..ff822221334 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/viewActivityDashboard.jsp +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/viewActivityDashboard.jsp @@ -124,7 +124,7 @@ function projectFiche(id) function showPanelLoading(msg){ var content = document.getElementById("myContentContent"); content.innerHTML = "
" + "Loading..." + - "
"; + "
"; showContent(); } diff --git a/amp/static/aim/view/scripts/reportWizard/prefilters.js b/amp/static/aim/view/scripts/reportWizard/prefilters.js index 6d6870fa145..dd65572c299 100644 --- a/amp/static/aim/view/scripts/reportWizard/prefilters.js +++ b/amp/static/aim/view/scripts/reportWizard/prefilters.js @@ -334,7 +334,7 @@ SaveFilters.prototype.saveFilters = function (e, obj) { //document.body.appendChild(element); } this.panel.setBody("
" + obj.filterObj.savingDataMessage + - "...
"); + "...
"); return false; }; diff --git a/amp/static/aim/view/scripts/reportWizard/saving.js b/amp/static/aim/view/scripts/reportWizard/saving.js index af721598c5f..2f076c6ff2b 100644 --- a/amp/static/aim/view/scripts/reportWizard/saving.js +++ b/amp/static/aim/view/scripts/reportWizard/saving.js @@ -340,7 +340,7 @@ SaveReportEngine.prototype.saveAndOrOpenReport = function (openReport) { this.titlePanel.hide(); this.divEl.style.visibility = ""; this.divEl.innerHTML = this.savingMessage + - "... "; + "... "; var reportTitles = getReportTitles(); var sendData = true; diff --git a/amp/static/aim/view/scripts/saveReports.js b/amp/static/aim/view/scripts/saveReports.js index 0aca46dcdf3..e0ca4859cc5 100644 --- a/amp/static/aim/view/scripts/saveReports.js +++ b/amp/static/aim/view/scripts/saveReports.js @@ -158,7 +158,7 @@ SaveReportEngine.prototype.saveReport = function () { this.panel.setFooter( SaveReportEngine.savingMessage + "...
Error: please enter a value in at least one language " ); } else { - this.panel.setFooter( SaveReportEngine.savingMessage + "...
" ); + this.panel.setFooter( SaveReportEngine.savingMessage + "...
" ); var postString = "dynamicSaveReport=true" + reportTitles + "&reportTitle=dummy" + diff --git a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-common.js b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-common.js index b1b667d8d1c..c94f9dd9251 100644 --- a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-common.js +++ b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-common.js @@ -129,8 +129,8 @@ DHTMLSuite.config.prototype = { // this.imagePath = '../images_dhtmlsuite/'; // Path to images // this.cssPath = '../css_dhtmlsuite/'; // Path to images - this.imagePath = '/jsp/aim/view/images/images_dhtmlsuite/'; // Path to images - this.cssPath = '/jsp/aim/view/css/css_dhtmlsuite/'; // Path to images + this.imagePath = '/static/aim/view/images/images_dhtmlsuite/'; // Path to images + this.cssPath = '/static/aim/view/css/css_dhtmlsuite/'; // Path to images this.defaultCssPath = this.cssPath; this.defaultImagePath = this.imagePath; diff --git a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js index 190577c860e..0c7bb35a714 100644 --- a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js +++ b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js @@ -33,7 +33,7 @@ Owner of DHTMLgoodies.com - var imageFolder = '/jsp/aim/view/images/images_dhtmlsuite/'; // Path to images + var imageFolder = '/static/aim/view/images/images_dhtmlsuite/'; // Path to images var folderImage = 'dhtmlgoodies_folder.gif'; var plusImage = 'dhtmlgoodies_plus.gif'; var minusImage = 'dhtmlgoodies_minus.gif'; diff --git a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js index b77abd03eb8..340da44c9dc 100644 --- a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js +++ b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-infoPanel.js @@ -47,7 +47,7 @@ DHTMLSuite.infoPanel = function() this.cookieNames = new Array(); this.currentlyExpandedPane = false; // this.layoutCSS = 'info-pane.css'; // Default css file for this widget. - this.layoutCSS = '/jsp/aim/view/css/css_dhtmlsuite/info-pane.css'; // Default css file for this widget. + this.layoutCSS = '/static/aim/view/css/css_dhtmlsuite/info-pane.css'; // Default css file for this widget. this.arrayOfPanes = new Array(); this.paneHeights = new Array(); try{ From be50bacd827feb76c6b6e7c2b04ec452af7d7026 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 16:23:28 +0300 Subject: [PATCH 82/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- amp/TEMPLATE/ampTemplate/layout/addEditLayout.jsp | 2 +- .../scripts/separateFiles/dhtmlSuite-folder-tree-static.js | 2 -- .../jsp/contentrepository/view/documentManagerJsHelper.jsp | 4 ++-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/amp/TEMPLATE/ampTemplate/layout/addEditLayout.jsp b/amp/TEMPLATE/ampTemplate/layout/addEditLayout.jsp index 5feb7563ada..92ef32f9ca1 100644 --- a/amp/TEMPLATE/ampTemplate/layout/addEditLayout.jsp +++ b/amp/TEMPLATE/ampTemplate/layout/addEditLayout.jsp @@ -53,7 +53,7 @@ - + diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js index a6cb1035c70..911d92cdd2e 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js @@ -31,8 +31,6 @@ Owner of DHTMLgoodies.com February, 3rd 2006 - Dynamic load nodes by use of Ajax(Alf Magne Kalleland) */ - - var imageFolder = '/static/aim/view/images/images_dhtmlsuite/'; // Path to images var folderImage = 'dhtmlgoodies_folder.gif'; var plusImage = 'dhtmlgoodies_plus.gif'; diff --git a/amp/src/main/webapp/WEB-INF/jsp/contentrepository/view/documentManagerJsHelper.jsp b/amp/src/main/webapp/WEB-INF/jsp/contentrepository/view/documentManagerJsHelper.jsp index ca1559716ca..a8e2ce488dd 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/contentrepository/view/documentManagerJsHelper.jsp +++ b/amp/src/main/webapp/WEB-INF/jsp/contentrepository/view/documentManagerJsHelper.jsp @@ -1274,12 +1274,12 @@ function toggleView(elementId, iconId, isMinus) { var icon = document.getElementById(iconId); var element = document.getElementById(elementId); if (isMinus) { - icon.src = '/jsp/contentrepository/view/images/dhtmlgoodies_plus.gif'; + icon.src = '/WEB-INF/jsp/contentrepository/view/images/dhtmlgoodies_plus.gif'; element.style.display = 'none'; isMinus = false; } else{ - icon.src = '/jsp/contentrepository/view/images/dhtmlgoodies_minus.gif'; + icon.src = '/WEB-INF/jsp/contentrepository/view/images/dhtmlgoodies_minus.gif'; element.style.display = ''; isMinus = true; } From b8377bea2353ed31dbd44c0abcd01cac9c6cc932 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 16:33:09 +0300 Subject: [PATCH 83/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js index 0c7bb35a714..fa5c53e2a18 100644 --- a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js +++ b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js @@ -31,8 +31,6 @@ Owner of DHTMLgoodies.com February, 3rd 2006 - Dynamic load nodes by use of Ajax(Alf Magne Kalleland) */ - - var imageFolder = '/static/aim/view/images/images_dhtmlsuite/'; // Path to images var folderImage = 'dhtmlgoodies_folder.gif'; var plusImage = 'dhtmlgoodies_plus.gif'; From 54965bafd567a5d8b8d56535316a9b66b4839eac Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 16:53:11 +0300 Subject: [PATCH 84/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../scripts/separateFiles/dhtmlSuite-folder-tree-static.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js index fa5c53e2a18..911d92cdd2e 100644 --- a/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js +++ b/amp/static/aim/view/scripts/separateFiles/dhtmlSuite-folder-tree-static.js @@ -52,9 +52,9 @@ Owner of DHTMLgoodies.com var start = document.cookie.indexOf(name+"="); var len = start+name.length+1; if ((!start) && (name != document.cookie.substring(0,name.length))) return null; - if (start == -1) return null; + if (start === -1) return null; var end = document.cookie.indexOf(";",len); - if (end == -1) end = document.cookie.length; + if (end === -1) end = document.cookie.length; return unescape(document.cookie.substring(len,end)); } // This function has been slightly modified From 2dd39b18067575c035252dabc61aef4d85e4c2b8 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 17:12:19 +0300 Subject: [PATCH 85/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../js/saiku/models/Repository.js | 30 +++++++++---------- .../js/saiku/routers/QueryRouter.js | 16 +++++----- 2 files changed, 24 insertions(+), 22 deletions(-) diff --git a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js index 4f5b72a4118..7f1c1dbf0f8 100644 --- a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js +++ b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js @@ -1,4 +1,4 @@ -/* +/* * Copyright 2012 OSBI Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,12 +13,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + /** * Repository query */ var RepositoryUrl = "api/jsp"; -var repoPathUrl = function() { +var repoPathUrl = function() { return RepositoryUrl; } @@ -52,21 +52,21 @@ var RepositoryZipExport = Backbone.Model.extend( { } } ); -var SavedQuery = Backbone.Model.extend({ +export var SavedQuery = Backbone.Model.extend({ parse: function(response) { Saiku.logger.log("SavedQuery.parse"); //console.log("response: " + response); //this.xml = response; }, - + url: function() { Saiku.logger.log("SavedQuery.url"); var u = repoPathUrl() + "/resource"; return u; }, - + move_query_to_workspace: function(model, response) { Saiku.logger.log("SavedQuery.move_query_to_workspace"); var file = response; @@ -78,24 +78,24 @@ var SavedQuery = Backbone.Model.extend({ var Re2 = new RegExp("\\$\\{" + variable.toLowerCase() + "\\}","g"); file = file.replace(Re,Settings[key]); file = file.replace(Re2,Settings[key]); - + } } - var query = new Query({ + var query = new Query({ xml: file, formatter: Settings.CELLSET_FORMATTER },{ name: filename }); - + var tab = Saiku.tabs.add(new Workspace({ query: query })); }, move_query_to_workspace_json: function(model, response) { Saiku.logger.log("SavedQuery.move_query_to_workspace_json"); var json = JSON.stringify(response); var filename = model.get('file'); - - var query = new Query({ + + var query = new Query({ json: json, formatter: Settings.CELLSET_FORMATTER, report_id: model.get('report_id'), @@ -113,7 +113,7 @@ var SavedQuery = Backbone.Model.extend({ },{ name: filename }); - + query.set('name', filename); var tab = Saiku.tabs.add(new Workspace({ query: query })); } @@ -124,21 +124,21 @@ var SavedQuery = Backbone.Model.extend({ */ var Repository = Backbone.Collection.extend({ model: SavedQuery, - + initialize: function(args, options) { Saiku.logger.log("Repository.initialize"); if (options && options.dialog) { this.dialog = options.dialog; } }, - + parse: function(response) { Saiku.logger.log("Repository.parse"); if (this.dialog) { this.dialog.populate(response); } }, - + url: function() { Saiku.logger.log("Repository.url"); var segment = repoPathUrl() + "?type=saiku"; diff --git a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js index 0acc2ffcd5e..5aa0b68d336 100644 --- a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js +++ b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js @@ -1,4 +1,4 @@ -/* +/* * Copyright 2012 OSBI Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -13,6 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +import { SavedQuery } from '../models/Repository' + /** * Router for opening query when session is initialized @@ -31,8 +33,8 @@ var QueryRouter = Backbone.Router.extend({ }, run_report: function(report_token) { Saiku.logger.log("QueryRouter.run_report"); - $.getJSON(Settings.AMP_PATH + "/run/" + report_token, process_spec); - }, + $.getJSON(Settings.AMP_PATH + "/run/" + report_token, process_spec); + }, open_report: function(report_id) { Saiku.logger.log("QueryRouter.open_report"); if (Saiku.originalReportMetadata) { @@ -42,7 +44,7 @@ var QueryRouter = Backbone.Router.extend({ } }, open_query: function(query_name) { - Saiku.logger.log("QueryRouter.open_query"); + Saiku.logger.log("QueryRouter.open_query"); }, open_query_repository: function( ) { Saiku.logger.log("QueryRouter.open_query_repository"); @@ -65,7 +67,7 @@ var process_spec = function(data) { templateQuery.reportSpec = data.reportSpec; Settings.RESULTS_PER_PAGE = data.reportMetadata.recordsPerPage; - + var report_type = data.reportMetadata.reportType; var report_fieldname = (report_type === "IN_MEMORY") ? "report_token" : "report_id"; var report_identifier = data.reportMetadata.reportIdentifier; @@ -102,8 +104,8 @@ var templateQuery = { }, "plugins":{ - }, + }, "metadata":{ } -}; \ No newline at end of file +}; From 1b492bdf8c40c25619b8d3715a164beedbc7dd71 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 17:36:42 +0300 Subject: [PATCH 86/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../ampTemplate/saikuui_reports/js/saiku/models/Repository.js | 2 +- .../ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js index 7f1c1dbf0f8..5401242999a 100644 --- a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js +++ b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/models/Repository.js @@ -52,7 +52,7 @@ var RepositoryZipExport = Backbone.Model.extend( { } } ); -export var SavedQuery = Backbone.Model.extend({ + var SavedQuery = Backbone.Model.extend({ parse: function(response) { Saiku.logger.log("SavedQuery.parse"); diff --git a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js index 5aa0b68d336..07d6232f429 100644 --- a/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js +++ b/amp/TEMPLATE/ampTemplate/saikuui_reports/js/saiku/routers/QueryRouter.js @@ -13,7 +13,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { SavedQuery } from '../models/Repository' /** From c54e42946680a24204e96dd3427631f9c92d6c18 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 17:47:57 +0300 Subject: [PATCH 87/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- amp/TEMPLATE/ampTemplate/saikuui_reports/index_reports.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/TEMPLATE/ampTemplate/saikuui_reports/index_reports.html b/amp/TEMPLATE/ampTemplate/saikuui_reports/index_reports.html index 3c7a13fce4a..6cd3c4bd323 100644 --- a/amp/TEMPLATE/ampTemplate/saikuui_reports/index_reports.html +++ b/amp/TEMPLATE/ampTemplate/saikuui_reports/index_reports.html @@ -127,13 +127,13 @@ + - From 6d7d96324746437b42d932db86466c5678939a5e Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 17:48:39 +0300 Subject: [PATCH 88/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- amp/TEMPLATE/ampTemplate/saikuui_reports/amp_notes.txt | 2 +- amp/TEMPLATE/ampTemplate/saikuui_reports/test.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/TEMPLATE/ampTemplate/saikuui_reports/amp_notes.txt b/amp/TEMPLATE/ampTemplate/saikuui_reports/amp_notes.txt index 8c8d0256425..fbb76e8c27b 100644 --- a/amp/TEMPLATE/ampTemplate/saikuui_reports/amp_notes.txt +++ b/amp/TEMPLATE/ampTemplate/saikuui_reports/amp_notes.txt @@ -8,7 +8,7 @@ Feature: Executing MDX queries coming from AMP Modified files: saiku/routers/QueryRouter.js saiku/Settings.js -saiku/jsp.js +saiku/Repository.js Feature: Deactivated Global Toolbar diff --git a/amp/TEMPLATE/ampTemplate/saikuui_reports/test.html b/amp/TEMPLATE/ampTemplate/saikuui_reports/test.html index 1bc0a7eded2..2ad368d3450 100644 --- a/amp/TEMPLATE/ampTemplate/saikuui_reports/test.html +++ b/amp/TEMPLATE/ampTemplate/saikuui_reports/test.html @@ -37,7 +37,7 @@ - + From cec50ed5cc732aaffe7d0743195b5d1a8cda6d7c Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 19:09:20 +0300 Subject: [PATCH 89/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .gitmodules | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000000..55713dfe41b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,12 @@ +[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate"] + path = amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate + url = https://github.com/devgateway/amp-boilerplate.git +[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-translate"] + path = amp/TEMPLATE/ampTemplate/node_modules/amp-translate + url = https://github.com/devgateway/amp-translate.git +[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-filter"] + path = amp/TEMPLATE/ampTemplate/node_modules/amp-filter + url = https://github.com/devgateway/amp-filter.git +[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-settings"] + path = amp/TEMPLATE/ampTemplate/node_modules/amp-settings + url = https://github.com/devgateway/amp-settings.git From 2540a76a69e7411fa7d951e8e61cfd87e28062ef Mon Sep 17 00:00:00 2001 From: brianbrix Date: Thu, 25 Apr 2024 19:18:32 +0300 Subject: [PATCH 90/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .gitmodules | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index 55713dfe41b..00000000000 --- a/.gitmodules +++ /dev/null @@ -1,12 +0,0 @@ -[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate"] - path = amp/TEMPLATE/ampTemplate/node_modules/amp-boilerplate - url = https://github.com/devgateway/amp-boilerplate.git -[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-translate"] - path = amp/TEMPLATE/ampTemplate/node_modules/amp-translate - url = https://github.com/devgateway/amp-translate.git -[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-filter"] - path = amp/TEMPLATE/ampTemplate/node_modules/amp-filter - url = https://github.com/devgateway/amp-filter.git -[submodule "amp/TEMPLATE/ampTemplate/node_modules/amp-settings"] - path = amp/TEMPLATE/ampTemplate/node_modules/amp-settings - url = https://github.com/devgateway/amp-settings.git From c3b7ed58ef7c3f67881e29c78a8e4cd1b1294cfe Mon Sep 17 00:00:00 2001 From: brianbrix Date: Mon, 6 May 2024 13:22:19 +0300 Subject: [PATCH 91/97] AMP-30860 : Issue - in admin activity manager delete activity cause error --- .../aim/view/scripts/reportWizard/saving.js | 50 +++++++++---------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js index 2f076c6ff2b..5e9794f1f58 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/reportWizard/saving.js @@ -82,7 +82,7 @@ function getReportTitlesInCurrentLang(lang) function getReportCategory() { var categoryEl = document.getElementById("repCat"); if (categoryEl != null ) { - var category = categoryEl.value; + var category = categoryEl.value; return category; } return 0; @@ -128,27 +128,27 @@ function getDesktopTab() { function getSelectedFields( ulId, name ) { var ret = ""; var ulEl = document.getElementById( ulId ); - + var fields = ulEl.getElementsByTagName( "input" ); for ( var i=0; i]*>/g, "").replace(/^\s+|\s+$/g, '') ); } - return ret; + return ret; } function getColInfo (id) { @@ -245,7 +245,7 @@ SaveReportEngine.prototype.success = function (o) { } return; } - + // got till here -> no error // example response string: {openReportId=1344,saiku=false} var parametersArray = response.split(','); @@ -266,7 +266,7 @@ SaveReportEngine.prototype.success = function (o) { } this.openReport(openReportId, openSaiku); // open report in a new browser tab/window - }else{ + }else{ //we test if we have to run the report in saiku if(shouldRunReport){ var runSaikuParamArray = parametersArray[0].split("="); @@ -309,15 +309,15 @@ SaveReportEngine.prototype.showTitlePanel = function () { if ( this.titlePanel == null ) { document.getElementById("titlePanel").style.display = "block"; - this.titlePanel = new YAHOO.widget.Panel("titlePanel", + this.titlePanel = new YAHOO.widget.Panel("titlePanel", { visible:true, - width: "400px", - constraintoviewport:true, - fixedcenter: true, + width: "400px", + constraintoviewport:true, + fixedcenter: true, modal: true, - close:true, + close:true, effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.5}, - visible:false, + visible:false, draggable:true } ); this.titlePanel.render( document.body ); } @@ -335,18 +335,18 @@ SaveReportEngine.prototype.saveAndOpenReport = function() { }; SaveReportEngine.prototype.saveAndOrOpenReport = function (openReport) { - + if (this.titlePanel != null) this.titlePanel.hide(); this.divEl.style.visibility = ""; - this.divEl.innerHTML = this.savingMessage + + this.divEl.innerHTML = this.savingMessage + "... "; var reportTitles = getReportTitles(); var sendData = true; var noReportNameSupplied = ""; if (reportTitles == null ) { - reportTitles = ""; + reportTitles = ""; noReportNameSupplied = "&noReportNameSupplied=true"; } else { var reportTitleInCurrentLang = getReportTitlesInCurrentLang(defaultLanguage); @@ -356,8 +356,8 @@ SaveReportEngine.prototype.saveAndOrOpenReport = function (openReport) { } } if (sendData) { - var postString = "reportTitle=dummy&reportDescription="+encodeURIComponent(getReportDescription()) + "&reportPeriod="+getReportPeriod() + - "&reportType="+getReportType() + "&" + getSelectedFields("dest_col_ul", "selectedColumns") + + var postString = "reportTitle=dummy&reportDescription="+encodeURIComponent(getReportDescription()) + "&reportPeriod="+getReportPeriod() + + "&reportType="+getReportType() + "&" + getSelectedFields("dest_col_ul", "selectedColumns") + "&reportCategory="+ getReportCategory()+ "&forceNameOverwrite=" + this.forceOverwrite+ "&runReport=" + this.runReport + @@ -372,17 +372,17 @@ SaveReportEngine.prototype.saveAndOrOpenReport = function (openReport) { "&useFilters="+getUseFilters()+ "&openReport=" + openReport + reportTitles + - noReportNameSupplied + + noReportNameSupplied + //"&reportContextId="+getReportContextId()+ "&allowEmptyFundingColumns="+getAllowEmptyFundingColumns()+ - "&" + getSelectedFields ("dest_measures_ul","selectedMeasures")+ "&" + getSelectedFields("dest_hierarchies_ul","selectedHierarchies"); - + "&" + getSelectedFields ("dest_measures_ul","selectedMeasures")+ "&" + getSelectedFields("dest_hierarchies_ul","selectedHierarchies"); + //YAHOO.util.Connect.asyncRequest("POST", "/aim/reportWizard.do", this, postString); - //uses synchronous request as a workaround for popup issues - AMP-22717 + //uses synchronous request as a workaround for popup issues - AMP-22717 var self = this; $.ajax({ - url:"/aim/reportWizard.do", - async:false, + url:"/TEMPLATE/reampv2/build/index.html#/report_generator?profile=T", + async:false, data: postString, success: function(data) { self.success({responseText:data}); From 9f958093642391dc9f16abb4547e315c826575a3 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Mon, 6 May 2024 13:35:52 +0300 Subject: [PATCH 92/97] AMP-30865 Issue - advanced search preview and save not works --- .../jsp/aim/view/scripts/saveReports.js | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js index e0ca4859cc5..118216a23c3 100644 --- a/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js +++ b/amp/src/main/webapp/WEB-INF/jsp/aim/view/scripts/saveReports.js @@ -1,4 +1,4 @@ -/* Check also reportsScripts.jsp for some initialization of this class. +/* Check also reportsScripts.jsp for some initialization of this class. The translated messages and the saveReprotEngine variables are declared there. */ function SaveReportEngine (isTab) { @@ -12,7 +12,7 @@ SaveReportEngine.prototype.getReportName = function () { if(reportName){ reportName = trim(reportName); } - return reportName; + return reportName; }; SaveReportEngine.prototype.getReportId = function () { @@ -39,22 +39,22 @@ SaveReportEngine.prototype.checkEnter = function (e) { saveReportEngine.saveReport(); return false; } - return true; + return true; }; SaveReportEngine.prototype.showPanel = function () { if (this.panel == null) { document.getElementById("saveTitlePanel").style.display = ""; - this.panel = new YAHOO.widget.Panel("saveTitlePanel", + this.panel = new YAHOO.widget.Panel("saveTitlePanel", { visible:true, - width: "400px", - constraintoviewport:true, - fixedcenter: true, + width: "400px", + constraintoviewport:true, + fixedcenter: true, underlay: 'shadow', modal: true, - close:true, + close:true, effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.5}, - visible:false, + visible:false, draggable:true } ); this.panel.render(document.body); this.innerBody = this.panel.body.innerHTML; @@ -65,7 +65,7 @@ SaveReportEngine.prototype.showPanel = function () { initMultilingualInput('AmpReports_name'); this.panel.subscribe("show", function () {$('#titlePanelBody input').first().focus(); }); }; - + SaveReportEngine.prototype.closePanel = function () { debugger; this.panel.close(); @@ -95,11 +95,11 @@ SaveReportEngine.prototype.success = function (o) { message += "
" + "
" + "" + - "
"; - + ""; + this.panel.setBody( message ); this.doneCopyMessage; - + } }; @@ -142,32 +142,32 @@ SaveReportEngine.prototype.saveReport = function () { this.saveButton.enable(); return; } - + var reportChangedName = true; //this.getReportName() == this.getOriginalReportName(); if (reportChangedName) { this.overwritingReport = true; } - else { + else { this.overwritingReport = false; } this.saveButton.disable(); var reportTitles = getReportTitles(); - + if (reportTitles == null) { - this.panel.setFooter( SaveReportEngine.savingMessage + "...
Error: please enter a value in at least one language " ); + this.panel.setFooter( SaveReportEngine.savingMessage + "...
Error: please enter a value in at least one language " ); } else { this.panel.setFooter( SaveReportEngine.savingMessage + "...
" ); var postString = "dynamicSaveReport=true" + - reportTitles + - "&reportTitle=dummy" + + reportTitles + + "&reportTitle=dummy" + "&desktopTab=" + this.isTab + "&reportId="+this.getReportId() + "&forceNameOverwrite=" + this.overwritingReport + "&useFilters=true"; //alert (postString); - YAHOO.util.Connect.asyncRequest("POST", "/aim/reportWizard.do", this, postString); + YAHOO.util.Connect.asyncRequest("POST", "/TEMPLATE/reampv2/build/index.html#/report_generator?profile=T", this, postString); } }; @@ -178,7 +178,7 @@ SaveReportEngine.enterPressed = function (e) { keyCode = e.which; if (e.keyCode != null) keyCode = e.keyCode; - + if ( keyCode == 13 ) { return true; } @@ -192,7 +192,7 @@ function ExtendedButton( buttonId ) { ExtendedButton.prototype.enable = function () { var btn = document.getElementById( this.buttonId ); var btnY = new YAHOO.util.Element(btn); - + btn.disabled = false; btnY.setStyle("color", "black"); }; From 61950467654237aa0e6be86c39171c9d67467710 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Mon, 6 May 2024 13:49:12 +0300 Subject: [PATCH 93/97] AMP-30865 Issue - advanced search preview and save not works --- amp/static/aim/view/scripts/saveReports.js | 44 +++++++++++----------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/amp/static/aim/view/scripts/saveReports.js b/amp/static/aim/view/scripts/saveReports.js index e0ca4859cc5..118216a23c3 100644 --- a/amp/static/aim/view/scripts/saveReports.js +++ b/amp/static/aim/view/scripts/saveReports.js @@ -1,4 +1,4 @@ -/* Check also reportsScripts.jsp for some initialization of this class. +/* Check also reportsScripts.jsp for some initialization of this class. The translated messages and the saveReprotEngine variables are declared there. */ function SaveReportEngine (isTab) { @@ -12,7 +12,7 @@ SaveReportEngine.prototype.getReportName = function () { if(reportName){ reportName = trim(reportName); } - return reportName; + return reportName; }; SaveReportEngine.prototype.getReportId = function () { @@ -39,22 +39,22 @@ SaveReportEngine.prototype.checkEnter = function (e) { saveReportEngine.saveReport(); return false; } - return true; + return true; }; SaveReportEngine.prototype.showPanel = function () { if (this.panel == null) { document.getElementById("saveTitlePanel").style.display = ""; - this.panel = new YAHOO.widget.Panel("saveTitlePanel", + this.panel = new YAHOO.widget.Panel("saveTitlePanel", { visible:true, - width: "400px", - constraintoviewport:true, - fixedcenter: true, + width: "400px", + constraintoviewport:true, + fixedcenter: true, underlay: 'shadow', modal: true, - close:true, + close:true, effect:{effect:YAHOO.widget.ContainerEffect.FADE, duration: 0.5}, - visible:false, + visible:false, draggable:true } ); this.panel.render(document.body); this.innerBody = this.panel.body.innerHTML; @@ -65,7 +65,7 @@ SaveReportEngine.prototype.showPanel = function () { initMultilingualInput('AmpReports_name'); this.panel.subscribe("show", function () {$('#titlePanelBody input').first().focus(); }); }; - + SaveReportEngine.prototype.closePanel = function () { debugger; this.panel.close(); @@ -95,11 +95,11 @@ SaveReportEngine.prototype.success = function (o) { message += "
" + "
" + "" + - "
"; - + ""; + this.panel.setBody( message ); this.doneCopyMessage; - + } }; @@ -142,32 +142,32 @@ SaveReportEngine.prototype.saveReport = function () { this.saveButton.enable(); return; } - + var reportChangedName = true; //this.getReportName() == this.getOriginalReportName(); if (reportChangedName) { this.overwritingReport = true; } - else { + else { this.overwritingReport = false; } this.saveButton.disable(); var reportTitles = getReportTitles(); - + if (reportTitles == null) { - this.panel.setFooter( SaveReportEngine.savingMessage + "...
Error: please enter a value in at least one language " ); + this.panel.setFooter( SaveReportEngine.savingMessage + "...
Error: please enter a value in at least one language " ); } else { this.panel.setFooter( SaveReportEngine.savingMessage + "...
" ); var postString = "dynamicSaveReport=true" + - reportTitles + - "&reportTitle=dummy" + + reportTitles + + "&reportTitle=dummy" + "&desktopTab=" + this.isTab + "&reportId="+this.getReportId() + "&forceNameOverwrite=" + this.overwritingReport + "&useFilters=true"; //alert (postString); - YAHOO.util.Connect.asyncRequest("POST", "/aim/reportWizard.do", this, postString); + YAHOO.util.Connect.asyncRequest("POST", "/TEMPLATE/reampv2/build/index.html#/report_generator?profile=T", this, postString); } }; @@ -178,7 +178,7 @@ SaveReportEngine.enterPressed = function (e) { keyCode = e.which; if (e.keyCode != null) keyCode = e.keyCode; - + if ( keyCode == 13 ) { return true; } @@ -192,7 +192,7 @@ function ExtendedButton( buttonId ) { ExtendedButton.prototype.enable = function () { var btn = document.getElementById( this.buttonId ); var btnY = new YAHOO.util.Element(btn); - + btn.disabled = false; btnY.setStyle("color", "black"); }; From 62ccdec34ee23800217d892f5811497d953dfcdd Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 8 May 2024 00:12:28 +0300 Subject: [PATCH 94/97] AMP-30865 Issue -Amp Offline not working --- amp/pom.xml | 6 +++--- .../digijava/kernel/content/ContentRepositoryManager.java | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/amp/pom.xml b/amp/pom.xml index 07b6bdc636e..92dbb183d44 100644 --- a/amp/pom.xml +++ b/amp/pom.xml @@ -12,7 +12,7 @@ 5.6.11 5.3.28 UTF-8 - 2.16.2 + 2.19.6 3.6.2 1.19 2.14.2 @@ -472,8 +472,8 @@ org.apache.jackrabbit - jackrabbit-api - ${jackrabbit.version} + oak-jackrabbit-api + 1.20.0 org.apache.jackrabbit diff --git a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java index a12c702c119..415f3b349e1 100644 --- a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java +++ b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java @@ -260,7 +260,7 @@ private static Set getUuidsFromPath(String path) { uuids.add(nodes.nextNode().getIdentifier()); } } catch (RepositoryException e) { - throw new RuntimeException(e); + logger.info("Error during query: ",e); } return uuids; From 9a9a71c35cb88bfc66b0e1523517190f80cae91c Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 8 May 2024 00:31:08 +0300 Subject: [PATCH 95/97] AMP-30865 Issue -Amp Offline not working --- .../org/digijava/kernel/content/ContentRepositoryManager.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java index 415f3b349e1..44bafb3deb5 100644 --- a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java +++ b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java @@ -100,7 +100,7 @@ public static Session getReadSession(HttpServletRequest request) { try { readSession = getOrCloseIfNotLive(readSession); if (readSession == null) { - readSession = getRepositoryInstance().login(new SimpleCredentials("admin", "admin".toCharArray())); + readSession = getRepositoryInstance().login(getCredentials(request)); } } catch (RepositoryException e) { throw new RuntimeException(e.getMessage(), e); @@ -154,7 +154,7 @@ private static SimpleCredentials getCredentials(HttpServletRequest request) { userName = teamMember.getEmail(); } - SimpleCredentials creden = new SimpleCredentials("admin", "admin".toCharArray()); + SimpleCredentials creden = new SimpleCredentials(userName, userName.toCharArray()); return creden; } From c11063e10c902213c3e2412487879cc0db336d5a Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 8 May 2024 00:41:38 +0300 Subject: [PATCH 96/97] AMP-30865 Issue -Amp Offline not working --- .../org/digijava/kernel/content/ContentRepositoryManager.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java index 44bafb3deb5..55ed08ff4b2 100644 --- a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java +++ b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java @@ -154,9 +154,7 @@ private static SimpleCredentials getCredentials(HttpServletRequest request) { userName = teamMember.getEmail(); } - SimpleCredentials creden = new SimpleCredentials(userName, userName.toCharArray()); - - return creden; + return new SimpleCredentials(userName, userName.toCharArray()); } private static void registerNamespace(Session session, String namespace, String uri) { From 4c99efe83454000ca690ef8f5f02ce59f886ef19 Mon Sep 17 00:00:00 2001 From: brianbrix Date: Wed, 8 May 2024 00:45:14 +0300 Subject: [PATCH 97/97] AMP-30865 Issue -Amp Offline not working --- .../org/digijava/kernel/content/ContentRepositoryManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java index 55ed08ff4b2..b246a7b7d8d 100644 --- a/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java +++ b/amp/src/main/java/org/digijava/kernel/content/ContentRepositoryManager.java @@ -154,7 +154,7 @@ private static SimpleCredentials getCredentials(HttpServletRequest request) { userName = teamMember.getEmail(); } - return new SimpleCredentials(userName, userName.toCharArray()); + return new SimpleCredentials("admin", "admin".toCharArray()); } private static void registerNamespace(Session session, String namespace, String uri) {