From 946e111897c047aca467a0935a1559ac7cf7533a Mon Sep 17 00:00:00 2001 From: jensp Date: Fri, 17 Jun 2011 18:47:57 +0000 Subject: [PATCH] Fehlerhafte DataQueries korrigiert. git-svn-id: https://svn.libreccm.org/ccm/trunk@969 8810af33-2d31-482b-a856-94f89814c4df --- .../com/arsdigita/content-types/SciDepartment.pdl | 6 +++--- .../arsdigita/cms/contenttypes/SciDepartment.java | 8 ++++---- .../cms/contenttypes/SciOrganization.java | 4 ++-- .../SciDepartmentWithPublications.pdl | 6 ++++-- .../SciDepartmentWithPublications.java | 8 ++++---- .../SciOrganizationWithPublications.java | 14 ++++++++------ 6 files changed, 25 insertions(+), 21 deletions(-) diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl index 5f598e10c..b756f4007 100644 --- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl +++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl @@ -51,14 +51,14 @@ query getIdsOfContactsOfSciDepartment { } query getIdsOfSubDepartmentsOfSciDepartment { - BigDecimal departmentId; + BigDecimal subDepartmentId; do { - select ct_sciorga_departments_subdepartments_map.department_id + select ct_sciorga_departments_subdepartments_map.subdepartment_id from ct_sciorga_departments_subdepartments_map where ct_sciorga_departments_subdepartments_map.department_id = :department } map { - departmentId = ct_sciorga_departments_subdepartments_map.department_id; + subDepartmentId = ct_sciorga_departments_subdepartments_map.subdepartment_id; } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java index eab14a2d0..e8f521fea 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java @@ -369,7 +369,7 @@ public class SciDepartment extends GenericOrganizationalUnit { boolean result = false; while (departmentsQuery.next()) { departmentId = (BigDecimal) departmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasMembers(departmentId, merge, status); if (result) { @@ -436,7 +436,7 @@ public class SciDepartment extends GenericOrganizationalUnit { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasMembers(subDepartmentId, merge, status); if (result) { @@ -506,7 +506,7 @@ public class SciDepartment extends GenericOrganizationalUnit { boolean result = false; while (departmentsQuery.next()) { departmentId = (BigDecimal) departmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasProjects(departmentId, merge, status); if (result) { @@ -578,7 +578,7 @@ public class SciDepartment extends GenericOrganizationalUnit { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasProjects(subDepartmentId, merge, status); if (result) { diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java index a0e2e44a8..ed3c641ec 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java @@ -293,7 +293,7 @@ public class SciOrganization extends GenericOrganizationalUnit { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasMembers(subDepartmentId, merge, status); if (result) { @@ -435,7 +435,7 @@ public class SciOrganization extends GenericOrganizationalUnit { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasProjects(subDepartmentId, merge, status); if (result) { diff --git a/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciDepartmentWithPublications.pdl b/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciDepartmentWithPublications.pdl index 3c29d70bc..d9b752ab6 100644 --- a/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciDepartmentWithPublications.pdl +++ b/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciDepartmentWithPublications.pdl @@ -23,13 +23,15 @@ association { query getIdsOfPublicationsOfSciDepartment { BigDecimal publicationId; + String objectType; do { - select ct_department_publication_map.publication_id - from ct_department_publication_map + select ct_department_publication_map.publication_id, acs_objects.object_type + from ct_department_publication_map join acs_objects on ct_department_publication_map.publication_id = acs_objects.object_id where ct_department_publication_map.department_id = :department } map { publicationId = ct_department_publication_map.publication_id; + objectType = acs_objects.object_type; } } diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.java index f10f1cfc5..fbaadf1f2 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.java @@ -80,7 +80,7 @@ public class SciDepartmentWithPublications extends SciDepartment { boolean result = false; while (departmentsQuery.next()) { departmentId = (BigDecimal) departmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasPublications(departmentId, merge); if (result) { @@ -124,7 +124,7 @@ public class SciDepartmentWithPublications extends SciDepartment { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasPublications(subDepartmentId, merge); if (result) { @@ -167,7 +167,7 @@ public class SciDepartmentWithPublications extends SciDepartment { boolean result = false; while (departmentsQuery.next()) { departmentId = (BigDecimal) departmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasWorkingPapers(departmentId, merge); if (result) { @@ -211,7 +211,7 @@ public class SciDepartmentWithPublications extends SciDepartment { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasPublications(subDepartmentId, merge); if (result) { diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.java index d6df03365..c739600c5 100644 --- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.java +++ b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.java @@ -87,8 +87,7 @@ public class SciOrganizationWithPublications extends SciOrganization { DataQuery departmentsQuery = SessionManager.getSession().retrieveQuery( "com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization"); - departmentsQuery.setParameter("organization", - getID()); + departmentsQuery.setParameter("organization", getID()); if (departmentsQuery.size() > 0) { BigDecimal departmentId; @@ -120,13 +119,15 @@ public class SciOrganizationWithPublications extends SciOrganization { final boolean merge) { DataQuery query = SessionManager.getSession().retrieveQuery( - "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciOrganization"); - query.setParameter("organization", departmentId); + "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciDepartment"); + query.setParameter("department", departmentId); if (getConfig().getOrganizationPublicationsSeparateWorkingPapers()) { query.addFilter( "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'"); } + System.out.printf("Proceedings department id %s\n ", departmentId.toString()); + if (query.size() > 0) { query.close(); return true; @@ -143,7 +144,8 @@ public class SciOrganizationWithPublications extends SciOrganization { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); + System.out.printf("Proceesing sub department %s...\n", subDepartmentId.toString()); result = hasPublications(subDepartmentId, merge); if (result) { @@ -236,7 +238,7 @@ public class SciOrganizationWithPublications extends SciOrganization { boolean result = false; while (subDepartmentsQuery.next()) { subDepartmentId = (BigDecimal) subDepartmentsQuery.get( - "departmentId"); + "subDepartmentId"); result = hasPublications(subDepartmentId, merge); if (result) {