diff --git a/ccm-sci-types-organization/application.xml b/ccm-sci-types-organization/application.xml
deleted file mode 100644
index 4527ba02b..000000000
--- a/ccm-sci-types-organization/application.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Content types for scientific organizations
-
-
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
deleted file mode 100644
index b756f4007..000000000
--- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl
+++ /dev/null
@@ -1,165 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.*;
-
-object type SciDepartment extends GenericOrganizationalUnit {
- String[0..1] departmentShortDescription = ct_sciorga_departments.shortdescription VARCHAR(500);
- String[0..1] departmentDescription = ct_sciorga_departments.description CLOB;
-
- reference key ( ct_sciorga_departments.department_id );
-}
-
-association {
- SciDepartment[0..n] superDepartment = join ct_sciorga_departments.department_id
- to ct_sciorga_departments_subdepartments_map.subdepartment_id,
- join ct_sciorga_departments_subdepartments_map.department_id
- to ct_sciorga_departments.department_id;
- SciDepartment[0..n] subDepartments = join ct_sciorga_departments.department_id
- to ct_sciorga_departments_subdepartments_map.department_id,
- join ct_sciorga_departments_subdepartments_map.subdepartment_id
- to ct_sciorga_departments.department_id;
-
- Integer[0..1] subDepartmentOrder = ct_sciorga_departments_subdepartments_map.subdepartments_order INTEGER;
-}
-
-association {
- SciDepartment[0..n] department = join ct_sciorga_projects.project_id
- to ct_sciorga_departments_projects_map.project_id,
- join ct_sciorga_departments_projects_map.department_id
- to ct_sciorga_departments.department_id;
-
- SciProject[0..n] projects = join ct_sciorga_departments.department_id
- to ct_sciorga_departments_projects_map.department_id,
- join ct_sciorga_departments_projects_map.project_id
- to ct_sciorga_projects.project_id;
-
- Integer[0..1] departmentOrder = ct_sciorga_departments_projects_map.departmentOrder INTEGER;
- Integer[0..1] projectOrder = ct_sciorga_departments_projects_map.projectorder INTEGER;
-}
-
-query getIdsOfContactsOfSciDepartment {
- BigDecimal contactId;
-
- do {
- select cms_organizationalunits_contact_map.contact_id
- from cms_organizationalunits_contact_map
- where cms_organizationalunits_contact_map.organizationalunit_id = :department
- } map {
- contactId = cms_organizationalunits_contact_map.contact_id;
- }
-}
-
-query getIdsOfSubDepartmentsOfSciDepartment {
- BigDecimal subDepartmentId;
-
- do {
- select ct_sciorga_departments_subdepartments_map.subdepartment_id
- from ct_sciorga_departments_subdepartments_map
- where ct_sciorga_departments_subdepartments_map.department_id = :department
- } map {
- subDepartmentId = ct_sciorga_departments_subdepartments_map.subdepartment_id;
- }
-}
-
-query getIdsOfMembersOfSciDepartment {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :department
- } map {
- memberId = cms_organizationalunits_person_map.person_id;
- }
-}
-
-query getIdsOfActiveMembersOfSciDepartment {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :department
- and cms_organizationalunits_person_map.status = 'active'
- } map {
- memberId = cms_organizationalunits_person_map.person_id;
- }
-}
-
-query getIdsOfAssociatedMembersOfSciDepartment {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :department
- and cms_organizationalunits_person_map.status = 'associated'
- } map {
- memberId = cms_organizationalunits_person_map.personId;
- }
-}
-
-query getIdsOfFormerMembersOfSciDepartment {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :department
- and (cms_organizationalunits_person_map.status = 'former' or cms_organizationalunits_person_map.status = 'associatedFormer')
- } map {
- memberId = cms_organizationalunits_person_map.personId;
- }
-}
-
-query getIdsOfProjectsOfSciDepartment {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_departments_projects_map.project_id
- from ct_sciorga_departments_projects_map
- where ct_sciorga_departments_projects_map.department_id = :department
- } map {
- projectId = ct_sciorga_departments_projects_map.project_id;
- }
-}
-
-query getIdsOfOngoingProjectsOfSciDepartment {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_projects.project_id
- from ct_sciorga_departments_projects_map
- join ct_sciorga_projects on ct_sciorga_departments_projects_map.project_id = ct_sciorga_projects.project_id
- where ct_sciorga_departments_projects_map.department_id = :department and ct_sciorga_projects.projectend >= ':today'
- } map {
- projectId = ct_sciorga_projects.project_id;
- }
-}
-
-query getIdsOfFinishedProjectsOfSciDepartment {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_projects.project_id
- from ct_sciorga_departments_projects_map
- join ct_sciorga_projects on ct_sciorga_departments_projects_map.project_id = ct_sciorga_projects.project_id
- where ct_sciorga_departments_projects_map.department_id = :department and ct_sciorga_projects.projectend < ':today'
- } map {
- projectId = ct_sciorga_projects.project_id;
- }
-}
-
-query getIdsOfPublicationLinksOfSciDepartment {
- BigDecimal linkId;
-
- do {
- select cms_related_links.related_link_id
- from cms_related_links
- where cms_related_links.owner_id = :department
- and cms_related_links.link_list_name = 'SciDepartmentPublications'
- } map {
- linkId = cms_related_links.related_link_id;
- }
-}
\ No newline at end of file
diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciMember.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciMember.pdl
deleted file mode 100644
index 6f0128001..000000000
--- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciMember.pdl
+++ /dev/null
@@ -1,8 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.*;
-
-object type SciMember extends GenericPerson {
- reference key ( ct_sciorga_members.member_id );
-}
\ No newline at end of file
diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl
deleted file mode 100644
index 4a8502902..000000000
--- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl
+++ /dev/null
@@ -1,169 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.*;
-
-object type SciOrganization extends GenericOrganizationalUnit {
-
- String[0..1] organizationShortDescription = ct_sciorga_organizations.shortdescription VARCHAR(500);
- String[0..1] organizationDescription = ct_sciorga_organizations.description CLOB;
-
- reference key ( ct_sciorga_organizations.organization_id );
-}
-
-association {
- SciOrganization[0..n] organization = join ct_sciorga_departments.department_id
- to ct_sciorga_organizations_departments_map.department_id,
- join ct_sciorga_organizations_departments_map.organization_id
- to ct_sciorga_organizations.organization_id;
-
- SciDepartment[0..n] departments = join ct_sciorga_organizations.organization_id
- to ct_sciorga_organizations_departments_map.organization_id,
- join ct_sciorga_organizations_departments_map.department_id
- to ct_sciorga_departments.department_id;
-
- Integer[0..1] departmentOrder = ct_sciorga_organizations_departments_map.department_order INTEGER;
- Integer[0..1] organizationOrder = ct_sciorga_organizations_departments_map.organization_order INTEGER;
-}
-
-association {
- SciOrganization[0..n] organization = join ct_sciorga_projects.project_id
- to ct_sciorga_organizations_projects_map.project_id,
- join ct_sciorga_organizations_projects_map.organization_id
- to ct_sciorga_organizations.organization_id;
-
- SciProject[0..n] projects = join ct_sciorga_organizations.organization_id
- to ct_sciorga_organizations_projects_map.organization_id,
- join ct_sciorga_organizations_projects_map.project_id
- to ct_sciorga_projects.project_id;
-
- Integer[0..1] projectOrder = ct_sciorga_organizations_projects_map.project_order INTEGER;
- Integer[0..1] organizationOrder = ct_sciorga_organizations_projects_map.organization_order INTEGER;
-}
-
-query getIdsOfContactsOfSciOrganization {
- BigDecimal contactId;
-
- do {
- select cms_organizationalunits_contact_map.contact_id
- from cms_organizationalunits_contact_map
- where cms_organizationalunits_contact_map.organizationalunit_id = :organization
- } map {
- contactId = cms_organizationalunits_contact_map.contact_id;
- }
-}
-
-query getIdsOfDepartmentsOfSciOrganization {
- BigDecimal departmentId;
-
- do {
- select ct_sciorga_organizations_departments_map.department_id
- from ct_sciorga_organizations_departments_map
- where ct_sciorga_organizations_departments_map.organization_id = :organization
- } map {
- departmentId = ct_sciorga_organizations_departments_map.department_id;
- }
-}
-
-query getIdsOfMembersOfSciOrganization {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :organization
- } map {
- memberId = cms_organizationalunits_person_map.person_id;
- }
-}
-
-query getIdsOfActiveMembersOfSciOrganization {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :organization
- and cms_organizationalunits_person_map.status = 'active'
- } map {
- memberId = cms_organizationalunits_person_map.person_id;
- }
-}
-
-query getIdsOfAssociatedMembersOfSciOrganization {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :organization
- and cms_organizationalunits_person_map.status = 'associated'
- } map {
- memberId = cms_organizationalunits_person_map.personId;
- }
-}
-
-query getIdsOfFormerMembersOfSciOrganization {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :organization
- and (cms_organizationalunits_person_map.status = 'former' or cms_organizationalunits_person_map.status = 'associatedFormer')
- } map {
- memberId = cms_organizationalunits_person_map.personId;
- }
-}
-
-query getIdsOfProjectsOfSciOrganization {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_organizations_projects_map.project_id
- from ct_sciorga_organizations_projects_map
- where ct_sciorga_organizations_projects_map.organization_id = :organization
- } map {
- projectId = ct_sciorga_organizations_projects_map.project_id;
- }
-}
-
-query getIdsOfOngoingProjectsOfSciOrganization {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_projects.project_id
- from ct_sciorga_organizations_projects_map
- join ct_sciorga_projects on ct_sciorga_organizations_projects_map.project_id = ct_sciorga_projects.project_id
- where ct_sciorga_organizations_projects_map.organization_id = :organization and ct_sciorga_projects.projectend >= ':today'
- } map {
- projectId = ct_sciorga_projects.project_id;
- }
-}
-
-query getIdsOfFinishedProjectsOfSciOrganization {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_projects.project_id
- from ct_sciorga_organizations_projects_map
- join ct_sciorga_projects on ct_sciorga_organizations_projects_map.project_id = ct_sciorga_projects.project_id
- where ct_sciorga_organizations_projects_map.organization_id = :organization and ct_sciorga_projects.projectend < ':today'
- } map {
- projectId = ct_sciorga_projects.project_id;
- }
-}
-
-query getIdsOfPublicationLinksOfSciOrganization {
- BigDecimal linkId;
-
- do {
- select cms_related_links.related_link_id
- from cms_related_links
- where cms_related_links.owner_id = :organization
- and cms_related_links.link_list_name = 'SciOrganizationPublications'
- } map {
- linkId = cms_related_links.related_link_id;
- }
-}
-
diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciProject.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciProject.pdl
deleted file mode 100644
index ba6238d25..000000000
--- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciProject.pdl
+++ /dev/null
@@ -1,119 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.*;
-
-object type SciProject extends GenericOrganizationalUnit {
-
- Date[0..1] projectbegin = ct_sciorga_projects.projectbegin DATE;
- Date[0..1] projectend = ct_sciorga_projects.projectend DATE;
- String[0..1] projectShortDesc = ct_sciorga_projects.shortdesc VARCHAR(500);
- String[0..1] projectDescription = ct_sciorga_projects.description CLOB;
- String[0..1] funding = ct_sciorga_projects.funding CLOB;
- String[0..1] fundingVolume = ct_sciorga_projects.funding_volume VARCHAR(128);
-
- reference key ( ct_sciorga_projects.project_id );
-}
-
-association {
- SciProject[0..n] superProject = join ct_sciorga_projects.project_id
- to ct_sciorga_projects_subprojects_map.subproject_id,
- join ct_sciorga_projects_subprojects_map.project_id
- to ct_sciorga_projects.project_id;
-
- SciProject[0..n] subProjects = join ct_sciorga_projects.project_id
- to ct_sciorga_projects_subprojects_map.project_id,
- join ct_sciorga_projects_subprojects_map.subproject_id
- to ct_sciorga_projects.project_id;
-
- Integer[0..1] subProjectOrder = ct_sciorga_projects_subprojects_map.subprojectorder INTEGER;
-
-}
-
-query getIdsOfContactsOfSciProject {
- BigDecimal contactId;
-
- do {
- select cms_organizationalunits_contact_map.contact_id
- from cms_organizationalunits_contact_map
- where cms_organizationalunits_contact_map.organizationalunit_id = :project
- } map {
- contactId = cms_organizationalunits_contact_map.contact_id;
- }
-}
-
-query getIdsOfSubProjectsOfSciProject {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_projects_subprojects_map.subproject_id
- from ct_sciorga_projects_subprojects_map
- where ct_sciorga_projects_subprojects_map.project_id = :project
- } map {
- projectId = ct_sciorga_projects_subprojects_map.project_id;
- }
-}
-
-query getIdsOfMembersOfSciProject {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :project
- } map {
- memberId = cms_organizationalunits_person_map.person_id;
- }
-}
-
-query getIdsOfActiveMembersOfSciProject {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :project
- and cms_organizationalunits_person_map.status = 'active'
- } map {
- memberId = cms_organizationalunits_person_map.person_id;
- }
-}
-
-query getIdsOfAssociatedMembersOfSciProject {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :project
- and cms_organizationalunits_person_map.status = 'associated'
- } map {
- memberId = cms_organizationalunits_person_map.personId;
- }
-}
-
-query getIdsOfFormerMembersOfSciProject {
- BigDecimal memberId;
-
- do {
- select cms_organizationalunits_person_map.cms_persons.person_id
- from cms_organizationalunits_person_map
- where cms_organizationalunits_person_map.organizationalunit_id = :project
- and (cms_organizationalunits_person_map.status = 'former' or cms_organizationalunits_person_map.status = 'associatedFormer')
- } map {
- memberId = cms_organizationalunits_person_map.personId;
- }
-}
-
-query getIdsOfPublicationLinksOfSciProject {
- BigDecimal linkId;
-
- do {
- select cms_related_links.related_link_id
- from cms_related_links
- where cms_related_links.owner_id = :project
- and cms_related_links.link_list_name = 'SciProjectPublications'
- } map {
- linkId = cms_related_links.related_link_id;
- }
-}
\ No newline at end of file
diff --git a/ccm-sci-types-organization/sql/ccm-sci-types-organization/postgres-create.sql b/ccm-sci-types-organization/sql/ccm-sci-types-organization/postgres-create.sql
deleted file mode 100644
index 38716a0ca..000000000
--- a/ccm-sci-types-organization/sql/ccm-sci-types-organization/postgres-create.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-begin;
-\i ddl/postgres/create.sql
-\i ddl/postgres/deferred.sql
-end;
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml
deleted file mode 100644
index a27473d4f..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciMember.xml b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciMember.xml
deleted file mode 100644
index d9d1004f1..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciMember.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml
deleted file mode 100644
index 7b079d97c..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganizationDescription.jsp b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganizationDescription.jsp
deleted file mode 100644
index 36bd83a39..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganizationDescription.jsp
+++ /dev/null
@@ -1,49 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
- long age = Navigation.getConfig().getIndexPageCacheLifetime();
- if (age == 0) {
- DispatcherHelper.cacheDisable(response);
- } else {
- DispatcherHelper.cacheForWorld(response, (int)age);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml
deleted file mode 100644
index 858f2743f..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/scidepartment-item.jsp b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/scidepartment-item.jsp
deleted file mode 100644
index c53ce0e63..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/scidepartment-item.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- NavigationModel model = new CMSNavigationModel();
-
-
-
-
-
-
- ((com.arsdigita.navigation.ui.category.Path)categoryPath)
- .setModel(model);
-
-
-
- ((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
- .setModel(model);
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciorganization-item.jsp b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciorganization-item.jsp
deleted file mode 100644
index 8ef611dd3..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciorganization-item.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- NavigationModel model = new CMSNavigationModel();
-
-
-
-
-
-
- ((com.arsdigita.navigation.ui.category.Path)categoryPath)
- .setModel(model);
-
-
-
- ((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
- .setModel(model);
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciproject-item.jsp b/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciproject-item.jsp
deleted file mode 100644
index c7f8a2d93..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciproject-item.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- NavigationModel model = new CMSNavigationModel();
-
-
-
-
-
-
- ((com.arsdigita.navigation.ui.category.Path)categoryPath)
- .setModel(model);
-
-
-
- ((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
- .setModel(model);
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml b/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml
deleted file mode 100644
index 618b776be..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciMember.xml b/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciMember.xml
deleted file mode 100644
index 6f1922be6..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciMember.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml b/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml
deleted file mode 100644
index e3903afea..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml b/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml
deleted file mode 100644
index b37af9316..000000000
--- a/ccm-sci-types-organization/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- -->
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/src/ccm-sci-types-organization.config b/ccm-sci-types-organization/src/ccm-sci-types-organization.config
deleted file mode 100644
index 786bbc0dc..000000000
--- a/ccm-sci-types-organization/src/ccm-sci-types-organization.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
diff --git a/ccm-sci-types-organization/src/ccm-sci-types-organization.load b/ccm-sci-types-organization/src/ccm-sci-types-organization.load
deleted file mode 100644
index 8ab3f7df3..000000000
--- a/ccm-sci-types-organization/src/ccm-sci-types-organization.load
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
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
deleted file mode 100644
index e8f521fea..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java
+++ /dev/null
@@ -1,620 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import org.apache.log4j.Logger;
-
-/**
- *
- * A class for representing departments of an organization. Adds two
- * associations to {@link GenericOrganizationalUnit}:
- *
- *
- * - Subdepartments
- * - Projects
- *
- *
- * The subdepartments association links one instance of this class
- * with another.
- * The projects association links an department with projects.
- *
- *
- * Also, there are two additional fields:
- *
- *
- * - shortDescription
- * - description
- *
- *
- * shortDescription takes a short text (maximum length 500 characters)
- * about the department. For more detailed description, the description
- * field can be used.
- *
- *
- * There is an
- * UML digram
- * with an overview of the content types and their associations. Please not that
- * the diagram show a design sketch and not the actually implemented classes.
- *
- *
- * @author Jens Pelzetter
- * @see GenericOrganizationalUnit
- * @see SciOrganization
- * @see SciProject
- */
-public class SciDepartment extends GenericOrganizationalUnit {
-
- private static final Logger logger = Logger.getLogger(SciDepartment.class);
- public static final String DEPARTMENT_SHORT_DESCRIPTION =
- "departmentShortDescription";
- public static final String DEPARTMENT_DESCRIPTION = "departmentDescription";
- public static final String ORGANIZATION = "organization";
- public static final String SUPER_DEPARTMENT = "superDepartment";
- public static final String SUBDEPARTMENTS = "subDepartments";
- public static final String SUBDEPARTMENT_ORDER = "subDepartmentOrder";
- public static final String PROJECTS = "projects";
- public static final String PROJECT_ORDER = "projectOrder";
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.contenttypes.SciDepartment";
- private static final SciOrganizationConfig s_config =
- new SciOrganizationConfig();
-
- static {
- logger.debug("Static initalizer starting...");
- s_config.load();
- logger.debug("Static initalizer finished.");
- }
-
- public enum MemberStatus {
-
- ALL,
- ACTIVE,
- ASSOCIATED,
- FORMER
- }
-
- public enum ProjectStatus {
-
- ALL,
- ONGOING,
- FINISHED
- }
-
- public SciDepartment() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- public SciDepartment(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public SciDepartment(OID oid) throws DataObjectNotFoundException {
- super(oid);
- }
-
- public SciDepartment(DataObject obj) {
- super(obj);
- }
-
- public SciDepartment(String type) {
- super(type);
- }
-
- public static final SciOrganizationConfig getConfig() {
- return s_config;
- }
-
- public String getDepartmentShortDescription() {
- return (String) get(DEPARTMENT_SHORT_DESCRIPTION);
- }
-
- public void setDepartmentShortDescription(String description) {
- set(DEPARTMENT_SHORT_DESCRIPTION, description);
- }
-
- public String getDepartmentDescription() {
- return (String) get(DEPARTMENT_DESCRIPTION);
- }
-
- public void setDepartmentDescription(String description) {
- set(DEPARTMENT_DESCRIPTION, description);
- }
-
- public SciDepartment getSuperDepartment() {
- /*This is some sort of hack because if we define the
- * relation in PDL with a multiplicity of 0..1 for the super department
- * part, CCM crashes when trying to publish the item. So we have to
- * define both parts of the association with 0..n in PDL. But we don't
- * want more than one superior department per department. So we are
- * retrieving the data collection and get the first element of it, and
- * return this.
- */
- DataCollection collection;
-
- collection = (DataCollection) get(SUPER_DEPARTMENT);
-
- if (0 == collection.size()) {
- return null;
- } else {
- DataObject dobj;
-
- collection.next();
- dobj = collection.getDataObject();
- collection.close();
-
- return (SciDepartment) DomainObjectFactory.newInstance(dobj);
- }
- }
-
- public void setSuperDepartment(SciDepartment department) {
- /* Similar hack as in getSuperDepartment() above. Here, we are
- * retrieving the data collection, removing the first (and only item)
- * and put the new one in it.
- *
- */
- SciDepartment oldSuperDepartment;
-
- oldSuperDepartment = getSuperDepartment();
- if (oldSuperDepartment != null) {
- remove(SUPER_DEPARTMENT, oldSuperDepartment);
- }
-
- if (null != department) {
- Assert.exists(department, SciDepartment.class);
- DataObject link = add(SUPER_DEPARTMENT, department);
- link.set(SUBDEPARTMENT_ORDER,
- Integer.valueOf((int) department.getSubDepartments().size()));
- link.save();
- }
- }
-
- /*public boolean hasSuperDepartment() {
-
-
-
- }*/
- public SciOrganization getOrganization() {
- DataCollection collection;
-
- collection = (DataCollection) get(ORGANIZATION);
-
- if (0 == collection.size()) {
- return null;
- } else {
- DataObject dobj;
-
- collection.next();
- dobj = collection.getDataObject();
- collection.close();
-
- return (SciOrganization) DomainObjectFactory.newInstance(dobj);
- }
- }
-
- public void setOrganization(SciOrganization orga) {
- SciOrganization oldOrganization;
-
- oldOrganization = getOrganization();
- if (oldOrganization != null) {
- remove(ORGANIZATION, oldOrganization);
- }
-
- if (null != orga) {
- Assert.exists(orga, SciOrganization.class);
- DataObject link = add(ORGANIZATION, orga);
- link.set(SciOrganization.DEPARTMENT_ORDER,
- Integer.valueOf((int) orga.getDepartments().size()));
- link.save();
- }
- }
-
- public SciDepartmentSubDepartmentsCollection getSubDepartments() {
- return new SciDepartmentSubDepartmentsCollection(
- (DataCollection) get(SUBDEPARTMENTS));
- }
-
- public void addSubDepartment(SciDepartment subDepartment) {
- Assert.exists(subDepartment, SciDepartment.class);
-
- DataObject link = add(SUBDEPARTMENTS, subDepartment);
-
- link.set(SUBDEPARTMENT_ORDER, Integer.valueOf((int) getSubDepartments().
- size()));
- link.save();
- }
-
- public void removeSubDepartment(SciDepartment subDepartment) {
- Assert.exists(subDepartment, SciDepartment.class);
-
- remove(SUBDEPARTMENTS, subDepartment);
- }
-
- public SciDepartmentProjectsCollection getProjects() {
- return new SciDepartmentProjectsCollection(
- (DataCollection) get(PROJECTS));
- }
-
- public void addProject(SciProject project) {
- Assert.exists(project, SciProject.class);
-
- DataObject link = add(PROJECTS, project);
-
- link.set(PROJECT_ORDER,
- Integer.valueOf((int) getProjects().size()));
- link.set(SciProject.DEPARTMENTS_ORDER,
- Integer.valueOf((int) project.getDepartments().size()));
- link.save();
- }
-
- public void removeProject(SciProject project) {
- Assert.exists(project, SciProject.class);
-
- remove(PROJECTS, project);
- }
-
- @Override
- public boolean hasContacts() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfContactsOfSciDepartment");
- query.setParameter("department", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }
-
- public boolean hasSubDepartments() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- query.setParameter("department", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }
-
- /**
- *
- * @param merge Should I also look into the departments and return true
- * if the organization or at least one of the departments has members?
- * @return
- */
- public boolean hasMembers(final boolean merge, final MemberStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciDepartment";
- break;
- case ACTIVE:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciDepartment";
- break;
- case ASSOCIATED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciDepartment";
- break;
- case FORMER:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciDepartment";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("department", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- departmentsQuery.setParameter("department", getID());
-
- if (query.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "subDepartmentId");
- result = hasMembers(departmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasMembers(final BigDecimal departmentId,
- final boolean merge,
- final MemberStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciDepartment";
- break;
- case ACTIVE:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciDepartment";
- break;
- case ASSOCIATED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfDepartment";
- break;
- case FORMER:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciDepartment";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("department", departmentId);
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (query.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- result = hasMembers(subDepartmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public boolean hasProjects(final boolean merge,
- final ProjectStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciDepartment";
- break;
- case ONGOING:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciDepartment";
- break;
- case FINISHED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciDepartment";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("department", getID());
- if (status != ProjectStatus.ALL) {
- Calendar today = new GregorianCalendar();
- query.setParameter("today",
- String.format("%d-%02d-%02d",
- today.get(Calendar.YEAR),
- today.get(Calendar.MONTH) + 1,
- today.get(Calendar.DAY_OF_MONTH)));
- }
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- departmentsQuery.setParameter("department", getID());
-
- if (departmentsQuery.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "subDepartmentId");
- result = hasProjects(departmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasProjects(final BigDecimal departmentId,
- final boolean merge,
- final ProjectStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciDepartment";
- break;
- case ONGOING:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciDepartment";
- break;
- case FINISHED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciDepartment";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("department", departmentId);
- if (status != ProjectStatus.ALL) {
- Calendar today = new GregorianCalendar();
- query.setParameter("today",
- String.format("%d-%02d-%02d",
- today.get(Calendar.YEAR),
- today.get(Calendar.MONTH) + 1,
- today.get(Calendar.DAY_OF_MONTH)));
-
- }
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (query.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- result = hasProjects(subDepartmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public boolean hasPublications() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationLinksOfSciDepartment");
- query.setParameter("department", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentInitializer.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentInitializer.java
deleted file mode 100644
index 3d4964595..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentInitializer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import org.apache.log4j.Logger;
-
-/**
- * Initializer for {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentInitializer extends ContentTypeInitializer {
-
- private static final Logger s_log = Logger.getLogger(
- SciDepartmentInitializer.class);
-
- public SciDepartmentInitializer() {
- super("empty.pdl.mf", SciDepartment.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xsl"
- };
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartment.xml";
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentLoader.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentLoader.java
deleted file mode 100644
index e72273cbf..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentLoader.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.util.parameter.Parameter;
-import com.arsdigita.util.parameter.ResourceParameter;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import java.io.InputStream;
-
-/**
- * Loader for {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentLoader extends AbstractContentTypeLoader {
-
- private ResourceParameter m_template;
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml"
- };
-
- public SciDepartmentLoader() {
- super();
-
- m_template = new ResourceParameter(
- "com.arsdigita.cms.contenttypes.SciDepartmentTemplate",
- Parameter.REQUIRED,
- "/WEB-INF/content-types/com/arsdigita/"
- + "cms/contenttypes/scidepartment-item.jsp");
-
- register(m_template);
- }
-
- public String[] getTypes() {
- return TYPES;
- }
-
- @Override
- protected void prepareSection(final ContentSection section,
- final ContentType type,
- final LifecycleDefinition lifecycle,
- final WorkflowTemplate workflow) {
- super.prepareSection(section, type, lifecycle, workflow);
-
- setDefaultTemplate("SciDepartment Item",
- "scidepartment-item",
- (InputStream) get(m_template),
- section,
- type,
- lifecycle,
- workflow);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentProjectsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentProjectsCollection.java
deleted file mode 100644
index 7008b01a9..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentProjectsCollection.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import org.apache.log4j.Logger;
-
-/**
- * Special domain collection for the projects of an department.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciProject
- */
-public class SciDepartmentProjectsCollection extends DomainCollection {
-
- public String ORDER = "projectOrder";
- public String LINKORDER = "link.projectOrder";
- private static final Logger s_log =
- Logger.getLogger(SciDepartmentProjectsCollection.class);
-
- public SciDepartmentProjectsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addOrder(LINKORDER);
- }
-
- public Integer getProjectOrder() {
- return (Integer) m_dataCollection.get(LINKORDER);
- }
-
- public void setProjectOrder(Integer order) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(ORDER, order);
- }
-
- public void swapWithNext(SciProject project) {
- int currentPosition = 0;
- int currentIndex = 0;
- int nextIndex = 0;
-
- s_log.debug("Searching project...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getProjectOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getProjectOrder(): %d",
- getProjectOrder()));
- if (this.getProject().equals(project)) {
- break;
- }
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided project is not "
- + "part of this collection."));
- }
-
- if (this.next()) {
- nextIndex = this.getProjectOrder();
- } else {
- throw new IllegalArgumentException(
- "The provided project is the last "
- + "in the collection, so there is no next object "
- + "to swap with.");
- }
-
- this.rewind();
-
- while (this.getPosition() != currentPosition) {
- this.next();
- }
-
- this.setProjectOrder(nextIndex);
- this.next();
- this.setProjectOrder(currentIndex);
- this.rewind();
- }
-
- public void swapWithPrevious(SciProject project) {
- int previousPosition = 0;
- int previousIndex = 0;
- int currentPosition = 0;
- int currentIndex = 0;
-
- s_log.debug("Searching project...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getProjectOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getProjectOrder(): %d",
- getProjectOrder()));
- if (this.getProject().equals(project)) {
- break;
- }
-
- previousPosition = currentPosition;
- previousIndex = currentIndex;
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided project is not "
- + "part of this collection."));
- }
-
- if (previousPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided project is the first one in this "
- + "collection, so there is no previous one to switch "
- + "with."));
- }
-
- this.rewind();
- while (this.getPosition() != previousPosition) {
- this.next();
- }
-
- this.setProjectOrder(currentIndex);
- this.next();
- this.setProjectOrder(previousIndex);
- this.rewind();
- }
-
- public SciProject getProject() {
- return new SciProject(m_dataCollection.getDataObject());
- }
-}
-
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentSubDepartmentsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentSubDepartmentsCollection.java
deleted file mode 100644
index 816a7f883..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartmentSubDepartmentsCollection.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import org.apache.log4j.Logger;
-
-/**
- * Special domain collection for the subdepartments of a department.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentSubDepartmentsCollection extends DomainCollection {
-
- public String ORDER = "subDepartmentOrder";
- public String LINKORDER = "link.subDepartmentOrder";
- private static final Logger s_log =
- Logger.getLogger(SciDepartmentSubDepartmentsCollection.class);
-
- public SciDepartmentSubDepartmentsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addOrder(LINKORDER);
- }
-
- public Integer getSubDepartmentOrder() {
- return (Integer) m_dataCollection.get(LINKORDER);
- }
-
- public void setSubDepartmentOrder(Integer order) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(ORDER, order);
- }
-
- public void swapWithNext(SciDepartment department) {
- int currentPosition = 0;
- int currentIndex = 0;
- int nextIndex = 0;
-
- s_log.debug("Searching department...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getSubDepartmentOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getDepartmentOrder(): %d",
- getSubDepartmentOrder()));
- if (this.getSubDepartment().equals(department)) {
- break;
- }
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided department is not "
- + "part of this collection."));
- }
-
- if (this.next()) {
- nextIndex = this.getSubDepartmentOrder();
- } else {
- throw new IllegalArgumentException(
- "The provided department is the last "
- + "in the collection, so there is no next object "
- + "to swap with.");
- }
-
- this.rewind();
-
- while (this.getPosition() != currentPosition) {
- this.next();
- }
-
- this.setSubDepartmentOrder(nextIndex);
- this.next();
- this.setSubDepartmentOrder(currentIndex);
- this.rewind();
- }
-
- public void swapWithPrevious(SciDepartment department) {
- int previousPosition = 0;
- int previousIndex = 0;
- int currentPosition = 0;
- int currentIndex = 0;
-
- s_log.debug("Searching department...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getSubDepartmentOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getDepartmentOrder(): %d",
- getSubDepartmentOrder()));
- if (this.getSubDepartment().equals(department)) {
- break;
- }
-
- previousPosition = currentPosition;
- previousIndex = currentIndex;
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided department is not "
- + "part of this collection."));
- }
-
- if (previousPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided department is the first one in this "
- + "collection, so there is no previous one to switch "
- + "with."));
- }
-
- this.rewind();
- while (this.getPosition() != previousPosition) {
- this.next();
- }
-
- this.setSubDepartmentOrder(currentIndex);
- this.next();
- this.setSubDepartmentOrder(previousIndex);
- this.rewind();
- }
-
- public SciDepartment getSubDepartment() {
- return new SciDepartment(m_dataCollection.getDataObject());
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMember.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMember.java
deleted file mode 100644
index c64615130..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMember.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * A concrete class extending {@link GenericPerson}. Does not add any new
- * fields, it just makes the internal type GenericPerson usable
- * without any other modules.
- *
- * @author Jens Pelzetter
- */
-public class SciMember extends GenericPerson {
-
- private static final Logger logger = Logger.getLogger(SciMember.class);
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.contenttypes.SciMember";
- private static final String ORGANIZATIONS = "organizationalunit";
- private static final String DEPARTMENTS = "organizationalunit";
- private static final String PROJECTS = "organizationalunit";
- private static final SciOrganizationConfig s_config =
- new SciOrganizationConfig();
-
- static {
- logger.debug("Static initalizer starting...");
- s_config.load();
- logger.debug("Static initalizer starting...");
- }
-
- public SciMember() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- public SciMember(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public SciMember(OID oid) throws DataObjectNotFoundException {
- super(oid);
- }
-
- public SciMember(DataObject dobj) {
- super(dobj);
- }
-
- public SciMember(String type) {
- super(type);
- }
-
- public SciMemberSciOrganizationsCollection getOrganizations() {
- return new SciMemberSciOrganizationsCollection((DataCollection) get(
- ORGANIZATIONS));
- }
-
- public void addOrganization(SciOrganization organization,
- String role,
- String status) {
- Assert.exists(organization, SciOrganization.class);
-
- DataObject link = add(ORGANIZATIONS, organization);
-
- link.set(SciMemberSciOrganizationsCollection.MEMBER_ROLE, role);
- link.set(SciMemberSciOrganizationsCollection.STATUS, status);
- link.save();
- }
-
- public void removeOrganization(SciOrganization organization) {
- Assert.exists(organization, SciOrganization.class);
-
- remove(ORGANIZATIONS, organization);
- }
-
- public SciMemberSciDepartmentsCollection getDepartments() {
- return new SciMemberSciDepartmentsCollection((DataCollection) get(DEPARTMENTS));
- }
-
- public void addDepartment(SciDepartment department,
- String role,
- String status) {
- Assert.exists(department, SciDepartment.class);
-
- DataObject link = add(DEPARTMENTS, department);
-
- link.set(SciMemberSciDepartmentsCollection.MEMBER_ROLE, role);
- link.set(SciMemberSciDepartmentsCollection.STATUS, status);
- link.save();
- }
-
- public void removeDepartment(SciDepartment department) {
- Assert.exists(department, SciDepartment.class);
-
- remove(DEPARTMENTS, department);
- }
-
- public SciMemberSciProjectsCollection getProjects() {
- return new SciMemberSciProjectsCollection((DataCollection) get(PROJECTS));
- }
-
- public void addProject(SciProject project,
- String role,
- String status) {
- Assert.exists(project, SciProject.class);
-
- DataObject link = add(PROJECTS, project);
-
- link.set(SciMemberSciDepartmentsCollection.MEMBER_ROLE, role);
- link.set(SciMemberSciDepartmentsCollection.STATUS, status);
- link.save();
- }
-
- public void removeProject(SciProject project) {
- Assert.exists(project, SciProject.class);
-
- remove(PROJECTS, project);
- }
-
- public static SciOrganizationConfig getConfig() {
- return s_config;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberInitializer.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberInitializer.java
deleted file mode 100644
index ad25ccabd..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberInitializer.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-/**
- * Initializer for {@link SciMember}
- *
- * @author Jens Pelzetter
- */
-public class SciMemberInitializer extends ContentTypeInitializer {
-
- public SciMemberInitializer() {
- super("empty.pdl.mf", SciMember.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/SciMember.xsl"
- };
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciMember.xml";
-
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberLoader.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberLoader.java
deleted file mode 100644
index 0749a92c3..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberLoader.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-/**
- * Loader for {@link SciMember}
- *
- * @author Jens Pelzetter
- */
-public class SciMemberLoader extends AbstractContentTypeLoader {
-
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciMember.xml"};
-
- @Override
- public String[] getTypes() {
- return TYPES;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciDepartmentsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciDepartmentsCollection.java
deleted file mode 100644
index 87d0f566e..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciDepartmentsCollection.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciMemberSciDepartmentsCollection extends DomainCollection {
-
- public static final String LINK_MEMBER_ROLE = "link.role_name";
- public static final String LINK_STATUS = "link.status";
- public static final String MEMBER_ROLE = "role_name";
- public static final String STATUS = "status";
-
- public SciMemberSciDepartmentsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addFilter(String.format("type = '%s'",
- ContentType.
- findByAssociatedObjectType(SciDepartment.class.getName()).getID().
- toString()));
-
- m_dataCollection.addOrder("title");
- }
-
- public String getRoleName() {
- return (String) m_dataCollection.get(LINK_MEMBER_ROLE);
- }
-
- public void setRoleName(String roleName) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(MEMBER_ROLE, roleName);
- }
-
- public String getStatus() {
- return (String) m_dataCollection.get(LINK_STATUS);
- }
-
- public void setStatus(String status) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(STATUS, status);
- }
-
- public SciDepartment getDepartment() {
- return (SciDepartment) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciOrganizationsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciOrganizationsCollection.java
deleted file mode 100644
index bdace84a8..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciOrganizationsCollection.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciMemberSciOrganizationsCollection extends DomainCollection {
-
- public static final String LINK_MEMBER_ROLE = "link.role_name";
- public static final String LINK_STATUS = "link.status";
- public static final String MEMBER_ROLE = "role_name";
- public static final String STATUS = "status";
-
- public SciMemberSciOrganizationsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addFilter(String.format("type = '%s'",
- ContentType.
- findByAssociatedObjectType(SciOrganization.class.getName()).
- getID().toString()));
-
- m_dataCollection.addOrder("title");
- }
-
- public String getRoleName() {
- return (String) m_dataCollection.get(LINK_MEMBER_ROLE);
- }
-
- public void setRoleName(String roleName) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(MEMBER_ROLE, roleName);
- }
-
- public String getStatus() {
- return (String) m_dataCollection.get(LINK_STATUS);
- }
-
- public void setStatus(String status) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(STATUS, status);
- }
-
- public SciOrganization getOrganization() {
- return (SciOrganization) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciProjectsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciProjectsCollection.java
deleted file mode 100644
index 36aab5820..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciMemberSciProjectsCollection.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciMemberSciProjectsCollection extends DomainCollection {
-
- public static final String LINK_MEMBER_ROLE = "link.role_name";
- public static final String LINK_STATUS = "link.status";
- public static final String MEMBER_ROLE = "role_name";
- public static final String STATUS = "status";
-
- public SciMemberSciProjectsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addFilter(String.format("type = '%s'",
- ContentType.
- findByAssociatedObjectType(SciProject.class.getName()).getID().
- toString()));
-
- m_dataCollection.addOrder("title");
- }
-
- public String getRoleName() {
- return (String) m_dataCollection.get(LINK_MEMBER_ROLE);
- }
-
- public void setRoleName(String roleName) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(MEMBER_ROLE, roleName);
- }
-
- public String getStatus() {
- return (String) m_dataCollection.get(LINK_STATUS);
- }
-
- public void setStatus(String status) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(STATUS, status);
- }
-
- public SciProject getProject() {
- return (SciProject) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
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
deleted file mode 100644
index 02f2b6d54..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java
+++ /dev/null
@@ -1,524 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-import org.apache.log4j.Logger;
-
-/**
- *
- * A class for representing departments of an organization. Adds two
- * associations to {@link GenericOrganizationalUnit}:
- *
- *
- * - departments
- * - projects
- *
- *
- * The departments association is used to link an organization with
- * its departments. The project association can be used to link an
- * organization with projects.
- *
- *
- * Also, two fields are added. The shortDescription takes a string
- * of 500 characters for a short description of the organization. An detailed
- * description of the organization can be put into the description
- * field.
- *
- *
- * There is an
- * UML digram
- * with an overview of the content types and their associations. Please not that
- * the diagram show a design sketch and not the actually implemented classes.
- *
- *
- * @author Jens Pelzetter
- * @see GenericOrganizationalUnit
- * @see SciDepartment
- * @see SciProject
- */
-public class SciOrganization extends GenericOrganizationalUnit {
-
- private static final Logger logger = Logger.getLogger(SciOrganization.class);
- public static final String ORGANIZATION_SHORT_DESCRIPTION =
- "organizationShortDescription";
- public static final String ORGANIZATION_DESCRIPTION =
- "organizationDescription";
- public static final String DEPARTMENTS = "departments";
- public static final String DEPARTMENT_ORDER = "departmentOrder";
- public static final String PROJECTS = "projects";
- public static final String PROJECT_ORDER = "projectOrder";
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.contenttypes.SciOrganization";
- private static final SciOrganizationConfig s_config =
- new SciOrganizationConfig();
-
- static {
- logger.debug("Static initalizer starting...");
- s_config.load();
- logger.debug("Static initalizer finished.");
- }
-
- public enum MemberStatus {
-
- ALL,
- ACTIVE,
- ASSOCIATED,
- FORMER
- }
-
- public enum ProjectStatus {
-
- ALL,
- ONGOING,
- FINISHED
- }
-
- public SciOrganization() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- public SciOrganization(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public SciOrganization(OID oid) throws DataObjectNotFoundException {
- super(oid);
- }
-
- public SciOrganization(DataObject obj) {
- super(obj);
- }
-
- public SciOrganization(String type) {
- super(type);
- }
-
- public static SciOrganizationConfig getConfig() {
- return s_config;
- }
-
- public String getOrganizationShortDescription() {
- return (String) get(ORGANIZATION_SHORT_DESCRIPTION);
- }
-
- public void setOrganizationShortDescription(String description) {
- set(ORGANIZATION_SHORT_DESCRIPTION, description);
- }
-
- public String getOrganizationDescription() {
- return (String) get(ORGANIZATION_DESCRIPTION);
- }
-
- @Override
- public boolean hasContacts() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfContactsOfSciOrganization");
- query.setParameter("organization", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }
-
- public boolean hasDepartments() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
- query.setParameter("organization", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }
-
- /**
- *
- * @param merge Should I also look into the departments and return true
- * if the organization or at least one of the departments has members?
- * @param status
- * @return
- */
- public boolean hasMembers(final boolean merge, final MemberStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciOrganization";
- break;
- case ACTIVE:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciOrganization";
- break;
- case ASSOCIATED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciOrganization";
- break;
- case FORMER:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciOrganization";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("organization", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
- departmentsQuery.setParameter("organization", getID());
-
- if (departmentsQuery.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "departmentId");
- result = hasMembers(departmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasMembers(final BigDecimal departmentId,
- final boolean merge,
- final MemberStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciDepartment";
- break;
- case ACTIVE:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciDepartment";
- break;
- case ASSOCIATED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciDepartment";
- break;
- case FORMER:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciDepartment";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("department", departmentId);
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (query.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- result = hasMembers(subDepartmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public boolean hasProjects(final boolean merge,
- final ProjectStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciOrganization";
- break;
- case ONGOING:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciOrganization";
- break;
- case FINISHED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciOrganization";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("organization", getID());
- if (status != ProjectStatus.ALL) {
- Calendar today = new GregorianCalendar();
- query.setParameter("today",
- String.format("%d-%02d-%02d",
- today.get(Calendar.YEAR),
- today.get(Calendar.MONTH) + 1,
- today.get(Calendar.DAY_OF_MONTH)));
- }
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
- departmentsQuery.setParameter("organization", getID());
-
- if (departmentsQuery.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "departmentId");
- result = hasProjects(departmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasProjects(final BigDecimal departmentId,
- final boolean merge,
- final ProjectStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciDepartment";
- break;
- case ONGOING:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfOngoingProjectsOfSciDepartment";
- break;
- case FINISHED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFinishedProjectsOfSciDepartment";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("department", departmentId);
- if (status != ProjectStatus.ALL) {
- Calendar today = new GregorianCalendar();
- query.setParameter("today",
- String.format("%d-%02d-%02d",
- today.get(Calendar.YEAR),
- today.get(Calendar.MONTH) + 1,
- today.get(Calendar.DAY_OF_MONTH)));
-
- }
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (subDepartmentsQuery.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- result = hasProjects(subDepartmentId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- /*public boolean hasPublications() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationLinksOfSciOrganization");
- query.setParameter("organization", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }*/
-
- public void setOrganizationDescription(String description) {
- set(ORGANIZATION_DESCRIPTION, description);
- }
-
- public SciOrganizationDepartmentsCollection getDepartments() {
- return new SciOrganizationDepartmentsCollection(
- (DataCollection) get(DEPARTMENTS));
- }
-
- public void addDepartment(SciDepartment department) {
- Assert.exists(department, SciDepartment.class);
-
- DataObject link = add(DEPARTMENTS, department);
-
- link.set(DEPARTMENT_ORDER,
- Integer.valueOf((int) getDepartments().size()));
- link.save();
- }
-
- public void removeDepartment(SciDepartment department) {
- Assert.exists(department, SciDepartment.class);
-
- remove(DEPARTMENTS, department);
- }
-
- public SciOrganizationProjectsCollection getProjects() {
- return new SciOrganizationProjectsCollection(
- (DataCollection) get(PROJECTS));
- }
-
- public void addProject(SciProject project) {
- Assert.exists(project, SciProject.class);
-
- DataObject link = add(PROJECTS, project);
- link.set(PROJECT_ORDER, Integer.valueOf((int) getProjects().size()));
- link.set(SciProject.ORGANIZATIONS_ORDER, Integer.valueOf((int) project.
- getOrganizations().size()));
- link.save();
- }
-
- public void removeProject(SciProject project) {
- Assert.exists(project, SciProject.class);
-
- remove(PROJECTS, project);
- }
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig.java
deleted file mode 100644
index 110b93027..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig.java
+++ /dev/null
@@ -1,329 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.runtime.AbstractConfig;
-import com.arsdigita.util.parameter.BooleanParameter;
-import com.arsdigita.util.parameter.Parameter;
-
-/**
- * Configuration class for the complete ccm-sci-types-organization-module.
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationConfig extends AbstractConfig {
-
- private final Parameter m_organizationAddPersonHide;
- private final Parameter m_organizationAddDepartmentHide;
- private final Parameter m_organizationAddProjectHide;
- private final Parameter m_organizationAddContactHide;
- private final Parameter m_organizationMembersAllInOne;
- private final Parameter m_organizationMembersMerge;
- private final Parameter m_organizationProjectsAllInOne;
- private final Parameter m_organizationProjectsMerge;
- private final Parameter m_departmentAddPersonHide;
- private final Parameter m_departmentAddSubDepartmentHide;
- private final Parameter m_departmentAddProjectHide;
- private final Parameter m_departmentSetOrganizationHide;
- private final Parameter m_departmentSetSuperDepartmentHide;
- private final Parameter m_departmentAddContactHide;
- private final Parameter m_departmentPublicationsHide;
- private final Parameter m_projectAddPersonHide;
- private final Parameter m_projectAddOrganizationHide;
- private final Parameter m_projectAddDepartmentHide;
- private final Parameter m_projectAddSubProjectHide;
- private final Parameter m_projectSetSuperProjectHide;
- private final Parameter m_projectAddContactHide;
- private final Parameter m_organizationDescriptionDhtml;
- private final Parameter m_departmentDescriptionDhtml;
- private final Parameter m_projectDescriptionDhtml;
- private final Parameter m_projectFundingHide;
- private final Parameter m_projectFundingDhtml;
- private final Parameter m_projectFundingVolumeHide;
- private final Parameter m_projectMaterialsHide;
- private final Parameter m_projectMembersAllInOne;
- private final Parameter m_projectMembersMerge;
-
- public SciOrganizationConfig() {
-
- m_organizationAddPersonHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.add_person_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_organizationAddDepartmentHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.add_department_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_organizationAddProjectHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.add_project_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_organizationAddContactHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_organizationMembersAllInOne = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_organizationMembersMerge = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.members_merge",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_organizationProjectsAllInOne = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_organizationProjectsMerge = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.projects_merge",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_departmentAddPersonHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.add_person_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_departmentAddSubDepartmentHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_departmentAddProjectHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.add_project_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_departmentSetOrganizationHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.organization_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_departmentSetSuperDepartmentHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_departmentAddContactHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_departmentPublicationsHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.publications_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_projectAddPersonHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.add_person_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_projectAddOrganizationHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.add_organization_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_projectAddDepartmentHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.add_department_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_projectAddSubProjectHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_projectSetSuperProjectHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_projectAddContactHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.add_project_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_organizationDescriptionDhtml = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.description_dhtml",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_departmentDescriptionDhtml = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.scidepartment.description_dhtml",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_projectDescriptionDhtml = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.description_dhtml",
- Parameter.REQUIRED,
- Boolean.TRUE);
-
- m_projectFundingHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.funding_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_projectFundingDhtml = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.funding_dhtml",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_projectFundingVolumeHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
- m_projectMaterialsHide = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.materials_hide",
- Parameter.REQUIRED,
- Boolean.FALSE);
-
- m_projectMembersAllInOne = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.members_all_in_one",
- Parameter.REQUIRED,
- Boolean.TRUE);
- m_projectMembersMerge = new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciproject.members_merge",
- Parameter.REQUIRED,
- Boolean.FALSE);
-
- register(m_organizationAddPersonHide);
- register(m_organizationAddDepartmentHide);
- register(m_organizationAddProjectHide);
- register(m_organizationMembersAllInOne);
- register(m_organizationMembersMerge);
- register(m_organizationProjectsAllInOne);
- register(m_organizationProjectsMerge);
-
- register(m_departmentAddPersonHide);
- register(m_departmentAddSubDepartmentHide);
- register(m_departmentAddProjectHide);
- register(m_departmentSetOrganizationHide);
- register(m_departmentSetSuperDepartmentHide);
- register(m_departmentPublicationsHide);
-
- register(m_projectAddPersonHide);
- register(m_projectAddOrganizationHide);
- register(m_projectAddDepartmentHide);
- register(m_projectAddSubProjectHide);
- register(m_projectSetSuperProjectHide);
-
- register(m_organizationDescriptionDhtml);
- register(m_departmentDescriptionDhtml);
- register(m_projectDescriptionDhtml);
-
- register(m_organizationAddContactHide);
- register(m_departmentAddContactHide);
- register(m_projectAddContactHide);
-
- register(m_projectFundingHide);
- register(m_projectFundingVolumeHide);
- register(m_projectFundingDhtml);
- register(m_projectMaterialsHide);
-
- register(m_projectMembersAllInOne);
- register(m_projectMembersMerge);
-
- loadInfo();
- }
-
- public final boolean getOrganizationAddPersonHide() {
- return (Boolean) get(m_organizationAddPersonHide);
- }
-
- public final boolean getOrganizationAddDepartmentHide() {
- return (Boolean) get(m_organizationAddDepartmentHide);
- }
-
- public final boolean getOrganizationAddProjectHide() {
- return (Boolean) get(m_organizationAddProjectHide);
- }
-
- public final boolean getOrganizationAddContactHide() {
- return (Boolean) get(m_organizationAddContactHide);
- }
-
- public final boolean getOrganizationMembersAllInOne() {
- return (Boolean) get(m_organizationMembersAllInOne);
- }
-
- public final boolean getOrganizationMembersMerge() {
- return (Boolean) get(m_organizationMembersMerge);
- }
-
- public final boolean getOrganizationProjectsAllInOne() {
- return (Boolean) get(m_organizationProjectsAllInOne);
- }
-
- public final boolean getOrganizationProjectsMerge() {
- return (Boolean) get(m_organizationProjectsMerge);
- }
-
- public final boolean getDepartmentAddPersonHide() {
- return (Boolean) get(m_departmentAddPersonHide);
- }
-
- public final boolean getDepartmentAddSubDepartmentHide() {
- return (Boolean) get(m_departmentAddSubDepartmentHide);
- }
-
- public final boolean getDepartmentAddProjectHide() {
- return (Boolean) get(m_departmentAddProjectHide);
- }
-
- public final boolean getDepartmentSetOrganizationHide() {
- return (Boolean) get(m_departmentSetOrganizationHide);
- }
-
- public final boolean getDepartmentSetSuperDepartmentHide() {
- return (Boolean) get(m_departmentSetSuperDepartmentHide);
- }
-
- public final boolean getDepartmentAddContactHide() {
- return (Boolean) get(m_departmentAddContactHide);
- }
-
- public final boolean getDepartmentPublicationsHide() {
- return (Boolean) get(m_departmentPublicationsHide);
- }
-
- public final boolean getProjectAddPersonHide() {
- return (Boolean) get(m_projectAddPersonHide);
- }
-
- public final boolean getProjectAddOrganizationHide() {
- return (Boolean) get(m_projectAddOrganizationHide);
- }
-
- public final boolean getProjectAddDepartmentHide() {
- return (Boolean) get(m_projectAddDepartmentHide);
- }
-
- public final boolean getProjectAddSubProjectHide() {
- return (Boolean) get(m_projectAddSubProjectHide);
- }
-
- public final boolean getProjectSetSuperProjectHide() {
- return (Boolean) get(m_projectSetSuperProjectHide);
- }
-
- public final boolean getProjectAddContactHide() {
- return (Boolean) get(m_projectAddContactHide);
- }
-
- public final boolean getOrganizationDescriptionDhtml() {
- return (Boolean) get(m_organizationDescriptionDhtml);
- }
-
- public final boolean getDepartmentDescriptionDhtml() {
- return (Boolean) get(m_departmentDescriptionDhtml);
- }
-
- public final boolean getProjectDescriptionDhtml() {
- return (Boolean) get(m_projectDescriptionDhtml);
- }
-
- public final boolean getProjectFundingHide() {
- return (Boolean) get(m_projectFundingHide);
- }
-
- public final boolean getProjectFundingDhtml() {
- return (Boolean) get(m_projectFundingDhtml);
- }
-
- public final boolean getProjectFundingVolumeHide() {
- return (Boolean) get(m_projectFundingVolumeHide);
- }
-
- public final boolean getProjectMaterialsHide() {
- return (Boolean) get(m_projectMaterialsHide);
- }
-
- public final boolean getProjectMembersAllInOne() {
- return (Boolean) get(m_projectMembersAllInOne);
- }
-
- public final boolean getProjectMembersMerge() {
- return (Boolean) get(m_projectMembersMerge);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig_parameter.properties b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig_parameter.properties
deleted file mode 100644
index 257f09b04..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationConfig_parameter.properties
+++ /dev/null
@@ -1,144 +0,0 @@
-com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.title = Hide the persons add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.purpose = Hide the persons add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.example = false
-com.arsdigita.cms.contenttypes.sciorganization.add_person_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.title = Hide the department add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.purpose = Hide the department add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.example = false
-com.arsdigita.cms.contenttypes.sciorganization.add_department_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.title = Hide the project add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.purpose = Hide the project add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.example = false
-com.arsdigita.cms.contenttypes.sciorganization.add_project_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.title = Hide the contact add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.purpose = Hide the contact add step of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.example = false
-com.arsdigita.cms.contenttypes.sciorganization.add_contact_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one.title = Members All-in-one
-com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one.purpose = Show all members (active, associated and former) in one instead in three seprated lists
-com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one.example = false
-com.arsdigita.cms.contenttypes.sciorganization.members_all_in_one.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.title = Merge members
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.purpose = Merge members from all departments and the organization into one list (or three list, for each status)
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.example = true
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.title = Project All-in-one
-com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.purpose = Show all projects (ongoing and finished) in one instead of two seperated lists.
-com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.example = false
-com.arsdigita.cms.contenttypes.sciorganization.projects_all_in_one.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.projects_merge.title = Merge projects
-com.arsdigita.cms.contenttypes.sciorganization.projects_merge.purpose = Merge all projects from the organization and its departments into one list (or two list for ongoing and finished projects)
-com.arsdigita.cms.contenttypes.sciorganization.projects_merge.examle = true
-com.arsdigita.cms.contenttypes.sciorganization.projects_merge.format = [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.title = Hide the person add step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.purpose = Hide the person add step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.example = false
-com.arsdigita.cms.contenttypes.scidepartment.add_person_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.title = Hide the subdepartment add step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.purpose = Hide the subdepartment add step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.example = true
-com.arsdigita.cms.contenttypes.scidepartment.add_subdepartment_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.title = Hide the organization set step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.purpose = Hide the organization set step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.example = false
-com.arsdigita.cms.contenttypes.scidepartment.set_organization_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.title = Hide the superdepartment set step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.purpose = Hide the superdepartment set step of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.example = false
-com.arsdigita.cms.contenttypes.scidepartment.set_superdepartment_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.title = Hide the contact add step of Scidepartment
-com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.purpose = Hide the contact add step of Scidepartment
-com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.example = false
-com.arsdigita.cms.contenttypes.scidepartment.add_contact_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.add_person_hide.title = Hide the person add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_person_hide.purpose = Hide the person add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_person_hide.example = false
-com.arsdigita.cms.contenttypes.sciproject.add_person_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.title = Hide the organization add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.purpose = Hide the organization add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.example = false
-com.arsdigita.cms.contenttypes.sciproject.add_organization_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.add_department_hide.title = Hide the department add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_department_hide.purpose Hide the department add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_department_hide.example = false
-com.arsdigita.cms.contenttypes.sciproject.add_department_hide = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.title = Hide the subproject add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.purpose = Hide the subproject add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.example = true
-com.arsdigita.cms.contenttypes.sciproject.add_subproject_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.title = Hide the superproject add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.purpose = Hide the superprojecft add step of SciProject
-com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.example = true
-com.arsdigita.cms.contenttypes.sciproject.set_superproject_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.title = Toggles the DHTML for the description of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.purpose = Toggles the DHTML for the description of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.example = true
-com.arsdigita.cms.contenttypes.sciorganization.description_dhtml.format = [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.description_dhtml.title = Toggles the DHTML for the description of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.description_dhtml.purpose = Toggles the DHTML for the description of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.description_dhtml.example = true
-com.arsdigita.cms.contenttypes.scidepartment.description_dhtml = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.description_dhtml.title = Toggles the DHTML for the description of SciProject
-com.arsdigita.cms.contenttypes.sciproject.description_dhtml.purpose = Toggles the DHTML for the description of SciProject
-com.arsdigita.cms.contenttypes.sciproject.description_dhtml.example = true
-com.arsdigita.cms.contenttypes.sciproject.description_dhtml.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.title = Hide the contact add step of Sciproject
-com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.purpose = Hide the contact add step of Sciproject
-com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.example = false
-com.arsdigita.cms.contenttypes.sciproject.add_contact_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.funding_hide.title = Hide funding text input
-com.arsdigita.cms.contenttypes.sciproject.funding_hide.purpose = Hide the funding text input
-com.arsdigita.cms.contenttypes.sciproject.funding_hide.example = false
-com.arsdigita.cms.contenttypes.sciproject.funding_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.title = Hide funding_volume text input
-com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.purpose = Hide the funding_volume text input
-com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.example = true
-com.arsdigita.cms.contenttypes.sciproject.funding_volume_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.title = Toggles the DHTML editor for funding
-com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.purpose = Toggles the DHTML editor for funding
-com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.example = false
-com.arsdigita.cms.contenttypes.sciproject.funding_dhtml.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.materials_hide.title = Hides the step for linking materials with a project
-com.arsdigita.cms.contenttypes.sciproject.materials_hide.purpose = Hides the step for linking materials with a project
-com.arsdigita.cms.contenttypes.sciproject.materials_hide.example = false
-com.arsdigita.cms.contenttypes.sciproject.materials_hide.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.title = Members All-in-one
-com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.purpose = Show all members (active, associated and former) in one instead in three separated lists
-com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.example = true
-com.arsdigita.cms.contenttypes.sciproject.members_all_in_one.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.title = Merge members
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.purpose = Merge members from all subproject into one list (or three list, for each status)
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.example = false
-com.arsdigita.cms.contenttypes.sciorganization.members_merge.format = [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.publications_hide.title = Hides the step for linking publications with a department
-com.arsdigita.cms.contenttypes.scidepartment.publications_hide.purpose = Hides the step for linking publications with a department
-com.arsdigita.cms.contenttypes.scidepartment.publications_hide.example = false
-com.arsdigita.cms.contenttypes.scidepartment.publications_hide.format = [boolean]
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationDepartmentsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationDepartmentsCollection.java
deleted file mode 100644
index fbac5a36f..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationDepartmentsCollection.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import org.apache.log4j.Logger;
-
-/**
- * Special domain collection for the departments of an organization.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- * @see SciDepartment
- */
-public class SciOrganizationDepartmentsCollection extends DomainCollection {
-
- public String ORDER = "departmentOrder";
- public String LINKORDER = "link.departmentOrder";
- private static final Logger s_log =
- Logger.getLogger(SciOrganizationDepartmentsCollection.class);
-
- public SciOrganizationDepartmentsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addOrder(LINKORDER);
- }
-
- public Integer getDepartmentOrder() {
- return (Integer) m_dataCollection.get(LINKORDER);
- }
-
- public void setDepartmentOrder(Integer order) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(ORDER, order);
- }
-
- public void swapWithNext(SciDepartment department) {
- int currentPosition = 0;
- int currentIndex = 0;
- int nextIndex = 0;
-
- s_log.debug("Searching department...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getDepartmentOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getDepartmentOrder(): %d",
- getDepartmentOrder()));
- if (this.getDepartment().equals(department)) {
- break;
- }
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided department is not "
- + "part of this collection."));
- }
-
- if (this.next()) {
- nextIndex = this.getDepartmentOrder();
- } else {
- throw new IllegalArgumentException(
- "The provided department is the last "
- + "in the collection, so there is no next object "
- + "to swap with.");
- }
-
- this.rewind();
-
- while (this.getPosition() != currentPosition) {
- this.next();
- }
-
- this.setDepartmentOrder(nextIndex);
- this.next();
- this.setDepartmentOrder(currentIndex);
- this.rewind();
- }
-
- public void swapWithPrevious(SciDepartment department) {
- int previousPosition = 0;
- int previousIndex = 0;
- int currentPosition = 0;
- int currentIndex = 0;
-
- s_log.debug("Searching department...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getDepartmentOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getDepartmentOrder(): %d",
- getDepartmentOrder()));
- if (this.getDepartment().equals(department)) {
- break;
- }
-
- previousPosition = currentPosition;
- previousIndex = currentIndex;
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided department is not "
- + "part of this collection."));
- }
-
- if (previousPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided department is the first one in this "
- + "collection, so there is no previous one to switch "
- + "with."));
- }
-
- this.rewind();
- while (this.getPosition() != previousPosition) {
- this.next();
- }
-
- this.setDepartmentOrder(currentIndex);
- this.next();
- this.setDepartmentOrder(previousIndex);
- this.rewind();
- }
-
- public SciDepartment getDepartment() {
- return new SciDepartment(m_dataCollection.getDataObject());
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationInitializer.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationInitializer.java
deleted file mode 100644
index be48223c4..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationInitializer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import org.apache.log4j.Logger;
-
-/**
- * Initalizer for {@link SciOrganization}
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationInitializer extends ContentTypeInitializer {
-
- private static final Logger s_log = Logger.getLogger(
- SciOrganizationInitializer.class);
-
- public SciOrganizationInitializer() {
- super("ccm-sci-types-organization.pdl.mf",
- SciOrganization.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xsl"
- };
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganization.xml";
-
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationLoader.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationLoader.java
deleted file mode 100644
index f6ea5a8a7..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationLoader.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.util.parameter.Parameter;
-import com.arsdigita.util.parameter.ResourceParameter;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import java.io.InputStream;
-
-/**
- * Loader for {@link SciOrganization}
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationLoader extends AbstractContentTypeLoader {
-
- private ResourceParameter m_template;
-
- public SciOrganizationLoader() {
- super();
-
- m_template = new ResourceParameter(
- "com.arsdigita.cms.contenttypes.SciOrganizationTemplate",
- Parameter.REQUIRED,
- "/WEB-INF/content-types/com/arsdigita/"
- + "cms/contenttypes/sciorganization-item.jsp");
-
- register(m_template);
-
- }
-
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/"
- + "SciOrganization.xml"
- };
-
- @Override
- public String[] getTypes() {
- return TYPES;
- }
-
- @Override
- protected void prepareSection(final ContentSection section,
- final ContentType type,
- final LifecycleDefinition lifecycle,
- final WorkflowTemplate workflow) {
- super.prepareSection(section, type, lifecycle, workflow);
-
- setDefaultTemplate("SciOrganization Item",
- "sciorganization-item",
- (InputStream) get(m_template),
- section,
- type,
- lifecycle,
- workflow);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationProjectsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationProjectsCollection.java
deleted file mode 100644
index ea99039f6..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganizationProjectsCollection.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import org.apache.log4j.Logger;
-
-/**
- * Special domain collection for the projects of an organization.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- * @see SciProject
- */
-public class SciOrganizationProjectsCollection extends DomainCollection {
-
- public String ORDER = "projectOrder";
- public String LINKORDER = "link.projectOrder";
- private static final Logger s_log =
- Logger.getLogger(SciOrganizationProjectsCollection.class);
-
- public SciOrganizationProjectsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addOrder(LINKORDER);
- }
-
- public Integer getProjectOrder() {
- return (Integer) m_dataCollection.get(LINKORDER);
- }
-
- public void setProjectOrder(Integer order) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(ORDER, order);
- }
-
- public void swapWithNext(SciProject project) {
- int currentPosition = 0;
- int currentIndex = 0;
- int nextIndex = 0;
-
- s_log.debug("Searching project...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getProjectOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getProjectOrder(): %d",
- getProjectOrder()));
- if (this.getProject().equals(project)) {
- break;
- }
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided project is not "
- + "part of this collection."));
- }
-
- if (this.next()) {
- nextIndex = this.getProjectOrder();
- } else {
- throw new IllegalArgumentException(
- "The provided project is the last "
- + "in the collection, so there is no next object "
- + "to swap with.");
- }
-
- this.rewind();
-
- while (this.getPosition() != currentPosition) {
- this.next();
- }
-
- this.setProjectOrder(nextIndex);
- this.next();
- this.setProjectOrder(currentIndex);
- this.rewind();
- }
-
- public void swapWithPrevious(SciProject project) {
- int previousPosition = 0;
- int previousIndex = 0;
- int currentPosition = 0;
- int currentIndex = 0;
-
- s_log.debug("Searching project...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getProjectOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getProjectOrder(): %d",
- getProjectOrder()));
- if (this.getProject().equals(project)) {
- break;
- }
-
- previousPosition = currentPosition;
- previousIndex = currentIndex;
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided project is not "
- + "part of this collection."));
- }
-
- if (previousPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided project is the first one in this "
- + "collection, so there is no previous one to switch "
- + "with."));
- }
-
- this.rewind();
- while (this.getPosition() != previousPosition) {
- this.next();
- }
-
- this.setProjectOrder(currentIndex);
- this.next();
- this.setProjectOrder(previousIndex);
- this.rewind();
- }
-
- public SciProject getProject() {
- return new SciProject(m_dataCollection.getDataObject());
- }
-}
-
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java
deleted file mode 100644
index 784f6f260..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java
+++ /dev/null
@@ -1,496 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-import java.util.Date;
-import org.apache.log4j.Logger;
-
-/**
- *
- * The class represents a (scientific) project. It extends
- * {@link GenericOrganizationalUnit} and adds a relation for subprojects and
- * some fields for additional information:
- *
- *
- * projectBegin
- * - The begin of the project
- * projectEnd
- * - The end of the project
- * shortDescription
- * - A short description (500 characters) of the project
- * description
- * - A description of the project/
-
- *
funding-
- *
- A text about the funding of the project
- * fundingVolume
- * Volume of the funding
- *
- *
- * Also, the class has some methods the access the associations defined by
- * {@link SciOrganization} and {@link SciDepartment} with
- * SciProject.
- *
- *
- * There is an
- * UML digram
- * with an overview of the content types and their associations. Please not that
- * the diagram show a design sketch and not the actually implemented classes.
- *
- *
- * @author Jens Pelzetter
- * @see GenericOrganizationalUnit
- * @see SciOrganization
- * @see SciDepartment
- */
-public class SciProject extends GenericOrganizationalUnit {
-
- public static final String BEGIN = "projectbegin";
- public static final String END = "projectend";
- public static final String PROJECT_SHORT_DESCRIPTION = "projectShortDesc";
- public static final String PROJECT_DESCRIPTION = "projectDescription";
- public static final String FUNDING = "funding";
- public static final String FUNDING_VOLUME = "fundingVolume";
- public static final String SUBPROJECTS = "subProjects";
- public static final String SUBPROJECT_ORDER = "subProjectOrder";
- public static final String ORGANIZATIONS = "organization";
- public static final String ORGANIZATIONS_ORDER = "organizationOrder";
- public static final String SUPER_PROJECT = "superProject";
- public static final String DEPARTMENTS = "department";
- public static final String DEPARTMENTS_ORDER = "departmentOrder";
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.contenttypes.SciProject";
- private static final SciOrganizationConfig s_config =
- new SciOrganizationConfig();
- private static final Logger logger = Logger.getLogger(SciProject.class);
-
- static {
- logger.debug("Static initalizer starting...");
- s_config.load();
- logger.debug("Static initalizer finished.");
- }
-
- public enum MemberStatus {
-
- ALL,
- ACTIVE,
- ASSOCIATED,
- FORMER
- }
-
- public enum ProjectStatus {
-
- ALL,
- ONGOING,
- FINISHED
- }
-
- public SciProject() {
- super(BASE_DATA_OBJECT_TYPE);
- }
-
- public SciProject(BigDecimal id) throws DataObjectNotFoundException {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public SciProject(OID oid) {
- super(oid);
- }
-
- public SciProject(DataObject obj) {
- super(obj);
- }
-
- public SciProject(String type) {
- super(type);
- }
-
- public static SciOrganizationConfig getConfig() {
- return s_config;
- }
-
- public Date getBegin() {
- return (Date) get(BEGIN);
- }
-
- public void setBegin(Date begin) {
- set(BEGIN, begin);
- }
-
- public Date getEnd() {
- return (Date) get(END);
- }
-
- public void setEnd(Date end) {
- set(END, end);
- }
-
- public String getProjectShortDescription() {
- return (String) get(PROJECT_SHORT_DESCRIPTION);
- }
-
- public void setProjectShortDescription(String shortDesc) {
- set(PROJECT_SHORT_DESCRIPTION, shortDesc);
- }
-
- public String getProjectDescription() {
- return (String) get(PROJECT_DESCRIPTION);
- }
-
- public void setProjectDescription(String description) {
- set(PROJECT_DESCRIPTION, description);
- }
-
- public String getFunding() {
- return (String) get(FUNDING);
- }
-
- public void setFunding(String funding) {
- set(FUNDING, funding);
- }
-
- public String getFundingVolume() {
- return (String) get(FUNDING_VOLUME);
- }
-
- public void setFundingVolume(String fundingVolume) {
- set(FUNDING_VOLUME, fundingVolume);
- }
-
- public SciProjectSubProjectsCollection getSubProjects() {
- return new SciProjectSubProjectsCollection(
- (DataCollection) get(SUBPROJECTS));
- }
-
- public void addSubProject(SciProject project) {
- Assert.exists(project, SciProject.class);
-
- DataObject link = add(SUBPROJECTS, project);
-
- link.set(SUBPROJECT_ORDER,
- Integer.valueOf((int) getSubProjects().size()));
- link.save();
- }
-
- public void removeSubProject(SciProject project) {
- Assert.exists(project, SciProject.class);
-
- logger.debug(String.format("Removing subproject %s",
- project.getTitle()));
- remove(SUBPROJECTS, project);
- }
-
- public SciProjectOrganizationsCollection getOrganizations() {
- return new SciProjectOrganizationsCollection((DataCollection) get(
- ORGANIZATIONS));
- }
-
- public void addOrganization(SciOrganization orga) {
- Assert.exists(orga, SciOrganization.class);
-
- DataObject link = add(ORGANIZATIONS, orga);
-
- link.set(ORGANIZATIONS_ORDER,
- Integer.valueOf((int) getOrganizations().size()));
- link.set(SciOrganization.PROJECT_ORDER,
- Integer.valueOf((int) orga.getProjects().size()));
- link.save();
- }
-
- public void removeOrganization(SciOrganization orga) {
- Assert.exists(orga, SciOrganization.class);
-
- remove(ORGANIZATIONS, orga);
- }
-
- public boolean hasOrganizations() {
- return !this.getOrganizations().isEmpty();
- }
-
- public SciProjectDepartmentsCollection getDepartments() {
- return new SciProjectDepartmentsCollection((DataCollection) get(
- DEPARTMENTS));
- }
-
- public void addDepartment(SciDepartment department) {
- Assert.exists(department, SciDepartment.class);
-
- DataObject link = add(DEPARTMENTS, department);
-
- link.set(DEPARTMENTS_ORDER,
- Integer.valueOf((int) getDepartments().size()));
- link.save();
- }
-
- public void removeDepartment(SciDepartment department) {
- Assert.exists(department, SciDepartment.class);
-
- remove(DEPARTMENTS, department);
- }
-
- public boolean hasDepartments() {
- return !this.getDepartments().isEmpty();
- }
-
- public SciProject getSuperProject() {
- DataCollection collection;
-
- collection = (DataCollection) get(SUPER_PROJECT);
-
- if (0 == collection.size()) {
- logger.debug(String.format("Project %s has NO super project...",
- getTitle()));
- return null;
- } else {
- DataObject dobj;
-
- logger.debug(String.format("Project %s has a super project...",
- getTitle()));
- collection.next();
- dobj = collection.getDataObject();
- collection.close();
-
- return new SciProject(dobj);
- }
- }
-
- public void setSuperProject(SciProject superProject) {
- SciProject oldSuperProject;
-
- oldSuperProject = getSuperProject();
- if (oldSuperProject != null) {
- logger.debug("Removing old super project...");
- remove(SUPER_PROJECT, oldSuperProject);
- }
-
- if (superProject != null) {
- Assert.exists(superProject, SciProject.class);
- logger.debug("Setting new super project...");
- DataObject link = add(SUPER_PROJECT, superProject);
-
- link.set(SUBPROJECT_ORDER,
- Integer.valueOf((int) superProject.getSubProjects().size()));
- link.save();
- }
- }
-
- @Override
- public boolean hasContacts() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfContactsOfSciProject");
- query.setParameter("project", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }
-
- public boolean hasSubProjects() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
- query.setParameter("project", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }
-
- /**
- *
- * @param merge Should I also look into the projects and return true
- * if the organization or at least one of the projects has members?
- * @return
- */
- public boolean hasMembers(final boolean merge, final MemberStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciProject";
- break;
- case ACTIVE:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciProject";
- break;
- case ASSOCIATED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfSciProject";
- break;
- case FORMER:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciProject";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("project", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery projectsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
- projectsQuery.setParameter("project", getID());
-
- if (query.size() > 0) {
- BigDecimal projectId;
- boolean result = false;
- while (projectsQuery.next()) {
- projectId = (BigDecimal) projectsQuery.get(
- "projectId");
- result = hasMembers(projectId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- projectsQuery.close();
- return result;
- } else {
- projectsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasMembers(final BigDecimal projectId,
- final boolean merge,
- final MemberStatus status) {
- String queryName;
-
- switch (status) {
- case ALL:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfMembersOfSciProject";
- break;
- case ACTIVE:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfActiveMembersOfSciProject";
- break;
- case ASSOCIATED:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfAssociatedMembersOfProject";
- break;
- case FORMER:
- queryName =
- "com.arsdigita.cms.contenttypes.getIdsOfFormerMembersOfSciProject";
- break;
- default:
- queryName = "";
- break;
- }
-
- DataQuery query = SessionManager.getSession().retrieveQuery(queryName);
- query.setParameter("project", projectId);
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subProjectsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
- subProjectsQuery.setParameter("project", projectId);
-
- if (query.size() > 0) {
- BigDecimal subprojectId;
- boolean result = false;
- while (subProjectsQuery.next()) {
- subprojectId = (BigDecimal) subProjectsQuery.get(
- "projectId");
- result = hasMembers(subprojectId, merge, status);
-
- if (result) {
- break;
- }
- }
-
- subProjectsQuery.close();
- return result;
- } else {
- subProjectsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- /*public boolean hasPublications() {
- boolean result = false;
-
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationLinksOfSciProject");
- query.setParameter("project", getID());
-
- if (query.size() > 0) {
- result = true;
- } else {
- result = false;
- }
-
- query.close();
-
- return result;
- }*/
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectDepartmentsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectDepartmentsCollection.java
deleted file mode 100644
index d681845d4..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectDepartmentsCollection.java
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import org.apache.log4j.Logger;
-
-/**
- * Special domain collection for the departments involved in a project.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectDepartmentsCollection extends DomainCollection {
-
- public String ORDER = "departmentOrder";
- public String LINKORDER = "link.departmentOrder";
- public static final Logger s_log = Logger.getLogger(
- SciProjectDepartmentsCollection.class);
-
- public SciProjectDepartmentsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addOrder(LINKORDER);
- }
-
- public Integer getDepartmentOrder() {
- return (Integer) m_dataCollection.get(LINKORDER);
- }
-
- public void setDepartmentOrder(Integer order) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(ORDER, order);
- }
-
- public void swapWithNext(SciDepartment department) {
- int currentPosition = 0;
- int currentIndex = 0;
- int nextIndex = 0;
-
- s_log.debug("Searching department...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getDepartmentOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getDepartmentOrder(): %d",
- getDepartmentOrder()));
- if (this.getDepartment().equals(department)) {
- break;
- }
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided subproject is not "
- + "part of this collection."));
- }
-
- if (this.next()) {
- nextIndex = this.getDepartmentOrder();
- } else {
- throw new IllegalArgumentException(
- "The provided subproject is the last "
- + "in the collection, so there is no next object "
- + "to swap with.");
- }
-
- this.rewind();
-
- while (this.getPosition() != currentPosition) {
- this.next();
- }
-
- this.setDepartmentOrder(nextIndex);
- this.next();
- this.setDepartmentOrder(currentIndex);
- this.rewind();
- }
-
- public void swapWithPrevious(SciDepartment department) {
- int previousPosition = 0;
- int previousIndex = 0;
- int currentPosition = 0;
- int currentIndex = 0;
-
- s_log.debug("Searching organization...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getDepartmentOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getDepartmentOrder(): %d",
- getDepartmentOrder()));
- if (this.getDepartment().equals(department)) {
- break;
- }
-
- previousPosition = currentPosition;
- previousIndex = currentIndex;
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided organization is not "
- + "part of this collection."));
- }
-
- if (previousPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided organization is the first one in this "
- + "collection, so there is no previous one to switch "
- + "with."));
- }
-
- this.rewind();
- while (this.getPosition() != previousPosition) {
- this.next();
- }
-
- this.setDepartmentOrder(currentIndex);
- this.next();
- this.setDepartmentOrder(previousIndex);
- this.rewind();
- }
-
- public SciDepartment getDepartment() {
- return new SciDepartment(m_dataCollection.getDataObject());
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java
deleted file mode 100644
index 55bd79f81..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import org.apache.log4j.Logger;
-
-/**
- * Initializer for {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectInitializer extends ContentTypeInitializer {
-
- private static final Logger s_log = Logger.getLogger(
- SciProjectInitializer.class);
-
- public SciProjectInitializer() {
- super("empty.pdl.mf", SciProject.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl"
- };
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml";
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectListXmlGenerator.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectListXmlGenerator.java
deleted file mode 100644
index d24a36b14..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectListXmlGenerator.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.dispatcher.SimpleXMLGenerator;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciProjectListXmlGenerator extends SimpleXMLGenerator {
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectLoader.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectLoader.java
deleted file mode 100644
index 7f9339dc8..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectLoader.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.util.parameter.Parameter;
-import com.arsdigita.util.parameter.ResourceParameter;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import java.io.InputStream;
-
-/**
- * Loader for {@link SciProject}
- *
- * @author Jens Pelzetter
- */
-public class SciProjectLoader extends AbstractContentTypeLoader {
-
- private ResourceParameter m_template;
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml"
- };
-
- public SciProjectLoader() {
- super();
-
- m_template = new ResourceParameter(
- "com.arsdigita.cms.contenttypes.SciProjectTemplate",
- Parameter.REQUIRED,
- "/WEB-INF/content-types/com/arsdigita/"
- + "cms/contenttypes/sciproject-item.jsp");
-
- register(m_template);
- }
-
- @Override
- public String[] getTypes() {
- return TYPES;
- }
-
- @Override
- protected void prepareSection(final ContentSection section,
- final ContentType type,
- final LifecycleDefinition lifecycle,
- final WorkflowTemplate workflow) {
- super.prepareSection(section, type, lifecycle, workflow);
-
- setDefaultTemplate("SciProject Item",
- "sciproject-item",
- (InputStream) get(m_template),
- section,
- type,
- lifecycle,
- workflow);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectOrganizationsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectOrganizationsCollection.java
deleted file mode 100644
index f1c9509d4..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectOrganizationsCollection.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import org.apache.log4j.Logger;
-
-/**
- * Special domain collection for the organization involved in a project.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectOrganizationsCollection extends DomainCollection {
-
- public String ORDER = "organizationOrder";
- public String LINKORDER = "link.organizationOrder";
- private static final Logger s_log =
- Logger.getLogger(
- SciProjectSubProjectsCollection.class);
-
- public SciProjectOrganizationsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addOrder(LINKORDER);
- }
-
- public Integer getOrganizationOrder() {
- return (Integer) m_dataCollection.get(LINKORDER);
- }
-
- public void setOrganizationOrder(Integer order) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(ORDER, order);
- }
-
- public void swapWithNext(SciOrganization orga) {
- int currentPosition = 0;
- int currentIndex = 0;
- int nextIndex = 0;
-
- s_log.debug("Searching organization...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getOrganizationOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getOrganizationOrder(): %d",
- getOrganizationOrder()));
- if (this.getOrganization().equals(orga)) {
- break;
- }
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided subproject is not "
- + "part of this collection."));
- }
-
- if (this.next()) {
- nextIndex = this.getOrganizationOrder();
- } else {
- throw new IllegalArgumentException(
- "The provided subproject is the last "
- + "in the collection, so there is no next object "
- + "to swap with.");
- }
-
- this.rewind();
-
- while (this.getPosition() != currentPosition) {
- this.next();
- }
-
- this.setOrganizationOrder(nextIndex);
- this.next();
- this.setOrganizationOrder(currentIndex);
- this.rewind();
- }
-
- public void swapWithPrevious(SciOrganization orga) {
- int previousPosition = 0;
- int previousIndex = 0;
- int currentPosition = 0;
- int currentIndex = 0;
-
- s_log.debug("Searching organization...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getOrganizationOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getOrganizationOrder(): %d",
- getOrganizationOrder()));
- if (this.getOrganization().equals(orga)) {
- break;
- }
-
- previousPosition = currentPosition;
- previousIndex = currentIndex;
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided organization is not "
- + "part of this collection."));
- }
-
- if (previousPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided organization is the first one in this "
- + "collection, so there is no previous one to switch "
- + "with."));
- }
-
- this.rewind();
- while (this.getPosition() != previousPosition) {
- this.next();
- }
-
- this.setOrganizationOrder(currentIndex);
- this.next();
- this.setOrganizationOrder(previousIndex);
- this.rewind();
- }
-
- public SciOrganization getOrganization() {
- return new SciOrganization(m_dataCollection.getDataObject());
- }
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectSubProjectsCollection.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectSubProjectsCollection.java
deleted file mode 100644
index 8bc8bd1d2..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProjectSubProjectsCollection.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import org.apache.log4j.Logger;
-
-/**
- * Special domain collection for the suprojects of a project.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectSubProjectsCollection extends DomainCollection {
-
- public String ORDER = "subProjectOrder";
- public String LINKORDER = "link.subProjectOrder";
- private static final Logger s_log =
- Logger.getLogger(
- SciProjectSubProjectsCollection.class);
-
- public SciProjectSubProjectsCollection(DataCollection dataCollection) {
- super(dataCollection);
-
- m_dataCollection.addOrder(LINKORDER);
- }
-
- public Integer getSubProjectOrder() {
- return (Integer) m_dataCollection.get(LINKORDER);
- }
-
- public void setSubProjectOrder(Integer order) {
- DataObject link = (DataObject) this.get("link");
-
- link.set(ORDER, order);
- }
-
- public void swapWithNext(SciProject subproject) {
- int currentPosition = 0;
- int currentIndex = 0;
- int nextIndex = 0;
-
- s_log.debug("Searching subproject...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getSubProjectOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getSubProjectOrder(): %d",
- getSubProjectOrder()));
- if (this.getSubProject().equals(subproject)) {
- break;
- }
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided subproject is not "
- + "part of this collection."));
- }
-
- if (this.next()) {
- nextIndex = this.getSubProjectOrder();
- } else {
- throw new IllegalArgumentException(
- "The provided subproject is the last "
- + "in the collection, so there is no next object "
- + "to swap with.");
- }
-
- this.rewind();
-
- while (this.getPosition() != currentPosition) {
- this.next();
- }
-
- this.setSubProjectOrder(nextIndex);
- this.next();
- this.setSubProjectOrder(currentIndex);
- this.rewind();
- }
-
- public void swapWithPrevious(SciProject subproject) {
- int previousPosition = 0;
- int previousIndex = 0;
- int currentPosition = 0;
- int currentIndex = 0;
-
- s_log.debug("Searching subproject...");
- this.rewind();
- while (this.next()) {
- currentPosition = this.getPosition();
- currentIndex = this.getSubProjectOrder();
- s_log.debug(String.format("Position: %d(%d)/%d", currentPosition,
- currentIndex, this.size()));
- s_log.debug(String.format("getSubProjectOrder(): %d",
- getSubProjectOrder()));
- if (this.getSubProject().equals(subproject)) {
- break;
- }
-
- previousPosition = currentPosition;
- previousIndex = currentIndex;
- }
-
- if (currentPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided subproject is not "
- + "part of this collection."));
- }
-
- if (previousPosition == 0) {
- throw new IllegalArgumentException(
- String.format(
- "The provided subproject is the first one in this "
- + "collection, so there is no previous one to switch "
- + "with."));
- }
-
- this.rewind();
- while (this.getPosition() != previousPosition) {
- this.next();
- }
-
- this.setSubProjectOrder(currentIndex);
- this.next();
- this.setSubProjectOrder(previousIndex);
- this.rewind();
- }
-
- public SciProject getSubProject() {
- return new SciProject(m_dataCollection.getDataObject());
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciTypesOrganizationUpdate660to661.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciTypesOrganizationUpdate660to661.java
deleted file mode 100644
index 8ac333357..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciTypesOrganizationUpdate660to661.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.installer.xml.XMLContentTypeHandler;
-import com.arsdigita.kernel.Kernel;
-import com.arsdigita.kernel.KernelExcursion;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.persistence.TransactionContext;
-import com.arsdigita.xml.XML;
-
-/**
- * Updates the authoring steps of SciOrganization, SciDepartment and
- * SciProject to reflect the changes made in version 6.6.1 (PWI SVN
- * revision 887).
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciTypesOrganizationUpdate660to661 {
-
- private static final String SCI_ORGANIZATION =
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xml";
- private static final String SCI_DEPARTMENT =
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xml";
- private static final String SCI_PROJECT =
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProject.xml";
-
- public static void main(String[] args) {
- final com.arsdigita.runtime.Runtime runtime =
- new com.arsdigita.runtime.Runtime();
- runtime.startup();
-
- final Session session = SessionManager.getSession();
- final TransactionContext tc = session.getTransactionContext();
-
- try {
- tc.beginTxn();
- new KernelExcursion() {
-
- @Override
- protected void excurse() {
- setEffectiveParty(Kernel.getSystemParty());
-
- /*
- * Reload content type definitions from XML config to add
- * new authoring steps.
- */
- XMLContentTypeHandler handler = new XMLContentTypeHandler();
- XML.parseResource(SCI_ORGANIZATION, handler);
- XML.parseResource(SCI_DEPARTMENT, handler);
- XML.parseResource(SCI_PROJECT, handler);
- }
- }.run();
- session.flushAll();
- tc.commitTxn();
- } catch (Exception ex) {
- System.out.println("Exception ocurred during update: ");
- ex.printStackTrace(System.out);
- } finally {
- if (tc.inTxn()) {
- tc.abortTxn();
- }
- }
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/doc-files/ccm-sci-types-organization_entities.png b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/doc-files/ccm-sci-types-organization_entities.png
deleted file mode 100644
index 5ac626f36..000000000
Binary files a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/doc-files/ccm-sci-types-organization_entities.png and /dev/null differ
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionEditForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionEditForm.java
deleted file mode 100644
index edc9a4796..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionEditForm.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.ui.CMSDHTMLEditor;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Edit form for the description of a SciDepartment.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentDescriptionEditForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- public SciDepartmentDescriptionEditForm(ItemSelectionModel itemModel) {
- super("scidepartmentEditDescForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.description")));
- ParameterModel descParam = new StringParameter(
- SciDepartment.DEPARTMENT_DESCRIPTION);
- TextArea desc;
- if (SciDepartment.getConfig().getDepartmentDescriptionDhtml()) {
- desc = new CMSDHTMLEditor(descParam);
- } else {
- desc = new TextArea(descParam);
- }
- desc.setCols(75);
- desc.setRows(25);
- add(desc);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- FormData data = fse.getFormData();
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
-
- data.put(SciDepartment.DEPARTMENT_DESCRIPTION,
- department.getDepartmentDescription());
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- FormData data = fse.getFormData();
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
-
- if ((department != null) && getSaveCancelSection().getSaveButton().
- isSelected(state)) {
- department.setDepartmentDescription((String) data.get(
- SciDepartment.DEPARTMENT_DESCRIPTION));
-
- department.save();
-
- init(fse);
- }
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionStep.java
deleted file mode 100644
index 9914e3e6d..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionStep.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- * EditStep for the description of a SciDepartment.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentDescriptionStep extends SimpleEditStep {
-
- private String EDIT_DEPARTMENT_DESC_SHEET_NAME = "editDepartmentDesc";
- private String UPLOAD_DEPARTMENT_DESC_SHEET_NAME = "uploadDepartmentDesc";
-
- public SciDepartmentDescriptionStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciDepartmentDescriptionStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm editDescForm =
- new SciDepartmentDescriptionEditForm(itemModel);
- add(EDIT_DEPARTMENT_DESC_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.edit_desc").localize(),
- new WorkflowLockedComponentAccess(editDescForm, itemModel),
- editDescForm.getSaveCancelSection().getCancelButton());
-
- SciDepartmentDescriptionUploadForm uploadDescForm =
- new SciDepartmentDescriptionUploadForm(
- itemModel);
- add(UPLOAD_DEPARTMENT_DESC_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.upload_desc").localize(),
- new WorkflowLockedComponentAccess(uploadDescForm, itemModel),
- uploadDescForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(
- getSciDepartmentDescSheet(itemModel));
- }
-
- public static Component getSciDepartmentDescSheet(
- ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
- itemModel);
-
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.desc"),
- SciDepartment.DEPARTMENT_DESCRIPTION);
-
- return sheet;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionUploadForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionUploadForm.java
deleted file mode 100644
index b5fe10dda..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentDescriptionUploadForm.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-/**
- * Upload form for the description of a SciDepartment.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see AbstractTextUploadForm
- */
-public class SciDepartmentDescriptionUploadForm extends AbstractTextUploadForm {
-
- public SciDepartmentDescriptionUploadForm(ItemSelectionModel itemModel) {
- super(itemModel);
- }
-
- @Override
- public GlobalizedMessage getLabelText() {
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.description.upload");
- }
-
- @Override
- public GlobalizedMessage getMimeTypeLabel() {
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.description.upload.mimetype");
- }
-
- @Override
- public void setText(ItemSelectionModel itemModel,
- PageState state,
- String text) {
- SciDepartment department = (SciDepartment) itemModel.getSelectedObject(
- state);
- department.setDepartmentDescription(text);
- department.save();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberAddForm.java
deleted file mode 100644
index 06fe7b42a..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberAddForm.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-
-/**
- * Form for adding members to a SciDepartment. This form overwrites
- * the {@link GenericOrganizationalUnitPersonAddForm#getPersonType()}
- * to limit the selectable type for adding to {@link SciMember}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciMember
- * @see GenericOrganizationalUnitPersonAddForm
- */
-public class SciDepartmentMemberAddForm
- extends GenericOrganizationalUnitPersonAddForm {
-
- public SciDepartmentMemberAddForm(ItemSelectionModel itemModel,
- GenericOrganizationalUnitPersonSelector personSelector) {
- super(itemModel, personSelector);
- }
-
- @Override
- protected String getPersonType() {
- return GenericPerson.class.getName();
- }
-
- @Override
- protected String getRoleAttributeName() {
- return "SciDepartmentRole";
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberStep.java
deleted file mode 100644
index 48b3894b4..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberStep.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Edit step for adding members to a SciDepartment.
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentMemberStep
- extends SimpleEditStep
- implements GenericOrganizationalUnitPersonSelector {
-
- private static final String ADD_MEMBER_SHEET_NAME = "addMember";
- private GenericPerson selectedPerson;
- private String selectedPersonRole;
- private String selectedPersonStatus;
-
- public SciDepartmentMemberStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciDepartmentMemberStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addMemberSheet =
- new SciDepartmentMemberAddForm(itemModel,
- this);
- add(ADD_MEMBER_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.add_member").localize(),
- new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
- addMemberSheet.getSaveCancelSection().getCancelButton());
-
- SciDepartmentMemberTable memberTable = new SciDepartmentMemberTable(
- itemModel,
- this);
- setDisplayComponent(memberTable);
- }
-
- public GenericPerson getSelectedPerson() {
- return selectedPerson;
- }
-
- public void setSelectedPerson(final GenericPerson selectedPerson) {
- this.selectedPerson = selectedPerson;
- }
-
- public String getSelectedPersonRole() {
- return selectedPersonRole;
- }
-
- public void setSelectedPersonRole(final String selectedPersonRole) {
- this.selectedPersonRole = selectedPersonRole;
- }
-
- public String getSelectedPersonStatus() {
- return selectedPersonStatus;
- }
-
- public void setSelectedPersonStatus(final String selectedPersonStatus) {
- this.selectedPersonStatus = selectedPersonStatus;
- }
-
- public void showEditComponent(PageState state) {
- showComponent(state, ADD_MEMBER_SHEET_NAME);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberTable.java
deleted file mode 100644
index 19a8ef255..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentMemberTable.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentMemberTable extends GenericOrganizationalUnitPersonsTable {
-
- public SciDepartmentMemberTable(ItemSelectionModel itemModel,
- GenericOrganizationalUnitPersonSelector personSelector) {
- super(itemModel, personSelector);
- }
-
- @Override
- protected String getRoleAttributeName() {
- return "SciDepartmentRole";
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationForm.java
deleted file mode 100644
index d4e217d95..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationForm.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for setting the superior organization of an SciDepartment.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciOrganization
- */
-public class SciDepartmentOrganizationForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "departmentOrga";
-
- public SciDepartmentOrganizationForm(ItemSelectionModel itemModel) {
- super("DepartmentOrganizationForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_organization")));
- m_itemSearch = new ItemSearchWidget(ITEM_SEARCH,
- ContentType.
- findByAssociatedObjectType(SciOrganization.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- SciOrganization orga = (SciOrganization) data.get(ITEM_SEARCH);
-
- orga = (SciOrganization) orga.getContentBundle().getInstance(department.getLanguage());
-
- department.setOrganization(orga);
- //department.setOrganization((SciOrganization) data.get(ITEM_SEARCH));
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.organization.add.no_organization_selected"));
-
- return;
- }
-
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
-
- SciOrganization orga = (SciOrganization) data.get(ITEM_SEARCH);
-
- if (!(orga.getContentBundle().hasInstance(department.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.organization.add.no_suitable_language_variant"));
- }
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationSheet.java
deleted file mode 100644
index 6f141fe20..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationSheet.java
+++ /dev/null
@@ -1,295 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Sheet for showing the superior organization of a SciDepartment.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciOrganization
- */
-public class SciDepartmentOrganizationSheet
- extends Table
- implements TableActionListener {
-
- private static final Logger logger =
- Logger.getLogger(
- SciDepartmentOrganizationSheet.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentOrganizationSheet(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.organization_none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.organization").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.organization.remove").localize(),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new SciDepartmentOrganizationSheetModelBuilder(itemModel));
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciDepartmentOrganizationSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentOrganizationSheetModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
- return new SciDepartmentOrganizationSheetModel(table,
- state,
- department);
- }
- }
-
- private class SciDepartmentOrganizationSheetModel
- implements TableModel {
-
- private Table m_table;
- private SciOrganization m_orga;
- private boolean m_done;
-
- public SciDepartmentOrganizationSheetModel(Table table,
- PageState state,
- SciDepartment department) {
- m_table = table;
- m_orga = department.getOrganization();
- if (m_orga == null) {
- m_done = false;
- } else {
- m_done = true;
- }
- }
-
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if (m_done) {
- ret = true;
- m_done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_orga.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.organization.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_orga.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- department);
-
- if (canEdit) {
- SciOrganization organization;
- try {
- organization = new SciOrganization((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- organization.getLanguage()),
- resolver.generateItemURL(state,
- organization,
- section,
- organization.
- getVersion()));
-
- return link;
- } else {
- SciOrganization organization;
- try {
- organization = new SciOrganization((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(
- String.format("%s (%s)",
- value.toString(),
- organization.getLanguage()));
- return label;
- }
-
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- department);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.department.organization."
- + "confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciDepartment department =
- (SciDepartment) m_itemModel.getSelectedObject(
- state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- department.setOrganization(null);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationStep.java
deleted file mode 100644
index 1b168b372..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentOrganizationStep.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for setting the superior organization of a SciDepartment.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciOrganization
- */
-public class SciDepartmentOrganizationStep extends SimpleEditStep {
-
- private String SET_DEPARTMENT_ORGANIZATION_STEP =
- "setDepartmentOrganization";
-
- public SciDepartmentOrganizationStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciDepartmentOrganizationStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm setOrgaForm =
- new SciDepartmentOrganizationForm(itemModel);
- add(SET_DEPARTMENT_ORGANIZATION_STEP,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.setOrganization").localize(),
- new WorkflowLockedComponentAccess(setOrgaForm, itemModel),
- setOrgaForm.getSaveCancelSection().getCancelButton());
-
- SciDepartmentOrganizationSheet sheet =
- new SciDepartmentOrganizationSheet(
- itemModel);
- setDisplayComponent(sheet);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPanel.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPanel.java
deleted file mode 100644
index 3526895d3..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPanel.java
+++ /dev/null
@@ -1,570 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.ui.panels.Filter;
-import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
-import com.arsdigita.xml.Element;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentPanel extends SciOrganizationBasePanel {
-
- private static final Logger s_log = Logger.getLogger(
- SciDepartmentPanel.class);
- public static final String SHOW_DESCRIPTION = "description";
- public static final String SHOW_MEMBERS_ACTIVE = "membersActive";
- public static final String SHOW_MEMBERS_ASSOCIATED = "membersAssociated";
- public static final String SHOW_MEMBERS_FORMER = "membersFormer";
- public static final String SHOW_SUBDEPARTMENTS = "subdepartments";
- public static final String SHOW_PROJECTS = "projects";
- public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
- public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
- private static final String TITLE = "title";
- private String show;
- private boolean displayDescription = true;
- private boolean displaySubDepartments = true;
- private boolean displayProjects = true;
- private Map projectFilters =
- new LinkedHashMap();
-
- public SciDepartmentPanel() {
- projectFilters.put(TITLE, new TextFilter(TITLE, TITLE));
- }
-
- @Override
- protected String getDefaultShowParam() {
- return SHOW_DESCRIPTION;
- }
-
- @Override
- protected Class extends ContentItem> getAllowedClass() {
- return SciDepartment.class;
- }
-
- public boolean isDisplayDescription() {
- return displayDescription;
- }
-
- public void setDisplayDescription(boolean displayDescription) {
- this.displayDescription = displayDescription;
- }
-
- public boolean isDisplayProjects() {
- return displayProjects;
- }
-
- public void setDisplayProjects(boolean displayProjects) {
- this.displayProjects = displayProjects;
- }
-
- public boolean isDisplaySubDepartments() {
- return displaySubDepartments;
- }
-
- public void setDisplaySubDepartments(boolean displaySubDepartments) {
- this.displaySubDepartments = displaySubDepartments;
- }
-
- protected boolean hasMembers(final SciDepartment department) {
- return department.hasMembers(SciDepartment.getConfig().
- getOrganizationMembersMerge(),
- SciDepartment.MemberStatus.ALL);
- }
-
- protected boolean hasActiveMembers(final SciDepartment department) {
- return department.hasMembers(SciDepartment.getConfig().
- getOrganizationMembersMerge(),
- SciDepartment.MemberStatus.ACTIVE);
- }
-
- protected boolean hasAssociatedMembers(final SciDepartment department) {
- return department.hasMembers(SciDepartment.getConfig().
- getOrganizationMembersMerge(),
- SciDepartment.MemberStatus.ASSOCIATED);
- }
-
- protected boolean hasFormerMembers(final SciDepartment department) {
- return department.hasMembers(SciDepartment.getConfig().
- getOrganizationMembersMerge(),
- SciDepartment.MemberStatus.FORMER);
- }
-
- protected boolean hasProjects(final SciDepartment department) {
- return department.hasProjects(SciDepartment.getConfig().
- getOrganizationProjectsMerge(),
- SciDepartment.ProjectStatus.ALL);
- }
-
- protected boolean hasOngoingProjects(final SciDepartment department) {
- return department.hasProjects(SciDepartment.getConfig().
- getOrganizationProjectsMerge(),
- SciDepartment.ProjectStatus.ONGOING);
- }
-
- protected boolean hasFinishedProjects(final SciDepartment department) {
- return department.hasProjects(SciDepartment.getConfig().
- getOrganizationProjectsMerge(),
- SciDepartment.ProjectStatus.FINISHED);
- }
-
- protected void generateSubDepartmentsXML(final SciDepartment department,
- final Element parent,
- final PageState state) {
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
- subDepartments.addOrder("link.subDepartmentOrder asc");
-
- long pageNumber = getPageNumber(state);
-
- Element subDepartmentsElem = parent.newChildElement("subDepartments");
-
- long pageCount = getPageCount(subDepartments.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, subDepartments.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count,
- subDepartments.size());
- subDepartments.setRange((int) begin + 1, (int) end + 1);
-
- while (subDepartments.next()) {
- SciDepartment subDepartment;
- subDepartment = subDepartments.getSubDepartment();
-
- Element subDepartmentElem = subDepartmentsElem.newChildElement(
- "department");
- subDepartmentElem.addAttribute("order",
- Integer.toString(subDepartments.
- getSubDepartmentOrder()));
- subDepartmentElem.addAttribute("oid", subDepartment.getOID().
- toString());
-
- Element title = subDepartmentElem.newChildElement("title");
- title.setText(subDepartment.getTitle());
-
- if ((subDepartment.getAddendum() != null)
- && !(subDepartment.getAddendum().isEmpty())) {
- Element addendum = subDepartmentElem.newChildElement("addendum");
- addendum.setText(subDepartment.getAddendum());
- }
-
- if ((subDepartment.getDepartmentShortDescription() != null)
- && !(subDepartment.getDepartmentShortDescription().isEmpty())) {
- Element shortDesc = subDepartmentElem.newChildElement(
- "shortDescription");
- shortDesc.setText(subDepartment.getDepartmentShortDescription());
- }
-
- GenericOrganizationalUnitPersonCollection heads;
- heads = subDepartment.getPersons();
- heads.addFilter(("link.role_name = 'head'"));
- heads.addOrder("surname asc, givenname asc");
-
- if (heads.size() > 0) {
- Element headsElem = subDepartmentElem.newChildElement("heads");
-
- while (heads.next()) {
- Element headElem = headsElem.newChildElement("head");
- Element titlePre = headElem.newChildElement("titlePre");
- titlePre.setText(heads.getTitlePre());
- Element givenName = headElem.newChildElement("givenname");
- givenName.setText(heads.getGivenName());
- Element surname = headElem.newChildElement("surname");
- surname.setText(heads.getSurname());
- Element titlePost = headElem.newChildElement("titlePost");
- titlePost.setText(heads.getTitlePost());
- }
- }
-
- GenericOrganizationalUnitContactCollection contacts;
- contacts = subDepartment.getContacts();
- if (contacts.size() > 0) {
- Element contactsElem = subDepartmentElem.newChildElement(
- "contacts");
-
- while (contacts.next()) {
- generateContactXML(contacts.getContactType(),
- contacts.getPerson(),
- contacts.getContactEntries(),
- contacts.getAddress(),
- contactsElem,
- state,
- Integer.toString(
- contacts.getContactOrder()),
- true);
- }
- }
- }
- }
-
- protected void generateMembersXML(final SciDepartment department,
- final Element parent,
- final PageState state,
- final List filters) {
- if (SciDepartment.getConfig().getOrganizationMembersMerge()) {
- List members;
- members = new LinkedList();
- GenericOrganizationalUnitPersonCollection departmentMembers;
- departmentMembers = department.getPersons();
- for (String filter : filters) {
- departmentMembers.addFilter(filter);
- }
-
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
-
- while (departmentMembers.next()) {
- addMember(departmentMembers,
- members);
- }
-
- mergeMembers(subDepartments, members, filters);
-
- Collections.sort(members, new MemberListItemComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(members.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, members.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count, members.
- size());
- List membersToShow = members.subList((int) begin,
- (int) end);
-
- Element membersElem = parent.newChildElement("members");
-
- for (MemberListItem memberItem : membersToShow) {
- generateMemberXML(memberItem,
- membersElem,
- memberItem.getRole(),
- memberItem.getStatus(),
- state);
- }
- } else {
- GenericOrganizationalUnitPersonCollection departmentMembers;
- departmentMembers = department.getPersons();
- for (String filter : filters) {
- departmentMembers.addFilter(filter);
- }
-
- List members = new LinkedList();
-
- while (departmentMembers.next()) {
- addMember(departmentMembers,
- members);
- }
-
- Collections.sort(members, new MemberListItemComparator());
-
- long pageNumber = getPageNumber(state);
-
- Element membersElem = parent.newChildElement("members");
-
- long pageCount = getPageCount(members.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, members.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count, members.
- size());
- List membersToShow = members.subList((int) begin,
- (int) end);
-
- for (MemberListItem memberItem : membersToShow) {
- generateMemberXML(memberItem,
- membersElem,
- memberItem.getRole(),
- memberItem.getStatus(),
- state);
- }
- }
- }
-
- protected void generateProjectFiltersXml(
- final List projects,
- final Element element) {
- final Element filterElement = element.newChildElement("filters");
-
- for (Map.Entry filterEntry : projectFilters.entrySet()) {
- filterEntry.getValue().generateXml(filterElement);
- }
- }
-
- protected void applyProjectFilters(
- final List filters,
- final HttpServletRequest request) {
- //Get parameters from HTTP request
- for (Map.Entry filterEntry : projectFilters.entrySet()) {
- String value = request.getParameter(
- filterEntry.getValue().getLabel());
-
- if ((value != null) && !(value.trim().isEmpty())) {
- filterEntry.getValue().setValue(value);
- }
- }
- }
-
- protected void generateProjectsXML(final SciDepartment department,
- final Element parent,
- final PageState state,
- final List filters) {
- Element controls = parent.newChildElement("filterControls");
- controls.addAttribute("customName", "sciDepartmentProjects");
- controls.addAttribute("show", show);
-
- if (SciDepartment.getConfig().getOrganizationProjectsMerge()) {
- List projects;
- projects = new LinkedList();
- SciDepartmentProjectsCollection departmentProjects;
- departmentProjects = department.getProjects();
-
- applyProjectFilters(filters, state.getRequest());
- if ((filters != null)
- && !(filters.isEmpty())) {
- for (String filter : filters) {
- departmentProjects.addFilter(filter);
- }
- }
-
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
-
- while (departmentProjects.next()) {
- projects.add(departmentProjects.getProject());
- }
-
- mergeProjects(subDepartments, projects, filters);
-
- Set projectsSet;
- List projectsWithoutDoubles;
- projectsSet = new HashSet(projects);
- projectsWithoutDoubles = new LinkedList(projectsSet);
-
- Collections.sort(projectsWithoutDoubles, new SciProjectComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(projectsWithoutDoubles.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, projectsWithoutDoubles.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generateProjectFiltersXml(projectsWithoutDoubles, controls);
- createPaginatorElement(parent,
- pageNumber,
- pageCount,
- begin,
- end,
- count,
- projectsWithoutDoubles.size());
- List projectsToShow =
- projectsWithoutDoubles.subList((int) begin,
- (int) end);
-
- Element projectsElem = parent.newChildElement("projects");
- for (SciProject project : projectsToShow) {
- generateProjectXML(project, projectsElem, state);
- }
- } else {
- SciDepartmentProjectsCollection departmentProjects;
- departmentProjects = department.getProjects();
-
- if ((filters != null)
- && !(filters.isEmpty())) {
- for (String filter : filters) {
- departmentProjects.addFilter(filter);
- }
- }
-
- List projects = new LinkedList();
-
- while (departmentProjects.next()) {
- projects.add(departmentProjects.getProject());
- }
-
- Collections.sort(projects, new SciProjectComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(projects.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, projects.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generateProjectFiltersXml(projects, controls);
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count, projects.
- size());
- List projectsToShow = projects.subList((int) begin,
- (int) end);
-
- Element projectsElem = parent.newChildElement("projects");
- for (SciProject project : projectsToShow) {
- generateProjectXML(project, projectsElem, state);
- }
- }
- }
-
- @Override
- protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
- final SciOrganizationConfig config = SciOrganization.getConfig();
-
- SciDepartment department = (SciDepartment) orga;
-
- if ((department.getDepartmentDescription() != null)
- && !department.getDepartmentDescription().isEmpty()
- && displayDescription) {
- element.newChildElement("description");
- }
- if (department.hasContacts()
- && isDisplayContacts()) {
- element.newChildElement("contacts");
- }
- if (department.hasSubDepartments()
- && displaySubDepartments) {
- element.newChildElement("subDepartments");
- }
- if (config.getOrganizationMembersAllInOne()) {
- if (hasMembers(department)
- && isDisplayMembers()) {
- element.newChildElement("members");
- }
- } else {
- if (hasActiveMembers(department)
- && isDisplayMembers()) {
- element.newChildElement("membersActive");
- }
- if (hasAssociatedMembers(department)
- && isDisplayMembers()) {
- element.newChildElement("membersAssociated");
- }
- if (hasFormerMembers(department)
- && isDisplayMembers()) {
- element.newChildElement("membersFormer");
- }
- }
- if (config.getOrganizationProjectsAllInOne()) {
- if (hasProjects(department)
- && displayProjects) {
- element.newChildElement("projects");
- }
- } else {
- if (hasOngoingProjects(department)
- && displayProjects) {
- element.newChildElement("projectsOngoing");
- }
- if (hasFinishedProjects(department)
- && displayProjects) {
- element.newChildElement("projectsFinished");
- }
- }
- }
-
- @Override
- protected void generateDataXml(GenericOrganizationalUnit orga,
- Element element,
- PageState state) {
- show = getShowParam(state);
-
- SciDepartment department = (SciDepartment) orga;
-
- if (SHOW_DESCRIPTION.equals(show)) {
- String desc;
- desc = department.getDepartmentDescription();
-
- Element description = element.newChildElement("description");
- description.setText(desc);
- } else if (SHOW_CONTACTS.equals(show)) {
- generateContactsXML(department, element, state);
- } else if (SHOW_MEMBERS.equals(show)) {
- generateMembersXML(department, element, state,
- new LinkedList());
- } else if (SHOW_MEMBERS_ACTIVE.equals(show)) {
- generateMembersXML(department, element, state,
- getFiltersForActiveMembers());
- } else if (SHOW_MEMBERS_ASSOCIATED.equals(show)) {
- generateMembersXML(department, element, state,
- getFiltersForAssociatedMembers());
- } else if (SHOW_MEMBERS_FORMER.equals(show)) {
- generateMembersXML(department, element, state,
- getFiltersForFormerMembers());
- } else if (SHOW_PROJECTS.equals(show)) {
- generateProjectsXML(department, element, state,
- new LinkedList());
- } else if (SHOW_PROJECTS_ONGOING.equals(show)) {
- generateProjectsXML(department, element, state,
- getFiltersForOngoingProjects());
- } else if (SHOW_PROJECTS_FINISHED.equals(show)) {
- generateProjectsXML(department, element, state,
- getFiltersForFinishedProjects());
- } else if (SHOW_SUBDEPARTMENTS.equals(show)) {
- generateSubDepartmentsXML(department, element, state);
- }
- }
-
- /*@Override
- public void generateXML(ContentItem item,
- Element element,
- PageState state) {
- Element content = generateBaseXML(item, element, state);
-
- Element availableData = content.newChildElement("availableData");
-
- SciDepartment department = (SciDepartment) item;
-
- generateAvailableDataXml(department, availableData, state);
-
- generateDataXml(department, content, state);
- }*/
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectAddForm.java
deleted file mode 100644
index ddab81c50..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectAddForm.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for linking an {@link SciDepartment} with a {@link SciProject}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciProject
- */
-public class SciDepartmentProjectAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "projects";
-
- public SciDepartmentProjectAddForm(ItemSelectionModel itemModel) {
- super("ProjectsAddForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_project").localize()));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciProject.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
-
- if (!(this.getSaveCancelSection().getCancelButton().
- isSelected(state))) {
- SciProject project = (SciProject) data.get(ITEM_SEARCH);
- project = (SciProject) project.getContentBundle().getInstance(department.
- getLanguage());
-
- department.addProject(project);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_project.no_project_selected"));
- return;
- }
-
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
- SciProject project = (SciProject) data.get(ITEM_SEARCH);
- if (!(project.getContentBundle().hasInstance(department.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_project.no_suitable_language_variant"));
- return;
- }
-
- project = (SciProject) project.getContentBundle().getInstance(department.
- getLanguage());
- SciDepartmentProjectsCollection projects = department.getProjects();
- projects.addFilter(String.format("id = %s", project.getID().toString()));
- if (projects.size() > 0) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_project.already_added"));
- }
-
- projects.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsStep.java
deleted file mode 100644
index 4f9b3065e..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsStep.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for linking {@link SciDepartment}s with {@link SciProject}s.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciProject
- */
-public class SciDepartmentProjectsStep extends SimpleEditStep {
-
- private String ADD_PROJECT_SHEET_NAME = "addProject";
-
- public SciDepartmentProjectsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciDepartmentProjectsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addProjectSheet =
- new SciDepartmentProjectAddForm(itemModel);
- add(ADD_PROJECT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.add_project").localize(),
- new WorkflowLockedComponentAccess(addProjectSheet, itemModel),
- addProjectSheet.getSaveCancelSection().getCancelButton());
-
- SciDepartmentProjectsTable projectsTable =
- new SciDepartmentProjectsTable(
- itemModel);
- setDisplayComponent(projectsTable);
-
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTable.java
deleted file mode 100644
index 1056dca74..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentProjectsTable.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import java.math.BigDecimal;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- * Table for showing all {@link SciProject}s linked with a {@link SciDepartment}
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciProject
- */
-public class SciDepartmentProjectsTable
- extends Table
- implements TableActionListener {
-
- private final Logger s_log = Logger.getLogger(
- SciDepartmentProjectsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentProjectsTable(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.projects.none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.remove").localize(),
- TABLE_COL_DEL));
- /*colModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.up").localize(),
- TABLE_COL_UP));
- colModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.down").localize(),
- TABLE_COL_DOWN));*/
-
- setModelBuilder(
- new SciDepartmentProjectsTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
- //colModel.get(2).setCellRenderer(new UpCellRenderer());
- //colModel.get(3).setCellRenderer(new DownCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciDepartmentProjectsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentProjectsTableModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
- return new SciDepartmentProjectsTableModel(table,
- state,
- department);
- }
- }
-
- private class SciDepartmentProjectsTableModel
- implements TableModel {
-
- private Table m_table;
- private SciDepartmentProjectsCollection m_projects;
- private SciProject m_project;
-
- public SciDepartmentProjectsTableModel(Table table,
- PageState state,
- SciDepartment department) {
- m_table = table;
- m_projects = department.getProjects();
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((m_projects != null) && m_projects.next()) {
- m_project = m_projects.getProject();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_project.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.remove").
- localize();
- case 2:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.up").
- localize();
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.down").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_project.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- department);
-
- if (canEdit) {
- SciProject project;
- try {
- project = new SciProject((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
-
- }
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link =
- new Link(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()),
- resolver.generateItemURL(state,
- project,
- section,
- project.getVersion()));
-
- return link;
- } else {
- SciProject project;
- try {
- project = new SciProject((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
-
- }
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- department);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.department.project."
- + "confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class UpCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- if (0 == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.up").
- localize());
- return link;
- }
- }
- }
-
- private class DownCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(
- state);
- SciDepartmentProjectsCollection projects =
- department.getProjects();
-
- if ((projects.size() - 1) == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.project.down").
- localize());
- return link;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciProject project = new SciProject(
- new BigDecimal(event.getRowKey().toString()));
-
- SciDepartment department =
- (SciDepartment) m_itemModel.getSelectedObject(state);
-
- SciDepartmentProjectsCollection projects =
- department.getProjects();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- department.removeProject(project);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
- projects.swapWithPrevious(project);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
- projects.swapWithNext(project);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertiesStep.java
deleted file mode 100644
index 04419d42f..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertiesStep.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ContentTypeCollection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- * Step for editing a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentPropertiesStep
- extends GenericOrganizationalUnitPropertiesStep {
-
- public SciDepartmentPropertiesStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- super(itemModel, parent);
- }
-
- public static Component getSciDepartmentPropertySheet(
- ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet =
- (DomainObjectPropertySheet) GenericOrganizationalUnitPropertiesStep.
- getGenericOrganizationalUnitPropertySheet(itemModel);
-
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.department.shortdescription"),
- SciDepartment.DEPARTMENT_SHORT_DESCRIPTION);
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
- parent,
- EDIT_SHEET_NAME);
-
- BasicPageForm editBasicSheet =
- new SciDepartmentPropertyForm(itemModel, this);
-
- basicProperties.add(EDIT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.edit_basic_properties").
- localize(),
- new WorkflowLockedComponentAccess(editBasicSheet,
- itemModel),
- editBasicSheet.getSaveCancelSection().
- getCancelButton());
-
- basicProperties.setDisplayComponent(
- getSciDepartmentPropertySheet(itemModel));
-
- getSegmentedPanel().addSegment(
- new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.basic_properties").localize()),
- basicProperties);
- }
-
- @Override
- protected void addSteps(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- //super.addSteps(itemModel, parent);
-
- SciOrganizationConfig config;
- config = SciDepartment.getConfig();
-
- if (!config.getDepartmentAddContactHide()) {
- addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.contacts"));
- }
-
- /*
- if (!config.getDepartmentAddPersonHide()) {
- addStep(new SciDepartmentMemberStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.members"));
- }
- */
-
- /*
- if (!config.getDepartmentAddSubDepartmentHide()) {
- addStep(new SciDepartmentSubDepartmentsStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartments"));
- }
- */
-
- if (!config.getDepartmentSetSuperDepartmentHide()) {
- addStep(new SciDepartmentSuperDepartmentStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.superdepartment"));
- }
-
- /*
- if (!config.getDepartmentAddProjectHide()) {
- addStep(new SciDepartmentProjectsStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.projects"));
- }
- */
-
- if (!config.getDepartmentSetOrganizationHide()) {
- addStep(new SciDepartmentOrganizationStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.organization"));
- }
-
- /*
- ContentTypeCollection contentTypes = ContentType.getAllContentTypes();
- contentTypes.addFilter("associatedObjectType = :type").set(
- "type",
- "com.arsdigita.cms.contenttypes.Publication");
- if ((!config.getDepartmentPublicationsHide())
- && (contentTypes.size() > 0)) {
- /*
- * Must add this step manually since the basic class is not
- * SimpleEditStep...
- */
- /* getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
- globalize("sciorganization.ui.department.publications")),
- new SciDepartmentPublicationsStep(
- itemModel, parent));
- }*/
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertyForm.java
deleted file mode 100644
index 6ab2f7dad..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPropertyForm.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-
-/**
- * Form for editing the basic properties of a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentPropertyForm
- extends GenericOrganizationalUnitPropertyForm
- implements FormProcessListener,
- FormInitListener {
-
- public static final String ID = "SciDepartmentEdit";
-
- public SciDepartmentPropertyForm(ItemSelectionModel itemModel) {
- this(itemModel, null);
- }
-
- public SciDepartmentPropertyForm(ItemSelectionModel itemModel,
- SciDepartmentPropertiesStep step) {
- super(itemModel, step);
- addSubmissionListener(this);
- }
-
- @Override
- public void addWidgets() {
- super.addWidgets();
-
- Label descLabel = new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.department.shortdescription"));
- add(descLabel);
- ParameterModel descParam = new StringParameter(
- SciDepartment.DEPARTMENT_SHORT_DESCRIPTION);
- TextArea desc = new TextArea(descParam);
- desc.addValidationListener(new StringInRangeValidationListener(0, 500));
- desc.setCols(75);
- desc.setRows(5);
- add(desc);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- super.init(fse);
-
- FormData data = fse.getFormData();
- SciDepartment department = (SciDepartment) super.initBasicWidgets(fse);
-
- data.put(SciDepartment.DEPARTMENT_SHORT_DESCRIPTION,
- department.getDepartmentShortDescription());
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- super.process(fse);
-
- FormData data = fse.getFormData();
- SciDepartment department =
- (SciDepartment) super.processBasicWidgets(fse);
-
- if ((department != null) && getSaveCancelSection().getSaveButton().
- isSelected(fse.getPageState())) {
- department.setDepartmentShortDescription(
- (String) data.get(SciDepartment.DEPARTMENT_SHORT_DESCRIPTION));
-
- department.save();
-
- init(fse);
- }
- }
-
- @Override
- protected String getTitleLabel() {
- return (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.department.title").localize();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentAddForm.java
deleted file mode 100644
index 24db08526..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentAddForm.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for adding subdepartments to a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentSubDepartmentAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "subdepartments";
-
- public SciDepartmentSubDepartmentAddForm(ItemSelectionModel itemModel) {
- super("SubDepartmentsAddForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_subdepartment")));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(SciDepartment.class.
- getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
-
- if (!(this.getSaveCancelSection().getCancelButton().
- isSelected(state))) {
- SciDepartment subDepartment = (SciDepartment) data.get(ITEM_SEARCH);
- subDepartment = (SciDepartment) subDepartment.getContentBundle().
- getInstance(department.getLanguage());
-
- department.addSubDepartment(subDepartment);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_subdepartment.no_department_selected"));
- return;
- }
-
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
- SciDepartment subDepartment = (SciDepartment) data.get(ITEM_SEARCH);
- if (!(subDepartment.getContentBundle().hasInstance(department.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_subdepartment.no_suitable_language_variant"));
- return;
- }
-
- subDepartment = (SciDepartment) subDepartment.getContentBundle().getInstance(department.getLanguage());
-
- if (department.getID().equals(subDepartment.getID())) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_subdepartment.adding_to_itself"));
- return;
- }
-
- SciDepartmentSubDepartmentsCollection subDepartments = department.getSubDepartments();
- subDepartments.addFilter(String.format("id = %s", subDepartment.getID().toString()));
- if (subDepartments.size() > 0) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_subdepartment.already_added"));
- }
-
- subDepartments.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsStep.java
deleted file mode 100644
index 07e8b62cc..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsStep.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for adding subdepartments to a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentSubDepartmentsStep extends SimpleEditStep {
-
- private String ADD_SUBDEPARTMENT_SHEET_NAME = "addSubDepartment";
-
- public SciDepartmentSubDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciDepartmentSubDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addSubDepartmentSheet =
- new SciDepartmentSubDepartmentAddForm(itemModel);
- add(ADD_SUBDEPARTMENT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.add_subdepartment").localize(),
- new WorkflowLockedComponentAccess(addSubDepartmentSheet, itemModel),
- addSubDepartmentSheet.getSaveCancelSection().getCancelButton());
-
- SciDepartmentSubDepartmentsTable subdepartmentTable =
- new SciDepartmentSubDepartmentsTable(
- itemModel);
- setDisplayComponent(subdepartmentTable);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsTable.java
deleted file mode 100644
index c491e6ab1..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSubDepartmentsTable.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Table for showing the subdepartments of a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentSubDepartmentsTable
- extends Table
- implements TableActionListener {
-
- private final Logger s_log = Logger.getLogger(
- SciDepartmentSubDepartmentsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentSubDepartmentsTable(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartments.none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.remove").localize(),
- TABLE_COL_DEL));
- colModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.up").localize(),
- TABLE_COL_UP));
- colModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.down").localize(),
- TABLE_COL_DOWN));
-
- setModelBuilder(
- new SciDepartmentSubDepartmentsTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
- colModel.get(2).setCellRenderer(new UpCellRenderer());
- colModel.get(3).setCellRenderer(new DownCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciDepartmentSubDepartmentsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentSubDepartmentsTableModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
- return new SciDepartmentSubDepartmentsTableModel(table,
- state,
- department);
- }
- }
-
- private class SciDepartmentSubDepartmentsTableModel
- implements TableModel {
-
- private Table m_table;
- private SciDepartmentSubDepartmentsCollection m_subdepartments;
- private SciDepartment m_subdepartment;
-
- private SciDepartmentSubDepartmentsTableModel(Table table,
- PageState state,
- SciDepartment department) {
- m_table = table;
- m_subdepartments = department.getSubDepartments();
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((m_subdepartments != null) && m_subdepartments.next()) {
- m_subdepartment = m_subdepartments.getSubDepartment();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_subdepartment.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.remove").
- localize();
- case 2:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.up").
- localize();
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.down").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_subdepartment.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- department);
-
- if (canEdit) {
- SciDepartment subDepartment;
- try {
- subDepartment = new SciDepartment(
- (BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- subDepartment.getLanguage()),
- resolver.generateItemURL(state,
- subDepartment,
- section,
- subDepartment.
- getVersion()));
-
- return link;
-
-
- } else {
- SciDepartment subDepartment;
- try {
- subDepartment = new SciDepartment(
- (BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- subDepartment.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- department);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.department.subdepartment."
- + ".confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class UpCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- if (0 == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.up").
- localize());
- return link;
- }
- }
- }
-
- private class DownCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
- SciDepartmentSubDepartmentsCollection subDepartments =
- department.getSubDepartments();
-
- if ((subDepartments.size() - 1) == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.subdepartment.down").
- localize());
- return link;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciDepartment subdepartment = new SciDepartment(
- new BigDecimal(event.getRowKey().toString()));
-
- SciDepartment department =
- (SciDepartment) m_itemModel.getSelectedObject(state);
-
- SciDepartmentSubDepartmentsCollection subdepartments =
- department.getSubDepartments();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- department.removeSubDepartment(subdepartment);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
- subdepartments.swapWithPrevious(subdepartment);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
- subdepartments.swapWithNext(subdepartment);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentForm.java
deleted file mode 100644
index 04cac9c04..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentForm.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for setting the superior department of a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentSuperDepartmentForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "superdepartment";
-
- public SciDepartmentSuperDepartmentForm(ItemSelectionModel itemModel) {
- super("SuperDepartmentSetForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_superdepartment").
- localize()));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciDepartment.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
-
- if ((this.getSaveCancelSection().getSaveButton().isSelected(state))) {
- SciDepartment superDepartment =
- (SciDepartment) data.get(ITEM_SEARCH);
- superDepartment = (SciDepartment) superDepartment.getContentBundle().
- getInstance(department.getLanguage());
-
- department.setSuperDepartment(superDepartment);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_superdepartment.no_department_selected"));
- return;
- }
-
- SciDepartment department = (SciDepartment) getItemSelectionModel().
- getSelectedObject(state);
- SciDepartment superDepartment =
- (SciDepartment) data.get(ITEM_SEARCH);
- if (!(superDepartment.getContentBundle().hasInstance(department.
- getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_superdepartment.no_suitable_language_variant"));
- return;
- }
-
- superDepartment = (SciDepartment) superDepartment.getContentBundle().
- getInstance(department.getLanguage());
- if (superDepartment.getID().equals(department.getID())) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.select_superdepartment.same_department"));
- return;
- }
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java
deleted file mode 100644
index 453032dd1..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentSheet.java
+++ /dev/null
@@ -1,282 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- * Sheet for showing the superior department of a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentSuperDepartmentSheet
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentSuperDepartmentSheet(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.superdepartment_none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.superdepartment").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.superdepartment.remove").localize(),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new SciDepartmentSuperDepartmentSheetModelBuilder(itemModel));
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciDepartmentSuperDepartmentSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciDepartmentSuperDepartmentSheetModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
- return new SciDepartmentSuperDepartmentSheetModel(table,
- state,
- department);
- }
- }
-
- private class SciDepartmentSuperDepartmentSheetModel
- implements TableModel {
-
- private Table m_table;
- private SciDepartment m_superDepartment;
- private boolean m_done;
-
- public SciDepartmentSuperDepartmentSheetModel(Table table,
- PageState state,
- SciDepartment department) {
- m_table = table;
- m_superDepartment = department.getSuperDepartment();
- if (m_superDepartment == null) {
- m_done = false;
- } else {
- m_done = true;
- }
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if (m_done) {
- ret = true;
- m_done = false;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_superDepartment.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.superdepartment.remove").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_superDepartment.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state, Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment department = (SciDepartment) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- department);
-
- if (canEdit) {
- SciDepartment subDepartment;
- try {
- subDepartment = new SciDepartment((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- subDepartment.getLanguage()),
- resolver.generateItemURL(state,
- subDepartment,
- section,
- subDepartment.
- getVersion()));
-
- return link;
- } else {
- SciDepartment subDepartment;
- try {
- subDepartment = new SciDepartment((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- Label label = new Label(
- String.format("%s (%s)",
- value.toString(),
- subDepartment.getLanguage()));
- return label;
- }
-
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state, Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciDepartment project = (SciDepartment) m_itemModel.
- getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- project);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.department.superdepartment."
- + ".confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciDepartment department =
- (SciDepartment) m_itemModel.getSelectedObject(
- state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- department.setSuperDepartment(null);
- }
- }
-
- public void headSelected(TableActionEvent event) {
- //Noting to do
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentStep.java
deleted file mode 100644
index cbd532251..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentSuperDepartmentStep.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for setting the superior department of a {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- */
-public class SciDepartmentSuperDepartmentStep extends SimpleEditStep {
-
- private String SET_SUPER_DEPARTMENT_STEP = "setSuperDepartment";
-
- public SciDepartmentSuperDepartmentStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciDepartmentSuperDepartmentStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm setSuperDepartmentForm =
- new SciDepartmentSuperDepartmentForm(itemModel);
- add(SET_SUPER_DEPARTMENT_STEP,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.department.setSuperDepartment").localize(),
- new WorkflowLockedComponentAccess(setSuperDepartmentForm,
- itemModel),
- setSuperDepartmentForm.getSaveCancelSection().
- getCancelButton());
-
- SciDepartmentSuperDepartmentSheet sheet =
- new SciDepartmentSuperDepartmentSheet(
- itemModel);
- setDisplayComponent(sheet);
-
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberPropertiesStep.java
deleted file mode 100644
index c801f9a20..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberPropertiesStep.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.SegmentedPanel;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- * Step for editing the basic properties of an {@link SciMember}.
- *
- * @author Jens Pelzetter
- * @see SciMember
- * @see GenericPerson
- */
-public class SciMemberPropertiesStep extends SimpleEditStep {
-
- public static final String EDIT_SHEET_NAME = "edit";
- private SegmentedPanel segmentedPanel;
-
- public SciMemberPropertiesStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- super(itemModel, parent);
-
- segmentedPanel = new SegmentedPanel();
- setDefaultEditKey(EDIT_SHEET_NAME);
-
- SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
- parent,
- EDIT_SHEET_NAME);
-
- BasicPageForm editSheet;
- editSheet = new SciMemberPropertyForm(itemModel, this);
- basicProperties.add(EDIT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.member.edit_basic_properties").localize(),
- new WorkflowLockedComponentAccess(editSheet,
- itemModel),
- editSheet.getSaveCancelSection().getCancelButton());
-
- basicProperties.setDisplayComponent(getSciMemberPropertySheet(itemModel));
-
- segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
- globalize("scimember.ui.basic_properties").localize()),
- basicProperties);
-
- segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
- globalize("scimember.ui.organizations").localize()),
- new SciMemberSciOrganizationsStep(itemModel,
- parent));
-
- segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
- globalize("scimember.ui.departments").localize()),
- new SciMemberSciDepartmentsStep(itemModel,
- parent));
-
- segmentedPanel.addSegment(new Label((String) SciOrganizationGlobalizationUtil.
- globalize("scimember.ui.projects").localize()),
- new SciMemberSciProjectsStep(itemModel,
- parent));
-
- setDisplayComponent(segmentedPanel);
- }
-
- public static Component getSciMemberPropertySheet(
- ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet;
-
- sheet = (DomainObjectPropertySheet) GenericPersonPropertiesStep.
- getGenericPersonPropertySheet(itemModel);
-
- return sheet;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberPropertyForm.java
deleted file mode 100644
index b6a17e674..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberPropertyForm.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.SciMember;
-
-/**
- * Form for editing the basic properties of a {@link SciMember}. This form
- * extends the form for editing the basic properties of {@link GenericPerson}.
- *
- * @author Jens Pelzetter
- * @see SciMember
- * @see GenericPerson
- * @see GenericPersonPropertyForm
- */
-public class SciMemberPropertyForm
- extends GenericPersonPropertyForm
- implements FormInitListener,
- FormSubmissionListener {
-
- /*private static final Logger logger =
- Logger.getLogger(SciMemberPropertyForm.class);
- private SciMemberPropertiesStep m_step;
- private CheckboxGroup m_associated;
- private CheckboxGroup m_former;*/
-
- public SciMemberPropertyForm(ItemSelectionModel itemModel) {
- this(itemModel, null);
- }
-
- public SciMemberPropertyForm(ItemSelectionModel itemModel,
- SciMemberPropertiesStep step) {
- super(itemModel);
- //m_step = step;
- }
-
- @Override
- protected void addWidgets() {
- super.addWidgets();
- }
-
- @Override
- public void init(FormSectionEvent fse) {
- super.init(fse);
-
- FormData data = fse.getFormData();
- SciMember member = (SciMember) super.initBasicWidgets(fse);
- }
-
- @Override
- public void process(FormSectionEvent fse) {
- super.process(fse);
-
- PageState state = fse.getPageState();
- SciMember member = (SciMember) super.processBasicWidgets(fse);
-
- if ((member != null) && getSaveCancelSection().getSaveButton().
- isSelected(fse.getPageState())) {
-
- member.save();
-
- init(fse);
- }
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentAddForm.java
deleted file mode 100644
index 8fcc5d91b..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentAddForm.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.SingleSelect;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.RelationAttribute;
-import com.arsdigita.cms.RelationAttributeCollection;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciMemberSciDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizationHelper;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciMemberSciDepartmentAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener,
- FormSubmissionListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "sciMemberDepartment";
- private SciMemberSciDepartmentsStep step;
- private Label selectedDepartmentNameLabel;
-
- public SciMemberSciDepartmentAddForm(ItemSelectionModel itemModel,
- SciMemberSciDepartmentsStep step) {
- super("sciMemberDepartmentAddForm", itemModel);
- this.step = step;
- }
-
- @Override
- public void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.select_department")));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
- findByAssociatedObjectType(SciDepartment.class.getName()));
- add(itemSearch);
-
- selectedDepartmentNameLabel = new Label("");
- add(selectedDepartmentNameLabel);
-
- add(new Label(ContenttypesGlobalizationUtil.globalize(
- "cms.contenttypes.ui.genericorgaunit.person.role")));
- ParameterModel roleParam =
- new StringParameter(
- SciMemberSciDepartmentsCollection.MEMBER_ROLE);
- SingleSelect roleSelect = new SingleSelect(roleParam);
- roleSelect.addValidationListener(new NotNullValidationListener());
- roleSelect.addOption(
- new Option("",
- new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
- RelationAttributeCollection roles = new RelationAttributeCollection(
- "SciDepartmentRole");
- roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
- getLanguage());
- while (roles.next()) {
- RelationAttribute role;
- role = roles.getRelationAttribute();
- roleSelect.addOption(new Option(role.getKey(), role.getName()));
- }
- add(roleSelect);
-
- add(new Label(ContenttypesGlobalizationUtil.globalize(
- "cms.contenttypes.ui.genericorgaunit.person.status")));
- ParameterModel statusModel =
- new StringParameter(
- SciMemberSciDepartmentsCollection.STATUS);
- SingleSelect statusSelect = new SingleSelect(statusModel);
- statusSelect.addValidationListener(new NotNullValidationListener());
- statusSelect.addOption(new Option("",
- new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
- RelationAttributeCollection statusColl =
- new RelationAttributeCollection(
- "GenericOrganizationalUnitMemberStatus");
- statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
- getLanguage());
- while (statusColl.next()) {
- RelationAttribute status;
- status = statusColl.getRelationAttribute();
- statusSelect.addOption(new Option(status.getKey(), status.getName()));
- }
- add(statusSelect);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
-
- SciDepartment department;
- String role;
- String status;
-
- department = step.getSelectedDepartment();
- role = step.getSelectedDepartmentRole();
- status = step.getSelectedDepartmentStatus();
-
- if (department == null) {
- itemSearch.setVisible(state, true);
- selectedDepartmentNameLabel.setVisible(state, false);
- } else {
- data.put(ITEM_SEARCH, department);
- data.put(SciMemberSciDepartmentsCollection.MEMBER_ROLE, role);
- data.put(SciMemberSciDepartmentsCollection.STATUS, status);
-
- itemSearch.setVisible(state, false);
- selectedDepartmentNameLabel.setVisible(state, true);
- selectedDepartmentNameLabel.setLabel(department.getTitle(), state);
- }
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
- state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- SciDepartment department;
- department = step.getSelectedDepartment();
-
- if (department == null) {
- SciDepartment departmentToAdd = (SciDepartment) data.get(
- ITEM_SEARCH);
- departmentToAdd = (SciDepartment) departmentToAdd.
- getContentBundle().getInstance(
- member.getLanguage());
-
- member.addDepartment(departmentToAdd,
- (String) data.get(
- SciMemberSciDepartmentsCollection.MEMBER_ROLE),
- (String) data.get(
- SciMemberSciDepartmentsCollection.STATUS));
- } else {
- SciMemberSciDepartmentsCollection departments;
-
- departments = member.getDepartments();
-
- while (departments.next()) {
- if (departments.getDepartment().equals(department)) {
- break;
- }
- }
-
- departments.setRoleName((String) data.get(
- SciMemberSciDepartmentsCollection.MEMBER_ROLE));
- departments.setStatus((String) data.get(
- SciMemberSciDepartmentsCollection.STATUS));
-
- step.setSelectedDepartment(null);
- step.setSelectedDepartmentRole(null);
- step.setSelectedDepartmentStatus(null);
-
- departments.close();
- }
-
- init(fse);
- }
- }
-
- @Override
- public void submitted(FormSectionEvent fse) throws FormProcessException {
- if (getSaveCancelSection().getCancelButton().isSelected(
- fse.getPageState())) {
- step.setSelectedDepartment(null);
- step.setSelectedDepartmentRole(null);
- step.setSelectedDepartmentStatus(null);
-
- init(fse);
- }
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.select_department.no_department_selected"));
- return;
- }
-
- SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
- state);
- SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
- if (!(department.getContentBundle().hasInstance(member.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.select_department.no_suitable_language_variant"));
- return;
- }
-
- department = (SciDepartment) department.getContentBundle().getInstance(member.
- getLanguage());
- SciMemberSciDepartmentsCollection departments = member.getDepartments();
- departments.addFilter(String.format("id = %s", department.getID().toString()));
- if (departments.size() > 0) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.select_department.already_added"));
- }
-
- departments.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsStep.java
deleted file mode 100644
index 22fd17c4f..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsStep.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciMemberSciDepartmentsStep extends SimpleEditStep {
-
- private String MEMBER_ADD_DEPARTMENT_SHEET_NAME = "memberAddDepartment";
- private SciDepartment selectedDepartment;
- private String selectedDepartmentRole;
- private String selectedDepartmentStatus;
-
- public SciMemberSciDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciMemberSciDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addDepartmentForm = new SciMemberSciDepartmentAddForm(itemModel, this);
- add(MEMBER_ADD_DEPARTMENT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize("scimember.ui.department.add").localize(),
- new WorkflowLockedComponentAccess(addDepartmentForm, itemModel),
- addDepartmentForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(new SciMemberSciDepartmentsTable(itemModel, this));
- }
-
- protected SciDepartment getSelectedDepartment() {
- return selectedDepartment;
- }
-
- protected void setSelectedDepartment(SciDepartment selectedDepartment) {
- this.selectedDepartment = selectedDepartment;
- }
-
- protected String getSelectedDepartmentRole() {
- return selectedDepartmentRole;
- }
-
- protected void setSelectedDepartmentRole(String selectedDepartmentRole) {
- this.selectedDepartmentRole = selectedDepartmentRole;
- }
-
- protected String getSelectedDepartmentStatus() {
- return selectedDepartmentStatus;
- }
-
- protected void setSelectedDepartmentStatus(String selectedDepartmentStatus) {
- this.selectedDepartmentStatus = selectedDepartmentStatus;
- }
-
- protected void showEditComponent(PageState state) {
- showComponent(state, MEMBER_ADD_DEPARTMENT_SHEET_NAME);
- }
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsTable.java
deleted file mode 100644
index e8c0fbe00..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciDepartmentsTable.java
+++ /dev/null
@@ -1,352 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.RelationAttributeCollection;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciMemberSciDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciMemberSciDepartmentsTable
- extends Table
- implements TableActionListener {
-
- private static final Logger logger = Logger.getLogger(
- SciMemberSciDepartmentsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_EDIT_LINK = "table_col_edit_link";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel itemModel;
- private SciMemberSciDepartmentsStep step;
-
- public SciMemberSciDepartmentsTable(ItemSelectionModel itemModel,
- SciMemberSciDepartmentsStep step) {
- super();
- this.itemModel = itemModel;
- this.step = step;
-
- setEmptyView(new Label(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.departments.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.role").localize()));
- columnModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.status").localize()));
- columnModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.edit").localize(),
- TABLE_COL_EDIT_LINK));
- columnModel.add(new TableColumn(
- 4,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.department.remove").localize(),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new SciMemberSciDepartmentsTableModelBuilder(itemModel));
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(3).setCellRenderer(new EditLinkCellRenderer());
- columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciMemberSciDepartmentsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- public SciMemberSciDepartmentsTableModelBuilder(
- ItemSelectionModel itemModel) {
- SciMemberSciDepartmentsTable.this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
- return new SciMemberSciDepartmentsTableModel(table,
- state,
- member);
- }
- }
-
- private class SciMemberSciDepartmentsTableModel implements TableModel {
-
- private Table table;
- private SciMemberSciDepartmentsCollection departments;
- private SciDepartment department;
-
- public SciMemberSciDepartmentsTableModel(Table table,
- PageState state,
- SciMember member) {
- this.table = table;
- this.departments = member.getDepartments();
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((departments != null) && departments.next()) {
- department = departments.getDepartment();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return department.getTitle();
- case 1:
- RelationAttributeCollection role =
- new RelationAttributeCollection(
- "SciDepartmentRole",
- departments.getRoleName());
- if (role.next()) {
- String roleName = role.getName();
- role.close();
- return roleName;
- } else {
- return ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknownRole").localize();
- }
- case 2:
- RelationAttributeCollection status =
- new RelationAttributeCollection(
- "GenericOrganizationalUnitMemberStatus",
- departments.getStatus());
- if (status.next()) {
- String statusName = status.getName();
- status.close();
- return statusName;
- } else {
- return ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknownStatus").localize();
- }
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.departments.edit_assoc").localize();
- case 4:
- return SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.departments.remove").localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return department.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- SciDepartment department;
- try {
- department = new SciDepartment((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()),
- resolver.generateItemURL(state,
- department,
- section,
- department.
- getVersion()));
- return link;
- } else {
- SciDepartment department;
- try {
- department = new SciDepartment((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()));
- return label;
- }
- }
- }
-
- private class EditLinkCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "scimember.ui.department."
- + "confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciDepartment department = new SciDepartment(new BigDecimal(event.
- getRowKey().toString()));
-
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- SciMemberSciDepartmentsCollection departments = member.getDepartments();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- } else if (TABLE_COL_EDIT_LINK.equals(
- column.getHeaderKey().toString())) {
- while (departments.next()) {
- if (departments.getDepartment().equals(department)) {
- break;
- }
- }
- step.setSelectedDepartment(departments.getDepartment());
- step.setSelectedDepartmentRole(departments.getRoleName());
- step.setSelectedDepartmentStatus(departments.getStatus());
-
- departments.close();
-
- step.showEditComponent(state);
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- member.removeDepartment(department);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationAddForm.java
deleted file mode 100644
index 5c607021f..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationAddForm.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.SingleSelect;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.RelationAttribute;
-import com.arsdigita.cms.RelationAttributeCollection;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciMemberSciOrganizationsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizationHelper;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciMemberSciOrganizationAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener,
- FormSubmissionListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "sciMemberOrganization";
- private SciMemberSciOrganizationsStep step;
- private Label selectedOrganizationNameLabel;
-
- public SciMemberSciOrganizationAddForm(ItemSelectionModel itemModel,
- SciMemberSciOrganizationsStep step) {
- super("sciMemberOrganizationAddForm", itemModel);
- this.step = step;
-
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.select_organization")));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
- findByAssociatedObjectType(SciOrganization.class.getName()));
- add(itemSearch);
-
- selectedOrganizationNameLabel = new Label("");
- add(selectedOrganizationNameLabel);
-
- add(new Label(ContenttypesGlobalizationUtil.globalize(
- "cms.contenttypes.ui.genericorgaunit.person.role")));
- ParameterModel roleParam =
- new StringParameter(
- SciMemberSciOrganizationsCollection.MEMBER_ROLE);
- SingleSelect roleSelect = new SingleSelect(roleParam);
- roleSelect.addValidationListener(new NotNullValidationListener());
- roleSelect.addOption(
- new Option("",
- new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
- RelationAttributeCollection roles = new RelationAttributeCollection(
- "SciOrganizationRole");
- roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
- getLanguage());
- while (roles.next()) {
- RelationAttribute role;
- role = roles.getRelationAttribute();
- roleSelect.addOption(new Option(role.getKey(), role.getName()));
- }
- add(roleSelect);
-
- add(new Label(ContenttypesGlobalizationUtil.globalize(
- "cms.contenttypes.ui.genericorgaunit.person.status")));
- ParameterModel statusModel =
- new StringParameter(
- SciMemberSciOrganizationsCollection.STATUS);
- SingleSelect statusSelect = new SingleSelect(statusModel);
- statusSelect.addValidationListener(new NotNullValidationListener());
- statusSelect.addOption(new Option("",
- new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
- RelationAttributeCollection statusColl =
- new RelationAttributeCollection(
- "GenericOrganizationalUnitMemberStatus");
- statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
- getLanguage());
- while (statusColl.next()) {
- RelationAttribute status;
- status = statusColl.getRelationAttribute();
- statusSelect.addOption(new Option(status.getKey(), status.getName()));
- }
- add(statusSelect);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
-
- SciOrganization orga;
- String role;
- String status;
-
- orga = step.getSelectedOrganization();
- role = step.getSelectedOrganizationRole();
- status = step.getSelectedOrganizationStatus();
-
- if (orga == null) {
- itemSearch.setVisible(state, true);
- selectedOrganizationNameLabel.setVisible(state, false);
- } else {
- data.put(ITEM_SEARCH, orga);
- data.put(SciMemberSciOrganizationsCollection.MEMBER_ROLE, role);
- data.put(SciMemberSciOrganizationsCollection.STATUS, status);
-
- itemSearch.setVisible(state, false);
- selectedOrganizationNameLabel.setVisible(state, true);
- selectedOrganizationNameLabel.setLabel(orga.getTitle(), state);
- }
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
- state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
-
- SciOrganization orga;
- orga = step.getSelectedOrganization();
-
- if (orga == null) {
- SciOrganization orgaToAdd = (SciOrganization) data.get(
- ITEM_SEARCH);
- orgaToAdd = (SciOrganization) orgaToAdd.getContentBundle().
- getInstance(member.getLanguage());
-
- member.addOrganization(orga,
- (String) data.get(
- SciMemberSciOrganizationsCollection.MEMBER_ROLE),
- (String) data.get(
- SciMemberSciOrganizationsCollection.STATUS));
- } else {
- SciMemberSciOrganizationsCollection orgas;
-
- orgas = member.getOrganizations();
-
- while (orgas.next()) {
- if (orgas.getOrganization().equals(orga)) {
- break;
- }
- }
-
- orgas.setRoleName((String) data.get(
- SciMemberSciOrganizationsCollection.MEMBER_ROLE));
- orgas.setStatus((String) data.get(
- SciMemberSciOrganizationsCollection.STATUS));
-
- step.setSelectedOrganization(null);
- step.setSelectedOrganizationRole(null);
- step.setSelectedOrganizationStatus(null);
-
- orgas.close();
- }
-
- init(fse);
- }
- }
-
- @Override
- public void submitted(FormSectionEvent fse) throws FormProcessException {
- if (getSaveCancelSection().getCancelButton().isSelected(
- fse.getPageState())) {
- step.setSelectedOrganization(null);
- step.setSelectedOrganizationRole(null);
- step.setSelectedOrganizationStatus(null);
-
- init(fse);
- }
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.select_organization.no_orga_selected"));
- return;
- }
-
- SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
- state);
- SciOrganization orga = (SciOrganization) data.get(
- ITEM_SEARCH);
- if (!(orga.getContentBundle().hasInstance(member.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.select_organization.no_suitable_language_variant"));
- return;
- }
-
- orga = (SciOrganization) orga.getContentBundle().getInstance(member.
- getLanguage());
- SciMemberSciOrganizationsCollection organizations = member.
- getOrganizations();
- organizations.addFilter(String.format("id = %s",
- orga.getID().toString()));
- if (organizations.size() > 0) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.select_organization.already_added"));
- }
-
- organizations.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsStep.java
deleted file mode 100644
index 6650bcb9e..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsStep.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciMemberSciOrganizationsStep extends SimpleEditStep {
-
- private String MEMBER_ADD_ORGANIZATION_SHEET_NAME = "memberAddOrganization";
- private SciOrganization selectedOrganization;
- private String selectedOrganizationRole;
- private String selectedOrganizationStatus;
-
- public SciMemberSciOrganizationsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciMemberSciOrganizationsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addOrganizationForm = new SciMemberSciOrganizationAddForm(
- itemModel,
- this);
- add(MEMBER_ADD_ORGANIZATION_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.add").localize(),
- new WorkflowLockedComponentAccess(addOrganizationForm, itemModel),
- addOrganizationForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(new SciMemberSciOrganizationsTable(itemModel, this));
- }
-
- protected SciOrganization getSelectedOrganization() {
- return selectedOrganization;
- }
-
- protected void setSelectedOrganization(SciOrganization organization) {
- this.selectedOrganization = organization;
- }
-
- protected String getSelectedOrganizationRole() {
- return selectedOrganizationRole;
- }
-
- protected void setSelectedOrganizationRole(String role) {
- this.selectedOrganizationRole = role;
- }
-
- protected String getSelectedOrganizationStatus() {
- return selectedOrganizationStatus;
- }
-
- protected void setSelectedOrganizationStatus(String status) {
- this.selectedOrganizationStatus = status;
- }
-
- protected void showEditComponent(PageState state) {
- showComponent(state, MEMBER_ADD_ORGANIZATION_SHEET_NAME);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsTable.java
deleted file mode 100644
index ca2915382..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciOrganizationsTable.java
+++ /dev/null
@@ -1,354 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.RelationAttributeCollection;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciMemberSciOrganizationsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciMemberSciOrganizationsTable
- extends Table
- implements TableActionListener {
-
- private static final Logger logger = Logger.getLogger(
- SciMemberSciOrganizationsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_EDIT_LINK = "table_col_edit_link";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel itemModel;
- private SciMemberSciOrganizationsStep step;
-
- public SciMemberSciOrganizationsTable(ItemSelectionModel itemModel,
- SciMemberSciOrganizationsStep step) {
- super();
- this.itemModel = itemModel;
- this.step = step;
-
- setEmptyView(new Label(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organizations.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.role").localize()));
- columnModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.status").localize()));
- columnModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.edit").localize(),
- TABLE_COL_EDIT_LINK));
- columnModel.add(new TableColumn(
- 4,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organization.remove").localize(),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new SciMemberSciOrganizationsTableModelBuilder(itemModel));
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(3).setCellRenderer(new EditLinkCellRenderer());
- columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciMemberSciOrganizationsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- public SciMemberSciOrganizationsTableModelBuilder(
- ItemSelectionModel itemModel) {
- SciMemberSciOrganizationsTable.this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
- return new SciMemberSciOrganizationsTableModel(table,
- state,
- member);
- }
- }
-
- private class SciMemberSciOrganizationsTableModel implements TableModel {
-
- private Table table;
- private SciMemberSciOrganizationsCollection organizations;
- private SciOrganization organization;
-
- public SciMemberSciOrganizationsTableModel(Table table,
- PageState state,
- SciMember member) {
- this.table = table;
- this.organizations = member.getOrganizations();
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((organizations != null) && organizations.next()) {
- organization = organizations.getOrganization();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return organization.getTitle();
- case 1:
- RelationAttributeCollection role =
- new RelationAttributeCollection(
- "SciOrganizationRole",
- organizations.getRoleName());
- if (role.next()) {
- String roleName = role.getName();
- role.close();
- return roleName;
- } else {
- return ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknownRole").localize();
- }
- case 2:
- RelationAttributeCollection status =
- new RelationAttributeCollection(
- "GenericOrganizationalUnitMemberStatus",
- organizations.getStatus());
- if (status.next()) {
- String statusName = status.getName();
- status.close();
- return statusName;
- } else {
- return ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknownStatus").localize();
- }
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organizations.edit_assoc").localize();
- case 4:
- return SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.organizations.remove").localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return organization.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- SciOrganization organization;
- try {
- organization = new SciOrganization((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- organization.getLanguage()),
- resolver.generateItemURL(state,
- organization,
- section,
- organization.
- getVersion()));
- return link;
- } else {
- SciOrganization organization;
- try {
- organization = new SciOrganization((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- organization.getLanguage()));
- return label;
- }
- }
- }
-
- private class EditLinkCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "scimember.ui.organization."
- + "confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciOrganization organization = new SciOrganization(new BigDecimal(event.
- getRowKey().toString()));
-
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- SciMemberSciOrganizationsCollection organizations = member.
- getOrganizations();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- } else if (TABLE_COL_EDIT_LINK.equals(
- column.getHeaderKey().toString())) {
- while (organizations.next()) {
- if (organizations.getOrganization().equals(organization)) {
- break;
- }
- }
- step.setSelectedOrganization(organizations.getOrganization());
- step.setSelectedOrganizationRole(organizations.getRoleName());
- step.setSelectedOrganizationStatus(organizations.getStatus());
-
- organizations.close();
-
- step.showEditComponent(state);
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- member.removeOrganization(organization);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectAddForm.java
deleted file mode 100644
index 355853e8f..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectAddForm.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.Option;
-import com.arsdigita.bebop.form.SingleSelect;
-import com.arsdigita.bebop.parameters.NotNullValidationListener;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.RelationAttribute;
-import com.arsdigita.cms.RelationAttributeCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciMemberSciProjectsCollection;
-import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.globalization.GlobalizationHelper;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciMemberSciProjectAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener,
- FormSubmissionListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "sciMemberProject";
- private SciMemberSciProjectsStep step;
- private Label selectedProjectNameLabel;
-
- public SciMemberSciProjectAddForm(ItemSelectionModel itemModel,
- SciMemberSciProjectsStep step) {
- super("sciMemberProjectAddForm", itemModel);
- this.step = step;
- }
-
- @Override
- public void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.select_project")));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
- findByAssociatedObjectType(SciProject.class.getName()));
- add(itemSearch);
-
- selectedProjectNameLabel = new Label("");
- add(selectedProjectNameLabel);
-
- add(new Label(ContenttypesGlobalizationUtil.globalize(
- "cms.contenttypes.ui.genericorgaunit.person.role")));
- ParameterModel roleParam =
- new StringParameter(
- SciMemberSciProjectsCollection.MEMBER_ROLE);
- SingleSelect roleSelect = new SingleSelect(roleParam);
- roleSelect.addValidationListener(new NotNullValidationListener());
- roleSelect.addOption(
- new Option("",
- new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
- RelationAttributeCollection roles = new RelationAttributeCollection(
- "SciProjectRole");
- roles.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
- getLanguage());
- while (roles.next()) {
- RelationAttribute role;
- role = roles.getRelationAttribute();
- roleSelect.addOption(new Option(role.getKey(), role.getName()));
- }
- add(roleSelect);
-
- add(new Label(ContenttypesGlobalizationUtil.globalize(
- "cms.contenttypes.ui.genericorgaunit.person.status")));
- ParameterModel statusModel =
- new StringParameter(
- SciMemberSciProjectsCollection.STATUS);
- SingleSelect statusSelect = new SingleSelect(statusModel);
- statusSelect.addValidationListener(new NotNullValidationListener());
- statusSelect.addOption(new Option("",
- new Label((String) ContenttypesGlobalizationUtil.
- globalize("cms.ui.select_one").localize())));
- RelationAttributeCollection statusColl =
- new RelationAttributeCollection(
- "GenericOrganizationalUnitMemberStatus");
- statusColl.addLanguageFilter(GlobalizationHelper.getNegotiatedLocale().
- getLanguage());
- while (statusColl.next()) {
- RelationAttribute status;
- status = statusColl.getRelationAttribute();
- statusSelect.addOption(new Option(status.getKey(), status.getName()));
- }
- add(statusSelect);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
-
- SciProject project;
- String role;
- String status;
-
- project = step.getSelectedProject();
- role = step.getSelectedProjectRole();
- status = step.getSelectedProjectStatus();
-
- if (project == null) {
- itemSearch.setVisible(state, true);
- selectedProjectNameLabel.setVisible(state, false);
- } else {
- data.put(ITEM_SEARCH, project);
- data.put(SciMemberSciProjectsCollection.MEMBER_ROLE, role);
- data.put(SciMemberSciProjectsCollection.STATUS, status);
-
- itemSearch.setVisible(state, false);
- selectedProjectNameLabel.setVisible(state, true);
- selectedProjectNameLabel.setLabel(project.getTitle(), state);
- }
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
- state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- SciProject project;
- project = step.getSelectedProject();
-
- if (project == null) {
- SciProject projectToAdd = (SciProject) data.get(ITEM_SEARCH);
- projectToAdd = (SciProject) projectToAdd.getContentBundle().
- getInstance(member.getLanguage());
-
- member.addProject(projectToAdd,
- (String) data.get(
- SciMemberSciProjectsCollection.MEMBER_ROLE),
- (String) data.get(
- SciMemberSciProjectsCollection.STATUS));
- } else {
- SciMemberSciProjectsCollection projects;
-
- projects = member.getProjects();
-
- while (projects.next()) {
- if (projects.getProject().equals(project)) {
- break;
- }
- }
-
- projects.setRoleName((String) data.get(
- SciMemberSciProjectsCollection.MEMBER_ROLE));
- projects.setStatus((String) data.get(
- SciMemberSciProjectsCollection.STATUS));
-
- step.setSelectedProject(null);
- step.setSelectedProjectRole(null);
- step.setSelectedProjectStatus(null);
-
- projects.close();
- }
-
- init(fse);
- }
- }
-
- @Override
- public void submitted(FormSectionEvent fse) throws FormProcessException {
- if (getSaveCancelSection().getCancelButton().isSelected(
- fse.getPageState())) {
- step.setSelectedProject(null);
- step.setSelectedProjectRole(null);
- step.setSelectedProjectStatus(null);
-
- init(fse);
- }
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.select_project.no_project_selected"));
- return;
- }
-
- SciMember member = (SciMember) getItemSelectionModel().getSelectedObject(
- state);
- SciProject project = (SciProject) data.get(ITEM_SEARCH);
- if (!(project.getContentBundle().hasInstance(member.getLanguage()))) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.select_project.no_suitable_language_variant"));
- return;
- }
-
- project = (SciProject) project.getContentBundle().getInstance(member.getLanguage());
- SciMemberSciProjectsCollection projects = member.getProjects();
- projects.addFilter(String.format("id = %s", project.getID().toString()));
- if (projects.size() > 0) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.select_project.already_added"));
- }
-
- projects.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsStep.java
deleted file mode 100644
index 81d277702..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsStep.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- * @version $Id$
- */
-public class SciMemberSciProjectsStep extends SimpleEditStep {
-
- private String MEMBER_ADD_project_SHEET_NAME = "memberAddproject";
- private SciProject selectedProject;
- private String selectedProjectRole;
- private String selectedProjectStatus;
-
- public SciMemberSciProjectsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciMemberSciProjectsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addprojectForm = new SciMemberSciProjectAddForm(itemModel, this);
- add(MEMBER_ADD_project_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize("scimember.ui.project.add").localize(),
- new WorkflowLockedComponentAccess(addprojectForm, itemModel),
- addprojectForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(new SciMemberSciProjectsTable(itemModel, this));
- }
-
- protected SciProject getSelectedProject() {
- return selectedProject;
- }
-
- protected void setSelectedProject(SciProject selectedProject) {
- this.selectedProject = selectedProject;
- }
-
- protected String getSelectedProjectRole() {
- return selectedProjectRole;
- }
-
- protected void setSelectedProjectRole(String selectedProjectRole) {
- this.selectedProjectRole = selectedProjectRole;
- }
-
- protected String getSelectedProjectStatus() {
- return selectedProjectStatus;
- }
-
- protected void setSelectedProjectStatus(String selectedProjectStatus) {
- this.selectedProjectStatus = selectedProjectStatus;
- }
-
- protected void showEditComponent(PageState state) {
- showComponent(state, MEMBER_ADD_project_SHEET_NAME);
- }
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsTable.java
deleted file mode 100644
index 58c9bc001..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciMemberSciProjectsTable.java
+++ /dev/null
@@ -1,352 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.RelationAttributeCollection;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciMemberSciProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciMemberSciProjectsTable
- extends Table
- implements TableActionListener {
-
- private static final Logger logger = Logger.getLogger(
- SciMemberSciProjectsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_EDIT_LINK = "table_col_edit_link";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel itemModel;
- private SciMemberSciProjectsStep step;
-
- public SciMemberSciProjectsTable(ItemSelectionModel itemModel,
- SciMemberSciProjectsStep step) {
- super();
- this.itemModel = itemModel;
- this.step = step;
-
- setEmptyView(new Label(SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.projects.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.role").localize()));
- columnModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.status").localize()));
- columnModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.edit").localize(),
- TABLE_COL_EDIT_LINK));
- columnModel.add(new TableColumn(
- 4,
- SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.project.remove").localize(),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new SciMemberSciProjectsTableModelBuilder(itemModel));
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(3).setCellRenderer(new EditLinkCellRenderer());
- columnModel.get(4).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciMemberSciProjectsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- public SciMemberSciProjectsTableModelBuilder(
- ItemSelectionModel itemModel) {
- SciMemberSciProjectsTable.this.itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
- return new SciMemberSciProjectsTableModel(table,
- state,
- member);
- }
- }
-
- private class SciMemberSciProjectsTableModel implements TableModel {
-
- private Table table;
- private SciMemberSciProjectsCollection projects;
- private SciProject project;
-
- public SciMemberSciProjectsTableModel(Table table,
- PageState state,
- SciMember member) {
- this.table = table;
- this.projects = member.getProjects();
- }
-
- @Override
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((projects != null) && projects.next()) {
- project = projects.getProject();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return project.getTitle();
- case 1:
- RelationAttributeCollection role =
- new RelationAttributeCollection(
- "SciProjectRole",
- projects.getRoleName());
- if (role.next()) {
- String roleName = role.getName();
- role.close();
- return roleName;
- } else {
- return ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknownRole").localize();
- }
- case 2:
- RelationAttributeCollection status =
- new RelationAttributeCollection(
- "GenericOrganizationalUnitMemberStatus",
- projects.getStatus());
- if (status.next()) {
- String statusName = status.getName();
- status.close();
- return statusName;
- } else {
- return ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknownStatus").localize();
- }
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.projects.edit_assoc").localize();
- case 4:
- return SciOrganizationGlobalizationUtil.globalize(
- "scimember.ui.projects.remove").localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return project.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- SciProject project;
- try {
- project = new SciProject((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()),
- resolver.generateItemURL(state,
- project,
- section, project.
- getVersion()));
- return link;
- } else {
- SciProject project;
- try {
- project = new SciProject((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- logger.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()));
- return label;
- }
- }
- }
-
- private class EditLinkCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- member);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "scimember.ui.project."
- + "confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciProject project = new SciProject(new BigDecimal(event.getRowKey().
- toString()));
-
- SciMember member = (SciMember) itemModel.getSelectedObject(state);
-
- SciMemberSciProjectsCollection projects = member.getProjects();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- } else if (TABLE_COL_EDIT_LINK.equals(
- column.getHeaderKey().toString())) {
- while (projects.next()) {
- if (projects.getProject().equals(project)) {
- break;
- }
- }
- step.setSelectedProject(projects.getProject());
- step.setSelectedProjectRole(projects.getRoleName());
- step.setSelectedProjectStatus(projects.getStatus());
-
- projects.close();
-
- step.showEditComponent(state);
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- member.removeProject(project);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationBasePanel.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationBasePanel.java
deleted file mode 100644
index 5c41927ad..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationBasePanel.java
+++ /dev/null
@@ -1,796 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.GenericPersonContactCollection;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.xml.Element;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.GregorianCalendar;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import org.apache.log4j.Logger;
-
-/**
- * Base class for all panels of the sci-types-organization module. The panels
- * are displaying the information of an organization type (
- * SciOrganization, SciDepartment,
- * SciProject) similar to the MultiPartArticle. For
- * each information, e.g. members, there is a link, which replaces the
- * information shown. To use this as an index item, a special template is
- * necessary. An example of such a template can be found in the ccm-zes-aplaws
- * module.
- *
- * @see SciOrganizationPanel
- * @see SciDepartmentPanel
- * @see SciProjectPanel
- * @author Jens Pelzetter
- */
-public abstract class SciOrganizationBasePanel
- extends GenericOrganizationalUnitPanel {
-
- private final static Logger s_log = Logger.getLogger(
- SciOrganizationBasePanel.class);
-
- protected class MemberListItem {
-
- private OID oid;
- private String surname;
- private String givenName;
- private String titlePre;
- private String titlePost;
- private Date birthdate;
- private String gender;
- private DataCollection contacts;
- //private GenericPerson member;
- private String role;
- private String status;
-
- public MemberListItem(final GenericPerson member,
- final String role,
- final String status) {
- /*this.member = member;
- this.role = role;
- this.status = status;*/
- this(member.getOID(),
- member.getSurname(),
- member.getGivenName(),
- member.getTitlePre(),
- member.getTitlePost(),
- member.getBirthdate(),
- member.getGender(),
- null,
- role,
- status);
-
- }
-
- public MemberListItem(final OID oid,
- final String surname,
- final String givenName,
- final String titlePre,
- final String titlePost,
- final Date birthdate,
- final String gender,
- final DataCollection contacts,
- final String role,
- final String status) {
- this.oid = oid;
- this.surname = surname;
- this.givenName = givenName;
- this.titlePre = titlePre;
- this.titlePost = titlePost;
- this.birthdate = birthdate;
- this.gender = gender;
- this.contacts = contacts;
- this.role = role;
- this.status = status;
- }
-
- /*public GenericPerson getMember() {
- return member;
- }*/
- public OID getOID() {
- return oid;
- }
-
- public Date getBirthdate() {
- return birthdate;
- }
-
- public DataCollection getContacts() {
- return contacts;
- }
-
- public String getGender() {
- return gender;
- }
-
- public String getGivenName() {
- return givenName;
- }
-
- public String getSurname() {
- return surname;
- }
-
- public String getTitlePost() {
- return titlePost;
- }
-
- public String getTitlePre() {
- return titlePre;
- }
-
- public String getRole() {
- return role;
- }
-
- public String getStatus() {
- return status;
- }
-
- /*@Override
- public boolean equals(Object obj) {
- if (obj instanceof MemberListItem) {
- MemberListItem other = (MemberListItem) obj;
-
- return member.equals(other.getMember());
- } else {
- return false;
- }
- }*/
- @Override
- public boolean equals(Object obj) {
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final MemberListItem other = (MemberListItem) obj;
- if ((this.surname == null) ? (other.surname != null)
- : !this.surname.equals(other.surname)) {
- return false;
- }
- if ((this.givenName == null) ? (other.givenName != null)
- : !this.givenName.equals(other.givenName)) {
- return false;
- }
- if ((this.titlePre == null) ? (other.titlePre != null)
- : !this.titlePre.equals(other.titlePre)) {
- return false;
- }
- if ((this.titlePost == null) ? (other.titlePost != null)
- : !this.titlePost.equals(other.titlePost)) {
- return false;
- }
- if (this.birthdate != other.birthdate && (this.birthdate == null
- || !this.birthdate.equals(
- other.birthdate))) {
- return false;
- }
- if ((this.gender == null) ? (other.gender != null)
- : !this.gender.equals(other.gender)) {
- return false;
- }
- if ((this.role == null) ? (other.role != null)
- : !this.role.equals(other.role)) {
- return false;
- }
- if ((this.status == null) ? (other.status != null)
- : !this.status.equals(other.status)) {
- return false;
- }
- return true;
- }
-
- /*@Override
- public int hashCode() {
- return member.hashCode();
- }*/
- @Override
- public int hashCode() {
- int hash = 3;
- hash =
- 41 * hash + (this.surname != null ? this.surname.hashCode() : 0);
- hash =
- 41 * hash + (this.givenName != null ? this.givenName.hashCode() : 0);
- hash =
- 41 * hash + (this.titlePre != null ? this.titlePre.hashCode() : 0);
- hash =
- 41 * hash + (this.titlePost != null ? this.titlePost.hashCode() : 0);
- hash =
- 41 * hash + (this.birthdate != null ? this.birthdate.hashCode() : 0);
- hash =
- 41 * hash + (this.gender != null ? this.gender.hashCode() : 0);
- hash = 41 * hash + (this.role != null ? this.role.hashCode() : 0);
- hash =
- 41 * hash + (this.status != null ? this.status.hashCode() : 0);
- return hash;
- }
- }
-
- protected class MemberListItemComparator
- implements Comparator {
-
- public int compare(MemberListItem member1, MemberListItem member2) {
- int result = 0;
-
- /*result =
- member1.getMember().getSurname().compareToIgnoreCase(member2.
- getMember().
- getSurname());
-
- if (result == 0) {
- result = member1.getMember().getGivenName().compareTo(
- member2.getMember().getGivenName());
- }*/
-
- result =
- member1.getSurname().compareToIgnoreCase(member2.getSurname());
-
- if (result == 0) {
- result =
- member1.getGivenName().compareTo(member2.getGivenName());
- }
-
- return result;
- }
- }
-
- protected class SciProjectComparator implements Comparator {
-
- public int compare(SciProject project1, SciProject project2) {
- /*int result = 0;
-
- if (project1.getBegin() == null) {
- return -1;
- } else if (project2.getBegin() == null) {
- return 1;
- } else {
- result = project1.getBegin().compareTo(project2.getBegin());
- }
-
- if (result == 0) {
- if (project1.getEnd() == null) {
- return -1;
- } else if (project2.getEnd() == null) {
- return 1;
- } else if ((project1.getEnd() == null) && (project2.getEnd()
- == null)) {
- return 0;
- } else {
- result = project1.getEnd().compareTo(project2.getEnd());
- }
- }
-
- return result;*/
-
- return project1.getTitle().compareTo(project2.getTitle());
- }
- }
-
- protected List getFiltersForActiveMembers() {
- List filters;
- filters = new LinkedList();
-
- filters.add("link.status = 'active'");
-
- return filters;
- }
-
- protected List getFiltersForAssociatedMembers() {
- List filters;
- filters = new LinkedList();
-
- filters.add("link.status = 'associated'");
-
- return filters;
- }
-
- protected List getFiltersForFormerAssociatedMembers() {
- List filters;
- filters = new LinkedList();
-
- filters.add("link.status = 'associatedFormer'");
-
- return filters;
- }
-
- protected List getFiltersForFormerMembers() {
- List filters;
- filters = new LinkedList();
-
- //filters.add("link.status = 'former'");
- filters.add("lower(link.status) like lower('%former%')");
-
- return filters;
- }
-
- protected List getFiltersForOngoingProjects() {
- List filters;
- Calendar today;
-
- filters = new LinkedList();
- today = new GregorianCalendar();
- filters.add(String.format(
- "(projectbegin IS NOT null) AND (projectend > '%d-%02d-%02d' OR projectend IS null)",
- today.get(java.util.Calendar.YEAR),
- today.get(java.util.Calendar.MONTH)
- + 1,
- today.get(java.util.Calendar.DAY_OF_MONTH)));
- return filters;
- }
-
- protected List getFiltersForFinishedProjects() {
- List filters;
- Calendar today;
-
- filters = new LinkedList();
- today = new GregorianCalendar();
- filters.add(String.format("projectend <= '%d-%02d-%02d'",
- today.get(java.util.Calendar.YEAR),
- today.get(java.util.Calendar.MONTH)
- + 1,
- today.get(java.util.Calendar.DAY_OF_MONTH)));
- return filters;
- }
-
- protected void generateMemberXML(final MemberListItem person,
- final Element parent,
- final String roleName,
- final String status,
- final PageState state) {
- Element memberElem = parent.newChildElement("member");
-
- memberElem.addAttribute("role", roleName);
- memberElem.addAttribute("status", status);
- memberElem.addAttribute("oid", person.getOID().toString());
-
- //Element title = memberElem.newChildElement("title");
- //title.setText(person.getTitle());
-
- if ((person.getTitlePre() != null)
- && !person.getTitlePre().isEmpty()) {
- Element titlePre = memberElem.newChildElement("titlePre");
- titlePre.setText(person.getTitlePre());
- }
-
- Element surname = memberElem.newChildElement("surname");
- surname.setText(person.getSurname());
-
- Element givenName = memberElem.newChildElement("givenname");
- givenName.setText(person.getGivenName());
-
- if ((person.getTitlePost() != null)
- && !person.getTitlePost().isEmpty()) {
- Element titlePost = memberElem.newChildElement("titlePost");
- titlePost.setText(person.getTitlePost());
- }
-
- if ((person.getContacts() != null)
- && (person.getContacts().size() > 0)) {
- GenericPersonContactCollection contacts;
- contacts = new GenericPersonContactCollection(person.getContacts());
-
- Element contactsElem =
- memberElem.newChildElement("contacts");
-
- while (contacts.next()) {
- generateContactXML(
- contacts.getContactType(),
- contacts.getPerson(),
- contacts.getContactEntries(),
- contacts.getAddress(),
- contactsElem,
- state,
- contacts.getContactOrder(),
- false);
- }
- }
- }
-
- @Deprecated
- protected void generateMemberXML(final GenericPerson person,
- final Element parent,
- final String roleName,
- final String status,
- final PageState state) {
- Element memberElem = parent.newChildElement("member");
-
- memberElem.addAttribute("role", roleName);
- memberElem.addAttribute("status", status);
- memberElem.addAttribute("oid", person.getOID().toString());
-
- Element title = memberElem.newChildElement("title");
- title.setText(person.getTitle());
-
- if ((person.getTitlePre() != null)
- && !person.getTitlePre().isEmpty()) {
- Element titlePre = memberElem.newChildElement("titlePre");
- titlePre.setText(person.getTitlePre());
- }
-
- Element surname = memberElem.newChildElement("surname");
- surname.setText(person.getSurname());
-
- Element givenName = memberElem.newChildElement("givenname");
- givenName.setText(person.getGivenName());
-
- if ((person.getTitlePost() != null)
- && !person.getTitlePost().isEmpty()) {
- Element titlePost = memberElem.newChildElement("titlePost");
- titlePost.setText(person.getTitlePost());
- }
-
- if ((person.getContacts() != null)
- && (person.getContacts().size() > 0)) {
- GenericPersonContactCollection contacts;
- contacts = person.getContacts();
-
- Element contactsElem =
- memberElem.newChildElement("contacts");
-
- while (contacts.next()) {
- generateContactXML(
- contacts.getContactType(),
- contacts.getPerson(),
- contacts.getContactEntries(),
- contacts.getAddress(),
- contactsElem,
- state,
- contacts.getContactOrder(),
- false);
- }
- }
- }
-
- protected void addMember(
- final GenericOrganizationalUnitPersonCollection persons,
- final List members) {
- addMember(persons.getOID(),
- persons.getSurname(),
- persons.getGivenName(),
- persons.getTitlePre(),
- persons.getTitlePost(),
- persons.getBirthdate(),
- persons.getGender(),
- persons.getContacts(),
- persons.getRoleName(),
- persons.getStatus(),
- members);
- }
-
- private void addMember(final OID oid,
- final String surname,
- final String givenName,
- final String titlePre,
- final String titlePost,
- final Date birthdate,
- final String gender,
- final DataCollection contacts,
- final String role,
- final String status,
- final List members) {
- MemberListItem listItem = new MemberListItem(oid,
- surname,
- givenName,
- titlePre,
- titlePost,
- birthdate,
- gender,
- contacts,
- role,
- status);
-
- if (!members.contains(listItem)) {
- members.add(listItem);
- }
- }
-
- @Deprecated
- protected void addMember(final GenericPerson person,
- final String roleName,
- final String status,
- final List members) {
- MemberListItem listItem = new MemberListItem(person, roleName, status);
-
- if (!members.contains(listItem)) {
- members.add(listItem);
- }
- }
-
- protected void mergeMembers(
- final SciDepartmentSubDepartmentsCollection subDepartments,
- final List members,
- final List filters) {
- while (subDepartments.next()) {
- SciDepartment subDepartment = subDepartments.getSubDepartment();
- GenericOrganizationalUnitPersonCollection departmentMembers;
- departmentMembers = subDepartment.getPersons();
- for (String filter : filters) {
- departmentMembers.addFilter(filter);
- }
-
- while (departmentMembers.next()) {
- addMember(departmentMembers.getOID(),
- departmentMembers.getSurname(),
- departmentMembers.getGivenName(),
- departmentMembers.getTitlePre(),
- departmentMembers.getTitlePost(),
- departmentMembers.getBirthdate(),
- departmentMembers.getGender(),
- null,
- departmentMembers.getRoleName(),
- departmentMembers.getStatus(),
- members);
- }
-
- SciDepartmentSubDepartmentsCollection subSubDepartments;
- subSubDepartments = subDepartment.getSubDepartments();
-
- if ((subSubDepartments != null)
- && (subSubDepartments.size() > 0)) {
- mergeMembers(subSubDepartments, members, filters);
- }
- }
- }
-
- protected void generateMembersListXML(final List members,
- final Element parent,
- final PageState state) {
- Set membersSet;
- List membersWithoutDoubles;
- membersSet = new HashSet(members);
- membersWithoutDoubles = new LinkedList(membersSet);
-
- Collections.sort(membersWithoutDoubles, new MemberListItemComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(membersWithoutDoubles.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, membersWithoutDoubles.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count,
- membersWithoutDoubles.size());
- List membersWithoutDoublesToShow =
- membersWithoutDoubles.subList((int) begin,
- (int) end);
-
- Element membersWithoutDoublesElem = parent.newChildElement(
- "members");
-
- for (MemberListItem memberItem : membersWithoutDoublesToShow) {
- generateMemberXML(memberItem,
- membersWithoutDoublesElem,
- memberItem.getRole(),
- memberItem.getStatus(),
- state);
- }
- }
-
- protected void generateProjectXML(final SciProject project,
- final Element parent,
- final PageState state) {
- Element projectElem = parent.newChildElement("project");
- projectElem.addAttribute("oid", project.getOID().toString());
-
- Element title = projectElem.newChildElement("title");
- title.setText(project.getTitle());
-
- Element beginElem = projectElem.newChildElement("projectbegin");
-
- if ((project.getAddendum() != null)
- && !(project.getAddendum().isEmpty())) {
- Element addendum = projectElem.newChildElement("addendum");
- addendum.setText(project.getAddendum());
- }
-
- if ((project.getProjectShortDescription() != null)
- && !(project.getProjectShortDescription().isEmpty())) {
- Element shortDesc = projectElem.newChildElement("shortDescription");
- shortDesc.setText(project.getProjectShortDescription());
- }
-
- GenericOrganizationalUnitPersonCollection members;
- members = project.getPersons();
- members.addOrder("surname asc, givenname asc");
-
- if (members.size() > 0) {
- Element membersElem = projectElem.newChildElement("members");
-
- while (members.next()) {
- generateMemberXML(new MemberListItem(members.getOID(),
- members.getSurname(),
- members.getGivenName(),
- members.getTitlePre(),
- members.getTitlePost(),
- members.getBirthdate(),
- members.getGender(),
- null, members.getRoleName(),
- members.getStatus()),
- membersElem,
- members.getRoleName(),
- members.getStatus(),
- state);
- }
- }
-
- GenericOrganizationalUnitContactCollection contacts;
- contacts = project.getContacts();
-
- if (contacts.size() > 0) {
- Element contactsElem = projectElem.newChildElement("contacts");
-
- while (contacts.next()) {
- generateContactXML(contacts.getContactType(),
- contacts.getPerson(),
- contacts.getContactEntries(),
- contacts.getAddress(),
- contactsElem,
- state,
- Integer.toString(contacts.getContactOrder()),
- true);
- }
- }
- }
-
- protected void mergeProjects(
- final SciDepartmentSubDepartmentsCollection subDepartments,
- final List projects,
- final List filters) {
- while (subDepartments.next()) {
- SciDepartmentProjectsCollection departmentProjects;
- departmentProjects = subDepartments.getSubDepartment().getProjects();
-
- if ((filters != null)
- && !(filters.isEmpty())) {
- for (String filter : filters) {
- departmentProjects.addFilter(filter);
- }
- }
-
- while (departmentProjects.next()) {
- projects.add(departmentProjects.getProject());
- }
-
- SciDepartmentSubDepartmentsCollection subSubDepartments;
- subSubDepartments = subDepartments.getSubDepartment().
- getSubDepartments();
-
- if ((subSubDepartments != null)
- && subSubDepartments.size() > 0) {
- mergeProjects(subSubDepartments, projects, filters);
- }
- }
- }
- /**
- * Create the XML for the list of publications, using the special
- * RelatedLinks passed by the caller. To avoid a dependency to the
- * sci-publications module, we are using only methods from
- * {@link DataObject}, {@link DomainObject}, {@link DataCollection} and
- * {@link DomainCollection}.
- *
- * @param links Links to the publications
- * @param parent The parent XML element for the XML created by this method
- * @param state The current page state.
- */
- /* protected void generatePublicationsXML(final DataCollection links,
- final Element parent,
- final PageState state) {
- RelatedLink link;
- ContentItem publication;
- List publications;
-
- publications = new ArrayList();
-
- while (links.next()) {
- link = new RelatedLink(links.getDataObject());
- publication = link.getTargetItem();
-
- publications.add(publication);
- }
-
- Collections.sort(publications, new Comparator() {
-
- public int compare(ContentItem o1, ContentItem o2) {
- Integer year1;
- Integer year2;
-
- if ((o1 == null) && o2 == null) {
- return 0;
- } else if ((o1 == null) && (o2 != null)) {
- return -1;
- } else if ((o1 != null) && o2 == null) {
- return 1;
- }
-
- year1 = (Integer) o1.get("yearOfPublication");
- year2 = (Integer) o2.get("yearOfPublication");
-
-
- if (year1.compareTo(year2)
- == 0) {
- String title1;
- String title2;
-
- title1 = (String) o1.get("title");
- title2 = (String) o2.get("title");
-
- return title1.compareTo(title2);
- } else {
- return (year1.compareTo(year2)) * -1;
- }
- }
- });
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publications.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, publications.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
- end);
- List publicationsToShow = publications.subList((int) begin,
- (int) end);
-
- for (ContentItem pub : publicationsToShow) {
- generatePublicationXML(pub, parent, state);
- }
- }
-
- protected void generatePublicationXML(final ContentItem publication,
- final Element parent,
- final PageState state) {
- Element publicationElem;
- ContentItemXMLRenderer renderer;
-
- if (publication == null) {
- return;
- }
-
- publicationElem = parent.newChildElement("publications");
-
- renderer = new ContentItemXMLRenderer(publicationElem);
- renderer.setWrapAttributes(true);
-
- renderer.walk(publication, SimpleXMLGenerator.class.getName());
- }*/
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentAddForm.java
deleted file mode 100644
index 5d3b68713..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentAddForm.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for linking {@link SciOrganization}s with {@link SciDepartment}s.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- * @see SciDepartment
- */
-public class SciOrganizationDepartmentAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "departments";
-
- public SciOrganizationDepartmentAddForm(ItemSelectionModel itemModel) {
- super("DepartmentsAddForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.select_department").localize()));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciDepartment.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciOrganization orga = (SciOrganization) getItemSelectionModel().
- getSelectedObject(state);
-
- if (!(this.getSaveCancelSection().getCancelButton().
- isSelected(state))) {
- SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
-
- department = (SciDepartment) department.getContentBundle().
- getInstance(orga.getLanguage());
-
- orga.addDepartment(department);
- //orga.addDepartment((SciDepartment) data.get(ITEM_SEARCH));
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.add.no_department_selected"));
-
- return;
- }
-
- SciOrganization orga = (SciOrganization) getItemSelectionModel().
- getSelectedObject(state);
-
- SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
- if (!(department.getContentBundle().hasInstance(orga.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.add.no_suitable_language_variant"));
-
- return;
- }
-
- department = (SciDepartment) department.getContentBundle().getInstance(orga.
- getLanguage());
- SciOrganizationDepartmentsCollection departments = orga.getDepartments();
- departments.addFilter(String.format("id = %s",
- department.getID().toString()));
- if (departments.size() > 0) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.add.already_added"));
- }
-
- departments.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsStep.java
deleted file mode 100644
index 9b87f25d9..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsStep.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for adding {@link SciDepartment}s to a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- * @see SciDepartment
- * @see SciOrganization
- */
-public class SciOrganizationDepartmentsStep extends SimpleEditStep {
-
- private String ADD_DEPARTMENT_SHEET_NAME = "addDepartment";
-
- public SciOrganizationDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciOrganizationDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addDepartmentSheet =
- new SciOrganizationDepartmentAddForm(itemModel);
- add(ADD_DEPARTMENT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.add_department").localize(),
- new WorkflowLockedComponentAccess(addDepartmentSheet, itemModel),
- addDepartmentSheet.getSaveCancelSection().getCancelButton());
-
- SciOrganizationDepartmentsTable departmentTable =
- new SciOrganizationDepartmentsTable(
- itemModel);
- setDisplayComponent(departmentTable);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsTable.java
deleted file mode 100644
index a8bd06228..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDepartmentsTable.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Table for showing the {@link SciDepartment}s linked to a
- * {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- * @see SciDepartment
- */
-public class SciOrganizationDepartmentsTable
- extends Table
- implements TableActionListener {
-
- private final Logger s_log = Logger.getLogger(
- SciOrganizationDepartmentsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel m_itemModel;
-
- public SciOrganizationDepartmentsTable(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.departments.none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.remove").localize(),
- TABLE_COL_DEL));
- colModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.up").localize(),
- TABLE_COL_UP));
- colModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.down").localize(),
- TABLE_COL_DOWN));
-
- setModelBuilder(
- new SciOrganizationDepartmentsTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
- colModel.get(2).setCellRenderer(new UpCellRenderer());
- colModel.get(3).setCellRenderer(new DownCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciOrganizationDepartmentsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciOrganizationDepartmentsTableModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
- return new SciOrganizationDepartmentsTableModel(table,
- state,
- orga);
- }
- }
-
- private class SciOrganizationDepartmentsTableModel
- implements TableModel {
-
- private Table m_table;
- private SciOrganizationDepartmentsCollection m_departments;
- private SciDepartment m_department;
-
- private SciOrganizationDepartmentsTableModel(Table table,
- PageState state,
- SciOrganization orga) {
- m_table = table;
- m_departments = orga.getDepartments();
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((m_departments != null) && m_departments.next()) {
- m_department = m_departments.getDepartment();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_department.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.remove").
- localize();
- case 2:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.up").
- localize();
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.down").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_department.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- orga);
-
- if (canEdit) {
- SciDepartment department;
- try {
- department = new SciDepartment((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()),
- resolver.generateItemURL(state,
- department,
- section,
- department.
- getVersion()));
-
- return link;
- } else {
- SciDepartment department;
- try {
- department = new SciDepartment((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- orga);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.organization.department."
- + "confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class UpCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- if (0 == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.up").
- localize());
- return link;
- }
- }
- }
-
- private class DownCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
- SciOrganizationDepartmentsCollection departments = orga.
- getDepartments();
-
- if ((departments.size() - 1) == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.department.down").
- localize());
- return link;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciDepartment department = new SciDepartment(
- new BigDecimal(event.getRowKey().toString()));
-
- SciOrganization orga =
- (SciOrganization) m_itemModel.getSelectedObject(state);
-
- SciOrganizationDepartmentsCollection departments =
- orga.getDepartments();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- orga.removeDepartment(department);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
- departments.swapWithPrevious(department);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
- departments.swapWithNext(department);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionEditForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionEditForm.java
deleted file mode 100644
index 756017bfd..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionEditForm.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.ui.CMSDHTMLEditor;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for editing the description of a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- */
-public class SciOrganizationDescriptionEditForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- public SciOrganizationDescriptionEditForm(ItemSelectionModel itemModel) {
- super("sciorganizationEditDescForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.description")));
- ParameterModel descParam = new StringParameter(
- SciOrganization.ORGANIZATION_DESCRIPTION);
- TextArea desc;
- if (SciOrganization.getConfig().getOrganizationDescriptionDhtml()) {
- desc = new CMSDHTMLEditor(descParam);
- } else {
- desc = new TextArea(descParam);
- }
- desc.setCols(75);
- desc.setRows(25);
- add(desc);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- FormData data = fse.getFormData();
- SciOrganization orga = (SciOrganization) getItemSelectionModel().
- getSelectedObject(state);
-
- data.put(SciOrganization.ORGANIZATION_DESCRIPTION,
- orga.getOrganizationDescription());
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- FormData data = fse.getFormData();
-
- SciOrganization orga = (SciOrganization) getItemSelectionModel().
- getSelectedObject(state);
-
- if ((orga != null) && this.getSaveCancelSection().getSaveButton().
- isSelected(state)) {
- orga.setOrganizationDescription((String) data.get(
- SciOrganization.ORGANIZATION_DESCRIPTION));
-
- orga.save();
-
- init(fse);
- }
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionStep.java
deleted file mode 100644
index 38f97e067..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionStep.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- * Step for editing the description of a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- */
-public class SciOrganizationDescriptionStep extends SimpleEditStep {
-
- private String EDIT_ORGANIZATION_DESC_SHEET_NAME = "editOrganizationDesc";
- private String UPLOAD_ORGANIZATION_DESC_SHEET_NAME =
- "uploadOrganizationDesc";
-
- public SciOrganizationDescriptionStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciOrganizationDescriptionStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm editDescForm =
- new SciOrganizationDescriptionEditForm(itemModel);
- add(EDIT_ORGANIZATION_DESC_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.edit_desc").localize(),
- new WorkflowLockedComponentAccess(editDescForm, itemModel),
- editDescForm.getSaveCancelSection().getCancelButton());
-
- SciOrganizationDescriptionUploadForm uploadDescForm =
- new SciOrganizationDescriptionUploadForm(itemModel);
- add(UPLOAD_ORGANIZATION_DESC_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.upload_desc").localize(),
- new WorkflowLockedComponentAccess(uploadDescForm, itemModel),
- uploadDescForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(getSciOrganizationEditDescSheet(itemModel));
- }
-
- public static Component getSciOrganizationEditDescSheet(
- ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
- itemModel);
-
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.desc"),
- SciOrganization.ORGANIZATION_DESCRIPTION);
-
- return sheet;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionUploadForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionUploadForm.java
deleted file mode 100644
index 8c5bc5c5f..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationDescriptionUploadForm.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-/**
- * Form for uploading the description of a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- * @see AbstractTextUploadForm
- */
-public class SciOrganizationDescriptionUploadForm
- extends AbstractTextUploadForm {
-
- public SciOrganizationDescriptionUploadForm(ItemSelectionModel itemModel) {
- super(itemModel);
- }
-
- @Override
- public GlobalizedMessage getLabelText() {
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.description.upload");
- }
-
- @Override
- public GlobalizedMessage getMimeTypeLabel() {
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.description.upload.mimetype");
- }
-
- @Override
- public void setText(ItemSelectionModel itemModel,
- PageState state,
- String text) {
- SciOrganization orga = (SciOrganization) itemModel.getSelectedObject(
- state);
- orga.setOrganizationDescription(text);
- orga.save();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationGlobalizationUtil.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationGlobalizationUtil.java
deleted file mode 100644
index ab5f89a26..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationGlobalizationUtil.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.globalization.GlobalizedMessage;
-
-/**
- * GlobalizationUtil for the ccm-sci-types-organization module.
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationGlobalizationUtil {
-
- public static final String BUNDLE_NAME = "com.arsdigita.cms.contenttypes.ui.SciOrganizationResources";
-
- public static GlobalizedMessage globalize(String key) {
- return new GlobalizedMessage(key, BUNDLE_NAME);
- }
-
- public static GlobalizedMessage globalize(String key, Object[] args) {
- return new GlobalizedMessage(key, BUNDLE_NAME, args);
- }
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberAddForm.java
deleted file mode 100644
index 26312d167..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberAddForm.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-
-/**
- * Form for linking members with a {@link SciOrganization}. The form overwrites
- * the {@link GenericOrganizationalUnitPersonAddForm#getPersonType()} to limit
- * the selectable person type to {@link SciMember}.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- * @see SciMember
- * @see GenericPerson
- * @see GenericOrganizationalUnitPersonAddForm
- */
-public class SciOrganizationMemberAddForm
- extends GenericOrganizationalUnitPersonAddForm {
-
- public SciOrganizationMemberAddForm(
- ItemSelectionModel itemModel,
- GenericOrganizationalUnitPersonSelector personSelector) {
- super(itemModel, personSelector);
- }
-
- @Override
- protected String getPersonType() {
- return GenericPerson.class.getName();
- }
-
- @Override
- protected String getRoleAttributeName() {
- return "SciOrganizationRole";
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberStep.java
deleted file mode 100644
index 9486098e3..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberStep.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for adding and removing member form a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- * @see SciOrganizationMemberAddForm
- * @see SciMember
- * @see SciOrganization
- */
-public class SciOrganizationMemberStep
- extends SimpleEditStep
- implements GenericOrganizationalUnitPersonSelector {
-
- public static final String ADD_MEMBER_SHEET_NAME = "addMember";
- private GenericPerson selectedPerson;
- private String selectedPersonRole;
- private String selectedPersonStatus;
-
- public SciOrganizationMemberStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciOrganizationMemberStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addMemberSheet =
- new SciOrganizationMemberAddForm(itemModel, this);
- add(ADD_MEMBER_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.orgnization.add_member").localize(),
- new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
- addMemberSheet.getSaveCancelSection().getCancelButton());
-
- SciOrganizationMemberTable memberTable = new SciOrganizationMemberTable(
- itemModel, this);
- setDisplayComponent(memberTable);
- }
-
- public GenericPerson getSelectedPerson() {
- return selectedPerson;
- }
-
- public void setSelectedPerson(final GenericPerson selectedPerson) {
- this.selectedPerson = selectedPerson;
- }
-
- public String getSelectedPersonRole() {
- return selectedPersonRole;
- }
-
- public void setSelectedPersonRole(final String selectedPersonRole) {
- this.selectedPersonRole = selectedPersonRole;
- }
-
- public String getSelectedPersonStatus() {
- return selectedPersonStatus;
- }
-
- public void setSelectedPersonStatus(final String selectedPersonStatus) {
- this.selectedPersonStatus = selectedPersonStatus;
- }
-
- public void showEditComponent(final PageState state) {
- showComponent(state, ADD_MEMBER_SHEET_NAME);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberTable.java
deleted file mode 100644
index a8fd810d3..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationMemberTable.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationMemberTable extends GenericOrganizationalUnitPersonsTable {
-
- public SciOrganizationMemberTable(ItemSelectionModel itemModel,
- GenericOrganizationalUnitPersonSelector personSelector) {
- super(itemModel, personSelector);
- }
-
- @Override
- protected String getRoleAttributeName() {
- return "SciOrganizationRole";
- }
-
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPanel.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPanel.java
deleted file mode 100644
index 877d02af7..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPanel.java
+++ /dev/null
@@ -1,594 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
-import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.ui.panels.Filter;
-import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
-import com.arsdigita.xml.Element;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
-/**
- * Panel for rendering the properties of a SciOrganization. The property to show
- * is selected via the show parameter.
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationPanel extends SciOrganizationBasePanel {
-
- private static final Logger s_log = Logger.getLogger(
- SciOrganizationPanel.class);
- public static final String SHOW_DESCRIPTION = "description";
- public static final String SHOW_MEMBERS_ACTIVE = "membersActive";
- public static final String SHOW_MEMBERS_ASSOCIATED = "membersAssociated";
- public static final String SHOW_MEMBERS_FORMER = "membersFormer";
- public static final String SHOW_DEPARTMENTS = "departments";
- public static final String SHOW_PROJECTS = "projects";
- public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
- public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
- private static final String TTILE = "title";
- private String show;
- private boolean displayDescription = true;
- private boolean displayDepartments = true;
- private boolean displayProjects = true;
- private final Map projectFilters =
- new LinkedHashMap();
-
- public SciOrganizationPanel() {
- projectFilters.put(TTILE, new TextFilter(TTILE, TTILE));
- }
-
- @Override
- protected String getDefaultShowParam() {
- return SHOW_DESCRIPTION;
- }
-
- @Override
- protected Class extends ContentItem> getAllowedClass() {
- return SciOrganization.class;
- }
-
- public boolean isDisplayDepartments() {
- return displayDepartments;
- }
-
- public void setDisplayDepartments(boolean displayDepartments) {
- this.displayDepartments = displayDepartments;
- }
-
- public boolean isDisplayDescription() {
- return displayDescription;
- }
-
- public void setDisplayDescription(boolean displayDescription) {
- this.displayDescription = displayDescription;
- }
-
- public boolean isDisplayProjects() {
- return displayProjects;
- }
-
- public void setDisplayProjects(boolean displayProjects) {
- this.displayProjects = displayProjects;
- }
-
- protected boolean hasMembers(final SciOrganization orga) {
- return orga.hasMembers(true, SciOrganization.MemberStatus.ALL);
- }
-
- protected boolean hasActiveMembers(final SciOrganization orga) {
- return orga.hasMembers(true, SciOrganization.MemberStatus.ACTIVE);
- }
-
- protected boolean hasAssociatedMembers(final SciOrganization orga) {
- return orga.hasMembers(true, SciOrganization.MemberStatus.ASSOCIATED);
- }
-
- protected boolean hasFormerMembers(final SciOrganization orga) {
- return orga.hasMembers(true, SciOrganization.MemberStatus.FORMER);
- }
-
- protected boolean hasProjects(final SciOrganization orga) {
- return orga.hasProjects(SciOrganization.getConfig().
- getOrganizationProjectsMerge(),
- SciOrganization.ProjectStatus.ALL);
- }
-
- protected boolean hasOngoingProjects(final SciOrganization orga) {
- return orga.hasProjects(SciOrganization.getConfig().
- getOrganizationProjectsMerge(),
- SciOrganization.ProjectStatus.ONGOING);
- }
-
- protected boolean hasFinishedProjects(final SciOrganization orga) {
- return orga.hasProjects(SciOrganization.getConfig().
- getOrganizationProjectsMerge(),
- SciOrganization.ProjectStatus.FINISHED);
- }
-
- protected void generateDepartmentsXML(final SciOrganization orga,
- final Element parent,
- final PageState state) {
- SciOrganizationDepartmentsCollection departments;
- departments = orga.getDepartments();
- departments.addOrder("link.departmentOrder asc");
-
- long pageNumber = getPageNumber(state);
-
- Element departmentsElem = parent.newChildElement("departments");
-
- long pageCount = getPageCount(departments.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, departments.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count, departments.
- size());
- departments.setRange((int) begin + 1, (int) end + 1);
-
- while (departments.next()) {
- SciDepartment department;
- department = departments.getDepartment();
-
- Element departmentElem = departmentsElem.newChildElement(
- "department");
- departmentElem.addAttribute("order", Integer.toString(departments.
- getDepartmentOrder()));
- departmentElem.addAttribute("oid", department.getOID().toString());
-
- Element title = departmentElem.newChildElement("title");
- title.setText(department.getTitle());
-
- if ((department.getAddendum() != null)
- && !(department.getAddendum().isEmpty())) {
- Element addendum = departmentElem.newChildElement("addendum");
- addendum.setText(department.getAddendum());
- }
-
- if ((department.getDepartmentShortDescription() != null)
- && !(department.getDepartmentShortDescription().isEmpty())) {
- Element shortDesc = departmentElem.newChildElement(
- "shortDescription");
- shortDesc.setText(department.getDepartmentShortDescription());
- }
-
- GenericOrganizationalUnitPersonCollection heads;
- heads = department.getPersons();
- heads.addFilter("link.role_name = 'head' and link.status = 'active'");
- heads.addOrder("surname asc, givenname asc");
-
- if (heads.size() > 0) {
- Element headsElem = departmentElem.newChildElement("heads");
-
- while (heads.next()) {
- Element headElem = headsElem.newChildElement("head");
- Element titlePre = headElem.newChildElement("titlePre");
- titlePre.setText(heads.getTitlePre());
- Element givenName = headElem.newChildElement("givenname");
- givenName.setText(heads.getGivenName());
- Element surname = headElem.newChildElement("surname");
- surname.setText(heads.getSurname());
- Element titlePost = headElem.newChildElement("titlePost");
- titlePost.setText(heads.getTitlePost());
- }
- }
-
- GenericOrganizationalUnitContactCollection contacts;
- contacts = department.getContacts();
- if (contacts.size() > 0) {
- Element contactsElem =
- departmentElem.newChildElement("contacts");
-
- while (contacts.next()) {
- generateContactXML(contacts.getContactType(),
- contacts.getPerson(),
- contacts.getContactEntries(),
- contacts.getAddress(),
- contactsElem,
- state,
- Integer.toString(
- contacts.getContactOrder()),
- true);
- }
- }
- }
- }
-
- protected void mergeMembers(
- final SciOrganizationDepartmentsCollection departments,
- final List members,
- final List filters) {
-
- while (departments.next()) {
- SciDepartment department = departments.getDepartment();
- GenericOrganizationalUnitPersonCollection departmentsMembers;
- departmentsMembers = department.getPersons();
- for (String filter : filters) {
- departmentsMembers.addFilter(filter);
- }
-
- while (departmentsMembers.next()) {
- addMember(departmentsMembers,
- members);
- }
-
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
-
-
- if ((subDepartments != null)
- && subDepartments.size() > 0) {
- mergeMembers(subDepartments, members, filters);
- }
- }
- }
-
- protected void generateMembersXML(final SciOrganization orga,
- final Element parent,
- final PageState state,
- final List filters) {
- if (SciOrganization.getConfig().getOrganizationMembersMerge()) {
- long begin = System.currentTimeMillis();
- List members;
- members = new LinkedList();
- GenericOrganizationalUnitPersonCollection orgaMembers;
- orgaMembers = orga.getPersons();
- for (String filter : filters) {
- orgaMembers.addFilter(filter);
- }
-
- SciOrganizationDepartmentsCollection departments;
- departments = orga.getDepartments();
-
- while (orgaMembers.next()) {
- addMember(orgaMembers,
- members);
- }
-
- mergeMembers(departments, members, filters);
-
- generateMembersListXML(members, parent, state);
- System.out.printf("Members XML generated in %d ms\n", System.currentTimeMillis() - begin);
- } else {
- GenericOrganizationalUnitPersonCollection orgaMembers;
- orgaMembers = orga.getPersons();
- for (String filter : filters) {
- orgaMembers.addFilter(filter);
- }
- List members = new LinkedList();
-
- while (orgaMembers.next()) {
- addMember(orgaMembers,
- members);
- }
-
- generateMembersListXML(members, parent, state);
- }
- }
-
- protected void mergeProjects(
- final SciOrganizationDepartmentsCollection departments,
- final List projects,
- final List filters,
- final PageState state) {
-
- while (departments.next()) {
- SciDepartmentProjectsCollection departmentProjects;
- departmentProjects = departments.getDepartment().getProjects();
-
- if ((filters != null)
- && !(filters.isEmpty())) {
- for (String filter : filters) {
- departmentProjects.addFilter(filter);
- }
- }
-
- while (departmentProjects.next()) {
- projects.add(departmentProjects.getProject());
- }
-
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = departments.getDepartment().getSubDepartments();
-
- if ((subDepartments != null)
- && subDepartments.size() > 0) {
- mergeProjects(subDepartments, projects, filters);
- }
- }
- }
-
- protected void generateProjectsXML(final SciOrganization orga,
- final Element parent,
- final PageState state,
- final List filters) {
- Element controls = parent.newChildElement("filterControls");
- controls.addAttribute("customName", "sciOrganizationProjects");
- controls.addAttribute("show", show);
-
- if (SciOrganization.getConfig().getOrganizationProjectsMerge()) {
- List projects;
- projects = new LinkedList();
- SciOrganizationProjectsCollection orgaProjects;
- orgaProjects = orga.getProjects();
-
- applyProjectFilters(filters, state.getRequest());
- if ((filters != null)
- && !(filters.isEmpty())) {
- for (String filter : filters) {
- orgaProjects.addFilter(filter);
- }
- }
-
- SciOrganizationDepartmentsCollection departments;
- departments = orga.getDepartments();
-
- while (orgaProjects.next()) {
- projects.add(orgaProjects.getProject());
- }
-
- mergeProjects(departments, projects, filters, state);
-
- Set projectsSet;
- List projectsWithoutDoubles;
- projectsSet = new HashSet(projects);
- projectsWithoutDoubles = new LinkedList(projectsSet);
-
- Collections.sort(projectsWithoutDoubles, new SciProjectComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(projectsWithoutDoubles.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, projectsWithoutDoubles.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generateProjectFiltersXml(projectsWithoutDoubles, controls);
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count,
- projectsWithoutDoubles.size());
- List projectsWithoutDoublesToShow =
- projectsWithoutDoubles.subList((int) begin,
- (int) end);
-
- Element projectsWithoutDoublesElem = parent.newChildElement(
- "projects");
- for (SciProject project : projectsWithoutDoublesToShow) {
- generateProjectXML(project, projectsWithoutDoublesElem, state);
- }
- } else {
- SciOrganizationProjectsCollection orgaProjects;
- orgaProjects = orga.getProjects();
-
- applyProjectFilters(filters, state.getRequest());
- if ((filters != null)
- && !(filters.isEmpty())) {
- for (String filter : filters) {
- orgaProjects.addFilter(filter);
- }
- }
-
- List projects = new LinkedList();
-
- while (orgaProjects.next()) {
- projects.add(orgaProjects.getProject());
- }
-
- Collections.sort(projects, new SciProjectComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(projects.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, projects.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generateProjectFiltersXml(projects, controls);
- createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count, projects.
- size());
- List projectsToShow = projects.subList((int) begin,
- (int) end);
-
- Element projectsElem = parent.newChildElement("projects");
- for (SciProject project : projectsToShow) {
- generateProjectXML(project, projectsElem, state);
- }
- }
- }
-
- protected void generateProjectFiltersXml(
- final List projects,
- final Element element) {
- final Element filterElement = element.newChildElement("filters");
-
- for (Map.Entry filterEntry : projectFilters.entrySet()) {
- filterEntry.getValue().generateXml(filterElement);
- }
- }
-
- protected void applyProjectFilters(
- final List filters,
- final HttpServletRequest request) {
- //Get parameters from HTTP request
- for (Map.Entry filterEntry : projectFilters.entrySet()) {
- String value = request.getParameter(
- filterEntry.getValue().getLabel());
-
- if ((value != null) && !(value.trim().isEmpty())) {
- filterEntry.getValue().setValue(value);
- }
- }
-
- //Apply filters to DomainCollection
- final StringBuilder filterBuilder = new StringBuilder();
- for (Map.Entry filterEntry : projectFilters.entrySet()) {
- if ((filterEntry.getValue().getFilter() == null)
- || (filterEntry.getValue().getFilter().isEmpty())) {
- continue;
- }
-
- if (filterBuilder.length() > 0) {
- filterBuilder.append(" AND ");
- }
- filterBuilder.append(filterEntry.getValue().getFilter());
- s_log.debug(String.format("filters: %s", filterBuilder));
- if (filterBuilder.length() > 0) {
- filters.add(filterBuilder.toString());
- }
- }
- }
-
- @Override
- protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
- SciOrganizationConfig config;
- config = SciOrganization.getConfig();
-
- SciOrganization organization = (SciOrganization) orga;
-
- if ((organization.getOrganizationDescription() != null)
- && !(organization.getOrganizationDescription().isEmpty())
- && displayDescription) {
- element.newChildElement("description");
- }
- if (organization.hasContacts()
- && isDisplayContacts()) {
- element.newChildElement("contacts");
- }
- if (organization.hasDepartments()
- && displayDepartments) {
- element.newChildElement("departments");
- }
- if (config.getOrganizationMembersAllInOne()) {
- if (hasMembers(organization)
- && isDisplayMembers()) {
- element.newChildElement("members");
- }
- } else {
- if (hasActiveMembers(organization)
- && isDisplayMembers()) {
- element.newChildElement("membersActive");
- }
- if (hasAssociatedMembers(organization)
- && isDisplayMembers()) {
- element.newChildElement("membersAssociated");
- }
- if (hasFormerMembers(organization)
- && isDisplayMembers()) {
- element.newChildElement("membersFormer");
- }
- }
- if (config.getOrganizationProjectsAllInOne()) {
- if (hasProjects(organization)
- && displayProjects) {
- element.newChildElement("projects");
- }
- } else {
- if (hasOngoingProjects(organization)
- && displayProjects) {
- element.newChildElement("projectsOngoing");
- }
- if (hasFinishedProjects(organization)
- && displayProjects) {
- element.newChildElement("projectsFinished");
- }
- }
- }
-
- @Override
- protected void generateDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
- show = getShowParam(state);
-
- SciOrganization organization = (SciOrganization) orga;
-
- if (SHOW_DESCRIPTION.equals(show)) {
- String desc;
- desc = organization.getOrganizationDescription();
-
- Element description = element.newChildElement("description");
- description.setText(desc);
- } else if (SHOW_CONTACTS.equals(show)) {
- generateContactsXML(organization, element, state);
- } else if (SHOW_DEPARTMENTS.equals(show)) {
- generateDepartmentsXML(organization, element, state);
- } else if (SHOW_MEMBERS.equals(show)) {
- generateMembersXML(organization, element, state,
- new LinkedList());
- } else if (SHOW_MEMBERS_ACTIVE.equals(show)) {
- generateMembersXML(organization, element, state,
- getFiltersForActiveMembers());
- } else if (SHOW_MEMBERS_ASSOCIATED.equals(show)) {
- generateMembersXML(organization, element, state,
- getFiltersForAssociatedMembers());
- } else if (SHOW_MEMBERS_FORMER.equals(show)) {
- generateMembersXML(organization, element, state,
- getFiltersForFormerMembers());
- } else if (SHOW_PROJECTS.equals(show)) {
- generateProjectsXML(organization, element, state,
- new LinkedList());
- } else if (SHOW_PROJECTS_ONGOING.equals(show)) {
- generateProjectsXML(
- organization, element, state, getFiltersForOngoingProjects());
- } else if (SHOW_PROJECTS_FINISHED.equals(show)) {
- generateProjectsXML(
- organization, element, state,
- getFiltersForFinishedProjects());
- }
- }
-
- /*@Override
- public void generateXML(ContentItem item,
- Element element,
- PageState state) {
- Element content = generateBaseXML(item, element, state);
-
- SciOrganization orga = (SciOrganization) item;
- Element availableData = content.newChildElement("availableData");
-
- generateAvailableDataXml(orga, availableData, state);
-
- generateDataXml(orga, content, state);
- }*/
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectAddForm.java
deleted file mode 100644
index 61aedfc6e..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectAddForm.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for linking projects with a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- * @see SciOrganizationProjectAddForm
- * @see SciOrganization
- * @see SciProject
- */
-public class SciOrganizationProjectAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "projects";
-
- public SciOrganizationProjectAddForm(ItemSelectionModel itemModel) {
- super("ProjectsAddForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.select_project").localize()));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciProject.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciOrganization orga = (SciOrganization) getItemSelectionModel().
- getSelectedObject(state);
-
- if (!(this.getSaveCancelSection().getCancelButton().
- isSelected(state))) {
- SciProject project = (SciProject) data.get(ITEM_SEARCH);
- project = (SciProject) project.getContentBundle().getInstance(orga.
- getLanguage());
-
- orga.addProject(project);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.select_project.no_project_selected"));
- return;
- }
-
- SciOrganization orga = (SciOrganization) getItemSelectionModel().
- getSelectedObject(state);
- SciProject project = (SciProject) data.get(ITEM_SEARCH);
- if (!(project.getContentBundle().hasInstance(orga.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.select_project.no_suitable_language_variant"));
- return;
- }
-
- project = (SciProject) project.getContentBundle().getInstance(orga.
- getLanguage());
- SciOrganizationProjectsCollection projects = orga.getProjects();
- projects.addFilter(String.format("id = %s", project.getID().toString()));
- if (projects.size() > 0) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.select_project.already_added"));
- }
-
- projects.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsStep.java
deleted file mode 100644
index 25d1d4c03..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsStep.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for adding and removing links from a {@link SciOrganization} to a
- * {@link SciProject}.
- *
- * @author Jens Pelzetter
- * @see SciOrganizationProjectAddForm
- * @see SciOrganization
- * @see SciProject
- */
-public class SciOrganizationProjectsStep extends SimpleEditStep {
-
- private String ADD_PROJECT_SHEET_NAME = "addProject";
-
- public SciOrganizationProjectsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciOrganizationProjectsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addProjectSheet =
- new SciOrganizationProjectAddForm(itemModel);
- add(ADD_PROJECT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.add_project").localize(),
- new WorkflowLockedComponentAccess(addProjectSheet, itemModel),
- addProjectSheet.getSaveCancelSection().getCancelButton());
-
- SciOrganizationProjectsTable projectsTable =
- new SciOrganizationProjectsTable(
- itemModel);
- setDisplayComponent(projectsTable);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsTable.java
deleted file mode 100644
index bd151d675..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationProjectsTable.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import java.math.BigDecimal;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- * Table for showing the links between a {@link SciOrganization} and
- * {@link SciProject}s.
- *
- * @author Jens Pelzetter
- * @see SciOrganization
- * @see SciProject
- */
-public class SciOrganizationProjectsTable
- extends Table
- implements TableActionListener {
-
- private final Logger s_log = Logger.getLogger(
- SciOrganizationProjectsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel m_itemModel;
-
- public SciOrganizationProjectsTable(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.projects.none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.remove").localize(),
- TABLE_COL_DEL));
- /*colModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.up").localize(),
- TABLE_COL_UP));
- colModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.down").localize(),
- TABLE_COL_DOWN));*/
-
- setModelBuilder(
- new SciOrganizationProjectsTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
- //colModel.get(2).setCellRenderer(new UpCellRenderer());
- //colModel.get(3).setCellRenderer(new DownCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciOrganizationProjectsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciOrganizationProjectsTableModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
- return new SciOrganizationProjectsTableModel(table,
- state,
- orga);
- }
- }
-
- private class SciOrganizationProjectsTableModel
- implements TableModel {
-
- private Table m_table;
- private SciOrganizationProjectsCollection m_projects;
- private SciProject m_project;
-
- public SciOrganizationProjectsTableModel(Table table,
- PageState state,
- SciOrganization orga) {
- m_table = table;
- m_projects = orga.getProjects();
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((m_projects != null) && m_projects.next()) {
- m_project = m_projects.getProject();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_project.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.remove").
- localize();
- case 2:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.up").
- localize();
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.down").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_project.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- orga);
-
- if (canEdit) {
- SciProject project;
- try {
- project = new SciProject((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link =
- new Link(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()),
- resolver.generateItemURL(state,
- project,
- section,
- project.getVersion()));
-
- return link;
-
- } else {
- SciProject project;
- try {
- project = new SciProject((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- orga);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.organization.project."
- + "confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class UpCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- if (0 == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.up").
- localize());
- return link;
- }
- }
- }
-
- private class DownCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- SciOrganization orga = (SciOrganization) m_itemModel.
- getSelectedObject(state);
- SciOrganizationProjectsCollection projects = orga.getProjects();
-
- if ((projects.size() - 1) == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.project.down").
- localize());
- return link;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciProject project = new SciProject(
- new BigDecimal(event.getRowKey().toString()));
-
- SciOrganization orga =
- (SciOrganization) m_itemModel.getSelectedObject(state);
-
- SciOrganizationProjectsCollection projects =
- orga.getProjects();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- orga.removeProject(project);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
- projects.swapWithPrevious(project);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
- projects.swapWithNext(project);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertiesStep.java
deleted file mode 100644
index a2affc2c5..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertiesStep.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- * Step for editing the basic properties of a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationPropertiesStep
- extends GenericOrganizationalUnitPropertiesStep {
-
- public SciOrganizationPropertiesStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- super(itemModel, parent);
- }
-
- @Override
- protected void addBasicProperties(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
- parent,
- EDIT_SHEET_NAME);
-
- BasicPageForm editBasicSheet =
- new SciOrganizationPropertyForm(itemModel, this);
-
- basicProperties.add(EDIT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.edit_basic_sheet").localize(),
- new WorkflowLockedComponentAccess(editBasicSheet,
- itemModel),
- editBasicSheet.getSaveCancelSection().
- getCancelButton());
-
- basicProperties.setDisplayComponent(
- getSciOrganizationPropertySheet(itemModel));
-
- getSegmentedPanel().addSegment(
- new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.basic_properties").
- localize()),
- basicProperties);
- }
-
- @Override
- protected void addSteps(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- //super.addSteps(itemModel, parent);
-
- SciOrganizationConfig config;
- config = SciOrganization.getConfig();
-
- if (!config.getOrganizationAddContactHide()) {
- addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.contacts"));
- }
-
- /* This steps are now separate steps in the left box.
- if (!config.getOrganizationAddPersonHide()) {
- addStep(new SciOrganizationMemberStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization_members"));
- }
-
- if (!config.getOrganizationAddDepartmentHide()) {
- addStep(new SciOrganizationDepartmentsStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.departments"));
- }
-
- if (!config.getOrganizationAddProjectHide()) {
- addStep(new SciOrganizationProjectsStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.organization.projects"));
- }*/
- }
-
- public static Component getSciOrganizationPropertySheet(
- ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) GenericOrganizationalUnitPropertiesStep.
- getGenericOrganizationalUnitPropertySheet(itemModel);
-
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.organization.shortdescription"),
- SciOrganization.ORGANIZATION_SHORT_DESCRIPTION);
-
- return sheet;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertyForm.java
deleted file mode 100644
index 37e17077a..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPropertyForm.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-
-/**
- * Form for editing the basic properties of a {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationPropertyForm
- extends GenericOrganizationalUnitPropertyForm
- implements FormProcessListener,
- FormInitListener,
- FormSubmissionListener {
-
- public static final String ID = "SciOrganizationEdit";
-
- public SciOrganizationPropertyForm(ItemSelectionModel itemModel) {
- this(itemModel, null);
- }
-
- public SciOrganizationPropertyForm(ItemSelectionModel itemModel,
- SciOrganizationPropertiesStep step) {
- super(itemModel, step);
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
- super.addWidgets();
-
- Label descLabel = new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.organization.shortdescription"));
- add(descLabel);
- ParameterModel descParam = new StringParameter(
- SciOrganization.ORGANIZATION_SHORT_DESCRIPTION);
- TextArea desc = new TextArea(descParam);
- desc.addValidationListener(new StringInRangeValidationListener(0, 500));
- desc.setCols(75);
- desc.setRows(5);
- add(desc);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- super.init(fse);
-
- FormData data = fse.getFormData();
- SciOrganization orga = (SciOrganization) super.initBasicWidgets(fse);
-
- data.put(SciOrganization.ORGANIZATION_SHORT_DESCRIPTION,
- orga.getOrganizationShortDescription());
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- super.process(fse);
-
- FormData data = fse.getFormData();
- SciOrganization organization = (SciOrganization) super.
- processBasicWidgets(fse);
-
- if ((organization != null) && getSaveCancelSection().getSaveButton().
- isSelected(fse.getPageState())) {
-
- organization.setOrganizationShortDescription((String) data.get(
- SciOrganization.ORGANIZATION_SHORT_DESCRIPTION));
-
- organization.save();
- }
- }
-
- @Override
- public String getTitleLabel() {
- return (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.organization.title").localize();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationResources.properties b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationResources.properties
deleted file mode 100644
index 836c6ffce..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationResources.properties
+++ /dev/null
@@ -1,232 +0,0 @@
-sciorganization.ui.project.subprojects.none=No subprojects found
-sciorganization.ui.project.subproject=Subproject
-sciorganization.ui.project.subproject.remove=Remove subproject
-sciorganization.ui.project.subproject.up=Up
-sciorganization.ui.project.subproject.down=Down
-sciorganization.ui.project.subproject.confirm_remove=Are you sure to remove this department?
-sciorganization.ui.project.select_subproject=Select project to add as subproject
-sciorganization.ui.member.edit_basic_properties=Edit basic properties
-sciorganization.ui.member.associatedMember=Associated member?
-sciorganization.ui.member.formerMember=Former member?
-sciorganization.ui.project.edit_desc=Edit description
-sciorganization.ui.project.upload_desc=Upload description
-sciorganization.ui.project.desc=Project description
-sciorganization.ui.project.funding=Funding
-sciorganization.ui.organization.add_department=Add department
-sciorganization.ui.department.add_project=Add project
-sciorganization.ui.organization.add_project=Add project
-sciorganization.ui.department.edit_basic_properties=Edit basic properties
-sciorganization.ui.department.basic_properties=Basic properties
-sciorganization.ui.organization.edit_basic_sheet=Basic properties
-sciorganization.ui.organization.basic_properties=Basic properties
-sciorganization.ui.project.begin=Start of project
-sciorganization.ui.project.end=End of project
-sciorganization.ui.project.shortdesc=Short description
-sciorganization.ui.project.edit_basic_sheet=Basic properties
-sciorganization.ui.project.basic_properties=Basis properties
-sciorganization.ui.department.add_subdepartment=Add subdepartment
-sciorganization.ui.organization.departments.none=No departments found
-sciorganization.ui.organization.department=Department
-sciorganization.ui.organization.department.remove=Remove department
-sciorganization.ui.organization.department.up=Up
-sciorganization.ui.organization.department.down=Down
-sciorganization.ui.organization.department.confirm_remove=Are you sure to remove this department?
-sciorganization.ui.department.projects.none=No projects found
-sciorganization.ui.department.project=Project
-sciorganization.ui.department.project.remove=Remove project
-sciorganization.ui.department.project.up=Up
-sciorganization.ui.department.project.down=Down
-sciorganization.ui.department.project.confirm_remove=Are you sure to remove this project?
-sciorganization.ui.organization.select_department=Select department to add
-sciorganization.ui.organization.projects.none=No projects found
-sciorganization.ui.organization.project=Project
-sciorganization.ui.organization.project.remove=Remove project
-sciorganization.ui.organization.project.up=Up
-sciorganization.ui.organization.project.down=Down
-sciorganization.ui.organization.project.confirm_remove=Are you sure to remove this project?
-sciorganization.ui.project.addSubProject=Add subproject
-sciorganization.ui.department.select_project=Select project to add
-sciorganization.ui.organization.select_project=Select project to add
-sciorganization.ui.department.subdepartments.none=No subdepartments found
-sciorganization.ui.department.subdepartment=Subdepartment
-sciorganization.ui.department.subdepartment.remove=Remove subdepartment
-sciorganization.ui.department.subdepartment.up=Up
-sciorganization.ui.department.subdepartment.down=Down
-sciorganization.ui.department.subdepartment.confirm_remove=Are you sure to remove this subdepartment?
-sciorganizations.ui.department.shortdescription=Short description
-sciorganizations.ui.organization.shortdescription=Short description
-sciorganization.ui.department.select_subdepartment=Select subdepartment to add
-sciorganization.ui.department.add_member=Add member
-sciorganizations.ui.project.shortdesc=Short description
-sciorganization.ui.project.addDepartment=Add involved department
-sciorganization.ui.project.addOrga=Add involved organization
-sciorganization.ui.project.departments.none=No involved departments found
-sciorganization.ui.project.department=Involved department
-sciorganization.ui.project.department.remove=Remove involved department
-sciorganization.ui.project.department.up=Up
-sciorganization.ui.project.department.down=Down
-sciorganization.ui.project.organization.confirm_remove=Are you sure to remove this involved organization?
-sciorganization.ui.project.select_organization=Select organization to add
-sciorganization.ui.project.organization.none=No involved organizations found
-sciorganization.ui.project.organization=Involved organization
-sciorganization.ui.project.organization.remove=Remove involved organization
-sciorganization.ui.project.organization.up=Up
-sciorganization.ui.project.organization.down=Down
-sciorganization.ui.project.select_department=Select department to add
-sciorganization.ui.project.superproject_none=No superior project found
-sciorganization.ui.project.superproject=Superior project
-sciorganization.ui.project.superproject.remove=Remove superior project
-sciorganization.ui.project.superproject.confirm_remove=Are you sure to remove this superior project?
-sciorganization.ui.department.select_superdepartment=Superior department
-sciorganization.ui.project.setSuperProject=Set superior project
-sciorganization.ui.project.description.upload=Upload project description
-sciorganization.ui.project.description.upload.mimetype=Type of file
-sciorganization.ui.organization.edit_desc=Edit description
-sciorganization.ui.organization.upload_desc=Upload description
-sciorganization.ui.organization.desc=Description
-sciorganization.ui.organization.description=Description
-sciorganization.ui.organization.description.upload=Upload description
-sciorganization.ui.organization.description.upload.mimetype=Type of file
-sciorganization.ui.project.select_superproject=Select superior project
-sciorganization.ui.department.setSuperDepartment=Set superior department
-sciorganization.ui.department.superdepartment_none=No superior department found
-sciorganization.ui.department.superdepartment=Superior department
-sciorganization.ui.department.superdepartment.remove=Remove superior department
-sciorganization.ui.department.superdepartment.confirm_remove=Are you sure to remove the superior department?
-sciorganization.ui.department.setOrganization=Set organization
-sciorganization.ui.department.select_organization=Select organization
-sciorganization.ui.department.organization_none=No assigned organization found
-sciorganization.ui.department.organization=Organization
-sciorganization.ui.department.organization.remove=Remove assigned organization
-sciorganization.ui.department.organization.confirm_remove=Are you sure sure to remove to assigned organization?
-sciorganization.ui.department.edit_desc=Edit description
-sciorganization.ui.department.upload_desc=Upload description
-sciorganization.ui.department.desc=Description
-sciorganization.ui.department.description=Description
-sciorganization.ui.department.description.upload=Upload description
-sciorganization.ui.department.description.upload.mimetype=Type of file
-sciorganization.ui.orgnization.add_member=Add member
-sciorganization.ui.member.yes=Yes
-sciorganization.ui.member.no=No
-sciorganization.ui.organization.contacts=Contacts
-sciorganization.ui.organization_members=Members of the organization
-sciorganization.ui.organization.departments=Departments
-sciorganization.ui.organization.projects=Projects
-sciorganization.ui.organizsation_description.title=Description
-sciorganization.ui.organization.properties.title=Properties
-sciorganization.ui.organization.description.title=Description
-sciorganization.ui.department.properties.title=Properties
-sciorganization.ui.department.contacts=Contacts
-sciorganization.ui.department.members=Members of the department
-sciorganization.ui.department.subdepartments=Subdivisions
-sciorganization.ui.department.projects=Projects of the department
-sciorganization.ui.department.description.title=Description
-sciorganization.ui.project_properties.title=Properties
-sciorganization.ui.project.edit_basic_properties=Edit basic properties
-sciorganization.ui.project.contacts=Contacts
-sciorganization.ui.project.members=Members of the project
-sciorganization.ui.project.subprojects=Subprojects
-sciorganization.ui.project.organizations=Involved organizations
-sciorganization.ui.project.departments=Involved departments
-sciorganization.ui.project.publications=Publications of the project
-sciorganization.ui.project_description.title=Description
-sciorganization.ui.project.add_member\ =Add member
-sciorganization.ui.project.subproject..confirm_remove=Are you sure to remove this subproject?
-sciorganization.ui.project.superproject..confirm_remove=Are you sure to remove the superior project?
-sciorganization.ui.project.add_member=Add member
-sciorganization.ui.department.publications=Publications of the department
-sciorganizations.ui.department.title=Name of the department
-sciorganizations.ui.organization.title=Name of the organization
-sciorganizations.ui.project.title=Name of the project
-sciorganization.ui.project.funding_volume=Volume of funding
-scimember.ui.basic_properties=Basic properties
-scimember.ui.organization=Organization
-scimember.ui.organization.role=Role
-scimember.ui.organization.status=Status
-scimember.ui.organization.edit=Edit
-scimember.ui.organization.remove=Remove
-scimember.ui.organizations.edit_assoc=Edit association
-scimember.ui.organizations.remove=Remove assoication
-scimember.ui.organization.add=Add member to organization
-scimember.ui.organization.select_organization=Organization
-scimember.ui.organization.confirm_remove=Do you really want to remove this association?
-scimember.ui.departments=Departments
-scimember.ui.projects=Projects
-scimember.ui.organizations=Organizations
-scimember.ui.department=Department
-scimember.ui.department.role=Role
-scimember.ui.department.status=Status
-scimember.ui.department.edit=Edit
-scimember.ui.department.remove=Remove
-scimember.ui.departments.edit_assoc=Edit association
-scimember.ui.departments.remove=Remove association
-scimember.ui.department.add=Add member to department
-scimember.ui.organizations.none=This member is not associated to any organization
-scimember.ui.departments.none=This member is not associated to any department
-scimember.ui.projects.none=This member is not associated to any project
-scimember.ui.project.add=Add member to project
-scimember.ui.project=Project
-scimember.ui.project.role=Role
-scimember.ui.project.status=Status
-scimember.ui.project.edit=Edit
-scimember.ui.project.remove=Remove
-scimember.ui.project.edit_assoc=Edit association
-scimember.ui.projects.remove=Remove association
-scimember.ui.department.select_department=Department
-scimember.ui.department.confirm_remove=Do you really want to remove this association?
-scimember.ui.project.confirm_remove=Do you really want to remove this association?
-scimember.ui.project.select_project=Project
-scimember.ui.projects.edit_assoc=Edit association
-sciorganization.ui.project.description=Description of project
-sciorganization.ui.organization.department.add.no_suitable_language_variant=The selected item has no language variant for the language of the current item. Please add an suitable language variant to the item to add before adding it.
-sciorganization.ui.department.organization.add.no_suitable_language_variant=The selected item has no language variant for the language of the current item. Please add an suitable language variant to the item to add before adding it.
-sciorganization.ui.organization.department.add.already_added=The selected department has already been added to the current organization.
-sciorganization.ui.organization.department.add.no_department_selected=No department selected.
-sciorganization.ui.department.organization.add.no_organization_selected=No organization selected.
-sciorganization.ui.department.select_project.no_project_selected=No project selected.
-sciorganization.ui.department.select_project.no_suitable_language_variant=The select project is no available for the language of the current department item..
-sciorganization.ui.department.select_project.already_added=The selected project has already been added to the projects of the current department item.
-sciorganization.ui.department.select_subdepartment.no_department_selected=No department selected.
-sciorganization.ui.department.select_subdepartment.no_suitable_language_variant=The selected department to add as subdepartment is not available for the language of the current department.
-sciorganization.ui.department.select_subdepartment.adding_to_itself=It is not possible to add a department to itself as a sub department.
-sciorganization.ui.department.select_subdepartment.already_added=The selected department is already an sub department of the current department.
-sciorganization.ui.department.select_superdepartment.no_department_selected=No department selected.
-sciorganization.ui.department.select_superdepartment.no_suitable_language_variant=The department selected to set as super department is not available in the language of the current department.
-sciorganization.ui.department.select_superdepartment.same_department=It is not possible to set the super department of a department to itself.
-scimember.ui.department.select_department.no_department_selected=No department selected.
-scimember.ui.department.select_department.no_suitable_language_variant=The department to add is not available for the language of the current member item.
-scimember.ui.department.select_department.already_added=The current member is already a member of the selected department.
-scimember.ui.organization.select_organization.no_orga_selected=No organization selected.
-scimember.ui.organization.select_organization.no_suitable_language_variant=The selected organization is not available for the language of the current member item.
-scimember.ui.organization.select_organization.already_added=The current member is already a member of the selected organization.
-scimember.ui.project.select_project.no_project_selected=No project selected.
-scimember.ui.project.select_project.no_suitable_language_variant=The selected project is not available for the language of the current member item.
-scimember.ui.project.select_project.already_added=The current member is already a member of the selected project.
-sciorganization.ui.organization.select_project.no_project_selected=No project selected.
-sciorganization.ui.organization.select_project.no_suitable_language_variant=The selected project is not available for the language of the current organization item.
-sciorganization.ui.organization.select_project.already_added=The selected project is already a project of the current organization.
-sciorganization.ui.project.select_department.no_department_selected=No department selected.
-sciorganization.ui.project.select_department.no_suitable_language_variant=The selected department is not available for the language of the current project item.
-sciorganization.ui.project.select_department.already_added=The current project is already a project of the selected department.
-sciorganization.ui.project.select_organization.no_organization_selected=No organization selected.
-sciorganization.ui.project.select_organization.no_suitable_language_variant=The selected organization is not available for the language of the current project item.
-sciorganization.ui.project.select_organization.already_added=The current project is already a project of the selected organization.
-sciorganization.ui.project.select_subproject.no_project_selected=No project selected.
-sciorganization.ui.project.select_subproject.no_suitable_language_variant=The selected sub project is not available for the language of the current project.
-sciorganization.ui.project.select_subproject.same_project=A project can't be a sub project of itself.
-sciorganization.ui.project.select_subproject.already_added=The selected project is already a sub project of the current project.
-sciorganization.ui.project.select_superproject.no_project_selected=No project selected.
-sciorganization.ui.project.select_superproject.no_suitable_language_variant=The selected super project is not available for the language of the current project item.
-sciorganization.ui.project.select_superproject.same_project=A project can't be the super project of itself.
-sciorganization.ui.selectDepartment.no_department_selected=No department selected.
-sciorganization.ui.selectDepartment.no_suitable_language_variant=The selected department is not avaiable for the language of the current publication item.
-sciorganization.ui.selectDepartment.already_added=The current publications has already been added to the list of publications of the selected department.
-sciorganization.ui.selectOrganization.no_orga_selected=No organization selected.
-sciorganization.ui.selectOrganization.no_suitable_language_variant=The selected organization is not avaiable for the language of the current publication item.
-sciorganization.ui.selectOrganization.already_added=The current publication has already been added to the list of publications of the selected organization.
-sciorganization.ui.selectProject.no_project_selected=No project selected.
-sciorganization.ui.selectProject.no_suitable_language_variant=The selected project is not available for the language of the current publication item.
-sciorganization.ui.selectProject.already_added=The current publications has already been added to the publication list of the selected project.
-sciorganization.ui.selectPublication.no_publication_selected=No publication selected.
-sciorganization.ui.selectPublication.no_suitable_language_variant=The selected publication is not available for the language of the current item.
-sciorganization.ui.selectPublication.already_added=The selected publication has already been added to the publication list of the current item.
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationResources_de.properties b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationResources_de.properties
deleted file mode 100644
index 50bd4fdf6..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationResources_de.properties
+++ /dev/null
@@ -1,232 +0,0 @@
-sciorganization.ui.project.subprojects.none=Keine Unterprojekte gefunden
-sciorganization.ui.project.subproject=Unterprojekt
-sciorganization.ui.project.subproject.remove=Unterprojekt entfernen
-sciorganization.ui.project.subproject.up=Hoch
-sciorganization.ui.project.subproject.down=Runter
-sciorganization.ui.project.subproject.confirm_remove=Wollen sie dieses Unterprojekt wirklich entfernen?
-sciorganization.ui.project.select_subproject=Projekt zum Hinzuf\u00fcgen als Unterprojekt ausw\u00e4hlen
-sciorganization.ui.member.edit_basic_properties=Basiseigenschaften bearbeiten
-sciorganization.ui.member.associatedMember=Assoziertes Mitglied?
-sciorganization.ui.member.formerMember=Ehemaliges Mitglied?
-sciorganization.ui.project.edit_desc=Beschreibung bearbeiten
-sciorganization.ui.project.upload_desc=Beschreibung hochladen
-sciorganization.ui.project.desc=Projektbeschreibung
-sciorganization.ui.project.funding=Finanzierung
-sciorganization.ui.organization.add_department=Abteilung hinzuf\u00fcgen
-sciorganization.ui.department.add_project=Projekt hinzuf\u00fcgen
-sciorganization.ui.organization.add_project=Projekt hinzuf\u00fcgen
-sciorganization.ui.department.edit_basic_properties=Basiseigenschaften bearbeiten
-sciorganization.ui.department.basic_properties=Basiseigenschaften
-sciorganization.ui.organization.edit_basic_sheet=Basiseigenschaften
-sciorganization.ui.organization.basic_properties=Basiseigenschaften
-sciorganization.ui.project.begin=Begin des Projektes
-sciorganization.ui.project.end=Ende des Projektes
-sciorganization.ui.project.shortdesc=Kurzbeschreibung
-sciorganization.ui.project.edit_basic_sheet=Basiseigenschaften
-sciorganization.ui.project.basic_properties=Basiseigenschaften
-sciorganization.ui.department.add_subdepartment=Unterabteilung hinzuf\u00fcgen
-sciorganization.ui.organization.departments.none=Keine Abteilungen gefunden
-sciorganization.ui.organization.department=Abteilung
-sciorganization.ui.organization.department.remove=Abteilung entfernen
-sciorganization.ui.organization.department.up=Hoch
-sciorganization.ui.organization.department.down=Runter
-sciorganization.ui.organization.department.confirm_remove=Wollen sie diese Abteilung wirklich entfernen?
-sciorganization.ui.department.projects.none=Keine Projekte gefunden
-sciorganization.ui.department.project=Projekt
-sciorganization.ui.department.project.remove=Projekt entfernen
-sciorganization.ui.department.project.up=Hoch
-sciorganization.ui.department.project.down=Runter
-sciorganization.ui.department.project.confirm_remove=Wollen sie dieses Projekt wirklich entfernen?
-sciorganization.ui.organization.select_department=Abteilung zum hinzuf\u00fcgen ausw\u00e4hlen
-sciorganization.ui.organization.projects.none=Keine Projekte gefunden
-sciorganization.ui.organization.project=Projekt
-sciorganization.ui.organization.project.remove=Projekt entfernen
-sciorganization.ui.organization.project.up=Hoch
-sciorganization.ui.organization.project.down=Runter
-sciorganization.ui.organization.project.confirm_remove=Wollen sie dieses Projekt wirklich entfernen?
-sciorganization.ui.project.addSubProject=Unterprojekt hinzuf\u00fcgen
-sciorganization.ui.department.select_project=Projekt zum hinzuf\u00fcgen ausw\u00e4hlen
-sciorganization.ui.organization.select_project=Projekt zum hinzuf\u00fcgen ausw\u00e4hlen
-sciorganization.ui.department.subdepartments.none=Keine Unterabteilungen gefunden
-sciorganization.ui.department.subdepartment=Unterabteilung
-sciorganization.ui.department.subdepartment.remove=Unterabteilung entfernen
-sciorganization.ui.department.subdepartment.up=Hoch
-sciorganization.ui.department.subdepartment.down=Runter
-sciorganization.ui.department.subdepartment.confirm_remove=Wollen sie diese Unterabteilung wirklich entfernen
-sciorganizations.ui.department.shortdescription=Kurzbeschreibung
-sciorganizations.ui.organization.shortdescription=Kurzbeschreibung
-sciorganization.ui.department.select_subdepartment=Unterabteilung zum hinzuf\u00fcgen ausw\u00e4hlen
-sciorganization.ui.department.add_member=Mitglied hinzuf\u00fcgen
-sciorganizations.ui.project.shortdesc=Kurzbeschreibung
-sciorganization.ui.project.addDepartment=Beteiligte Abteilung hinzuf\u00fcgen
-sciorganization.ui.project.addOrga=Beteiligte Organization hinzuf\u00fcgen
-sciorganization.ui.project.departments.none=Keine beteiligen Abteilungen gefunden
-sciorganization.ui.project.department=Beteiligte Abteilung
-sciorganization.ui.project.department.remove=Beteiligte Abteilung entfernen
-sciorganization.ui.project.department.up=Hoch
-sciorganization.ui.project.department.down=Runter
-sciorganization.ui.project.organization.confirm_remove=Wollen diese beteiligte Organization wirklich entfernen?
-sciorganization.ui.project.select_organization=Organisation zum hinzuf\u00fcgen ausw\u00e4hlen
-sciorganization.ui.project.organization.none=Keine beteiligten Organisationen gefunden
-sciorganization.ui.project.organization=Beteiligte Organisation
-sciorganization.ui.project.organization.remove=Beteiligte Organisation entfernen
-sciorganization.ui.project.organization.up=Hoch
-sciorganization.ui.project.organization.down=Runter
-sciorganization.ui.project.select_department=Abteilung zum hinzuf\u00fcgen ausw\u00e4hlen
-sciorganization.ui.project.superproject_none=Kein \u00fcbergeordnetes Projekt gefunden
-sciorganization.ui.project.superproject=\u00dcbergeordnetes Projekt
-sciorganization.ui.project.superproject.remove=\u00dcbergeordnetes Projekt entfernen
-sciorganization.ui.project.superproject.confirm_remove=Wollen sie dieses \u00fcbergeordnete Projekt wirklich entfernen?
-sciorganization.ui.department.select_superdepartment=\u00dcbergeordnete Abteilung
-sciorganization.ui.project.setSuperProject=\u00dcbergeordnetes Projekt setzen
-sciorganization.ui.project.description.upload=Projektbeschreibung hochladen
-sciorganization.ui.project.description.upload.mimetype=Dateityp
-sciorganization.ui.organization.edit_desc=Beschreibung bearbeiten
-sciorganization.ui.organization.upload_desc=Beschreibung hochladen
-sciorganization.ui.organization.desc=Beschreibung
-sciorganization.ui.organization.description=Beschreibung
-sciorganization.ui.organization.description.upload=Beschriebung hochladen
-sciorganization.ui.organization.description.upload.mimetype=Dateityp
-sciorganization.ui.project.select_superproject=\u00dcbergeordnetes Projekt ausw\u00e4hlen
-sciorganization.ui.department.setSuperDepartment=\u00dcbergeordnete Abteilung setzen
-sciorganization.ui.department.superdepartment_none=Keine \u00fcbergeordnete Abteilung gefunden
-sciorganization.ui.department.superdepartment=\u00dcbergeordnete Abteilung
-sciorganization.ui.department.superdepartment.remove=\u00dcbergeordnete Abteilung entfernen
-sciorganization.ui.department.superdepartment.confirm_remove=Wollen sie die \u00fcbergeordnete Abteilung wirklich entfernen?
-sciorganization.ui.department.setOrganization=Organization setzen
-sciorganization.ui.department.select_organization=Organization ausw\u00e4hlen
-sciorganization.ui.department.organization_none=Keine zugeordnete Organization gefunden
-sciorganization.ui.department.organization=Organisation
-sciorganization.ui.department.organization.remove=Zugeordnete Organisation entfernen
-sciorganization.ui.department.organization.confirm_remove=Wollen sie zugeordnete Organisation wirklich entfernen?
-sciorganization.ui.department.edit_desc=Beschreibung bearbeiten
-sciorganization.ui.department.upload_desc=Beschreibung hochladen
-sciorganization.ui.department.desc=Beschreibung
-sciorganization.ui.department.description=Beschreibung
-sciorganization.ui.department.description.upload=Beschreibung hochladen
-sciorganization.ui.department.description.upload.mimetype=Dateityp
-sciorganization.ui.orgnization.add_member=Mitglied hinzuf\u00fcgen
-sciorganization.ui.member.yes=Ja
-sciorganization.ui.member.no=Nein
-sciorganization.ui.organization.contacts=Kontakte
-sciorganization.ui.organization_members=Mitglieder der Organisation
-sciorganization.ui.organization.departments=Abteilungen
-sciorganization.ui.organization.projects=Projekte
-sciorganization.ui.organizsation_description.title=Beschreibung
-sciorganization.ui.organization.properties.title=Eigenschaften
-sciorganization.ui.organization.description.title=Beschreibung
-sciorganization.ui.department.properties.title=Eigenschaften
-sciorganization.ui.department.contacts=Kontakte
-sciorganization.ui.department.members=Mitglieder der Abteilung
-sciorganization.ui.department.subdepartments=Unterabteilungen
-sciorganization.ui.department.projects=Projekte der Abteilung
-sciorganization.ui.department.description.title=Beschreibung
-sciorganization.ui.project_properties.title=Eigenschaften
-sciorganization.ui.project.edit_basic_properties=Basiseigenschaften bearbeiten
-sciorganization.ui.project.contacts=Kontakte
-sciorganization.ui.project.members=Mitglieder des Projektes
-sciorganization.ui.project.subprojects=Unterprojekte
-sciorganization.ui.project.organizations=Beteiligte Organisationen
-sciorganization.ui.project.departments=Beteiligte Abteilungen
-sciorganization.ui.project.publications=Publikationen des Projektes
-sciorganization.ui.project_description.title=Beschreibung
-sciorganization.ui.project.add_member\ =Mitglied hinzuf\u00fcgen
-sciorganization.ui.project.subproject..confirm_remove=Sind sie sicher das sie dieses Unterprojekt entfernen wollen?
-sciorganization.ui.project.superproject..confirm_remove=Wollen sie dieses \u00fcbergeordnete Projekt wirklich entfernen?
-sciorganization.ui.project.add_member=Mitglied hinzuf\u00fcgen
-sciorganization.ui.department.publications=Publikationen der Abteilung
-sciorganizations.ui.department.title=Bezeichnung der Abteilung
-sciorganizations.ui.organization.title=Name der Organisation
-sciorganizations.ui.project.title=Name des Projektes
-sciorganization.ui.project.funding_volume=Volumen der Finanzierung
-scimember.ui.basic_properties=Basiseigenschaften
-scimember.ui.organization=Organisation
-scimember.ui.organization.role=Rolle
-scimember.ui.organization.status=Status
-scimember.ui.organization.edit=Bearbeiten
-scimember.ui.organization.remove=Entfernen
-scimember.ui.organizations.edit_assoc=Verkn\u00fcpfung bearbeiten
-scimember.ui.organizations.remove=Verkn\u00fcpfung entfernen
-scimember.ui.organization.add=Mitglied einer Organisation hinzuf\u00fcgen
-scimember.ui.organization.select_organization=Organisation
-scimember.ui.organization.confirm_remove=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
-scimember.ui.departments=Abteilungen
-scimember.ui.projects=Projekte
-scimember.ui.organizations=Organisationen
-scimember.ui.department=Abteilung
-scimember.ui.department.role=Rolle
-scimember.ui.department.status=Status
-scimember.ui.department.edit=Bearbeiten
-scimember.ui.department.remove=Entfernen
-scimember.ui.departments.edit_assoc=Verkn\u00fcpfung bearbeiten
-scimember.ui.departments.remove=Verkn\u00fcpfung entfernen
-scimember.ui.department.add=Mitglied einer Abteilung hinzuf\u00fcgen
-scimember.ui.organizations.none=Dieses Mitglied ist keinen Organisationen zugeordnet
-scimember.ui.departments.none=Dieses Mitglied ist keinen Abteilungen zugeordnet
-scimember.ui.projects.none=Dieses Mitglied ist keinen Projekten zugeordnet
-scimember.ui.project.add=Mitglied einem Projekt hinzuf\u00fcgen
-scimember.ui.project=Projekt
-scimember.ui.project.role=Rolle
-scimember.ui.project.status=Status
-scimember.ui.project.edit=Bearbeiten
-scimember.ui.project.remove=Entfernen
-scimember.ui.project.edit_assoc=Verkn\u00fcpfung bearbeiten
-scimember.ui.projects.remove=Verkn\u00fcpfung entfernen
-scimember.ui.department.select_department=Abteilung
-scimember.ui.department.confirm_remove=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
-scimember.ui.project.confirm_remove=Wollen Sie diese Verkn\u00fcpfung wirklich entfernen?
-scimember.ui.project.select_project=Projekt
-scimember.ui.projects.edit_assoc=Verkn\u00fcpfung bearbeiten
-sciorganization.ui.project.description=Projektbeschreibung
-sciorganization.ui.organization.department.add.no_suitable_language_variant=Das ausgew\u00e4hlte ContentItem besitzt keine Sprachvariante f\u00fcr die Sprache dieses Items und kann daher nicht hinzugef\u00fcgt werden.
-sciorganization.ui.department.organization.add.no_suitable_language_variant=Das ausgew\u00e4hlte ContentItem besitzt keine Sprachvariante f\u00fcr die Sprache dieses Items und kann daher nicht hinzugef\u00fcgt werden.
-sciorganization.ui.organization.department.add.already_added=Die ausgew\u00e4hlte Abteilung wurde der aktuellen Organisation bereits hinzugef\u00fcgt.
-sciorganization.ui.organization.department.add.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
-sciorganization.ui.department.organization.add.no_organization_selected=Keine Organisation ausgew\u00e4hlt.
-sciorganization.ui.department.select_project.no_project_selected=Kein Project ausgew\u00e4hlt.
-sciorganization.ui.department.select_project.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist f\u00fcr die Sprache des aktuellen Abteilungs-Items nicht verf\u00fcgbar.
-sciorganization.ui.department.select_project.already_added=Das ausgew\u00e4hlte Projekt wurde dem aktuellen Abteilungs-Item bereits hinzugef\u00fcgt.
-sciorganization.ui.department.select_subdepartment.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
-sciorganization.ui.department.select_subdepartment.no_suitable_language_variant=Die zum hinzuf\u00fcgen als Unterabteilung ausw\u00e4hlte Abteilung ist f\u00fcr die Sprache der aktuellen Abteilung nicht verf\u00fcgbar.
-sciorganization.ui.department.select_subdepartment.adding_to_itself=Eine Abteilung kann nicht sich selbst als Unterabteilung zugewiesen werden.
-sciorganization.ui.department.select_subdepartment.already_added=Die ausgew\u00e4hlte Abteilung ist bereits eine Unterabteilung der aktuellen Abteilung.
-sciorganization.ui.department.select_superdepartment.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
-sciorganization.ui.department.select_superdepartment.no_suitable_language_variant=Die als \u00fcbergeordnete Abteilung ausgew\u00e4hlte Abteilung ist nicht in der Sprache der aktuellen Abteilung verf\u00fcgbar.
-sciorganization.ui.department.select_superdepartment.same_department=Eine Abteilung kann nicht ihre eigene \u00fcbergeordnete Abteilung sein.
-scimember.ui.department.select_department.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
-scimember.ui.department.select_department.no_suitable_language_variant=Die ausgew\u00e4hlte Abteilung ist nicht f\u00fcr die Sprache des aktuellen Mitglieds-Items verf\u00fcgbar.
-scimember.ui.department.select_department.already_added=Das aktuelle Mitglieder ist bereits ein Mitglied der ausgew\u00e4hlten Abteilung.
-scimember.ui.organization.select_organization.no_orga_selected=Keine Organisation ausgew\u00e4hlt.
-scimember.ui.organization.select_organization.no_suitable_language_variant=Die ausgew\u00e4hlte Organisation ist f\u00fcr die Sprache des aktuellen Mitglieds-Items nicht verf\u00fcgbar.
-scimember.ui.organization.select_organization.already_added=Das aktuelle Mitglied ist bereits Mitglied der ausgew\u00e4hlten Organisation.
-scimember.ui.project.select_project.no_project_selected=Kein Projekt ausgew\u00e4hlt.
-scimember.ui.project.select_project.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist f\u00fcr die Sprache des aktuellen Mitglieds-Items nicht verf\u00fcgbar.
-scimember.ui.project.select_project.already_added=Das aktuelle Mitglied ist bereits ein Mitglied des ausgew\u00e4hlten Projektes.
-sciorganization.ui.organization.select_project.no_project_selected=Kein Projekt ausgew\u00e4hlt.
-sciorganization.ui.organization.select_project.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist nicht f\u00fcr die Sprache des aktuellen Organisations-Items verf\u00fcgbar.
-sciorganization.ui.organization.select_project.already_added=Das ausgew\u00e4hlte Projekt ist bereits ein Projekt der aktuellen Organisation.
-sciorganization.ui.project.select_department.no_department_selected=Kein Projekt ausgew\u00e4hlt.
-sciorganization.ui.project.select_department.no_suitable_language_variant=Die ausgew\u00e4hlte Abteilung ist nicht f\u00fcr die Sprache des aktuellen Projekt-Items verf\u00fcgbar.
-sciorganization.ui.project.select_department.already_added=Das aktuelle Projekt ist bereits ein Projekt der ausgew\u00e4hlten Abteilung.
-sciorganization.ui.project.select_organization.no_organization_selected=Keine Organisation ausgew\u00e4hlt.
-sciorganization.ui.project.select_organization.no_suitable_language_variant=Die ausgew\u00e4hlte Organisation ist nicht f\u00fcr die Sprache des aktuellen Projekt-Items verf\u00fcgbar.
-sciorganization.ui.project.select_organization.already_added=Das aktuelle Projekt is bereits ein Projekt der der ausgew\u00e4hlten Organisation.
-sciorganization.ui.project.select_subproject.no_project_selected=Kein Projekt ausgew\u00e4hlt.
-sciorganization.ui.project.select_subproject.no_suitable_language_variant=Das ausgew\u00e4hlte Unterprojekt ist nicht f\u00fcr die Sprache des aktuellen Projektes verf\u00fcgbar.
-sciorganization.ui.project.select_subproject.same_project=Ein Projekt kann kein Unterprojekt von sich selbst sein.
-sciorganization.ui.project.select_subproject.already_added=Das ausgew\u00e4hlte Projekt ist bereits ein Unterprojekt des aktuellen Projektes.
-sciorganization.ui.project.select_superproject.no_project_selected=Kein Projekt ausgew\u00e4hlt.
-sciorganization.ui.project.select_superproject.no_suitable_language_variant=Das ausgew\u00e4hlte Hauptprojekt ist nicht f\u00fcr die Sprache des aktuellen Projektes verf\u00fcgbar.
-sciorganization.ui.project.select_superproject.same_project=Ein Projekt kann nicht sein eigenes Hauptprojekt sein.
-sciorganization.ui.selectDepartment.no_department_selected=Keine Abteilung ausgew\u00e4hlt.
-sciorganization.ui.selectDepartment.no_suitable_language_variant=Die ausgew\u00e4hlte Abteilung ist nicht f\u00fcr die Sprache des aktuellen Publikations-Items verf\u00fcgbar.
-sciorganization.ui.selectDepartment.already_added=Die aktuelle Publikation wurde bereits der Publikationsliste der ausgew\u00e4hlten Abteilung hinzugef\u00fcgt.
-sciorganization.ui.selectOrganization.no_orga_selected=Keine Organisation ausgew\u00e4hlt.
-sciorganization.ui.selectOrganization.no_suitable_language_variant=Die ausgew\u00e4hlte Organisation ist nicht f\u00fcr die Sprache der aktuellen Publikation verf\u00fcgbar.
-sciorganization.ui.selectOrganization.already_added=Die aktuelle Publikation wurde bereits der Liste der Publikationen der ausgew\u00e4hlten Organisation hinzugef\u00fcgt.
-sciorganization.ui.selectProject.no_project_selected=Kein Projekt ausgew\u00e4hlt.
-sciorganization.ui.selectProject.no_suitable_language_variant=Das ausgew\u00e4hlte Projekt ist nicht f\u00fcr die Sprache des aktuellen Publikations-Items verf\u00fcgbar.
-sciorganization.ui.selectProject.already_added=Die aktuelle Publikation wurde bereits der Publikationsliste des ausgew\u00e4hlten Projektes hinzugef\u00fcgt.
-sciorganization.ui.selectPublication.no_publication_selected=Keine Publikation ausgew\u00e4hlt.
-sciorganization.ui.selectPublication.no_suitable_language_variant=Die ausgew\u00e4hlte Publikation ist nicht f\u00fcr die Sprache des aktuellen Items verf\u00fcgbar.
-sciorganization.ui.selectPublication.already_added=Die ausgew\u00e4hlte Publikation ist bereits Teil der Publikationsliste des aktuellen Items.
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentAddForm.java
deleted file mode 100644
index d0fa62f67..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentAddForm.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectDepartmentsCollection;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for adding a link between a {@link SciProject} and a
- * {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectDepartmentAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "projectDepartment";
-
- public SciProjectDepartmentAddForm(ItemSelectionModel itemModel) {
- super("projectDepartmentAddForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_department")));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciDepartment.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
-
- if (!(this.getSaveCancelSection().getCancelButton().
- isSelected(state))) {
- SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
- department = (SciDepartment) department.getContentBundle().
- getInstance(project.getLanguage());
-
- project.addDepartment(department);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_department.no_department_selected"));
- return;
- }
-
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
- SciDepartment department = (SciDepartment) data.get(ITEM_SEARCH);
- if (!(department.getContentBundle().hasInstance(project.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_department.no_suitable_language_variant"));
- return;
- }
-
- department = (SciDepartment) department.getContentBundle().getInstance(project.
- getLanguage());
- SciProjectDepartmentsCollection departments = project.getDepartments();
- departments.addFilter(String.format("id = %s", department.getID().
- toString()));
- if (departments.size() > 0) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_department.already_added"));
- }
-
- departments.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsStep.java
deleted file mode 100644
index 9664fb0bd..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsStep.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for adding and removing links between a {@link SciProject} and a
- * {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectDepartmentsStep extends SimpleEditStep {
-
- private String PROJECT_ADD_DEPARTMENT_SHEET_NAME = "projectAddDepartment";
-
- public SciProjectDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciProjectDepartmentsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addDepartmentForm =
- new SciProjectDepartmentAddForm(itemModel);
- add(PROJECT_ADD_DEPARTMENT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.addDepartment").localize(),
- new WorkflowLockedComponentAccess(addDepartmentForm, itemModel),
- addDepartmentForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(new SciProjectDepartmentsTable(itemModel));
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsTable.java
deleted file mode 100644
index 09ffe765e..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDepartmentsTable.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectDepartmentsCollection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Table for showing the links between a {@link SciProject} and a
- * {@link SciDepartment}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectDepartmentsTable
- extends Table
- implements TableActionListener {
-
- private final static Logger s_log = Logger.getLogger(
- SciProjectDepartmentsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel m_itemModel;
-
- public SciProjectDepartmentsTable(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.departments.none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.remove").localize(),
- TABLE_COL_DEL));
- colModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.up").localize(),
- TABLE_COL_UP));
- colModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.down").localize(),
- TABLE_COL_DOWN));
-
- setModelBuilder(
- new SciProjectDepartmentsTableModelBuilder(itemModel));
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
- colModel.get(2).setCellRenderer(new UpCellRenderer());
- colModel.get(3).setCellRenderer(new DownCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciProjectDepartmentsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- public SciProjectDepartmentsTableModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
- return new SciProjectDepartmentsTableModel(table,
- state,
- project);
-
- }
- }
-
- private class SciProjectDepartmentsTableModel implements TableModel {
-
- private Table m_table;
- private SciProjectDepartmentsCollection m_departments;
- private SciDepartment m_department;
-
- public SciProjectDepartmentsTableModel(Table table,
- PageState state,
- SciProject project) {
- m_table = table;
- m_departments = project.getDepartments();
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((m_departments != null) && m_departments.next()) {
- m_department = m_departments.getDepartment();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_department.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.remove").
- localize();
- case 2:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.up").
- localize();
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.down").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_department.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- project);
- if (canEdit) {
- SciDepartment department;
- try {
- department = new SciDepartment((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link =
- new Link(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()),
- resolver.generateItemURL(state,
- department,
- section,
- department.getVersion()));
-
- return link;
- } else {
- SciDepartment department;
- try {
- department = new SciDepartment((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- project);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.project.organization."
- + ".confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class UpCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- if (0 == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.up").
- localize());
- return link;
- }
- }
- }
-
- private class DownCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
- SciProjectDepartmentsCollection departments =
- project.getDepartments();
-
- if ((departments.size() - 1) == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.department.down").
- localize());
- return link;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciDepartment department = new SciDepartment(
- new BigDecimal(event.getRowKey().toString()));
-
- SciProject project =
- (SciProject) m_itemModel.getSelectedObject(state);
-
- SciProjectDepartmentsCollection departments =
- project.getDepartments();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- project.removeDepartment(department);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
- departments.swapWithPrevious(department);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
- departments.swapWithNext(department);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java
deleted file mode 100644
index c18271a9e..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionEditForm.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.form.TextField;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.CMSDHTMLEditor;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for editing the description of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectDescriptionEditForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- public SciProjectDescriptionEditForm(ItemSelectionModel itemModel) {
- super("sciprojectEditDescForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.description")));
- ParameterModel descParam = new StringParameter(
- SciProject.PROJECT_DESCRIPTION);
- TextArea desc;
- if (SciProject.getConfig().getProjectDescriptionDhtml()) {
- desc = new CMSDHTMLEditor(descParam);
- } else {
- desc = new TextArea(descParam);
- }
- desc.setCols(75);
- desc.setRows(25);
- add(desc);
-
- if (!SciProject.getConfig().getProjectFundingHide()) {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.funding")));
- ParameterModel fundingParam = new StringParameter(
- SciProject.FUNDING);
- TextArea funding;
- if (SciProject.getConfig().getProjectFundingDhtml()) {
- funding = new CMSDHTMLEditor(fundingParam);
- } else {
- funding = new TextArea(fundingParam);
- }
- funding.setCols(75);
- funding.setRows(8);
- add(funding);
- }
-
- if (!SciProject.getConfig().getProjectFundingVolumeHide()) {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.funding_volume")));
- ParameterModel fundingVolumeParam = new StringParameter(SciProject.FUNDING_VOLUME);
- TextField fundingVolume = new TextField(fundingVolumeParam);
- fundingVolume.addValidationListener(new StringInRangeValidationListener(
- 0, 128));
- add(fundingVolume);
- }
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- FormData data = fse.getFormData();
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
-
- data.put(SciProject.PROJECT_DESCRIPTION,
- project.getProjectDescription());
- if (!SciProject.getConfig().getProjectFundingHide()) {
- data.put(SciProject.FUNDING, project.getFunding());
- }
-
- if (!SciProject.getConfig().getProjectFundingVolumeHide()) {
- data.put(SciProject.FUNDING_VOLUME, project.getFundingVolume());
- }
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- FormData data = fse.getFormData();
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
-
- if ((project != null) && getSaveCancelSection().getSaveButton().
- isSelected(state)) {
- project.setProjectDescription((String) data.get(
- SciProject.PROJECT_DESCRIPTION));
- if (!SciProject.getConfig().getProjectFundingHide()) {
- project.setFunding((String) data.get(
- SciProject.FUNDING));
- }
- if (!SciProject.getConfig().getProjectFundingVolumeHide()) {
- project.setFundingVolume((String) data.get(
- SciProject.FUNDING_VOLUME));
- }
-
- project.save();
-
- init(fse);
- }
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java
deleted file mode 100644
index 034dd8730..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionStep.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-
-/**
- * Step for editing the description of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectDescriptionStep extends SimpleEditStep {
-
- private String EDIT_PROJECT_DESC_SHEET_NAME = "editProjectDesc";
- private String UPLOAD_PROJECT_DESC_SHEET_NAME = "uploadProjectDesc";
-
- public SciProjectDescriptionStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciProjectDescriptionStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm editDescForm =
- new SciProjectDescriptionEditForm(itemModel);
- add(EDIT_PROJECT_DESC_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.edit_desc").localize(),
- new WorkflowLockedComponentAccess(editDescForm, itemModel),
- editDescForm.getSaveCancelSection().getCancelButton());
-
- SciProjectDescriptionUploadForm uploadDescForm =
- new SciProjectDescriptionUploadForm(
- itemModel);
- add(UPLOAD_PROJECT_DESC_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.upload_desc").localize(),
- new WorkflowLockedComponentAccess(uploadDescForm, itemModel),
- uploadDescForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(
- getSciProjectEditDescSheet(itemModel));
-
- }
-
- public static Component getSciProjectEditDescSheet(
- ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = new DomainObjectPropertySheet(
- itemModel);
-
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.desc"),
- SciProject.PROJECT_DESCRIPTION);
- if (!SciProject.getConfig().getProjectFundingHide()) {
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.funding"),
- SciProject.FUNDING);
- }
- if (!SciProject.getConfig().getProjectFundingVolumeHide()) {
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.funding_volume"),
- SciProject.FUNDING_VOLUME);
- }
-
- return sheet;
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java
deleted file mode 100644
index 90b146878..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectDescriptionUploadForm.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-/**
- * Form for uploading the description of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectDescriptionUploadForm extends AbstractTextUploadForm {
-
- public SciProjectDescriptionUploadForm(ItemSelectionModel itemModel) {
- super(itemModel);
- }
-
- @Override
- public GlobalizedMessage getLabelText() {
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.description.upload");
- }
-
- @Override
- public GlobalizedMessage getMimeTypeLabel() {
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.description.upload.mimetype");
- }
-
- @Override
- public void setText(ItemSelectionModel itemModel,
- PageState state,
- String text) {
- SciProject project = (SciProject) itemModel.getSelectedObject(state);
- project.setProjectDescription(text);
- project.save();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java
deleted file mode 100644
index f7ed216d8..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberAddForm.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-
-/**
- * Form for adding a link between a {@link SciProject} and a {@link SciMember}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectMemberAddForm
- extends GenericOrganizationalUnitPersonAddForm {
-
- public SciProjectMemberAddForm(
- ItemSelectionModel itemModel,
- GenericOrganizationalUnitPersonSelector personSelector) {
- super(itemModel, personSelector);
- }
-
- @Override
- protected String getPersonType() {
- return GenericPerson.class.getName();
- }
-
- @Override
- protected String getRoleAttributeName() {
- return "SciProjectRole";
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberStep.java
deleted file mode 100644
index 01d029fc4..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberStep.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.GenericPerson;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for adding and removing member to and from a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectMemberStep
- extends SimpleEditStep
- implements GenericOrganizationalUnitPersonSelector {
-
- private static final String ADD_MEMBER_SHEET_NAME = "addMember";
- private GenericPerson selectedPerson;
- private String selectedPersonRole;
- private String selectedPersonStatus;
-
- public SciProjectMemberStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciProjectMemberStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addMemberSheet =
- new SciProjectMemberAddForm(itemModel,
- this);
- add(ADD_MEMBER_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.add_member").localize(),
- new WorkflowLockedComponentAccess(addMemberSheet, itemModel),
- addMemberSheet.getSaveCancelSection().getCancelButton());
-
- SciProjectMemberTable memberTable = new SciProjectMemberTable(
- itemModel, this);
- setDisplayComponent(memberTable);
- }
-
- public GenericPerson getSelectedPerson() {
- return selectedPerson;
- }
-
- public void setSelectedPerson(final GenericPerson selectedPerson) {
- this.selectedPerson = selectedPerson;
- }
-
- public String getSelectedPersonRole() {
- return selectedPersonRole;
- }
-
- public void setSelectedPersonRole(final String selectedPersonRole) {
- this.selectedPersonRole = selectedPersonRole;
- }
-
- public String getSelectedPersonStatus() {
- return selectedPersonStatus;
- }
-
- public void setSelectedPersonStatus(final String selectedPersonStatus) {
- this.selectedPersonStatus = selectedPersonStatus;
- }
-
- public void showEditComponent(PageState state) {
- showComponent(state, ADD_MEMBER_SHEET_NAME);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java
deleted file mode 100644
index f195ac1b4..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectMemberTable.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectMemberTable
- extends GenericOrganizationalUnitPersonsTable {
-
- public SciProjectMemberTable(ItemSelectionModel itemModel,
- GenericOrganizationalUnitPersonSelector personSelector) {
- super(itemModel, personSelector);
- }
-
- @Override
- protected String getRoleAttributeName() {
- return "SciProjectRole";
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsAddForm.java
deleted file mode 100644
index 4c580873c..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsAddForm.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectOrganizationsCollection;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for adding a link between a {@link SciProject} and a
- * {@link SciOrganization}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectOrganizationsAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "projectOrga";
-
- public SciProjectOrganizationsAddForm(ItemSelectionModel itemModel) {
- super("projectOrgaAddForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_organization")));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciOrganization.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
-
- if (!(this.getSaveCancelSection().getCancelButton().
- isSelected(state))) {
- SciOrganization orga = (SciOrganization) data.get(ITEM_SEARCH);
- orga = (SciOrganization) orga.getContentBundle().getInstance(project.
- getLanguage());
-
- project.addOrganization(orga);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_organization.no_organization_selected"));
- return;
- }
-
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
- SciOrganization orga = (SciOrganization) data.get(ITEM_SEARCH);
- if (!(orga.getContentBundle().hasInstance(project.getLanguage()))) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_organization.no_suitable_language_variant"));
- return;
- }
-
- orga = (SciOrganization) orga.getContentBundle().getInstance(project.getLanguage());
- SciProjectOrganizationsCollection organizations = project.getOrganizations();
- organizations.addFilter(String.format("id = %s", orga.getID().toString()));
- if (organizations.size() > 0) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_organization.already_added"));
- }
-
- organizations.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsStep.java
deleted file mode 100644
index 1d5279984..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsStep.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for adding and removing links between a {@link SciProject} and
- * {@link SciOrganization}s.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectOrganizationsStep extends SimpleEditStep {
-
- private String PROJECT_ADD_ORGA_SHEET_NAME = "projectAddOrga";
-
- public SciProjectOrganizationsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciProjectOrganizationsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addOrgaForm =
- new SciProjectOrganizationsAddForm(itemModel);
- add(PROJECT_ADD_ORGA_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.addOrga").localize(),
- new WorkflowLockedComponentAccess(addOrgaForm, itemModel),
- addOrgaForm.getSaveCancelSection().getCancelButton());
-
- setDisplayComponent(
- new SciProjectOrganizationsTable(itemModel));
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsTable.java
deleted file mode 100644
index 13bc310af..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectOrganizationsTable.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import java.math.BigDecimal;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectOrganizationsCollection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- * Table for showing the links between a {@link SciProject} and
- * {@link SciOrganization}s.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectOrganizationsTable
- extends Table
- implements TableActionListener {
-
- private static final Logger s_log = Logger.getLogger(
- SciProjectOrganizationsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel m_itemModel;
-
- public SciProjectOrganizationsTable(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.none")));
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.remove").localize(),
- TABLE_COL_DEL));
- colModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.up").localize(),
- TABLE_COL_UP));
- colModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.down").localize(),
- TABLE_COL_DOWN));
-
-
- setModelBuilder(
- new SciProjectOrganizationsTableModelBuilder(itemModel));
-
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
- colModel.get(2).setCellRenderer(new UpCellRenderer());
- colModel.get(3).setCellRenderer(new DownCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciProjectOrganizationsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciProjectOrganizationsTableModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
- return new SciProjectOrganizationsTableModel(table,
- state,
- project);
- }
- }
-
- private class SciProjectOrganizationsTableModel
- implements TableModel {
-
- private Table m_table;
- private SciProjectOrganizationsCollection m_organizations;
- private SciOrganization m_organization;
-
- public SciProjectOrganizationsTableModel(Table table,
- PageState state,
- SciProject project) {
- m_table = table;
- m_organizations = project.getOrganizations();
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((m_organizations != null) && m_organizations.next()) {
- m_organization = m_organizations.getOrganization();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_organization.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.remove").
- localize();
- case 2:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.up").
- localize();
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.down").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_organization.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- project);
-
- if (canEdit) {
- SciOrganization orga;
- try {
- orga = new SciOrganization((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link =
- new Link(String.format("%s (%s)",
- value.toString(),
- orga.getLanguage()),
- resolver.generateItemURL(state,
- orga,
- section,
- orga.getVersion()));
- return link;
-
- } else {
- SciOrganization orga;
- try {
- orga = new SciOrganization((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- orga.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- project);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.project.organization."
- + ".confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class UpCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- if (0 == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.up").
- localize());
- return link;
- }
- }
- }
-
- private class DownCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
- SciProjectOrganizationsCollection orgas =
- project.getOrganizations();
-
- if ((orgas.size() - 1) == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organization.down").
- localize());
- return link;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciOrganization orga = new SciOrganization(
- new BigDecimal(event.getRowKey().toString()));
-
- SciProject project =
- (SciProject) m_itemModel.getSelectedObject(state);
-
- SciProjectOrganizationsCollection subprojects =
- project.getOrganizations();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- project.removeOrganization(orga);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
- subprojects.swapWithPrevious(orga);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
- subprojects.swapWithNext(orga);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPanel.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPanel.java
deleted file mode 100644
index 269ef5052..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPanel.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
-import com.arsdigita.xml.Element;
-import java.util.LinkedList;
-import java.util.List;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectPanel extends SciOrganizationBasePanel {
-
- private static final Logger s_log = Logger.getLogger(SciProjectPanel.class);
- public static final String SHOW_DESCRIPTION = "description";
- public static final String SHOW_SUBPROJECTS = "subprojects";
- public static final String SHOW_SUBPROJECTS_ONGOING = "subprojectsOngoing";
- public static final String SHOW_SUBPROJECTS_FINISHED = "subprojectsFinished";
- private boolean displayDescription = true;
- private boolean displaySubProjects = true;
- private boolean displayPublications = true;
-
- @Override
- protected String getDefaultShowParam() {
- return SHOW_DESCRIPTION;
- }
-
- @Override
- protected Class extends ContentItem> getAllowedClass() {
- return SciProject.class;
- }
-
- public boolean isDisplayDescription() {
- return displayDescription;
- }
-
- public void setDisplayDescription(boolean displayDescription) {
- this.displayDescription = displayDescription;
- }
-
- public boolean isDisplaySubProjects() {
- return displaySubProjects;
- }
-
- public void setDisplaySubProjects(boolean displaySubProjects) {
- this.displaySubProjects = displaySubProjects;
- }
-
- protected boolean hasMembers(final SciProject project) {
- return project.hasMembers(SciProject.getConfig().
- getOrganizationMembersMerge(),
- SciProject.MemberStatus.ALL);
- }
-
- protected boolean hasActiveMembers(final SciProject project) {
- return project.hasMembers(SciProject.getConfig().
- getOrganizationMembersMerge(),
- SciProject.MemberStatus.ACTIVE);
- }
-
- protected boolean hasAssociatedMembers(final SciProject project) {
- return project.hasMembers(SciProject.getConfig().
- getOrganizationMembersMerge(),
- SciProject.MemberStatus.ASSOCIATED);
- }
-
- protected boolean hasFormerMembers(final SciProject project) {
- return project.hasMembers(SciProject.getConfig().
- getOrganizationMembersMerge(),
- SciProject.MemberStatus.FORMER);
- }
-
- protected boolean hasSubProjects(final SciProject project) {
- return project.hasSubProjects();
- }
-
- protected void generateSubProjectsXML(final SciProject project,
- final Element parent,
- final PageState state,
- final List filters) {
- SciProjectSubProjectsCollection subProjects;
- subProjects = project.getSubProjects();
- for (String filter : filters) {
- subProjects.addFilter(filter);
- }
- subProjects.addOrder("begin desc, end desc");
-
- long pageNumber = getPageNumber(state);
-
- Element subProjectsElem = parent.newChildElement("subProjects");
-
- long pageCount = getPageCount(subProjects.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, subProjects.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
- subProjects.size());
- subProjects.setRange((int) begin + 1, (int) end + 1);
-
-
- while (subProjects.next()) {
- SciProject subProject;
- subProject = subProjects.getSubProject();
-
- generateProjectXML(subProject, subProjectsElem, state);
- }
- }
-
- protected void mergeMembers(
- final SciProjectSubProjectsCollection subProjects,
- final List members,
- final boolean active,
- final boolean associated,
- final boolean former) {
- while (subProjects.next()) {
- SciProject subProject = subProjects.getSubProject();
- GenericOrganizationalUnitPersonCollection projectMembers;
- projectMembers = subProject.getPersons();
-
- while (projectMembers.next()) {
- addMember(projectMembers,
- members);
- }
-
- SciProjectSubProjectsCollection subSubProjects;
- subSubProjects = subProject.getSubProjects();
- if ((subSubProjects != null) && (subSubProjects.size() > 0)) {
- mergeMembers(subProjects, members, active, associated, former);
- }
- }
- }
-
- protected void generateMembersXML(final SciProject project,
- final Element parent,
- final PageState state,
- final boolean active,
- final boolean associated,
- final boolean former) {
- GenericOrganizationalUnitPersonCollection projectMembers;
- projectMembers = project.getPersons();
-
- List members;
- members = new LinkedList();
-
- while (projectMembers.next()) {
- addMember(projectMembers,
- members);
- }
-
- if (SciProject.getConfig().getProjectMembersMerge()) {
-
- SciProjectSubProjectsCollection subProjects;
- subProjects = project.getSubProjects();
-
- mergeMembers(subProjects, members, active, associated, former);
- }
-
- generateMembersListXML(members, parent, state);
- }
-
- @Override
- protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
-
- SciOrganizationConfig config = SciProject.getConfig();
-
- SciProject project = (SciProject) orga;
-
- if ((project.getProjectDescription() != null)
- && !project.getProjectDescription().isEmpty()
- && displayDescription) {
- element.newChildElement("description");
- }
- if (project.hasContacts()
- && isDisplayContacts()) {
- element.newChildElement("contacts");
- }
- if (hasSubProjects(project)
- && displaySubProjects) {
- element.newChildElement("subProjects");
- }
- if (config.getProjectMembersAllInOne()) {
- if (hasMembers(project)
- && isDisplayMembers()) {
- element.newChildElement("members");
- }
- } else {
- if (hasActiveMembers(project)
- && isDisplayMembers()) {
- element.newChildElement("activeMembers");
- }
- if (hasAssociatedMembers(project)
- && isDisplayMembers()) {
- element.newChildElement("associatedMembers");
- }
- if (hasFormerMembers(project)
- && isDisplayMembers()) {
- element.newChildElement("formerMembers");
- }
- }
- }
-
- @Override
- protected void generateDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
-
- String show = getShowParam(state);
-
- SciProject project = (SciProject) orga;
-
- if (SHOW_DESCRIPTION.equals(show)) {
- Element description = element.newChildElement("description");
- description.setText(project.getProjectDescription());
-
- Element funding = element.newChildElement("funding");
- funding.setText(project.getFunding());
- } else if (SHOW_CONTACTS.equals(show)) {
- generateContactsXML(project, element, state);
- } else if (SHOW_SUBPROJECTS.equals(show)) {
- generateSubProjectsXML(project, element, state,
- new LinkedList());
- } else if (SHOW_SUBPROJECTS_ONGOING.equals(show)) {
- generateSubProjectsXML(project, element, state,
- getFiltersForOngoingProjects());
- } else if (SHOW_SUBPROJECTS_FINISHED.equals(show)) {
- generateSubProjectsXML(project, element, state,
- getFiltersForFinishedProjects());
- } else if (SHOW_MEMBERS.equals(show)) {
- generateMembersXML(project, element, state, true, true, true);
- }
- }
-
- /*@Override
- public void generateXML(ContentItem item,
- Element element,
- PageState state) {
- Element content = generateBaseXML(item, element, state);
-
- Element availableData = content.newChildElement("availableData");
-
- SciProject project = (SciProject) item;
-
- generateAvailableDataXml(project, element, state);
-
- generateDataXml(project, element, state);
-
- }*/
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java
deleted file mode 100644
index 86c6f8426..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertiesStep.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ContentTypeCollection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.util.ContenttypesGlobalizationUtil;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicPageForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import com.arsdigita.domain.DomainObject;
-import com.arsdigita.toolbox.ui.DomainObjectPropertySheet;
-import java.text.DateFormat;
-
-/**
- * Step for editing the basic properties of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectPropertiesStep
- extends GenericOrganizationalUnitPropertiesStep {
-
- public SciProjectPropertiesStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- super(itemModel, parent);
- }
-
- public static Component getSciProjectPropertySheet(
- ItemSelectionModel itemModel) {
- DomainObjectPropertySheet sheet = (DomainObjectPropertySheet) GenericOrganizationalUnitPropertiesStep.
- getGenericOrganizationalUnitPropertySheet(
- itemModel);
-
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.begin"),
- SciProject.BEGIN,
- new DomainObjectPropertySheet.AttributeFormatter() {
-
- public String format(DomainObject obj,
- String attribute,
- PageState state) {
- SciProject project = (SciProject) obj;
- if (project.getBegin() == null) {
- return (String) ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknown").localize();
- } else {
- return DateFormat.getDateInstance(DateFormat.LONG).format(
- project.getBegin());
- }
- }
- });
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.end"),
- SciProject.END,
- new DomainObjectPropertySheet.AttributeFormatter() {
-
- public String format(DomainObject obj,
- String attribute,
- PageState state) {
- SciProject project = (SciProject) obj;
- if (project.getEnd() == null) {
- return (String) ContenttypesGlobalizationUtil.globalize(
- "cms.ui.unknown").localize();
- } else {
- return DateFormat.getDateInstance(DateFormat.LONG).format(
- project.getEnd());
- }
- }
- });
- sheet.add(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.shortdesc"),
- SciProject.PROJECT_SHORT_DESCRIPTION);
-
- return sheet;
- }
-
- @Override
- protected void addBasicProperties(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- SimpleEditStep basicProperties = new SimpleEditStep(itemModel,
- parent,
- EDIT_SHEET_NAME);
-
- BasicPageForm editBasicSheet =
- new SciProjectPropertyForm(itemModel, this);
-
- basicProperties.add(EDIT_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.edit_basic_sheet").localize(),
- new WorkflowLockedComponentAccess(editBasicSheet,
- itemModel),
- editBasicSheet.getSaveCancelSection().
- getCancelButton());
-
- basicProperties.setDisplayComponent(
- getSciProjectPropertySheet(itemModel));
-
- getSegmentedPanel().addSegment(
- new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.edit_basic_properties").
- localize()),
- basicProperties);
- }
-
- @Override
- protected void addSteps(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- SciOrganizationConfig config;
- config = SciProject.getConfig();
-
- if (!config.getProjectAddContactHide()) {
- addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.contacts"));
- }
-
- /* if (!config.getProjectAddPersonHide()) {
- addStep(new SciProjectMemberStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.members"));
- }*/
-
- if (!config.getProjectSetSuperProjectHide()) {
- addStep(new SciProjectSuperProjectStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.superproject"));
- }
-
- /* if (!config.getProjectAddSubProjectHide()) {
- addStep(new SciProjectSubprojectsStep(itemModel,
- parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subprojects"));
- }*/
-
- if (!config.getProjectAddOrganizationHide()) {
- addStep(new SciProjectOrganizationsStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.organizations"));
- }
-
- /*if (!config.getProjectAddDepartmentHide()) {
- addStep(new SciProjectDepartmentsStep(itemModel, parent),
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.departments"));
- }
-
- ContentTypeCollection contentTypes = ContentType.getAllContentTypes();
- contentTypes.addFilter("associatedObjectType = :type").set(
- "type",
- "com.arsdigita.cms.contenttypes.Publication");
- if ((!config.getProjectMaterialsHide())
- && (contentTypes.size() > 0)) {
- /*
- * Must add this step manually since the basic class is not
- * SimpleEditStep...
- */
- /* getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
- globalize("sciorganization.ui.project.publications")),
- new SciProjectPublicationsStep(
- itemModel, parent));
- }*/
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java
deleted file mode 100644
index 4778b93d3..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPropertyForm.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.bebop.event.FormSubmissionListener;
-import com.arsdigita.bebop.form.Date;
-import com.arsdigita.bebop.form.TextArea;
-import com.arsdigita.bebop.parameters.DateParameter;
-import com.arsdigita.bebop.parameters.ParameterModel;
-import com.arsdigita.bebop.parameters.StringInRangeValidationListener;
-import com.arsdigita.bebop.parameters.StringParameter;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import java.util.Calendar;
-import java.util.GregorianCalendar;
-
-/**
- * Form for editing the basic properties of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectPropertyForm
- extends GenericOrganizationalUnitPropertyForm
- implements FormProcessListener,
- FormInitListener,
- FormSubmissionListener {
-
- public static final String ID = "SciProjectEdit";
-
- public SciProjectPropertyForm(ItemSelectionModel itemModel) {
- this(itemModel, null);
- }
-
- public SciProjectPropertyForm(ItemSelectionModel itemModel,
- SciProjectPropertiesStep step) {
- super(itemModel, step);
- addSubmissionListener(this);
- }
-
- @Override
- protected void addWidgets() {
- super.addWidgets();
-
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.begin")));
- ParameterModel beginParam = new DateParameter(SciProject.BEGIN);
- Calendar today = new GregorianCalendar();
- Date begin = new Date(beginParam);
- begin.setYearRange(1970, (today.get(Calendar.YEAR) + 2));
- add(begin);
-
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.end")));
- ParameterModel endParam = new DateParameter(SciProject.END);
- Date end = new Date(endParam);
- end.setYearRange(1970, (today.get(Calendar.YEAR) + 8));
- add(end);
-
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.project.shortdesc")));
- ParameterModel shortDescParam = new StringParameter(
- SciProject.PROJECT_SHORT_DESCRIPTION);
- TextArea shortDesc = new TextArea(shortDescParam);
- shortDesc.addValidationListener(new StringInRangeValidationListener(0, 500));
- shortDesc.setCols(75);
- shortDesc.setRows(5);
- add(shortDesc);
-
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- super.init(fse);
-
- FormData data = fse.getFormData();
- SciProject project = (SciProject) super.initBasicWidgets(fse);
-
- data.put(SciProject.BEGIN, project.getBegin());
- data.put(SciProject.END, project.getEnd());
- data.put(SciProject.PROJECT_SHORT_DESCRIPTION,
- project.getProjectShortDescription());
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- super.process(fse);
-
- FormData data = fse.getFormData();
- SciProject project = (SciProject) super.processBasicWidgets(fse);
-
- if ((project != null) && getSaveCancelSection().getSaveButton().
- isSelected(fse.getPageState())) {
- project.setBegin((java.util.Date) data.get(
- SciProject.BEGIN));
- project.setEnd((java.util.Date) data.get(
- SciProject.END));
- project.setProjectShortDescription((String) data.get(
- SciProject.PROJECT_SHORT_DESCRIPTION));
-
- project.save();
-
- init(fse);
- }
- }
-
- @Override
- public String getTitleLabel() {
- return (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganizations.ui.project.title").localize();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsTable.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsTable.java
deleted file mode 100644
index aa7ae11a1..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubProjectsTable.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import java.math.BigDecimal;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.domain.DataObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import org.apache.log4j.Logger;
-
-/**
- * Table of showing the subprojects of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectSubProjectsTable
- extends Table
- implements TableActionListener {
-
- private static final Logger s_log = Logger.getLogger(
- SciProjectSubProjectsTable.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private final String TABLE_COL_UP = "table_col_up";
- private final String TABLE_COL_DOWN = "table_col_down";
- private ItemSelectionModel m_itemModel;
-
- public SciProjectSubProjectsTable(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subprojects.none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.remove").localize(),
- TABLE_COL_DEL));
- /*colModel.add(new TableColumn(
- 2,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.up").localize(),
- TABLE_COL_UP));
- colModel.add(new TableColumn(
- 3,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.down").localize(),
- TABLE_COL_DOWN));*/
-
- setModelBuilder(
- new SciProjectSubProjectsTableModelBuilder(itemModel));
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
- //colModel.get(2).setCellRenderer(new UpCellRenderer());
- //colModel.get(3).setCellRenderer(new DownCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciProjectSubProjectsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciProjectSubProjectsTableModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
- return new SciProjectSubProjectsTableModel(table,
- state,
- project);
- }
- }
-
- private class SciProjectSubProjectsTableModel
- implements TableModel {
-
- private Table m_table;
- private SciProjectSubProjectsCollection m_subprojects;
- private SciProject m_subproject;
-
- public SciProjectSubProjectsTableModel(Table table,
- PageState state,
- SciProject project) {
- m_table = table;
- m_subprojects = project.getSubProjects();
- }
-
- @Override
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- @Override
- public boolean nextRow() {
- boolean ret;
-
- if ((m_subprojects != null) && m_subprojects.next()) {
- m_subproject = m_subprojects.getSubProject();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- @Override
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return m_subproject.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.remove").
- localize();
- case 2:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.up").
- localize();
- case 3:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.down").
- localize();
- default:
- return null;
- }
- }
-
- @Override
- public Object getKeyAt(int columnIndex) {
- return m_subproject.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- project);
-
- if (canEdit) {
- SciProject subProject;
- try {
- subProject = new SciProject((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- subProject.getLanguage()),
- resolver.generateItemURL(state,
- subProject,
- section,
- subProject.
- getVersion()));
-
- return link;
-
- } else {
- SciProject subProject;
- try {
- subProject = new SciProject((BigDecimal) key);
- } catch (DataObjectNotFoundException ex) {
- s_log.warn(String.format("No object with key '%s' found.",
- key),
- ex);
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- subProject.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- project);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.project.subproject."
- + ".confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- private class UpCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- if (0 == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.up").
- localize());
- return link;
- }
- }
- }
-
- private class DownCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(
- Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
-
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
- SciProjectSubProjectsCollection subProjects =
- project.getSubProjects();
-
- if ((subProjects.size() - 1) == row) {
- Label label = new Label("");
- return label;
- } else {
- ControlLink link = new ControlLink(
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.subproject.down").
- localize());
- return link;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciProject subProject = new SciProject(
- new BigDecimal(event.getRowKey().toString()));
-
- SciProject project =
- (SciProject) m_itemModel.getSelectedObject(state);
-
- SciProjectSubProjectsCollection subprojects =
- project.getSubProjects();
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- project.removeSubProject(subProject);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_UP)) {
- subprojects.swapWithPrevious(subProject);
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DOWN)) {
- subprojects.swapWithNext(subProject);
- }
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubprojectAddForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubprojectAddForm.java
deleted file mode 100644
index eabf5e335..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubprojectAddForm.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for adding a subproject to a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectSubprojectAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "projects";
-
- public SciProjectSubprojectAddForm(ItemSelectionModel itemModel) {
- super("SubprojectAddForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label((String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_subproject").localize()));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciProject.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
-
- if (!(this.getSaveCancelSection().getCancelButton().
- isSelected(state))) {
- SciProject subProject = (SciProject) data.get(ITEM_SEARCH);
- subProject = (SciProject) subProject.getContentBundle().
- getInstance(project.getLanguage());
-
- project.addSubProject(subProject);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_subproject.no_project_selected"));
- return;
- }
-
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
- SciProject subProject = (SciProject) data.get(ITEM_SEARCH);
- if (!(subProject.getContentBundle().hasInstance(project.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_subproject.no_suitable_language_variant"));
- return;
- }
-
- subProject = (SciProject) subProject.getContentBundle().getInstance(project.
- getLanguage());
- if (subProject.getID().equals(project.getID())) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_subproject.same_project"));
- return;
- }
-
- SciProjectSubProjectsCollection subProjects = project.getSubProjects();
- subProjects.addFilter(String.format("id = %s", subProject.getID().
- toString()));
- if(subProjects.size() > 0) {
- data.addError(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_subproject.already_added"));
- }
-
- subProjects.close();
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubprojectsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubprojectsStep.java
deleted file mode 100644
index f4fa3f78e..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSubprojectsStep.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-import org.apache.log4j.Logger;
-
-/**
- * Step for adding and removing subprojects to and from a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectSubprojectsStep extends SimpleEditStep {
-
- private final static Logger s_log = Logger.getLogger(
- SciProjectSubprojectsStep.class);
- private String ADD_CHILD_SHEET_NAME = "addChild";
-
- public SciProjectSubprojectsStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciProjectSubprojectsStep(
- ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addSubProjectSheet =
- new SciProjectSubprojectAddForm(itemModel);
- add(ADD_CHILD_SHEET_NAME,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.addSubProject").localize(),
- new WorkflowLockedComponentAccess(addSubProjectSheet, itemModel),
- addSubProjectSheet.getSaveCancelSection().getCancelButton());
-
- SciProjectSubProjectsTable subProjectsTable = new SciProjectSubProjectsTable(
- itemModel);
- setDisplayComponent(subProjectsTable);
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSetForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSetForm.java
deleted file mode 100644
index 68ade854c..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSetForm.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- * Form for setting the superior project of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectSuperProjectSetForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget m_itemSearch;
- private final String ITEM_SEARCH = "superproject";
-
- public SciProjectSuperProjectSetForm(ItemSelectionModel itemModel) {
- super("SuperProjectSetForm", itemModel);
- }
-
- @Override
- protected void addWidgets() {
- add(new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_superproject")));
- m_itemSearch = new ItemSearchWidget(
- ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(
- SciProject.class.getName()));
- add(m_itemSearch);
- }
-
- @Override
- public void init(FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().
- isSelected(state)) {
- SciProject superProject = (SciProject) data.get(ITEM_SEARCH);
- superProject = (SciProject) superProject.getContentBundle().
- getInstance(project.getLanguage());
-
- project.setSuperProject(superProject);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_superproject.no_project_selected"));
- return;
- }
-
- SciProject project = (SciProject) getItemSelectionModel().
- getSelectedObject(state);
- SciProject superProject = (SciProject) data.get(ITEM_SEARCH);
- if (!(superProject.getContentBundle().hasInstance(project.getLanguage()))) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_superproject.no_suitable_language_variant"));
- return;
- }
-
- superProject = (SciProject) superProject.getContentBundle().getInstance(project.
- getLanguage());
- if (superProject.getID().equals(project.getID())) {
- data.addError(
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.select_superproject.same_project"));
- return;
- }
-
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java
deleted file mode 100644
index abe16001b..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectSheet.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.SecurityManager;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-import org.apache.log4j.Logger;
-
-/**
- * Sheet for showing the superior project of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectSuperProjectSheet
- extends Table
- implements TableActionListener {
-
- private static final Logger logger = Logger.getLogger(
- SciProjectSuperProjectSheet.class);
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel m_itemModel;
-
- public SciProjectSuperProjectSheet(ItemSelectionModel itemModel) {
- super();
- m_itemModel = itemModel;
-
- setEmptyView(
- new Label(SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.superproject_none")));
-
- TableColumnModel colModel = getColumnModel();
- colModel.add(new TableColumn(
- 0,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.superproject").localize(),
- TABLE_COL_EDIT));
- colModel.add(new TableColumn(
- 1,
- SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.superproject.remove").localize(),
- TABLE_COL_DEL));
-
- setModelBuilder(
- new SciProjectSuperProjectSheetModelBuilder(itemModel));
- colModel.get(0).setCellRenderer(new EditCellRenderer());
- colModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciProjectSuperProjectSheetModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel m_itemModel;
-
- public SciProjectSuperProjectSheetModelBuilder(
- ItemSelectionModel itemModel) {
- m_itemModel = itemModel;
- }
-
- @Override
- public TableModel makeModel(Table table, PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
- return new SciProjectSuperProjectSheetModel(table,
- state,
- project);
- }
- }
-
- private class SciProjectSuperProjectSheetModel
- implements TableModel {
-
- private Table m_table;
- private SciProject m_superProject;
- private boolean m_done;
-
- public SciProjectSuperProjectSheetModel(Table table,
- PageState state,
- SciProject project) {
- m_table = table;
- m_superProject = project.getSuperProject();
- if (m_superProject == null) {
- m_done = false;
- } else {
- m_done = true;
- logger.debug(String.format("Super project to show: %s",
- m_superProject.getTitle()));
- }
-
- }
-
- public int getColumnCount() {
- return m_table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if (m_done) {
- logger.debug("Returning true for nextRow()");
- ret = true;
- m_done = false;
- } else {
- logger.debug("Returning false for nextRow()");
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- logger.debug("returning project title...");
- return m_superProject.getTitle();
- case 1:
- return SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.superproject.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return m_superProject.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.EDIT_ITEM,
- project);
-
- if (canEdit) {
- SciProject subProject;
- try {
- subProject = new SciProject((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- subProject.getLanguage()),
- resolver.generateItemURL(state,
- subProject,
- section,
- subProject.
- getVersion()));
-
- return link;
- } else {
- SciProject subDepartment;
- try {
- subDepartment = new SciProject((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- Label label = new Label(
- String.format("%s (%s)",
- value.toString(),
- subDepartment.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- @Override
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int col) {
- SecurityManager securityManager =
- Utilities.getSecurityManager(state);
- SciProject project = (SciProject) m_itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- SecurityManager.DELETE_ITEM,
- project);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationGlobalizationUtil.
- globalize(
- "sciorganization.ui.project.superproject."
- + ".confirm_remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- @Override
- public void cellSelected(TableActionEvent event) {
- PageState state = event.getPageState();
-
- /*SciProject superProject = new SciProject(
- new BigDecimal(event.getRowKey().toString()));*/
-
- SciProject project = (SciProject) m_itemModel.getSelectedObject(state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (column.getHeaderKey().toString().equals(TABLE_COL_EDIT)) {
- } else if (column.getHeaderKey().toString().equals(TABLE_COL_DEL)) {
- project.setSuperProject(null);
- }
-
- }
-
- @Override
- public void headSelected(TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectStep.java
deleted file mode 100644
index cd01e4d5f..000000000
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectStep.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (c) 2010 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- * Step for setting the superior project of a {@link SciProject}.
- *
- * @author Jens Pelzetter
- */
-public class SciProjectSuperProjectStep extends SimpleEditStep {
-
- private String SET_SUPER_PROJECT_STEP = "setSuperProject";
-
- public SciProjectSuperProjectStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciProjectSuperProjectStep(ItemSelectionModel itemModel,
- AuthoringKitWizard parent,
- String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm setSuperProjectForm =
- new SciProjectSuperProjectSetForm(itemModel);
- add(SET_SUPER_PROJECT_STEP,
- (String) SciOrganizationGlobalizationUtil.globalize(
- "sciorganization.ui.project.setSuperProject").localize(),
- new WorkflowLockedComponentAccess(setSuperProjectForm,
- itemModel),
- setSuperProjectForm.getSaveCancelSection().
- getCancelButton());
-
- SciProjectSuperProjectSheet superProjectSheet =
- new SciProjectSuperProjectSheet(itemModel);
- setDisplayComponent(superProjectSheet);
- }
-}
diff --git a/ccm-sci-types-organization/src/empty.pdl.mf b/ccm-sci-types-organization/src/empty.pdl.mf
deleted file mode 100644
index e69de29bb..000000000
diff --git a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xsl b/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xsl
deleted file mode 100644
index 9af8f5179..000000000
--- a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xsl
+++ /dev/null
@@ -1,19 +0,0 @@
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciMember.xsl b/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciMember.xsl
deleted file mode 100644
index 80359c344..000000000
--- a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciMember.xsl
+++ /dev/null
@@ -1,20 +0,0 @@
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xsl b/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xsl
deleted file mode 100644
index 93f7e0825..000000000
--- a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xsl
+++ /dev/null
@@ -1,19 +0,0 @@
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl b/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl
deleted file mode 100644
index 5dd9498a5..000000000
--- a/ccm-sci-types-organization/web/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl
+++ /dev/null
@@ -1,19 +0,0 @@
-
-]>
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/application.xml b/ccm-sci-types-organizationwithpublications/application.xml
deleted file mode 100644
index 5b6a0be1f..000000000
--- a/ccm-sci-types-organizationwithpublications/application.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Extended versions of the types SciOrganization, SciDepartment and SciProject,
- with an association to publications.
-
-
\ No newline at end of file
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
deleted file mode 100644
index d9b752ab6..000000000
--- a/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciDepartmentWithPublications.pdl
+++ /dev/null
@@ -1,50 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.*;
-
-object type SciDepartmentWithPublications extends SciDepartment {
- reference key ( ct_sciorga_departments_with_publications.department_id );
-}
-
-association {
- SciDepartment[0..n] departments = join ct_publications.publication_id
- to ct_department_publication_map.publication_id,
- join ct_department_publication_map.department_id
- to ct_sciorga_departments_with_publications.department_id;
-
- Publication[0..n] publications = join ct_sciorga_departments_with_publications.department_id
- to ct_department_publication_map.department_id,
- join ct_department_publication_map.publication_id
- to ct_publications.publication_id;
-
- Integer[0..1] publicationOrder = ct_department_publication_map.publication_order INTEGER;
-}
-
-query getIdsOfPublicationsOfSciDepartment {
- BigDecimal publicationId;
- String objectType;
-
- do {
- 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;
- }
-}
-
-query getIdsOfWorkingPapersOfSciDepartment {
- BigDecimal workingPaperId;
- String objectType;
-
- do {
- 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 and acs_objects.object_type = 'com.arsdigita.cms.contenttypes.WorkingPaper'
- } map {
- workingPaperId = ct_department_publication_map.publication_id;
- objectType = acs_objects.object_type;
- }
-}
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciOrganizationWithPublications.pdl b/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciOrganizationWithPublications.pdl
deleted file mode 100644
index 5d3642ab1..000000000
--- a/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciOrganizationWithPublications.pdl
+++ /dev/null
@@ -1,123 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.*;
-
-object type SciOrganizationWithPublications extends SciOrganization {
- reference key ( ct_sciorga_organizations_with_publications.organization_id );
-}
-
-association {
- SciOrganization[0..n] organizations = join ct_publications.publication_id
- to ct_organization_publication_map.publication_id,
- join ct_organization_publication_map.organization_id
- to ct_sciorga_organizations_with_publications.organization_id;
-
- Publication[0..n] publications = join ct_sciorga_organizations_with_publications.organization_id
- to ct_organization_publication_map.organization_id,
- join ct_organization_publication_map.publication_id
- to ct_publications.publication_id;
-
- Integer[0..1] publicationOrder = ct_organization_publication_map.publication_order INTEGER;
-}
-
-query getIdsOfPublicationsOfSciOrganization {
- BigDecimal publicationId;
- String objectType;
-
- do {
- select ct_organization_publication_map.publication_id, acs_objects.object_type
- from ct_organization_publication_map join acs_objects on ct_organization_publication_map.publication_id = acs_objects.object_id
- where ct_organization_publication_map.organization_id = :organization
- } map {
- publicationId = ct_organization_publication_map.publication_id;
- objectType = acs_objects.object_type;
- }
-}
-
-query getIdsOfWorkingPapersOfSciOrganization {
- BigDecimal workingPaperId;
- String objectType;
-
- do {
- select ct_organization_publication_map.publication_id, acs_objects.object_type
- from ct_organization_publication_map join acs_objects on ct_organization_publication_map.publication_id = acs_objects.object_id
- where ct_organization_publication_map.organization_id = :organization and acs_objects.object_type = 'com.arsdigita.cms.contenttypes.WorkingPaper'
- } map {
- workingPaperId = ct_organization_publication_map.publication_id;
- objectType = acs_objects.object_type;
- }
-}
-
-query getAllYearsOfPublication {
- Integer yearOfPublication;
-
- do {
- select distinct ct_publications.year
- from ct_publications
- } map {
- yearOfPublication = ct_publications.year;
- }
-}
-
-query getAllYearsOfPublicationForAuthor {
- Integer yearOfPublication;
-
- do {
- select distinct ct_publications.year
- from ct_publications join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
- where person_id = :author
- } map {
- yearOfPublication = ct_publications.year;
- }
-}
-
-query getAllPublicationTypes {
-
- String objectType;
-
- do {
- select distinct acs_objects.object_type
- from ct_publications join acs_objects on ct_publications.publication_id = acs_objects.object_id
- } map {
- objectType = acs_objects.object_type;
- }
-}
-
-query getAllPublicationTypesForAuthor {
-
- String objectType;
-
- do {
- select distinct acs_objects.object_type
- from ct_publications join acs_objects on ct_publications.publication_id = acs_objects.object_id join ct_publications_authorship on ct_publications.publication_id = ct_publications_authorship.publication_id
- where person_id = :author
- } map {
- objectType = acs_objects.object_type;
- }
-
-}
-
-query getIdsOfPublicationsOfSciMember {
- BigDecimal publicationId;
-
- do {
- select ct_publications_authorship.publication_id
- from ct_publications_authorship
- where ct_publications_authorship.person_id = :author
- } map {
- publicationId = ct_publications_authorship.publication_id;
- }
-}
-
-query getIdsOfProjectsOfSciMember {
- BigDecimal projectId;
-
- do {
- select ct_sciorga_projects.project_id
- from ct_sciorga_projects join cms_organizationalunits_person_map on ct_sciorga_projects.project_id = cms_organizationalunits_person_map.organizationalunit_id
- where cms_organizationalunits_person_map.person_id = :member
- } map {
- projectId = ct_sciorga_projects.project_id;
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciProjectWithPublications.pdl b/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciProjectWithPublications.pdl
deleted file mode 100644
index 82fac65a6..000000000
--- a/ccm-sci-types-organizationwithpublications/pdl/com/arsdigita/content-types/SciProjectWithPublications.pdl
+++ /dev/null
@@ -1,50 +0,0 @@
-model com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.kernel.ACSObject;
-import com.arsdigita.cms.*;
-
-object type SciProjectWithPublications extends SciProject {
-
- reference key ( ct_sciorga_projects_with_publications.project_id );
-}
-
-association {
- SciProject[0..n] projects = join ct_publications.publication_id
- to ct_project_publication_map.publication_id,
- join ct_project_publication_map.project_id
- to ct_sciorga_projects_with_publications.project_id;
-
- Publication[0..n] publications = join ct_sciorga_projects_with_publications.project_id
- to ct_project_publication_map.project_id,
- join ct_project_publication_map.publication_id
- to ct_publications.publication_id;
-
- Integer[0..1] publicationOrder = ct_project_publication_map.publication_order INTEGER;
-
-}
-
-query getIdsOfPublicationsOfSciProject {
- BigDecimal publicationId;
-
- do {
- select ct_project_publication_map.publication_id
- from ct_project_publication_map
- where ct_project_publication_map.project_id = :project
- } map {
- publicationId = ct_project_publication_map.publication_id;
- }
-}
-
-query getIdsOfWorkingPapersOfSciProject {
- BigDecimal workingPaperId;
- String objectType;
-
- do {
- select ct_project_publication_map.publication_id, acs_objects.object_type
- from ct_project_publication_map join acs_objects on ct_project_publication_map.publication_id = acs_objects.object_id
- where ct_project_publication_map.project_id = :project and acs_objects.object_type = 'com.arsdigita.cms.contenttypes.WorkingPaper'
- } map {
- workingPaperId = ct_project_publication_map.publication_id;
- objectType = acs_objects.object_type;
- }
-}
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/sql/ccm-sci-types-organizationwithpublications/postgres-create.sql b/ccm-sci-types-organizationwithpublications/sql/ccm-sci-types-organizationwithpublications/postgres-create.sql
deleted file mode 100644
index 38716a0ca..000000000
--- a/ccm-sci-types-organizationwithpublications/sql/ccm-sci-types-organizationwithpublications/postgres-create.sql
+++ /dev/null
@@ -1,4 +0,0 @@
-begin;
-\i ddl/postgres/create.sql
-\i ddl/postgres/deferred.sql
-end;
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml b/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml
deleted file mode 100644
index 7de75ac0b..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.xml b/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.xml
deleted file mode 100644
index 2b1ab7894..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml b/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml
deleted file mode 100644
index 52927fd9f..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/scidepartment-with-publications-item.jsp b/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/scidepartment-with-publications-item.jsp
deleted file mode 100644
index b8003537c..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/scidepartment-with-publications-item.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- NavigationModel model = new CMSNavigationModel();
-
-
-
-
-
-
- ((com.arsdigita.navigation.ui.category.Path)categoryPath)
- .setModel(model);
-
-
-
- ((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
- .setModel(model);
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciorganization-with-publications-item.jsp b/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciorganization-with-publications-item.jsp
deleted file mode 100644
index daa940e9b..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciorganization-with-publications-item.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- NavigationModel model = new CMSNavigationModel();
-
-
-
-
-
-
- ((com.arsdigita.navigation.ui.category.Path)categoryPath)
- .setModel(model);
-
-
-
- ((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
- .setModel(model);
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciproject-with-publications-item.jsp b/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciproject-with-publications-item.jsp
deleted file mode 100644
index a5f875fe1..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/content-types/com/arsdigita/cms/contenttypes/sciproject-with-publications-item.jsp
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
- NavigationModel model = new CMSNavigationModel();
-
-
-
-
-
-
- ((com.arsdigita.navigation.ui.category.Path)categoryPath)
- .setModel(model);
-
-
-
- ((com.arsdigita.navigation.ui.category.Menu)categoryMenu)
- .setModel(model);
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml b/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml
deleted file mode 100644
index 35c899532..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.xml b/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.xml
deleted file mode 100644
index 1bedd0dc2..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml b/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml
deleted file mode 100644
index 02c350a3d..000000000
--- a/ccm-sci-types-organizationwithpublications/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/ccm-sci-types-organizationwithpublications.config b/ccm-sci-types-organizationwithpublications/src/ccm-sci-types-organizationwithpublications.config
deleted file mode 100644
index 2ba1da7f4..000000000
--- a/ccm-sci-types-organizationwithpublications/src/ccm-sci-types-organizationwithpublications.config
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/ccm-sci-types-organizationwithpublications.load b/ccm-sci-types-organizationwithpublications/src/ccm-sci-types-organizationwithpublications.load
deleted file mode 100644
index 467655745..000000000
--- a/ccm-sci-types-organizationwithpublications/src/ccm-sci-types-organizationwithpublications.load
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ConvertRelatedPublicationLinks.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ConvertRelatedPublicationLinks.java
deleted file mode 100644
index 92cfb665e..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ConvertRelatedPublicationLinks.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.categorization.CategorizedCollection;
-import com.arsdigita.categorization.Category;
-import com.arsdigita.cms.ContentBundle;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.contentassets.RelatedLink;
-import com.arsdigita.domain.DomainObject;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.persistence.TransactionContext;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ConvertRelatedPublicationLinks {
-
- public static void main(final String args[]) {
- final com.arsdigita.runtime.Runtime runtime =
- new com.arsdigita.runtime.Runtime();
-
- runtime.startup();
-
- final Session session = SessionManager.getSession();
- final TransactionContext tctx = session.getTransactionContext();
-
- tctx.beginTxn();
- try {
- DataCollection data = session.retrieve(
- SciDepartment.BASE_DATA_OBJECT_TYPE);
- data.addOrder("title");
-
-
- SciOrganizationWithPublications organization = null;
- SciDepartmentWithPublications department;
- while (data.next()) {
- department =
- (SciDepartmentWithPublications) DomainObjectFactory.newInstance(
- data.getDataObject());
-
- if (department.isDraftVersion()) {
- System.out.printf("Found department '%s'\n",
- department.getTitle());
-
- DataCollection relatedLinks = RelatedLink.getRelatedLinks(
- department, "SciDepartmentPublications");
-
- System.out.printf(
- "Found %d related links from department '%s' with link list name '%s':\n",
- relatedLinks.size(),
- department.getTitle(),
- "SciDepartmentPublications");
-
- int i = 0;
- long num = relatedLinks.size();
-
- while (relatedLinks.next()) {
- RelatedLink relatedLink =
- new RelatedLink(relatedLinks.getDataObject());
-
- if (relatedLink == null) {
- System.out.println(
- "Failed to convert related link to domain object...\n");
- continue;
- }
-
- ContentItem target = relatedLink.getTargetItem();
- Publication publication = (Publication) target;
- System.out.printf(
- "\tconverting related link to '%s' (%d of %d)\n",
- publication.getTitle(),
- i,
- num);
-
- department.addPublication(publication);
-
- relatedLink.delete();
-
- i++;
-
- organization =
- (SciOrganizationWithPublications) department.
- getOrganization().getDraftVersion();
- }
-
- }
- }
-
- if (organization == null) {
- data.rewind();
- while (data.next()) {
- department =
- (SciDepartmentWithPublications) DomainObjectFactory.
- newInstance(data.getDataObject());
-
- if (department.isDraftVersion()) {
- if (department.getOrganization() != null) {
- organization =
- (SciOrganizationWithPublications) department.
- getOrganization().getDraftVersion();
- }
- }
- }
- }
-
- //Add publications without department to organization.
- if (args.length > 0) {
- System.out.println(
- "Found arguments. Interpreting as categories.");
-
- for (int i = 0; i < args.length; i++) {
- Category category = new Category(new BigDecimal(args[i]));
-
- if (category == null) {
- throw new IllegalArgumentException(String.format(
- "No category with id '%s'", args[i]));
- }
-
- if (organization == null) {
- throw new IllegalArgumentException("No organization.");
- }
-
- System.out.printf(
- "Adding all publications in category '%s' to publications of organization '%s'...\n",
- category.getName(),
- organization.getName());
-
- CategorizedCollection objects =
- category.getObjects(
- ContentItem.BASE_DATA_OBJECT_TYPE);
-
- while (objects.next()) {
- DomainObject obj =
- DomainObjectFactory.newInstance(objects.
- getDomainObject().getOID());
- if (obj instanceof ContentBundle) {
- obj = ((ContentBundle) obj).getPrimaryInstance();
- }
-
- if (obj instanceof Publication) {
- Publication publication = (Publication) obj;
- publication = (Publication) publication.
- getDraftVersion();
-
- if ((publication.get("organizations") == null)
- || ((DataCollection) publication.get(
- "organizations")).size() == 0) {
- System.out.printf(
- "Publication '%s' has no associated organization. Adding...\n",
- publication.getTitle());
- organization.addPublication(publication);
- } else {
- System.out.printf(
- "Publication '%s' has already an associated organization. No action neccessary.\n",
- publication.getTitle());
- }
-
- } else {
- System.out.printf(
- "Object is not a publication. Skiping.\n");
- continue;
- }
-
- }
- }
- }
-
- DataCollection persons = session.retrieve(
- GenericPerson.BASE_DATA_OBJECT_TYPE);
- persons.addOrder("surname");
- persons.addOrder("givenname");
-
- GenericPerson person;
- while (persons.next()) {
- person =
- (GenericPerson) DomainObjectFactory.newInstance(persons.
- getDataObject());
-
- if (person.isDraftVersion()) {
- System.out.printf("Found person '%s'\n",
- person.getGivenName(),
- person.getSurname());
-
- DataCollection relatedLinks = RelatedLink.getRelatedLinks(
- person, "MyPublications");
-
- System.out.printf(
- "Found %d related links from person '%s' '%s' with link list name '%s'\n",
- relatedLinks.size(),
- person.getGivenName(),
- person.getSurname(),
- "MyPublications");
- int i = 1;
- while (relatedLinks.next()) {
- RelatedLink relatedLink =
- (RelatedLink) DomainObjectFactory.
- newInstance(relatedLinks.getDataObject());
-
- if (relatedLink == null) {
- System.out.println(
- "Failed to convert related link to domain object...");
- continue;
- }
-
- ContentItem target = relatedLink.getTargetItem();
- if (target == null) {
- System.out.println(
- "\t Strange: Target item is null. But thats no problem, since we are only deleting this related link.");
-
- } else {
- Publication publication = (Publication) target;
- System.out.printf(
- "\tDeleting obsolete related link to '%s' (%d of %d)\n",
- publication.getTitle(),
- i,
- relatedLinks.size());
- }
- relatedLink.delete();
- i++;
- }
- }
- }
-
- System.out.println("Finished, no errors. Commiting transaction.");
- tctx.commitTxn();
- System.out.println(
- "Now republish all SciOrganization, SciDepartment, "
- + "GenericPerson and Publication items, for example using "
- + "BulkPublish from the london-util module, with the "
- + "'-r' switch.");
- } catch (Exception ex) {
- System.err.println(
- "Exeception ocurred during convert process. "
- + "Transaction rolled back, all changes will be lost.");
- ex.printStackTrace(System.err);
- } finally {
- if (tctx.inTxn()) {
- tctx.abortTxn();
- }
- }
-
-
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciDepartmentCollection.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciDepartmentCollection.java
deleted file mode 100644
index 84e187587..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciDepartmentCollection.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciDepartmentCollection extends DomainCollection {
-
- public PublicationSciDepartmentCollection(
- final DataCollection dataCollection) {
- super(dataCollection);
-
- addOrder("title");
- }
-
- public SciDepartmentWithPublications getDepartment() {
- return (SciDepartmentWithPublications) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciOrganizationCollection.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciOrganizationCollection.java
deleted file mode 100644
index 6d25d9cbb..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciOrganizationCollection.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciOrganizationCollection extends DomainCollection {
-
- public PublicationSciOrganizationCollection(
- final DataCollection dataCollection) {
- super(dataCollection);
-
- addOrder("title");
- }
-
- public SciOrganizationWithPublications getOrganization() {
- return (SciOrganizationWithPublications) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciProjectCollection.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciProjectCollection.java
deleted file mode 100644
index ba69d14ca..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/PublicationSciProjectCollection.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciProjectCollection extends DomainCollection {
-
- public PublicationSciProjectCollection(
- final DataCollection dataCollection) {
- super(dataCollection);
-
- addOrder("title");
- }
-
- public SciProjectWithPublications getOrganization() {
- return (SciProjectWithPublications) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentPublicationsCollection.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentPublicationsCollection.java
deleted file mode 100644
index 9eaeaae34..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentPublicationsCollection.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentPublicationsCollection extends DomainCollection {
-
- public SciDepartmentPublicationsCollection(
- final DataCollection dataCollection) {
- super(dataCollection);
- }
-
- public Publication getPublication() {
- return (Publication) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
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
deleted file mode 100644
index fbaadf1f2..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentWithPublications extends SciDepartment {
-
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.contenttypes.SciDepartmentWithPublications";
- public static final String PUBLICATIONS = "publications";
-
- public SciDepartmentWithPublications() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- public SciDepartmentWithPublications(final BigDecimal id) {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public SciDepartmentWithPublications(final OID oid) {
- super(oid);
- }
-
- public SciDepartmentWithPublications(final DataObject dobj) {
- super(dobj);
- }
-
- public SciDepartmentWithPublications(final String type) {
- super(type);
-
- }
-
- public boolean hasPublications(final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciDepartment");
- query.setParameter("department", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- departmentsQuery.setParameter("department", getID());
-
- if (departmentsQuery.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "subDepartmentId");
- result = hasPublications(departmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasPublications(final BigDecimal departmentId,
- final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciDepartment");
- query.setParameter("department", departmentId);
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (subDepartmentsQuery.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- result = hasPublications(subDepartmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public boolean hasWorkingPapers(final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciDepartment");
- query.setParameter("department", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- departmentsQuery.setParameter("department", getID());
-
- if (departmentsQuery.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "subDepartmentId");
- result = hasWorkingPapers(departmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasWorkingPapers(final BigDecimal departmentId,
- final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciDepartment");
- query.setParameter("department", departmentId);
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (subDepartmentsQuery.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- result = hasPublications(subDepartmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public SciDepartmentPublicationsCollection getPublications() {
- return new SciDepartmentPublicationsCollection((DataCollection) get(
- PUBLICATIONS));
- }
-
- public void addPublication(final Publication publication) {
- Assert.exists(publication, Publication.class);
-
- DataObject link = add(PUBLICATIONS, publication);
- link.set("publicationOrder", Integer.valueOf((int) getPublications().
- size()));
- link.save();
- }
-
- public void removePublication(final Publication publication) {
- Assert.exists(publication, Publication.class);
-
- remove(PUBLICATIONS, publication);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublicationsInitializer.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublicationsInitializer.java
deleted file mode 100644
index 243958060..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublicationsInitializer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.contenttypes.ui.PublicationSciDepartmentStep;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.runtime.DomainInitEvent;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentWithPublicationsInitializer
- extends ContentTypeInitializer {
-
- public SciDepartmentWithPublicationsInitializer() {
- super("empty.pdl.mf",
- SciDepartmentWithPublications.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public void init(final DomainInitEvent event) {
- super.init(event);
-
- ContentType departmentType =
- ContentType.findByAssociatedObjectType(SciDepartment.class.
- getName());
- if (!departmentType.isInternal()) {
- departmentType.setMode("internal");
- }
-
- AuthoringKitWizard.registerAssetStep(Publication.BASE_DATA_OBJECT_TYPE,
- PublicationSciDepartmentStep.class,
- new GlobalizedMessage(
- "sciorganizationpublication.ui.publication.departments.title",
- "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
- new GlobalizedMessage(
- "sciorganizationpublication.ui.publication.departments.description",
- "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
- 1);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/SciDepartment.xsl"};
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml";
-
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublicationsLoader.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublicationsLoader.java
deleted file mode 100644
index aa7cd959d..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciDepartmentWithPublicationsLoader.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.util.parameter.Parameter;
-import com.arsdigita.util.parameter.ResourceParameter;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import java.io.InputStream;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentWithPublicationsLoader extends AbstractContentTypeLoader {
-
- private ResourceParameter m_template;
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciDepartmentWithPublications.xml"
- };
-
- public SciDepartmentWithPublicationsLoader() {
- super();
-
- m_template =
- new ResourceParameter(
- "com.arsdigita.cms.contenttypes.SciDepartmentWithPublicationsTemplate",
- Parameter.REQUIRED,
- "/WEB-INF/content-types/com/arsdigita/"
- + "cms/contenttypes/scidepartment-with-publications-item.jsp");
-
- register(m_template);
- }
-
- public String[] getTypes() {
- return TYPES;
- }
-
- @Override
- protected void prepareSection(final ContentSection section,
- final ContentType type,
- final LifecycleDefinition lifecycle,
- final WorkflowTemplate workflow) {
- super.prepareSection(section, type, lifecycle, workflow);
-
- setDefaultTemplate("SciDepartmentWithPublications Item",
- "scidepartment-with-publications-item",
- (InputStream) get(m_template),
- section,
- type,
- lifecycle,
- workflow);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationPublicationsCollection.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationPublicationsCollection.java
deleted file mode 100644
index 8a3fc5512..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationPublicationsCollection.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationPublicationsCollection extends DomainCollection {
-
- public String ORDER = "departmentOrder";
- public String LINKORDER = "link.departmentOrder";
-
- public SciOrganizationPublicationsCollection(
- final DataCollection dataCollection) {
- super(dataCollection);
- }
-
- public Publication getPublication() {
- return (Publication) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
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
deleted file mode 100644
index c739600c5..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationWithPublications extends SciOrganization {
-
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.contenttypes.SciOrganizationWithPublications";
- public static final String PUBLICATIONS = "publications";
- public static final String PUBLICATION_ORDER = "publicationOrder";
- private static final SciOrganizationWithPublicationsConfig config =
- new SciOrganizationWithPublicationsConfig();
-
- static {
- config.load();
- }
-
- public SciOrganizationWithPublications() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- public SciOrganizationWithPublications(final BigDecimal id) {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public SciOrganizationWithPublications(final OID oid) {
- super(oid);
- }
-
- public SciOrganizationWithPublications(final DataObject dobj) {
- super(dobj);
- }
-
- public SciOrganizationWithPublications(final String type) {
- super(type);
- }
-
- public static SciOrganizationWithPublicationsConfig getConfig() {
- return config;
- }
-
- public boolean hasPublications(final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciOrganization");
- query.setParameter("organization", getID());
- if (getConfig().getOrganizationPublicationsSeparateWorkingPapers()) {
- query.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
- departmentsQuery.setParameter("organization", getID());
-
- if (departmentsQuery.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "departmentId");
- result = hasPublications(departmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasPublications(final BigDecimal departmentId,
- final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "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;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (subDepartmentsQuery.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- System.out.printf("Proceesing sub department %s...\n", subDepartmentId.toString());
- result = hasPublications(subDepartmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public boolean hasWorkingPapers(final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciOrganization");
- query.setParameter("organization", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
-
- DataQuery departmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfDepartmentsOfSciOrganization");
- departmentsQuery.setParameter("organization",
- getID());
-
- if (departmentsQuery.size() > 0) {
- BigDecimal departmentId;
- boolean result = false;
- while (departmentsQuery.next()) {
- departmentId = (BigDecimal) departmentsQuery.get(
- "departmentId");
- result = hasWorkingPapers(departmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- departmentsQuery.close();
- return result;
- } else {
- departmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasWorkingPapers(final BigDecimal departmentId,
- final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciOrganization");
- query.setParameter("organization", departmentId);
- if (getConfig().getOrganizationPublicationsSeparateWorkingPapers()) {
- query.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subDepartmentsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubDepartmentsOfSciDepartment");
- subDepartmentsQuery.setParameter("department", departmentId);
-
- if (subDepartmentsQuery.size() > 0) {
- BigDecimal subDepartmentId;
- boolean result = false;
- while (subDepartmentsQuery.next()) {
- subDepartmentId = (BigDecimal) subDepartmentsQuery.get(
- "subDepartmentId");
- result = hasPublications(subDepartmentId, merge);
-
- if (result) {
- break;
- }
- }
-
- subDepartmentsQuery.close();
- return result;
- } else {
- subDepartmentsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public SciOrganizationPublicationsCollection getPublications() {
- return new SciOrganizationPublicationsCollection((DataCollection) get(
- PUBLICATIONS));
- }
-
- public void addPublication(final Publication publication) {
- Assert.exists(publication, Publication.class);
-
- DataObject link = add(PUBLICATIONS, publication);
- link.set(PUBLICATION_ORDER, Integer.valueOf(
- (int) getPublications().size()));
- link.save();
- }
-
- public void removePublication(final Publication publication) {
- Assert.exists(publication, Publication.class);
-
- remove(PUBLICATIONS, publication);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsConfig.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsConfig.java
deleted file mode 100644
index f9697ba61..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsConfig.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.util.parameter.BooleanParameter;
-import com.arsdigita.util.parameter.Parameter;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationWithPublicationsConfig extends SciOrganizationConfig {
-
- private final Parameter m_organizationPublicationsMerge;
- private final Parameter m_organizationPublicationsSeparateWorkingPapers;
- private final Parameter m_departmentPublicationsSeparateWorkingPapers;
- private final Parameter m_projectPublicationsSeparateWorkingPapers;
-
- public SciOrganizationWithPublicationsConfig() {
- super();
-
- m_organizationPublicationsMerge =
- new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.publications_merge",
- Parameter.REQUIRED,
- Boolean.TRUE);
- register(m_organizationPublicationsMerge);
-
- m_organizationPublicationsSeparateWorkingPapers =
- new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization..organization.workingpapers_separate",
- Parameter.REQUIRED,
- Boolean.TRUE);
- register(m_organizationPublicationsSeparateWorkingPapers);
-
- m_departmentPublicationsSeparateWorkingPapers =
- new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.department.workingpapers_separate",
- Parameter.REQUIRED,
- Boolean.TRUE);
- register(m_departmentPublicationsSeparateWorkingPapers);
-
- m_projectPublicationsSeparateWorkingPapers =
- new BooleanParameter(
- "com.arsdigita.cms.contenttypes.sciorganization.project.workingpapers_separate",
- Parameter.REQUIRED,
- Boolean.FALSE);
- register(m_projectPublicationsSeparateWorkingPapers);
-
- loadInfo();
- }
-
- public final boolean getOrganizationPublicationsMerge() {
- return (Boolean) get(m_organizationPublicationsMerge);
- }
-
- public final boolean getOrganizationPublicationsSeparateWorkingPapers() {
- return (Boolean) get(m_organizationPublicationsSeparateWorkingPapers);
- }
-
- public final boolean getDepartmentPublicationsSeparateWorkingPapers() {
- return (Boolean) get(m_departmentPublicationsSeparateWorkingPapers);
- }
-
- public final boolean getProjectPublicationsSeparateWorkingPapers() {
- return (Boolean) get(m_projectPublicationsSeparateWorkingPapers);
- }
-
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsConfig_parameter.properties b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsConfig_parameter.properties
deleted file mode 100644
index 48a0c0353..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsConfig_parameter.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-com.arsdigita.cms.contenttypes.sciorganization.publications_merge.title = Merge publications
-com.arsdigita.cms.contenttypes.sciorganization.publications_merge.purpose = Merge publications from sub organizations into one list.
-com.arsdigita.cms.contenttypes.sciorganization.publications_merge.example = true
-com.arsdigita.cms.contenttypes.sciorganization.publications_merge.format = [boolean]
-
-com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.title = Separate working papers of SciOrganization
-com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.purpose = Show a separate panel for the working papers on SciOrganizationWithPublicationsPanel
-com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.example = true
-com.arsdigita.cms.contenttypes.sciorganization.organization.workingpapers_separate.format [boolean]
-
-com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.title = Separate working papers of SciDepartment
-com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.purpose = Show a separate panel for the working papers on SciDepartmentWithPublicationsPanel
-com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.example = true
-com.arsdigita.cms.contenttypes.scidepartment.department.workingpapers_separate.format [boolean]
-
-com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.title = Separate working papers of SciProject
-com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.purpose = Show a separate panel for the working papers on SciProjectWithPublicationsPanel
-com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.example = false
-com.arsdigita.cms.contenttypes.sciproject.project.workingpapers_separate.format [boolean]
-
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsInitializer.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsInitializer.java
deleted file mode 100644
index c9da03a86..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsInitializer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.contenttypes.ui.PublicationSciOrganizationStep;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.runtime.DomainInitEvent;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationWithPublicationsInitializer
- extends ContentTypeInitializer {
-
- public SciOrganizationWithPublicationsInitializer() {
- super("ccm-sci-types-organizationwithpublications.pdl.mf",
- SciOrganizationWithPublications.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public void init(final DomainInitEvent event) {
- super.init(event);
-
- ContentType orgaType =
- ContentType.findByAssociatedObjectType(SciOrganization.class.
- getName());
- if (!orgaType.isInternal()) {
- orgaType.setMode("internal");
- }
- System.out.println("Set mode to interal");
-
- AuthoringKitWizard.registerAssetStep(Publication.BASE_DATA_OBJECT_TYPE,
- PublicationSciOrganizationStep.class,
- new GlobalizedMessage(
- "sciorganizationpublication.ui.publication.organization.title",
- "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
- new GlobalizedMessage(
- "sciorganizationpublication.ui.publication.organization.description",
- "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
- 1);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/SciOrganization.xsl"};
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciOrganizationWithPublications.xml";
-
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsLoader.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsLoader.java
deleted file mode 100644
index 39b12e111..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciOrganizationWithPublicationsLoader.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.util.parameter.Parameter;
-import com.arsdigita.util.parameter.ResourceParameter;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import java.io.InputStream;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationWithPublicationsLoader extends AbstractContentTypeLoader {
-
- private ResourceParameter m_template;
-
- public SciOrganizationWithPublicationsLoader() {
- super();
-
- m_template = new ResourceParameter(
- "com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsTemplate",
- Parameter.REQUIRED,
- "/WEB-INF/content-types/com/arsdigita/"
- + "cms/contenttypes/sciorganization-with-publications-item.jsp");
-
- register(m_template);
- }
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/"
- + "SciOrganizationWithPublications.xml"
- };
-
- @Override
- public String[] getTypes() {
- return TYPES;
- }
-
- @Override
- protected void prepareSection(final ContentSection section,
- final ContentType type,
- final LifecycleDefinition lifecycle,
- final WorkflowTemplate workflow) {
- super.prepareSection(section, type, lifecycle, workflow);
-
- setDefaultTemplate("SciOrganizationWithPublications Item",
- "sciorganization-with-publications-item",
- (InputStream) get(m_template),
- section,
- type,
- lifecycle,
- workflow);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectPublicationsCollection.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectPublicationsCollection.java
deleted file mode 100644
index fbb592469..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectPublicationsCollection.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.domain.DomainObjectFactory;
-import com.arsdigita.persistence.DataCollection;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectPublicationsCollection extends DomainCollection {
-
- public SciProjectPublicationsCollection(final DataCollection dataCollection) {
- super(dataCollection);
- }
-
- public Publication getPublication() {
- return (Publication) DomainObjectFactory.newInstance(m_dataCollection.
- getDataObject());
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublications.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublications.java
deleted file mode 100644
index bfb1e3fc0..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublications.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.OID;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.util.Assert;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectWithPublications extends SciProject {
-
- public static final String BASE_DATA_OBJECT_TYPE =
- "com.arsdigita.cms.contenttypes.SciProjectWithPublications";
- public static final String PUBLICATIONS = "publications";
-
- public SciProjectWithPublications() {
- this(BASE_DATA_OBJECT_TYPE);
- }
-
- public SciProjectWithPublications(final BigDecimal id) {
- this(new OID(BASE_DATA_OBJECT_TYPE, id));
- }
-
- public SciProjectWithPublications(final OID oid) {
- super(oid);
- }
-
- public SciProjectWithPublications(final DataObject dobj) {
- super(dobj);
- }
-
- public SciProjectWithPublications(final String type) {
- super(type);
- }
-
- public boolean hasPublications(final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciProject");
- query.setParameter("project", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subProjectsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
- subProjectsQuery.setParameter("project", getID());
-
- if (subProjectsQuery.size() > 0) {
- BigDecimal subProjectId;
- boolean result = false;
- while (subProjectsQuery.next()) {
- subProjectId = (BigDecimal) subProjectsQuery.get(
- "projectId");
- result = hasPublications(subProjectId, merge);
-
- if (result) {
- break;
- }
- }
-
- subProjectsQuery.close();
- return result;
- } else {
- subProjectsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasPublications(final BigDecimal projectId,
- final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciProject");
- query.setParameter("project", projectId);
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subProjectsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
- subProjectsQuery.setParameter("project", projectId);
-
- if (subProjectsQuery.size() > 0) {
- BigDecimal subProjectId;
- boolean result = false;
- while (subProjectsQuery.next()) {
- subProjectId = (BigDecimal) subProjectsQuery.get(
- "projectId");
- result = hasPublications(subProjectId, merge);
-
- if (result) {
- break;
- }
- }
-
- subProjectsQuery.close();
- return result;
- } else {
- subProjectsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public boolean hasWorkingPapers(final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciProject");
- query.setParameter("project", getID());
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subProjectsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
- subProjectsQuery.setParameter("project", getID());
-
- if (subProjectsQuery.size() > 0) {
- BigDecimal subProjectId;
- boolean result = false;
- while (subProjectsQuery.next()) {
- subProjectId = (BigDecimal) subProjectsQuery.get(
- "projectId");
- result = hasPublications(subProjectId, merge);
-
- if (result) {
- break;
- }
- }
-
- subProjectsQuery.close();
- return result;
- } else {
- subProjectsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- private boolean hasWorkingPapers(final BigDecimal projectId,
- final boolean merge) {
- DataQuery query =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfWorkingPapersOfSciProject");
- query.setParameter("projectId", projectId);
-
- if (query.size() > 0) {
- query.close();
- return true;
- } else {
- if (merge) {
- query.close();
- DataQuery subProjectsQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfSubProjectsOfSciProject");
- subProjectsQuery.setParameter("project", projectId);
-
- if (subProjectsQuery.size() > 0) {
- BigDecimal subProjectId;
- boolean result = false;
- while (subProjectsQuery.next()) {
- subProjectId = (BigDecimal) subProjectsQuery.get(
- "projectId");
- result = hasPublications(subProjectId, merge);
-
- if (result) {
- break;
- }
- }
-
- subProjectsQuery.close();
- return result;
- } else {
- subProjectsQuery.close();
- return false;
- }
- } else {
- query.close();
- return false;
- }
- }
- }
-
- public SciProjectPublicationsCollection getPublications() {
- return new SciProjectPublicationsCollection((DataCollection) get(
- PUBLICATIONS));
- }
-
- public void addPublication(final Publication publication) {
- Assert.exists(publication, Publication.class);
-
- DataObject link = add(PUBLICATIONS, publication);
- link.set("publicationOrder", Integer.valueOf((int) getPublications().
- size()));
- link.save();
- }
-
- public void removePublication(final Publication publication) {
- Assert.exists(publication, Publication.class);
-
- remove(PUBLICATIONS, publication);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublicationsInitializer.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublicationsInitializer.java
deleted file mode 100644
index edd8a5081..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublicationsInitializer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.contenttypes.ui.PublicationSciProjectStep;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.globalization.GlobalizedMessage;
-import com.arsdigita.runtime.DomainInitEvent;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectWithPublicationsInitializer
- extends ContentTypeInitializer {
-
- public SciProjectWithPublicationsInitializer() {
- super("empty.pdl.mf",
- SciProjectWithPublications.BASE_DATA_OBJECT_TYPE);
- }
-
- @Override
- public void init(final DomainInitEvent event) {
- super.init(event);
-
- ContentType projectType =
- ContentType.findByAssociatedObjectType(SciProject.class.
- getName());
- if (!projectType.isInternal()) {
- projectType.setMode("internal");
- }
-
- AuthoringKitWizard.registerAssetStep(Publication.BASE_DATA_OBJECT_TYPE,
- PublicationSciProjectStep.class,
- new GlobalizedMessage(
- "sciorganizationpublication.ui.publication.projects.title",
- "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
- new GlobalizedMessage(
- "sciorganizationpublication.ui.publication.projects.description",
- "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources"),
- 1);
- }
-
- @Override
- public String[] getStylesheets() {
- return new String[]{
- "/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl"};
- }
-
- @Override
- public String getTraversalXML() {
- return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml";
-
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublicationsLoader.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublicationsLoader.java
deleted file mode 100644
index 406d4bf6e..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciProjectWithPublicationsLoader.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.util.parameter.Parameter;
-import com.arsdigita.util.parameter.ResourceParameter;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import java.io.InputStream;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectWithPublicationsLoader extends AbstractContentTypeLoader {
-
- private ResourceParameter m_template;
- private static final String[] TYPES = {
- "/WEB-INF/content-types/com/arsdigita/cms/contenttypes/SciProjectWithPublications.xml"
- };
-
- public SciProjectWithPublicationsLoader() {
- super();
-
- m_template =
- new ResourceParameter(
- "com.arsdigita.cms.contenttypes.SciProjectWithPublicationsTemplate",
- Parameter.REQUIRED,
- "/WEB-INF/content-types/com/arsdigita/"
- + "cms/contenttypes/sciproject-with-publications-item.jsp");
-
- register(m_template);
- }
-
- @Override
- public String[] getTypes() {
- return TYPES;
- }
-
- @Override
- protected void prepareSection(final ContentSection section,
- final ContentType type,
- final LifecycleDefinition lifecycle,
- final WorkflowTemplate workflow) {
- super.prepareSection(section, type, lifecycle, workflow);
-
- setDefaultTemplate("SciProjectWithPublications Item",
- "sciproject-with-publications-item",
- (InputStream) get(m_template),
- section,
- type,
- lifecycle,
- workflow);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationAuthorComparator.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationAuthorComparator.java
deleted file mode 100644
index de1d562a8..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationAuthorComparator.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.SessionManager;
-import java.math.BigDecimal;
-import java.util.Comparator;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciPublicationAuthorComparator implements Comparator {
-
- private Logger logger = Logger.getLogger(
- SciPublicationAuthorComparator.class);
-
- public int compare(Publication publication1, Publication publication2) {
- if ((publication1.getAuthors() == null)
- || publication1.getAuthors().size() == 0) {
- logger.debug("publication1 has no authors, returning -1");
- return -1;
- } else if ((publication2.getAuthors() == null)
- || publication2.getAuthors().size() == 0) {
- logger.debug("publication2 has no authors, returning ");
- return 1;
- } else {
- logger.debug("Both publication have authors, comparing authors...");
- int ret = 0;
-
- AuthorshipCollection authors1 = publication1.getAuthors();
- AuthorshipCollection authors2 = publication2.getAuthors();
-
- while ((ret == 0) && authors1.next() && authors2.next()) {
- GenericPerson author1 = authors1.getAuthor();
- GenericPerson author2 = authors2.getAuthor();
- logger.debug(String.format(
- "Comparing surnames: author1.surname = '%s'; author2.surname = '%s'",
- author1.getSurname(),
- author2.getSurname()));
- ret = author1.getSurname().compareTo(author2.getSurname());
-
- if (ret == 0) {
- logger.debug(String.format(
- "Surnames are identical, comparing given names:"
- + "author1.givenName = '%s'; author2.givenName = '%s'",
- author1.getGivenName(),
- author2.getGivenName()));
- ret = author1.getGivenName().compareTo(
- author2.getGivenName());
- }
- logger.debug(String.format("ret = %d", ret));
- }
-
- return ret;
- }
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationTitleComparator.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationTitleComparator.java
deleted file mode 100644
index 1c61571c5..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationTitleComparator.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import java.util.Comparator;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciPublicationTitleComparator implements Comparator {
-
- public int compare(Publication publication1, Publication publication2) {
- String title1;
- String title2;
- if (publication1.getTitle().startsWith("\"")) {
- title1 = publication1.getTitle().substring(1,
- publication1.getTitle().
- length() - 1);
- } else if (publication1.getTitle().startsWith("'")) {
- title1 = publication1.getTitle().substring(1,
- publication1.getTitle().
- length() - 1);
- } else {
- title1 = publication1.getTitle();
- }
-
- if (publication2.getTitle().startsWith("\"")) {
- title2 = publication2.getTitle().substring(2,
- publication2.getTitle().
- length() - 1);
- } else if (publication2.getTitle().startsWith("'")) {
- title2 = publication2.getTitle().substring(2,
- publication2.getTitle().
- length() - 1);
- } else {
- title2 = publication2.getTitle();
- }
-
-
-
- return title1.compareToIgnoreCase(title2);
- //return publication1.getTitle().compareTo(publication2.getTitle());
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationYearAscComparator.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationYearAscComparator.java
deleted file mode 100644
index 89d844079..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationYearAscComparator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import java.util.Comparator;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciPublicationYearAscComparator implements Comparator {
-
- public int compare(Publication publication1, Publication publication2) {
- if (publication1.getYearOfPublication() == null) {
- return -1;
- } else if (publication2.getYearOfPublication() == null) {
- return 1;
- } else {
- int ret = publication1.getYearOfPublication().compareTo(publication2.
- getYearOfPublication());
-
- if (ret == 0) {
- SciPublicationTitleComparator titleComparator =
- new SciPublicationTitleComparator();
- ret = titleComparator.compare(publication1, publication2);
- }
-
- return ret;
- }
-
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationYearDescComparator.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationYearDescComparator.java
deleted file mode 100644
index 5ee87a4a5..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/SciPublicationYearDescComparator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import java.util.Comparator;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciPublicationYearDescComparator implements Comparator {
-
- public int compare(Publication publication1, Publication publication2) {
- if (publication1.getYearOfPublication() == null) {
- return 1;
- } else if (publication2.getYearOfPublication() == null) {
- return -1;
- } else {
- int ret = publication2.getYearOfPublication().compareTo(publication1.
- getYearOfPublication());
- if (ret == 0) {
- SciPublicationTitleComparator titleComparator = new SciPublicationTitleComparator();
- ret = titleComparator.compare(publication1, publication2);
- }
-
- return ret;
- }
-
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ZeSLanguageVersionFix.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ZeSLanguageVersionFix.java
deleted file mode 100644
index 02ce16048..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ZeSLanguageVersionFix.java
+++ /dev/null
@@ -1,511 +0,0 @@
-package com.arsdigita.cms.contenttypes;
-
-import com.arsdigita.cms.ContentBundle;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.ContentPage;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ContentSectionCollection;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ContentTypeLifecycleDefinition;
-import com.arsdigita.cms.ContentTypeWorkflowTemplate;
-import com.arsdigita.cms.Folder;
-import com.arsdigita.cms.lifecycle.LifecycleDefinition;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.persistence.TransactionContext;
-import com.arsdigita.workflow.simple.Workflow;
-import com.arsdigita.workflow.simple.WorkflowTemplate;
-import java.util.Date;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class ZeSLanguageVersionFix {
-
- public static void main(final String[] args) {
-
- final com.arsdigita.runtime.Runtime runtime =
- new com.arsdigita.runtime.Runtime();
- runtime.startup();
-
- final Session session = SessionManager.getSession();
- final TransactionContext tctx = session.getTransactionContext();
-
- tctx.beginTxn();
- try {
- System.out.println("Starting to fix associations...");
-
- ContentSectionCollection contentSections = ContentSection.
- getAllSections();
- ContentSection sectionContent = null;
- ContentSection sectionResearch = null;
- while (contentSections.next()) {
- ContentSection section = contentSections.getContentSection();
- if ("content".equals(section.getName())) {
- sectionContent = section;
- } else if ("research".equals(section.getName())) {
- sectionResearch = section;
- }
- }
-
- fixZeS(session, sectionContent, sectionResearch);
- fixTheorieUndVerfassung(session, sectionContent, sectionResearch);
- fixInstitutionenUndGeschichte(session,
- sectionContent,
- sectionResearch);
- fixWirtschaftswissenschaftliche(session,
- sectionContent,
- sectionResearch);
- fixGesundheit(session, sectionContent, sectionResearch);
- fixGesundheitArbeitsbereich1(session,
- sectionContent,
- sectionResearch);
- fixGesundheitArbeitsbereich2(session,
- sectionContent,
- sectionResearch);
- fixGesundheitArbeitsbereich3(session,
- sectionContent,
- sectionResearch);
- fixGesundheitArbeitsbereich4(session,
- sectionContent,
- sectionResearch);
- fixGeschlechterpolitik(session, sectionContent, sectionResearch);
-
- fixFileStorageItems(session, sectionContent, sectionResearch);
-
- System.out.println("Finished, commiting transaction...");
- tctx.commitTxn();
- } catch (Exception ex) {
- System.err.println(
- "Exeception ocurred during convert process. "
- + "Transaction rolled back, all changes will be lost.");
- ex.printStackTrace(System.err);
- } finally {
- if (tctx.inTxn()) {
- tctx.abortTxn();
- }
- }
- }
-
- public static void fixZeS(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- System.out.println(
- "First, the publications of the english variant of the ZeS...");
- Folder folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem("das-zentrum", true);
- ContentItem item = folder.getItem("zes", false);
-
- SciOrganizationWithPublications zesDe;
- SciOrganizationWithPublications zesEn;
- if (item instanceof ContentBundle) {
- zesDe =
- (SciOrganizationWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- zesDe = (SciOrganizationWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
- zesEn = (SciOrganizationWithPublications) zesDe.getContentBundle().
- getInstance("en");
-
- System.out.printf("Got the ZeS: %s (%s)\n", zesDe.getName(), zesDe.
- getLanguage());
-
- SciOrganizationPublicationsCollection publicationsZeSde = zesDe.
- getPublications();
- SciOrganizationPublicationsCollection publicationsZeSen = zesEn.
- getPublications();
-
- Publication publicationDe;
- Publication publicationEn;
-
- //Delete all publication links from the english variant to german variants of publications
- System.out.println(
- "Deleting all assciations of the english ZeS item with german variants of publication items...");
- int i = 1;
- long size = publicationsZeSen.size();
- while (publicationsZeSen.next()) {
- publicationEn = publicationsZeSen.getPublication();
- System.out.printf("\tProcessing item %d of %d ('%s')...\n",
- i,
- size,
- publicationEn.getName());
- if (!("de").equals(publicationEn.getLanguage())) {
- zesEn.removePublication(publicationEn);
- LifecycleDefinition lifecycleDef =
- ContentTypeLifecycleDefinition.
- getLifecycleDefinition(
- publicationEn.getContentSection(),
- publicationEn.getContentType());
-
- System.out.println("\t\t\tPublishing new item...");
- publicationEn.publish(lifecycleDef, new Date());
- i++;
- }
- }
-
- publicationEn = null;
-
- publicationsZeSen = zesEn.getPublications();
-
- i = 1;
- size = publicationsZeSde.size();
- System.out.println(
- "Processing publications and linking them to the english variant of the ZeS item...");
- while (publicationsZeSde.next()) {
- publicationDe = publicationsZeSde.getPublication();
- publicationEn = (Publication) publicationDe.getContentBundle().
- getInstance("en");
- System.out.printf("\tProceesing item %d of %d ('%s')...",
- i,
- size,
- publicationDe.getName());
-
- System.out.println(
- "\tCreating english versions of the publication items of associated with the ZeS item (if necessary)...");
- if (publicationEn == null) {
- System.out.println(
- "\t\tNo english version found, creating one...");
- publicationEn =
- (Publication) createEnglishVersion(publicationDe,
- sectionResearch);
- } else {
- System.out.println(
- "\t\tEnglish version exists, no action necessary here.");
- }
-
- System.out.println(
- "\tChecking if english variant of the publication item is already associated with the english version of the ZeS item. ");
- publicationsZeSen.addFilter(String.format("id = %s", publicationEn.
- getID()));
- if (publicationsZeSen.isEmpty()) {
- System.out.println(
- "\t\tAdding english version of publication item to english version of the ZeS item...");
- zesEn.addPublication(publicationEn);
- LifecycleDefinition lifecycleDef =
- ContentTypeLifecycleDefinition.
- getLifecycleDefinition(
- publicationEn.getContentSection(),
- publicationEn.getContentType());
- System.out.println("\t\t\t(Re)publishing publication item...");
- if (publicationEn.isPublished()) {
- publicationEn.republish();
- } else {
- publicationEn.publish(lifecycleDef, new Date());
- }
- } else {
- System.out.println(
- "\t\tAlready associated, no actions necessary.");
- }
- publicationsZeSen.reset();
- i++;
- }
-
- System.out.println("\t\t\t(Re)publishing the english ZeS item...");
- if (zesEn.isPublished()) {
- zesEn.republish();
- } else {
- LifecycleDefinition lifcycleDef =
- ContentTypeLifecycleDefinition.
- getLifecycleDefinition(zesEn.getContentSection(),
- zesEn.getContentType());
- zesEn.publish(lifcycleDef, new Date());
- }
- }
-
- public static void fixTheorieUndVerfassung(final Session session,
- final ContentSection sectionContent,
- final ContentSection researchContent) {
- Folder folder;
- ContentItem item;
-
- System.out.println(
- "Abteilung Theorie und Verfassung des Wohlfahrtsstaates...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem("theorie-und-verfassung", true);
- item = folder.getItem("theorie-und-verfassung-des-wohlfahrtsstaates",
- false);
-
- final SciDepartmentWithPublications theorieDe;
- if (item instanceof ContentBundle) {
- theorieDe =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- theorieDe =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n", theorieDe.getName(), theorieDe.
- getLanguage());
- }
-
- public static void fixInstitutionenUndGeschichte(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println(
- "Abteilung Institutionen und Geschichte des Wohlfahrtsstaates...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem("institutionen-und-geschichte",
- true);
- item = folder.getItem(
- "institutionen-und-geschichte-des-wohlfahrtsstaates", false);
-
- final SciDepartmentWithPublications institutionenDe;
- if (item instanceof ContentBundle) {
- institutionenDe =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- institutionenDe =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n",
- institutionenDe.getName(),
- institutionenDe.getLanguage());
- }
-
- public static void fixWirtschaftswissenschaftliche(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println(
- "Abteilung Wirtschaftswissenschaftliche Abteilung...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem(
- "wirtschaftswissenschaftliche-abteilung",
- true);
- item =
- folder.getItem("wirtschaftswissenschaftliche-abteilung", false);
- final SciDepartmentWithPublications wirtschaftDe;
- if (item instanceof ContentBundle) {
- wirtschaftDe =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- wirtschaftDe =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n", wirtschaftDe.getName(),
- wirtschaftDe.getLanguage());
- }
-
- public static void fixGesundheit(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println("Abteilung Gesundheit...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem(
- "gesundheit",
- true);
- item =
- folder.getItem(
- "gesundheitsoekonomie-gesundheitspolitik-und-versorgungsforschung",
- false);
- final SciDepartmentWithPublications gesundheitDe;
- if (item instanceof ContentBundle) {
- gesundheitDe =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- gesundheitDe =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n", gesundheitDe.getName(),
- gesundheitDe.getLanguage());
- }
-
- public static void fixGesundheitArbeitsbereich1(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println("Gesundheit/Arbeitsbereich 1...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem(
- "gesundheit",
- true);
- item =
- folder.getItem("arbeitsbereich-1", false);
- final SciDepartmentWithPublications arbeitsbereich1De;
- if (item instanceof ContentBundle) {
- arbeitsbereich1De =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- arbeitsbereich1De =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n", arbeitsbereich1De.getName(),
- arbeitsbereich1De.getLanguage());
- }
-
- public static void fixGesundheitArbeitsbereich2(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println("Arbeitsbereich 2...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem(
- "gesundheit",
- true);
- item =
- folder.getItem("arbeitsbereich-2", false);
- final SciDepartmentWithPublications arbeitsbereich2De;
- if (item instanceof ContentBundle) {
- arbeitsbereich2De =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- arbeitsbereich2De =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n",
- arbeitsbereich2De.getName(),
- arbeitsbereich2De.getLanguage());
-
- }
-
- public static void fixGesundheitArbeitsbereich3(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println("Arbeitsbereich 3...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem(
- "gesundheit",
- true);
- item =
- folder.getItem("arbeitsbereich-3", false);
- final SciDepartmentWithPublications arbeitsbereich3De;
- if (item instanceof ContentBundle) {
- arbeitsbereich3De =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- arbeitsbereich3De =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n",
- arbeitsbereich3De.getName(),
- arbeitsbereich3De.getLanguage());
- }
-
- public static void fixGesundheitArbeitsbereich4(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println("Arbeitsbereich 4...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem(
- "gesundheit",
- true);
- item =
- folder.getItem("arbeitsbereich-4", false);
- final SciDepartmentWithPublications arbeitsbereich4De;
- if (item instanceof ContentBundle) {
- arbeitsbereich4De =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- arbeitsbereich4De =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n",
- arbeitsbereich4De.getName(),
- arbeitsbereich4De.getLanguage());
- }
-
- public static void fixGeschlechterpolitik(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println("Abteilung Geschlechterpolitik...");
- folder = sectionContent.getRootFolder();
- folder = (Folder) folder.getItem("geschlechterpolitik",
- true);
- item =
- folder.getItem("geschlechterpolitik-im-wohlfahrtsstaat", false);
- final SciDepartmentWithPublications geschlechterDe;
- if (item instanceof ContentBundle) {
- geschlechterDe =
- (SciDepartmentWithPublications) ((ContentBundle) item).
- getPrimaryInstance();
- } else {
- geschlechterDe =
- (SciDepartmentWithPublications) ((ContentPage) item).
- getContentBundle().getPrimaryInstance();
- }
-
- System.out.printf("Got '%s' (%s)\n",
- geschlechterDe.getName(),
- geschlechterDe.getLanguage());
- }
-
- public static void fixFileStorageItems(final Session session,
- final ContentSection sectionContent,
- final ContentSection sectionResearch) {
- Folder folder;
- ContentItem item;
-
- System.out.println("FileStorageItems for WorkingPapers...");
- }
-
- public static ContentPage createEnglishVersion(final ContentPage item,
- final ContentSection section) {
- ContentPage itemPrimary;
- ContentPage itemEn;
-
- itemPrimary = (Publication) item.getContentBundle().
- getPrimaryInstance();
-
- itemEn = (Publication) itemPrimary.copy("en");
- itemEn.setLanguage("en");
- itemEn.setName(item.getContentBundle().getName());
-
- ContentType type = item.getContentType();;
- WorkflowTemplate template = ContentTypeWorkflowTemplate.
- getWorkflowTemplate(section, type);
- if (template != null) {
- Workflow workflow = template.instantiateNewWorkflow();
- workflow.setObjectID(itemEn.getID());
- workflow.save();
- }
-
- return itemEn;
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentAddForm.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentAddForm.java
deleted file mode 100644
index 429970882..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentAddForm.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.PublicationSciDepartmentCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciDepartmentAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "departments";
-
- public PublicationSciDepartmentAddForm(ItemSelectionModel itemModel) {
- super("PublicationSciDepartmentAddForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganization.ui.selectDepartment").localize()));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(SciDepartmentWithPublications.class.
- getName()));
- add(itemSearch);
- }
-
- @Override
- public void init(final FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
-
- Publication publication = (Publication) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- SciDepartmentWithPublications department =
- (SciDepartmentWithPublications) data.
- get(ITEM_SEARCH);
- department = (SciDepartmentWithPublications) department.
- getContentBundle().getInstance(publication.getLanguage());
- DataObject link = publication.add("departments", department);
- link.set("publicationOrder", Integer.valueOf((int) department.
- getPublications().size()));
-
- link.save();
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectDepartment.no_department_selected"));
- return;
- }
-
- Publication publication = (Publication) getItemSelectionModel().
- getSelectedObject(state);
- SciDepartmentWithPublications department =
- (SciDepartmentWithPublications) data.get(
- ITEM_SEARCH);
- if (!(department.getContentBundle().hasInstance(publication.getLanguage()))) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectDepartment.no_suitable_language_variant"));
- return;
- }
-
- department = (SciDepartmentWithPublications) department.getContentBundle().getInstance(publication.getLanguage());
- PublicationSciDepartmentCollection departments = new PublicationSciDepartmentCollection((DataCollection) publication.
- get("departments"));
- departments.addFilter(String.format("id = %s", department.getID().toString()));
- if (departments.size() > 0) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectDepartment.already_added"));
- }
-
- departments.close();
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentStep.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentStep.java
deleted file mode 100644
index 01bf10f0b..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentStep.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciDepartmentStep extends SimpleEditStep {
-
- private String ADD_ORGANIZATION_SHEET_NAME = "addSciDepartment";
-
- public PublicationSciDepartmentStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public PublicationSciDepartmentStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addDepartmentSheet =
- new PublicationSciDepartmentAddForm(itemModel);
- add(ADD_ORGANIZATION_SHEET_NAME,
- (String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.addDepartment").localize(),
- new WorkflowLockedComponentAccess(addDepartmentSheet, itemModel),
- addDepartmentSheet.getSaveCancelSection().getCancelButton());
-
- PublicationSciDepartmentTable departmentTable =
- new PublicationSciDepartmentTable(
- itemModel);
- setDisplayComponent(departmentTable);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentTable.java
deleted file mode 100644
index 890b2516c..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciDepartmentTable.java
+++ /dev/null
@@ -1,278 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.PublicationSciDepartmentCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciDepartmentTable
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel itemModel;
-
- public PublicationSciDepartmentTable(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganizationpublication.ui.departments.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.department").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.department.remove").
- localize(), TABLE_COL_DEL));
-
- setModelBuilder(new PublicationSciDepartmentTableModelBuilder(
- itemModel));
-
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class PublicationSciDepartmentTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public PublicationSciDepartmentTableModelBuilder(
- final ItemSelectionModel itemModel) {
- this.itemModel = itemModel;
- }
-
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
- return new PublicationSciDepartmentTableModel(table,
- state,
- publication);
- }
- }
-
- private class PublicationSciDepartmentTableModel implements TableModel {
-
- private Table table;
- private PublicationSciDepartmentCollection departments;
- private SciDepartmentWithPublications department;
-
- public PublicationSciDepartmentTableModel(final Table table,
- final PageState state,
- final Publication publication) {
- this.table = table;
-
- departments =
- new PublicationSciDepartmentCollection((DataCollection) publication.
- get("departments"));
- }
-
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if ((departments != null) && departments.next()) {
- department = departments.getDepartment();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return department.getTitle();
- case 1:
- return SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.department.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return department.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- publication);
-
- if (canEdit) {
- SciDepartmentWithPublications department;
- try {
- department =
- new SciDepartmentWithPublications((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link =
- new Link(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()),
- resolver.generateItemURL(state,
- department,
- section,
- department.getVersion()));
- return link;
- } else {
- SciDepartmentWithPublications department;
- try {
- department =
- new SciDepartmentWithPublications((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- department.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.DELETE_ITEM,
- publication);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.department.confirm.remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- public void cellSelected(final TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciDepartmentWithPublications department =
- new SciDepartmentWithPublications(
- new BigDecimal(event.getRowKey().toString()));
-
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- //Nothing to do
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- Assert.exists(department, SciDepartmentWithPublications.class);
-
- publication.remove("departments", department);
- }
- }
-
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationAddForm.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationAddForm.java
deleted file mode 100644
index 8332009b8..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationAddForm.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.PublicationSciOrganizationCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciOrganizationAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "organizations";
-
- public PublicationSciOrganizationAddForm(final ItemSelectionModel itemModel) {
- super("PublicationSciOrganizationAddForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganization.ui.selectOrganization").localize()));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(SciOrganizationWithPublications.class.
- getName()));
- add(itemSearch);
- }
-
- @Override
- public void init(final FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
-
- Publication publication = (Publication) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) data.
- get(ITEM_SEARCH);
- organization = (SciOrganizationWithPublications) organization.
- getContentBundle().getInstance(publication.getLanguage());
- DataObject link = publication.add("organizations", organization);
- link.set("publicationOrder", Integer.valueOf((int) organization.
- getPublications().size()));
- link.save();
- }
-
- init(fse);
- }
-
- @Override
- public void validate(final FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganization.ui.selectOrganization.no_orga_selected"));
- return;
- }
-
- Publication publication = (Publication) getItemSelectionModel().
- getSelectedObject(state);
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) data.
- get(ITEM_SEARCH);
- if (!(organization.getContentBundle().hasInstance(publication.
- getLanguage()))) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectOrganization.no_suitable_language_variant"));
- return;
- }
-
- organization = (SciOrganizationWithPublications) organization.
- getContentBundle().getInstance(publication.getLanguage());
- PublicationSciOrganizationCollection organizations =
- new PublicationSciOrganizationCollection((DataCollection) publication.
- get("organizations"));
- organizations.addFilter(String.format("id = %s", organization.getID().toString()));
- if (organizations.size() > 0 ) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectOrganization.already_added"));
- }
-
- organizations.close();
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationStep.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationStep.java
deleted file mode 100644
index 7f356072b..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationStep.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciOrganizationStep extends SimpleEditStep {
-
- private String ADD_ORGANIZATION_SHEET_NAME = "addSciOrganization";
-
- public PublicationSciOrganizationStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public PublicationSciOrganizationStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addOrganizationSheet =
- new PublicationSciOrganizationAddForm(itemModel);
- add(ADD_ORGANIZATION_SHEET_NAME,
- (String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.addOrganization").localize(),
- new WorkflowLockedComponentAccess(addOrganizationSheet, itemModel),
- addOrganizationSheet.getSaveCancelSection().getCancelButton());
-
- PublicationSciOrganizationTable organizationTable =
- new PublicationSciOrganizationTable(
- itemModel);
- setDisplayComponent(organizationTable);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationTable.java
deleted file mode 100644
index 1a7123425..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciOrganizationTable.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.PublicationSciOrganizationCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciOrganizationTable
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel itemModel;
-
- public PublicationSciOrganizationTable(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganizationpublication.ui.organizations.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.organization").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.organization.remove").
- localize(), TABLE_COL_DEL));
-
- setModelBuilder(new PublicationSciOrganizationTableModelBuilder(
- itemModel));
-
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class PublicationSciOrganizationTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public PublicationSciOrganizationTableModelBuilder(
- final ItemSelectionModel itemModel) {
- this.itemModel = itemModel;
- }
-
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
- return new PublicationSciOrganizationTableModel(table,
- state,
- publication);
- }
- }
-
- private class PublicationSciOrganizationTableModel implements TableModel {
-
- private Table table;
- private PublicationSciOrganizationCollection organizations;
- private SciOrganizationWithPublications organization;
-
- public PublicationSciOrganizationTableModel(final Table table,
- final PageState state,
- final Publication publication) {
-
- this.table = table;
-
- organizations =
- new PublicationSciOrganizationCollection((DataCollection) publication.
- get("organizations"));
- }
-
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if ((organizations != null) && organizations.next()) {
- organization = organizations.getOrganization();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return organization.getTitle();
- case 1:
- return SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.organization.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return organization.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- publication);
-
- if (canEdit) {
- SciOrganizationWithPublications organization;
- try {
- organization =
- new SciOrganizationWithPublications((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link =
- new Link(String.format("%s (%s)",
- value.toString(),
- organization.getLanguage()),
- resolver.generateItemURL(state,
- organization,
- section,
- organization.getVersion()));
- return link;
- } else {
- SciOrganizationWithPublications organization;
- try {
- organization =
- new SciOrganizationWithPublications((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- Label label = new Label(
- String.format("%s (%s)",
- value.toString(),
- organization.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.DELETE_ITEM,
- publication);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.organization.confirm.remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- public void cellSelected(final TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciOrganizationWithPublications organization =
- new SciOrganizationWithPublications(
- new BigDecimal(event.getRowKey().toString()));
-
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- //Nothing to do
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- Assert.exists(organization, SciOrganizationWithPublications.class);
-
- publication.remove("organizations", organization);
- }
- }
-
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectAddForm.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectAddForm.java
deleted file mode 100644
index 27397cf59..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectAddForm.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.PublicationSciProjectCollection;
-import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataObject;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciProjectAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "projects";
-
- public PublicationSciProjectAddForm(final ItemSelectionModel itemModel) {
- super("PublicationSciProjectAddForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganization.ui.selectProject").localize()));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH,
- ContentType.findByAssociatedObjectType(SciProjectWithPublications.class.
- getName()));
- add(itemSearch);
- }
-
- @Override
- public void init(final FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
-
- Publication publication = (Publication) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- SciProjectWithPublications project =
- (SciProjectWithPublications) data.get(
- ITEM_SEARCH);
- project = (SciProjectWithPublications) project.getContentBundle().
- getInstance(publication.getLanguage());
- DataObject link = publication.add("projects", project);
- link.set("publicationOrder", Integer.valueOf((int) project.
- getPublications().size()));
- link.save();
- }
-
- init(fse);
- }
-
- @Override
- public void validate(FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganization.ui.selectProject.no_project_selected"));
- return;
- }
-
- Publication publication = (Publication) getItemSelectionModel().
- getSelectedObject(state);
- SciProjectWithPublications project =
- (SciProjectWithPublications) data.get(
- ITEM_SEARCH);
- if (!(project.getContentBundle().hasInstance(publication.getLanguage()))) {
- data.addError(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganization.ui.selectProject.no_suitable_language_variant"));
- return;
- }
-
- project = (SciProjectWithPublications) project.getContentBundle().getInstance(publication.getLanguage());
- PublicationSciProjectCollection projects = new PublicationSciProjectCollection((DataCollection) publication.
- get("projects"));
- projects.addFilter(String.format("id = %s", project.getID().toString()));
- if (projects.size() > 0) {
- data.addError(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganization.ui.selectProject.already_added"));
- }
-
- projects.close();
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectStep.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectStep.java
deleted file mode 100644
index cf32dda77..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectStep.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciProjectStep extends SimpleEditStep {
-
- private String ADD_ORGANIZATION_SHEET_NAME = "addSciProject";
-
- public PublicationSciProjectStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public PublicationSciProjectStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addProjectSheet =
- new PublicationSciProjectAddForm(itemModel);
- add(ADD_ORGANIZATION_SHEET_NAME,
- (String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.addOrganization").localize(),
- new WorkflowLockedComponentAccess(addProjectSheet, itemModel),
- addProjectSheet.getSaveCancelSection().getCancelButton());
-
- PublicationSciProjectTable projectTable =
- new PublicationSciProjectTable(
- itemModel);
- setDisplayComponent(projectTable);
- }
-
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectTable.java
deleted file mode 100644
index f6a85d9f8..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/PublicationSciProjectTable.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.PublicationSciProjectCollection;
-import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.util.Assert;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class PublicationSciProjectTable
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel itemModel;
-
- public PublicationSciProjectTable(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganizationpublication.ui.projects.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.projects").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.projects.remove").
- localize(), TABLE_COL_DEL));
-
- setModelBuilder(new PublicationSciProjectTableModelBuilder(
- itemModel));
-
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class PublicationSciProjectTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public PublicationSciProjectTableModelBuilder(
- final ItemSelectionModel itemModel) {
- this.itemModel = itemModel;
- }
-
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
- return new PublicationSciProjectTableModel(table,
- state,
- publication);
- }
- }
-
- private class PublicationSciProjectTableModel implements TableModel {
-
- private Table table;
- private PublicationSciProjectCollection projects;
- private SciProjectWithPublications project;
-
- public PublicationSciProjectTableModel(final Table table,
- final PageState state,
- final Publication publication) {
-
- this.table = table;
-
- projects =
- new PublicationSciProjectCollection((DataCollection) publication.get(
- "projects"));
- }
-
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if ((projects != null) && projects.next()) {
- project = projects.getOrganization();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return project.getTitle();
- case 1:
- return SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.project.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return project.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- publication);
-
- if (canEdit) {
- SciProjectWithPublications project;
- try {
- project =
- new SciProjectWithPublications((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link =
- new Link(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()),
- resolver.generateItemURL(state,
- project,
- section,
- project.getVersion()));
- return link;
- } else {
- SciProjectWithPublications project;
- try {
- project =
- new SciProjectWithPublications((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- Label label = new Label(String.format("%s (%s)",
- value.toString(),
- project.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.DELETE_ITEM,
- publication);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.project.confirm.remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- public void cellSelected(final TableActionEvent event) {
- PageState state = event.getPageState();
-
- SciProjectWithPublications project = new SciProjectWithPublications(
- new BigDecimal(event.getRowKey().toString()));
-
- Publication publication = (Publication) itemModel.getSelectedObject(
- state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- //Nothing to do
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- Assert.exists(project, SciProjectWithPublications.class);
-
- publication.remove("projects", project);
- }
- }
-
- public void headSelected(final TableActionEvent event) {
- //Nothing to do
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsAddForm.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsAddForm.java
deleted file mode 100644
index b669e25fe..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsAddForm.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentPublicationsAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "publications";
-
- public SciDepartmentPublicationsAddForm(final ItemSelectionModel itemModel) {
- super("SciDepartmentPublicationsAddForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganization.ui.selectPublication").localize()));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
- findByAssociatedObjectType(Publication.class.getName()));
- add(itemSearch);
- }
-
- @Override
- public void init(final FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciDepartmentWithPublications department =
- (SciDepartmentWithPublications) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- Publication publication = (Publication) data.get(ITEM_SEARCH);
- publication = (Publication) publication.getContentBundle().
- getInstance(department.getLanguage());
-
- department.addPublication(publication);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(final FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectPublication.no_publication_selected"));
- return;
- }
-
- SciDepartmentWithPublications department =
- (SciDepartmentWithPublications) getItemSelectionModel().
- getSelectedObject(state);
- Publication publication = (Publication) data.get(ITEM_SEARCH);
- if (!(publication.getContentBundle().hasInstance(
- department.getLanguage()))) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectPublication.no_suitable_language_variant"));
- return;
- }
-
- publication = (Publication) publication.getContentBundle().getInstance(
- department.getLanguage());
- SciDepartmentPublicationsCollection publications = department.
- getPublications();
- publications.addFilter(String.format("id = %s", publication.getID().
- toString()));
- if (publications.size() > 0) {
- data.addError(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganization.ui.selectPublication.already_added"));
- }
-
- publications.close();
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsStep.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsStep.java
deleted file mode 100644
index e1d5c19f8..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsStep.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentPublicationsStep extends SimpleEditStep {
-
- private String ADD_PUBLICATION_SHEET_NAME = "addPublication";
-
- public SciDepartmentPublicationsStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciDepartmentPublicationsStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addPublicationSheet =
- new SciDepartmentPublicationsAddForm(itemModel);
- add(ADD_PUBLICATION_SHEET_NAME,
- (String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.addPublication").localize(),
- new WorkflowLockedComponentAccess(addPublicationSheet, itemModel),
- addPublicationSheet.getSaveCancelSection().getCancelButton());
-
- SciDepartmentPublicationsTable publicationTable =
- new SciDepartmentPublicationsTable(
- itemModel);
- setDisplayComponent(publicationTable);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTable.java
deleted file mode 100644
index e1174db8b..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsTable.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentPublicationsTable
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel itemModel;
-
- public SciDepartmentPublicationsTable(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganizationpublication.ui.publications.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.publication").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.publication.remove").
- localize(), TABLE_COL_DEL));
-
- setModelBuilder(
- new SciDepartmentPublicationsTableModelBuilder(itemModel));
-
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciDepartmentPublicationsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public SciDepartmentPublicationsTableModelBuilder(
- final ItemSelectionModel itemModel) {
- this.itemModel = itemModel;
- }
-
- public TableModel makeModel(final Table table,
- final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciDepartmentWithPublications department =
- (SciDepartmentWithPublications) itemModel.
- getSelectedObject(state);
-
- return new SciDepartmentPublicationsTableModel(table,
- state,
- department);
- }
- }
-
- private class SciDepartmentPublicationsTableModel
- implements TableModel {
-
- private Table table;
- private SciDepartmentPublicationsCollection publications;
- private Publication publication;
-
- public SciDepartmentPublicationsTableModel(
- final Table table,
- final PageState state,
- final SciDepartmentWithPublications department) {
- this.table = table;
- publications = department.getPublications();
- }
-
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if ((publications != null) && publications.next()) {
- publication = publications.getPublication();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return publication.getTitle();
- case 1:
- return SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.publiction.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return publication.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
-
- SciDepartmentWithPublications department =
- (SciDepartmentWithPublications) itemModel.
- getSelectedObject(state);
-
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- department);
-
- if (canEdit) {
- Publication publication;
- try {
- publication = new Publication((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- publication.getLanguage()),
- resolver.generateItemURL(state,
- publication,
- section,
- publication.
- getVersion()));
-
- return link;
- } else {
- Publication publication;
- try {
- publication = new Publication((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- Label label =
- new Label(String.format("%s (%s)",
- value.toString(),
- publication.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciDepartmentWithPublications organization =
- (SciDepartmentWithPublications) itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.DELETE_ITEM,
- organization);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.publication.confirm.remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- public void cellSelected(final TableActionEvent event) {
- PageState state = event.getPageState();
-
- Publication publication =
- new Publication(new BigDecimal(event.getRowKey().toString()));
-
- SciDepartmentWithPublications department =
- (SciDepartmentWithPublications) itemModel.
- getSelectedObject(state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- //Nothing to do here
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- department.removePublication(publication);
- }
- }
-
- public void headSelected(final TableActionEvent event) {
- //Nothing to do her
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentWithPublicationsPanel.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentWithPublicationsPanel.java
deleted file mode 100644
index 1ab7268df..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentWithPublicationsPanel.java
+++ /dev/null
@@ -1,411 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
-import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
-import com.arsdigita.cms.contenttypes.SciPublicationYearAscComparator;
-import com.arsdigita.cms.contenttypes.SciPublicationYearDescComparator;
-import com.arsdigita.cms.contenttypes.ui.panels.Filter;
-import com.arsdigita.cms.contenttypes.ui.panels.SelectFilter;
-import com.arsdigita.cms.contenttypes.ui.panels.SortField;
-import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.xml.Element;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciDepartmentWithPublicationsPanel extends SciDepartmentPanel {
-
- private static final Logger logger =
- Logger.getLogger(
- SciDepartmentWithPublicationsPanel.class);
- public static final String SHOW_PUBLICATIONS = "publications";
- public static final String SHOW_WORKING_PAPERS = "workingPapers";
- private static final String SORT = "sort";
- private static final String TITLE = "title";
- private static final String AUTHORS = "authors";
- private static final String YEAR_OF_PUBLICATION = "yearOfPublication";
- private static final String YEAR_ASC = "yearAsc";
- private static final String YEAR_DESC = "yearDesc";
- private String show;
- private boolean displayPublications = true;
- private boolean displayWorkingPapers = true;
- private final Map filters =
- new LinkedHashMap();
- private final Map> sortFields =
- new LinkedHashMap>();
- private String sortByKey;
-
- public SciDepartmentWithPublicationsPanel() {
- filters.put(TITLE, new TextFilter(TITLE, TITLE));
- filters.put(AUTHORS, new TextFilter(AUTHORS, "authors.surname"));
- SelectFilter yearFilter = new SelectFilter(YEAR_OF_PUBLICATION,
- YEAR_OF_PUBLICATION,
- true,
- true,
- true,
- true);
- DataQuery query = SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getAllYearsOfPublication");
- yearFilter.setDataQuery(query, "yearOfPublication");
- filters.put(YEAR_OF_PUBLICATION, yearFilter);
-
- sortFields.put(YEAR_DESC,
- new SortField(YEAR_DESC,
- new SciPublicationYearDescComparator()));
- sortFields.put(TITLE,
- new SortField(TITLE,
- new SciPublicationTitleComparator()));
- sortFields.put(YEAR_ASC,
- new SortField(YEAR_ASC,
- new SciPublicationYearAscComparator()));
-
- /*sortFields.put(AUTHORS,
- new SortField(AUTHORS,
- new SciPublicationAuthorComparator()));*/
- }
-
- @Override
- public Class extends ContentItem> getAllowedClass() {
- return SciDepartmentWithPublications.class;
- }
-
- @Override
- protected String getPanelName() {
- return SciDepartment.class.getSimpleName();
- }
-
- public boolean isDisplayPublications() {
- return displayPublications;
- }
-
- public void setDisplayPublications(final boolean displayPublications) {
- this.displayPublications = displayPublications;
- }
-
- public boolean isDisplayWorkingPapers() {
- return displayWorkingPapers;
- }
-
- public void setDisplayWorkingPapers(final boolean displayWorkingPapers) {
- this.displayWorkingPapers = displayWorkingPapers;
- }
-
- @Override
- protected void generateAvailableDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
- SciDepartment department = (SciDepartment) orga;
-
- super.generateAvailableDataXml(department, element, state);
-
- SciOrganizationWithPublicationsConfig config =
- SciOrganizationWithPublications.
- getConfig();
-
- SciDepartmentWithPublications dep =
- (SciDepartmentWithPublications) department;
-
- if ((dep.hasPublications(
- config.getOrganizationPublicationsMerge()))
- && displayPublications) {
- element.newChildElement("publications");
- }
- if ((dep.hasWorkingPapers(config.getOrganizationPublicationsMerge())
- && displayWorkingPapers
- && config.getDepartmentPublicationsSeparateWorkingPapers())) {
- element.newChildElement("workingPapers");
- }
- }
-
- protected void mergePublications(
- final SciDepartmentSubDepartmentsCollection subDepartments,
- final List publications,
- final boolean workingPapersOnly,
- final PageState state) {
- while (subDepartments.next()) {
- SciDepartment dep;
- SciDepartmentWithPublications department;
- SciDepartmentPublicationsCollection departmentPublications;
-
- dep = subDepartments.getSubDepartment();
- if (!(dep instanceof SciDepartmentWithPublications)) {
- continue;
- }
- department = (SciDepartmentWithPublications) dep;
- departmentPublications = department.getPublications();
- applyFilters(departmentPublications, state.getRequest());
- if (workingPapersOnly) {
- departmentPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getDepartmentPublicationsSeparateWorkingPapers()) {
- departmentPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- if (publications instanceof ArrayList) {
- ((ArrayList) publications).ensureCapacity(
- publications.size()
- + (int) departmentPublications.size());
- }
-
- Publication publication;
- while (departmentPublications.next()) {
- publication = departmentPublications.getPublication();
- publications.add(publication);
- }
-
- SciDepartmentSubDepartmentsCollection subSubDepartments = dep.
- getSubDepartments();
-
- if ((subSubDepartments != null) && subSubDepartments.size() > 0) {
- mergePublications(subDepartments,
- publications,
- workingPapersOnly,
- state);
- }
- }
- }
-
- protected void generateFiltersXml(
- final List publications,
- final Element element) {
- final Element filterElement = element.newChildElement("filters");
-
- for (Map.Entry filterEntry : filters.entrySet()) {
- filterEntry.getValue().generateXml(filterElement);
- }
- }
-
- protected void generateSortFieldsXml(final Element element) {
- final Element sortFieldsElement = element.newChildElement("sortFields");
- sortFieldsElement.addAttribute("sortBy", sortByKey);
- for (Map.Entry> sortField :
- sortFields.entrySet()) {
- sortField.getValue().generateXml(sortFieldsElement);
- }
- }
-
- protected void applySortFields(
- final List publications,
- final HttpServletRequest request) {
- sortByKey = request.getParameter("sort");
- if (!sortFields.containsKey(sortByKey)) {
- sortByKey = new ArrayList(sortFields.keySet()).get(0);
- }
-
- if (sortFields.containsKey(sortByKey)) {
- Comparator comparator = sortFields.get(sortByKey).
- getComparator();
- Collections.sort(publications, comparator);
- } else {
- Collections.sort(publications, new SciPublicationTitleComparator());
- }
- }
-
- protected void applyFilters(
- final DomainCollection publications,
- final HttpServletRequest request) {
- //Get parameters from HTTP request
- for (Map.Entry filterEntry : filters.entrySet()) {
- String value = request.getParameter(
- filterEntry.getValue().getLabel());
-
- if ((value != null) && !(value.trim().isEmpty())) {
- filterEntry.getValue().setValue(value);
- }
- }
-
- //Apply filters to DomainCollection
- final StringBuilder filterBuilder = new StringBuilder();
- for (Map.Entry filterEntry : filters.entrySet()) {
- if ((filterEntry.getValue().getFilter() == null)
- || (filterEntry.getValue().getFilter().isEmpty())) {
- continue;
- }
-
- if (filterBuilder.length() > 0) {
- filterBuilder.append(" AND ");
- }
- filterBuilder.append(filterEntry.getValue().getFilter());
- logger.debug(String.format("filters: %s", filterBuilder));
- if (filterBuilder.length() > 0) {
- publications.addFilter(filterBuilder.toString());
- }
- }
- }
-
- protected void generatePublicationsXml(final SciDepartment department,
- final Element parent,
- final PageState state,
- final boolean workingPapersOnly) {
- final SciDepartmentWithPublications dep =
- (SciDepartmentWithPublications) department;
-
- Element controls = parent.newChildElement("filterControls");
- controls.addAttribute("customName", "sciDepartmentPublications");
- controls.addAttribute("show", show);
-
- if (SciOrganizationWithPublications.getConfig().
- getOrganizationPublicationsMerge()) {
- List publications;
- SciDepartmentPublicationsCollection departmentPublications;
- departmentPublications = dep.getPublications();
- applyFilters(departmentPublications, state.getRequest());
- if (workingPapersOnly) {
- departmentPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getDepartmentPublicationsSeparateWorkingPapers()) {
- departmentPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
- publications =
- new ArrayList((int) departmentPublications.size());
-
- Publication publication;
- while (departmentPublications.next()) {
- publication = departmentPublications.getPublication();
- publications.add(publication);
- }
-
- mergePublications(department.getSubDepartments(),
- publications,
- workingPapersOnly,
- state);
-
- Set publicationsSet;
- List publicationsWithoutDoubles;
- publicationsSet = new HashSet(publications);
- publicationsWithoutDoubles = new LinkedList(
- publicationsSet);
-
- applySortFields(publicationsWithoutDoubles, state.getRequest());
-
- //Collections.sort(publicationsWithoutDoubles,
- // new SciPublicationTitleComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publicationsWithoutDoubles.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, publicationsWithoutDoubles.
- size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generateFiltersXml(publicationsWithoutDoubles, controls);
- generateSortFieldsXml(controls);
- createPaginatorElement(parent, pageNumber, pageCount, begin, end,
- count, publicationsWithoutDoubles.size());
- List publicationsToShow = publicationsWithoutDoubles.
- subList((int) begin, (int) end);
-
- for (Publication pub : publicationsToShow) {
- PublicationXmlHelper xmlHelper = new PublicationXmlHelper(parent,
- pub);
- xmlHelper.generateXml();
- }
- } else {
- SciDepartmentPublicationsCollection departmentPublications;
- departmentPublications = dep.getPublications();
- applyFilters(departmentPublications, state.getRequest());
-
- List publications = new LinkedList();
- if (workingPapersOnly) {
- departmentPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getDepartmentPublicationsSeparateWorkingPapers()) {
- departmentPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- while (departmentPublications.next()) {
- publications.add(departmentPublications.getPublication());
- }
-
- applySortFields(publications, state.getRequest());
-
- //Collections.sort(publications, new SciPublicationTitleComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publications.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, publications.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generateFiltersXml(publications, controls);
- generateSortFieldsXml(controls);
- createPaginatorElement(parent, pageNumber, pageCount, begin, end,
- count, publications.size());
- List publicationsToShow = publications.subList(
- (int) begin, (int) end);
-
- for (Publication publication : publicationsToShow) {
- PublicationXmlHelper xmlHelper =
- new PublicationXmlHelper(parent,
- publication);
- xmlHelper.generateXml();
- }
- }
- }
-
- @Override
- public void generateDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
- show = getShowParam(state);
-
- if (SHOW_PUBLICATIONS.equals(show)) {
- generatePublicationsXml((SciDepartment) orga, element, state, false);
- } else if (SHOW_WORKING_PAPERS.equals(show)) {
- generatePublicationsXml((SciDepartment) orga, element, state, true);
- } else {
- super.generateDataXml(orga, element, state);
- }
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciMemberDemoPanel.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciMemberDemoPanel.java
deleted file mode 100644
index bec7137d0..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciMemberDemoPanel.java
+++ /dev/null
@@ -1,270 +0,0 @@
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.xml.Element;
-import com.arsdigita.cms.contenttypes.SciMember;
-import com.arsdigita.persistence.DataCollection;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.persistence.Session;
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.ui.panels.Filter;
-import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
-import com.arsdigita.cms.contenttypes.ui.panels.SelectFilter;
-import com.arsdigita.cms.contenttypes.ui.panels.CollectionSortField;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.LinkedHashMap;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciMemberDemoPanel extends CompoundContentItemPanel {
-
- private static final Logger logger = Logger.getLogger(
- SciMemberDemoPanel.class);
- private static final String SHOW_PUBLICATIONS = "publications";
- private static final String SHOW_PROJECTS = "projects";
- private static final String TITLE = "title";
- private static final String AUTHORS = "authors";
- private static final String YEAR_OF_PUBLICATION = "yearOfPublication";
- private static final String YEAR_ASC = "yearAsc";
- private static final String YEAR_DESC = "yearDesc";
- private static final String TYPE = "type";
- private String show;
- private final Map filters =
- new LinkedHashMap();
- private final Map sortFields =
- new LinkedHashMap();
- private String sortByKey;
-
- public SciMemberDemoPanel() {
- filters.put(TITLE, new TextFilter(TITLE, TITLE));
- filters.put(AUTHORS, new TextFilter(AUTHORS, "authors.surname"));
- SelectFilter yearFilter = new SelectFilter(YEAR_OF_PUBLICATION,
- YEAR_OF_PUBLICATION,
- true,
- true,
- true,
- true);
- filters.put(YEAR_OF_PUBLICATION, yearFilter);
- SelectFilter typeFilter = new SelectFilter(TYPE,
- "objectType",
- false,
- true,
- true,
- false);
- filters.put(TYPE, typeFilter);
- sortFields.put(TITLE,
- new CollectionSortField(TITLE, "title"));
- sortFields.put(YEAR_ASC,
- new CollectionSortField(YEAR_ASC, "year asc"));
- sortFields.put(YEAR_DESC,
- new CollectionSortField(YEAR_DESC, "year desc"));
- }
-
- @Override
- protected String getDefaultShowParam() {
- return "publications";
- }
-
- @Override
- protected Class extends ContentItem> getAllowedClass() {
- return SciMember.class;
- }
-
- protected void generatePublicationsXml(final SciMember member,
- final Element parent,
- final PageState state) {
-
- Element controls = parent.newChildElement("filterControls");
- controls.addAttribute("customName", "sciOrganizationPublications");
- controls.addAttribute("show", show);
-
- DataQuery yearQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getAllYearsOfPublicationForAuthor");
- yearQuery.setParameter("author", member.getID());
- ((SelectFilter) filters.get(YEAR_OF_PUBLICATION)).setDataQuery(yearQuery,
- "yearOfPublication");
- DataQuery typeQuery =
- SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getAllPublicationTypesForAuthor");
- typeQuery.setParameter("author", member.getID());
- ((SelectFilter) filters.get(TYPE)).setDataQuery(typeQuery, "objectType");
-
- DataCollection publicationsData = (DataCollection) member.get(
- "publication");
- DomainCollection publications = new DomainCollection(publicationsData);
-// publications.addOrder("yearOfPublication desc");
-
- applyPublicationsFilter(publications, state.getRequest());
- applyPublicationSortFields(publications, state.getRequest());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publications.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, publications.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generatePublicationFiltersXml(controls);
- generatePublicationSortFieldsXml(controls);
- createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
- publications.size());
- System.out.printf("\n\n\npublications.size = %d\n", publications.size());
- if ((publications.size() <= 1) || publications.isEmpty()) {
- return;
- }
-
- if (publications.size() == 1) {
- publications.setRange((int) begin, (int) end);
- } else {
- publications.setRange((int) begin + 1, (int) end);
- }
-
- while (publications.next()) {
- /*Publication publication = (Publication) DomainObjectFactory.
- newInstance(publications.getDomainObject().getOID());*/
- PublicationXmlHelper xmlHelper =
- new PublicationXmlHelper(parent,
- (Publication) publications.
- getDomainObject());
- xmlHelper.generateXml();
- }
- }
-
- protected void generateProjectsXml(final SciMember member,
- final Element parent,
- final PageState state) {
- /*DataCollection projectsData = (DataCollection) member.get("project");
- DomainCollection projects = new DomainCollection(projectsData);
- projects.addOrder("title");
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(projects.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, projects.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
- projects.size());*/
- }
-
- protected void generatePublicationFiltersXml(final Element element) {
- final Element filterElement = element.newChildElement("filters");
-
- for (Map.Entry filterEntry : filters.entrySet()) {
- filterEntry.getValue().generateXml(filterElement);
- }
- }
-
- protected void generatePublicationSortFieldsXml(final Element element) {
- final Element sortFieldsElement = element.newChildElement("sortFields");
- sortFieldsElement.addAttribute("sortBy", sortByKey);
- for (Map.Entry sortField : sortFields.
- entrySet()) {
- sortField.getValue().generateXml(sortFieldsElement);
- }
- }
-
- protected void applyPublicationsFilter(final DomainCollection publications,
- final HttpServletRequest request) {
- for (Map.Entry filterEntry : filters.entrySet()) {
- String value = request.getParameter(
- filterEntry.getValue().getLabel());
-
- if ((value != null) && !(value.trim().isEmpty())) {
- filterEntry.getValue().setValue(value);
- }
- }
-
- final StringBuilder filterBuilder = new StringBuilder();
- for (Map.Entry filterEntry : filters.entrySet()) {
- if ((filterEntry.getValue().getFilter() == null)
- || (filterEntry.getValue().getFilter().isEmpty())) {
- continue;
- }
-
- if (filterBuilder.length() > 0) {
- filterBuilder.append(" AND ");
- }
- filterBuilder.append(filterEntry.getValue().getFilter());
- logger.debug(String.format("filters: %s", filterBuilder));
- if (filterBuilder.length() > 0) {
- publications.addFilter(filterBuilder.toString());
- }
- }
- }
-
- protected void applyPublicationSortFields(
- final DomainCollection publications,
- final HttpServletRequest request) {
- sortByKey = request.getParameter("sort");
- if (!sortFields.containsKey(sortByKey)) {
- sortByKey = new ArrayList(sortFields.keySet()).get(0);
- }
-
- publications.addOrder(sortFields.get(sortByKey).getField());
- }
-
- protected void generateAvailableDataXml(final SciMember member,
- final Element element,
- final PageState state) {
- Session session = SessionManager.getSession();
- DataQuery hasPublicationsQuery =
- session.retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfPublicationsOfSciMember");
- hasPublicationsQuery.setParameter("author", member.getID().toString());
-
- if (hasPublicationsQuery.size() > 0) {
- element.newChildElement("publications");
- }
- hasPublicationsQuery.close();
-
- DataQuery hasProjectsQuery = session.retrieveQuery(
- "com.arsdigita.cms.contenttypes.getIdsOfProjectsOfSciMember");
- hasProjectsQuery.setParameter("member", member.getID().toString());
-
- if (hasProjectsQuery.size() > 0) {
- element.newChildElement("projects");
- }
- hasProjectsQuery.close();
-
- }
-
- public void generateDataXml(final SciMember member,
- final Element element,
- final PageState state) {
- show = getShowParam(state);
-
- if (SHOW_PUBLICATIONS.equals(show)) {
- generatePublicationsXml(member, element, state);
- } else if (SHOW_PROJECTS.equals(show)) {
- generateProjectsXml(member, element, state);
- }
-
- }
-
- @Override
- public void generateXML(final ContentItem item,
- final Element element,
- final PageState state) {
- Element content = generateBaseXML(item, element, state);
-
- SciMember member = (SciMember) item;
- Element availableData = content.newChildElement("availableData");
-
- if (!(isShowOnlyDefault())) {
- generateAvailableDataXml(member, availableData, state);
- }
-
- generateDataXml(member, content, state);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsAddForm.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsAddForm.java
deleted file mode 100644
index 8d50e8642..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsAddForm.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciOrganizationPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationPublicationsAddForm
- extends BasicItemForm
- implements FormProcessListener,
- FormInitListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "publications";
-
- public SciOrganizationPublicationsAddForm(final ItemSelectionModel itemModel) {
- super("SciOrganizationPublicationsAddForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganization.ui.selectPublication").localize()));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
- findByAssociatedObjectType(Publication.class.getName()));
- add(itemSearch);
- }
-
- @Override
- public void init(final FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- Publication publication = (Publication) data.get(ITEM_SEARCH);
- publication = (Publication) publication.getContentBundle().
- getInstance(organization.getLanguage());
- organization.addPublication(publication);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(final FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectPublication.no_publication_selected"));
- return;
- }
-
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) getItemSelectionModel().
- getSelectedObject(state);
- Publication publication = (Publication) data.get(ITEM_SEARCH);
- if (!(publication.getContentBundle().hasInstance(
- organization.getLanguage()))) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganization.ui.selectPublication.no_suitable_language_variant"));
- return;
- }
-
- publication = (Publication) publication.getContentBundle().getInstance(
- organization.getLanguage());
- SciOrganizationPublicationsCollection publications = organization.
- getPublications();
- publications.addFilter(String.format("id = %s", publication.getID().
- toString()));
- if (publications.size() > 0) {
- data.addError(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganization.ui.selectPublication.already_added"));
- }
-
- publications.close();
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsStep.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsStep.java
deleted file mode 100644
index c55c11340..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsStep.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationPublicationsStep extends SimpleEditStep {
-
- private String ADD_PUBLICATION_SHEET_NAME = "addPublication";
-
- public SciOrganizationPublicationsStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciOrganizationPublicationsStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addPublicationSheet = new SciOrganizationPublicationsAddForm(itemModel);
- add(ADD_PUBLICATION_SHEET_NAME,
- (String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.addPublication").localize(),
- new WorkflowLockedComponentAccess(addPublicationSheet, itemModel),
- addPublicationSheet.getSaveCancelSection().getCancelButton());
-
- SciOrganizationPublicationsTable publicationTable = new SciOrganizationPublicationsTable(itemModel);
- setDisplayComponent(publicationTable);
-
- }
-
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsTable.java
deleted file mode 100644
index d18ab28ba..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPublicationsTable.java
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciOrganizationPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationPublicationsTable
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel itemModel;
-
- public SciOrganizationPublicationsTable(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganizationpublication.ui.publications.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.publication").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.publication.remove").
- localize(), TABLE_COL_DEL));
-
- setModelBuilder(new SciOrganizationPublicationsTableModelBuilder(
- itemModel));
-
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciOrganizationPublicationsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public SciOrganizationPublicationsTableModelBuilder(
- final ItemSelectionModel itemModel) {
- this.itemModel = itemModel;
- }
-
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) itemModel.
- getSelectedObject(state);
-
- return new SciOrganizationPublicationsTableModel(table,
- state,
- organization);
- }
- }
-
- private class SciOrganizationPublicationsTableModel implements TableModel {
-
- private Table table;
- private SciOrganizationPublicationsCollection publications;
- private Publication publication;
-
- public SciOrganizationPublicationsTableModel(
- final Table table,
- final PageState state,
- final SciOrganizationWithPublications organization) {
- this.table = table;
- publications = organization.getPublications();
- }
-
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if ((publications != null) && publications.next()) {
- publication = publications.getPublication();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(final int columnIndex) {
- switch (columnIndex) {
- case 0:
- return publication.getTitle();
- case 1:
- return SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.publiction.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(final int columnIndex) {
- return publication.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- organization);
-
- if (canEdit) {
- Publication publication;
- try {
- publication = new Publication((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- publication.getLanguage()),
- resolver.generateItemURL(state,
- publication,
- section,
- publication.
- getVersion()));
-
- return link;
- } else {
- Publication publication;
- try {
- publication = new Publication((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- Label label =
- new Label(String.format("%s (%s)",
- value.toString(),
- publication.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.DELETE_ITEM,
- organization);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.publication.confirm.remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- @Override
- public void cellSelected(final TableActionEvent event) {
- PageState state = event.getPageState();
-
- Publication publication =
- new Publication(new BigDecimal(event.getRowKey().toString()));
-
- SciOrganizationWithPublications organization =
- (SciOrganizationWithPublications) itemModel.
- getSelectedObject(state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- //Nothing to do here
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- organization.removePublication(publication);
- }
- }
-
- @Override
- public void headSelected(final TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsGlobalizationUtil.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsGlobalizationUtil.java
deleted file mode 100644
index 7894140f1..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsGlobalizationUtil.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.contentassets.ui.*;
-import com.arsdigita.globalization.GlobalizedMessage;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationWithPublicationsGlobalizationUtil {
-
- public static final String BUNDLE_NAME =
- "com.arsdigita.cms.contenttypes.ui.SciOrganizationWithPublicationsResources";
-
- public static GlobalizedMessage globalize(String key) {
- return new GlobalizedMessage(key, BUNDLE_NAME);
- }
-
- public static GlobalizedMessage globalize(String key, Object[] args) {
- return new GlobalizedMessage(key, BUNDLE_NAME, args);
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsPanel.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsPanel.java
deleted file mode 100644
index d12918f87..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsPanel.java
+++ /dev/null
@@ -1,446 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciDepartment;
-import com.arsdigita.cms.contenttypes.SciDepartmentPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciDepartmentWithPublications;
-import com.arsdigita.cms.contenttypes.SciOrganization;
-import com.arsdigita.cms.contenttypes.SciOrganizationDepartmentsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
-import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
-import com.arsdigita.cms.contenttypes.SciPublicationYearAscComparator;
-import com.arsdigita.cms.contenttypes.SciPublicationYearDescComparator;
-import com.arsdigita.cms.contenttypes.ui.panels.Filter;
-import com.arsdigita.cms.contenttypes.ui.panels.SelectFilter;
-import com.arsdigita.cms.contenttypes.ui.panels.SortField;
-import com.arsdigita.cms.contenttypes.ui.panels.TextFilter;
-import com.arsdigita.domain.DomainCollection;
-import com.arsdigita.persistence.DataQuery;
-import com.arsdigita.persistence.SessionManager;
-import com.arsdigita.xml.Element;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.servlet.http.HttpServletRequest;
-import org.apache.log4j.Logger;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciOrganizationWithPublicationsPanel extends SciOrganizationPanel {
-
- private static final Logger logger =
- Logger.getLogger(
- SciOrganizationWithPublicationsPanel.class);
- public static final String SHOW_PUBLICATIONS = "publications";
- public static final String SHOW_WORKING_PAPERS = "workingPapers";
- private static final String SORT = "sort";
- private static final String TITLE = "title";
- private static final String AUTHORS = "authors";
- private static final String YEAR_OF_PUBLICATION = "yearOfPublication";
- private static final String YEAR_ASC = "yearAsc";
- private static final String YEAR_DESC = "yearDesc";
- private String show;
- private boolean displayPublications = true;
- private boolean displayWorkingPapers = true;
- private final Map filters =
- new LinkedHashMap();
- private final Map> sortFields =
- new LinkedHashMap>();
- private String sortByKey;
-
- public SciOrganizationWithPublicationsPanel() {
- filters.put(TITLE, new TextFilter(TITLE, TITLE));
- filters.put(AUTHORS, new TextFilter(AUTHORS, "authors.surname"));
- SelectFilter yearFilter = new SelectFilter(YEAR_OF_PUBLICATION,
- YEAR_OF_PUBLICATION,
- true,
- true,
- true,
- true);
- DataQuery query = SessionManager.getSession().retrieveQuery(
- "com.arsdigita.cms.contenttypes.getAllYearsOfPublication");
- yearFilter.setDataQuery(query, "yearOfPublication");
- filters.put(YEAR_OF_PUBLICATION, yearFilter);
- sortFields.put(TITLE,
- new SortField(TITLE,
- new SciPublicationTitleComparator()));
- sortFields.put(YEAR_ASC,
- new SortField(YEAR_ASC,
- new SciPublicationYearAscComparator()));
- sortFields.put(YEAR_DESC,
- new SortField(YEAR_DESC,
- new SciPublicationYearDescComparator()));
- /*sortFields.put(AUTHORS,
- new SortField(AUTHORS,
- new SciPublicationAuthorComparator()));*/
- }
-
- @Override
- protected Class extends ContentItem> getAllowedClass() {
- return SciOrganizationWithPublications.class;
- }
-
- @Override
- protected String getPanelName() {
- return SciOrganization.class.getSimpleName();
- }
-
- public boolean isDisplayPublications() {
- return displayPublications;
- }
-
- public void setDisplayPublications(final boolean displayPublications) {
- this.displayPublications = displayPublications;
- }
-
- public boolean isDisplayWorkingPapers() {
- return displayWorkingPapers;
- }
-
- public void setDisplayWorkingPapers(final boolean displayWorkingPapers) {
- this.displayWorkingPapers = displayWorkingPapers;
- }
-
- @Override
- protected void generateAvailableDataXml(
- final GenericOrganizationalUnit organization,
- final Element element,
- final PageState state) {
- super.generateAvailableDataXml(organization, element, state);
-
- SciOrganizationWithPublicationsConfig config;
- config = SciOrganizationWithPublications.getConfig();
-
- SciOrganizationWithPublications orga =
- (SciOrganizationWithPublications) organization;
-
- long start = System.currentTimeMillis();
- if ((orga.hasPublications(config.getOrganizationPublicationsMerge()))
- && displayPublications) {
- element.newChildElement("publications");
- }
- if ((orga.hasWorkingPapers(config.getOrganizationPublicationsMerge()))
- && displayWorkingPapers
- && config.getOrganizationPublicationsSeparateWorkingPapers()) {
- element.newChildElement("workingPapers");
- }
-
- System.out.printf(
- "\n\nNeeded %d ms to determine if organization has publications\n\n",
- System.currentTimeMillis() - start);
- }
-
- protected void mergePublications(
- final SciOrganizationDepartmentsCollection departments,
- final Collection publications,
- final boolean workingPapersOnly,
- final PageState state) {
- while (departments.next()) {
- SciDepartment dep;
- SciDepartmentWithPublications department;
- SciDepartmentPublicationsCollection departmentPublications;
-
- dep = departments.getDepartment();
- if (!(dep instanceof SciDepartmentWithPublications)) {
- continue;
- }
- department = (SciDepartmentWithPublications) dep;
- departmentPublications = department.getPublications();
- applyPublicationFilters(departmentPublications, state.getRequest());
- if (workingPapersOnly) {
- departmentPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getOrganizationPublicationsSeparateWorkingPapers()) {
- departmentPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- if (publications instanceof ArrayList) {
- ((ArrayList) publications).ensureCapacity(
- publications.size()
- + (int) departmentPublications.size());
- }
-
- Publication publication;
- while (departmentPublications.next()) {
- publication = departmentPublications.getPublication();
- publications.add(publication);
- }
-
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = dep.getSubDepartments();
-
- if ((subDepartments != null) && subDepartments.size() > 0) {
- mergePublications(departments,
- publications,
- workingPapersOnly,
- state);
- }
- }
- }
-
- protected void generatePublicationFiltersXml(
- final List publications,
- final Element element) {
- final Element filterElement = element.newChildElement("filters");
-
- for (Map.Entry filterEntry : filters.entrySet()) {
- filterEntry.getValue().generateXml(filterElement);
- }
- }
-
- protected void generatePublicationSortFieldsXml(final Element element) {
- final Element sortFieldsElement = element.newChildElement("sortFields");
- sortFieldsElement.addAttribute("sortBy", sortByKey);
- for (Map.Entry> sortField :
- sortFields.entrySet()) {
- sortField.getValue().generateXml(sortFieldsElement);
- }
- }
-
- protected void applyPublicationSortFields(
- final List publications,
- final HttpServletRequest request) {
- sortByKey = request.getParameter("sort");
- if (!sortFields.containsKey(sortByKey)) {
- sortByKey = new ArrayList(sortFields.keySet()).get(0);
- }
-
- if (sortFields.containsKey(sortByKey)) {
- Collections.sort(publications, sortFields.get(sortByKey).
- getComparator());
- } else {
- Collections.sort(publications, new SciPublicationTitleComparator());
- }
- }
-
- protected void applyPublicationFilters(
- final DomainCollection publications,
- final HttpServletRequest request) {
- //Get parameters from HTTP request
- for (Map.Entry filterEntry : filters.entrySet()) {
- String value = request.getParameter(
- filterEntry.getValue().getLabel());
-
- if ((value != null) && !(value.trim().isEmpty())) {
- filterEntry.getValue().setValue(value);
- }
- }
-
- //Apply filters to DomainCollection
- final StringBuilder filterBuilder = new StringBuilder();
- for (Map.Entry filterEntry : filters.entrySet()) {
- if ((filterEntry.getValue().getFilter() == null)
- || (filterEntry.getValue().getFilter().isEmpty())) {
- continue;
- }
-
- if (filterBuilder.length() > 0) {
- filterBuilder.append(" AND ");
- }
- filterBuilder.append(filterEntry.getValue().getFilter());
- logger.debug(String.format("filters: %s", filterBuilder));
- if (filterBuilder.length() > 0) {
- publications.addFilter(filterBuilder.toString());
- }
- }
- }
-
- protected void generatePublicationsXml(final SciOrganization organization,
- final Element parent,
- final PageState state,
- final boolean workingPapersOnly) {
- final SciOrganizationWithPublications orga =
- (SciOrganizationWithPublications) organization;
-
- Element controls = parent.newChildElement("filterControls");
- controls.addAttribute("customName", "sciOrganizationPublications");
- controls.addAttribute("show", show);
-
- if (SciOrganizationWithPublications.getConfig().
- getOrganizationPublicationsMerge()) {
- long start = System.currentTimeMillis();
- List publications;
- SciOrganizationPublicationsCollection orgaPublications;
- orgaPublications = orga.getPublications();
- applyPublicationFilters(orgaPublications, state.getRequest());
- if (workingPapersOnly) {
- orgaPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getOrganizationPublicationsSeparateWorkingPapers()) {
- orgaPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
- publications = new ArrayList((int) orgaPublications.
- size());
-
- Publication publication;
- while (orgaPublications.next()) {
- publication = orgaPublications.getPublication();
- publications.add(publication);
- }
-
- System.out.printf("Got publications of organization in %d ms\n",
- System.currentTimeMillis() - start);
-
- SciOrganizationDepartmentsCollection departments = organization.
- getDepartments();
- long mergeStart = System.currentTimeMillis();
- mergePublications(departments,
- publications,
- workingPapersOnly,
- state);
- System.err.printf("Merged publications in %d ms\n", System.
- currentTimeMillis() - mergeStart);
-
- long sortStart = System.currentTimeMillis();
- Set publicationsSet;
- List publicationsWithoutDoubles;
- publicationsSet = new HashSet(publications);
- publicationsWithoutDoubles = new LinkedList(
- publicationsSet);
-
-
- applyPublicationSortFields(publicationsWithoutDoubles, state.
- getRequest());
-
- //Collections.sort(publicationsWithoutDoubles,
- // new SciPublicationTitleComparator());
- System.out.printf("Sorted publications in %d ms\n", System.
- currentTimeMillis() - sortStart);
-
- long paginatorStart = System.currentTimeMillis();
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publicationsWithoutDoubles.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin,
- publicationsWithoutDoubles.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generatePublicationFiltersXml(publicationsWithoutDoubles, controls);
- generatePublicationSortFieldsXml(controls);
- createPaginatorElement(parent, pageNumber, pageCount, begin, end,
- count, publicationsWithoutDoubles.size());
- System.out.printf("Created paginator in %d ms", System.
- currentTimeMillis() - paginatorStart);
- List publicationsToShow = publicationsWithoutDoubles.
- subList((int) begin, (int) end);
-
- System.out.printf(
- "\n\nCreated list of publications to show in %d ms.\n\n",
- System.currentTimeMillis() - start);
-
- start = System.currentTimeMillis();
-
- for (Publication pub : publicationsToShow) {
- PublicationXmlHelper xmlHelper =
- new PublicationXmlHelper(parent,
- pub);
- xmlHelper.generateXml();
- }
-
- System.out.printf("\n\nGenerated publications XML in %d ms\n\n",
- System.currentTimeMillis() - start);
- } else {
- SciOrganizationPublicationsCollection orgaPublications;
- orgaPublications = orga.getPublications();
- applyPublicationFilters(orgaPublications, state.getRequest());
- if (workingPapersOnly) {
- orgaPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getOrganizationPublicationsSeparateWorkingPapers()) {
- orgaPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- List publications = new LinkedList();
-
- while (orgaPublications.next()) {
- publications.add(orgaPublications.getPublication());
- }
-
- applyPublicationSortFields(publications, state.getRequest());
-
- //Collections.sort(publications, new SciPublicationTitleComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publications.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, publications.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- generatePublicationFiltersXml(publications, controls);
- generatePublicationSortFieldsXml(controls);
- createPaginatorElement(parent, pageNumber, pageCount, begin, end,
- count, publications.size());
- List publicationsToShow = publications.subList(
- (int) begin, (int) end);
-
- for (Publication publication : publicationsToShow) {
- PublicationXmlHelper xmlHelper =
- new PublicationXmlHelper(parent,
- publication);
- xmlHelper.generateXml();
- }
- }
- }
-
- @Override
- protected void generateDataXml(final GenericOrganizationalUnit organization,
- final Element element,
- final PageState state) {
- show = getShowParam(state);
-
- if (SHOW_PUBLICATIONS.equals(show)) {
- generatePublicationsXml((SciOrganization) organization,
- element,
- state,
- false);
- } else if (SHOW_WORKING_PAPERS.equals(show)) {
- generatePublicationsXml((SciOrganization) organization,
- element,
- state,
- true);
- } else {
- super.generateDataXml(organization, element, state);
- }
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsResources.properties b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsResources.properties
deleted file mode 100644
index 4ec4dd842..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsResources.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-
-sciorganizationpublication.ui.publicationsOfOrganization=Publications of the organization
-sciorganizationpublication.ui.publicationsOfDepartment=Publications of the department
-sciorganizationpublication.ui.publicationsOfProject=Publications of the project
-sciorganizationpublication.ui.organizationsOfPublication=Organizations
-sciorganizationpublication.ui.organization=Organization
-sciorganizationpublication.ui.organization.remove=Remove orgnization
-sciorganizationpublication.ui.addOrganization=Add organization
-sciorganizationpublication.ui.publication=Publication
-sciorganizationpublication.ui.publication.remove=Remove publication
-sciorganizationpublication.ui.addPublication=Add publication
-sciorganizationpublication.ui.publications.none=No publications found
-sciorganizationpublication.ui.organization.publications.title=Publications
-sciorganizationpublication.ui.organization.publications.description=Publications
-sciorganizationpublication.ui.department.publications.title=Publications
-sciorganizationpublication.ui.department.publications.description=Publications
-sciorganizationpublication.ui.project.publications.title=Publications
-sciorganizationpublication.ui.project.publications.description=Publications
-sciorganizationpublication.ui.publication.projects.title=Lists of publications (Projects)
-sciorganizationpublication.ui.publication.projects.description=Lists of publications (Projects)
-sciorganizationpublication.ui.publication.organization.title=Lists of publications (Organizations)
-sciorganizationpublication.ui.publication.organization.description=Lists of publications (Organizations)
-sciorganizationpublication.ui.publication.departments.title=Lists of publications (Departments)
-sciorganizationpublication.ui.publication.departments.description=Lists of publications (Departments)
-sciorganization.ui.selectPublication=Select publication
-sciorganizationpublication.ui.publiction.remove=Remove publication
-sciorganizationpublication.ui.organizations.none=This publication is not part of any publication list of a organization
-sciorganization.ui.selectOrganization=Select organization
-sciorganization.ui.addPublication=Add publication
-sciorganizationpublication.ui.departments.none=This publication is not part of any publication list of a department
-sciorganizationpublication.ui.addDepartment=Add publication to publication list of a department
-sciorganization.ui.selectDepartment=Select department
-sciorganizationpublication.ui.projects.none=This publication is not part of any publication list of a project
-sciorganizationpublication.ui.project.addPublication=Add publication to publication list of a project
-sciorganization.ui.selectProject=Select project
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsResources_de.properties b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsResources_de.properties
deleted file mode 100644
index 3b047dff7..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationWithPublicationsResources_de.properties
+++ /dev/null
@@ -1,35 +0,0 @@
-
-sciorganizationpublication.ui.publicationsOfOrganization=Publikationen der Organisation
-sciorganizationpublication.ui.publicationsOfDepartment=Publikationen der Abteilung
-sciorganizationpublication.ui.publicationsOfProject=Publikationen des Projektes
-sciorganizationpublication.ui.organizationsOfPublication=Beteiligte Organizationen
-sciorganizationpublication.ui.organization=Organisation
-sciorganizationpublication.ui.organization.remove=Organisation entfernen
-sciorganizationpublication.ui.addOrganization=Organisation hinzuf\u00fcgen
-sciorganizationpublication.ui.publication=Publikation
-sciorganizationpublication.ui.publication.remove=Publikation entfernen
-sciorganizationpublication.ui.addPublication=Publikation hinzuf\u00fcgen
-sciorganizationpublication.ui.publications.none=Keine Publikationen gefunden
-sciorganizationpublication.ui.organization.publications.title=Publikationen
-sciorganizationpublication.ui.organization.publications.description=Publikationen
-sciorganizationpublication.ui.department.publications.title=Publikationen
-sciorganizationpublication.ui.department.publications.description=Publikationen
-sciorganizationpublication.ui.project.publications.title=Publikationen
-sciorganizationpublication.ui.project.publications.description=Publikationen
-sciorganizationpublication.ui.publication.projects.title=Publikationslisten (Projekte)
-sciorganizationpublication.ui.publication.projects.description=Publikationslisten (Projekte)
-sciorganizationpublication.ui.publication.organization.title=Publikationslisten (Organisationen)
-sciorganizationpublication.ui.publication.organization.description=Publikationslisten (Organisationen)
-sciorganizationpublication.ui.publication.departments.title=Publikationslisten (Abteilungen)
-sciorganizationpublication.ui.publication.departments.description=Publikationslisten (Abteilungen)
-sciorganization.ui.selectPublication=Publikation w\u00e4hlen
-sciorganizationpublication.ui.publiction.remove=Publikation entfernen
-sciorganizationpublication.ui.organizations.none=Diese Publikation ist nicht Teil einer Publikationsliste einer Organisation
-sciorganization.ui.selectOrganization=Organisation w\u00e4hlen
-sciorganization.ui.addPublication=Publikation hinzuf\u00fcgen
-sciorganizationpublication.ui.departments.none=Diese Publikation ist nicht Teil einer Publikationsliste einer Abteilung
-sciorganizationpublication.ui.addDepartment=Publikation der Publikationsliste einer Abteilung hinzuf\u00fcgen
-sciorganization.ui.selectDepartment=Abteilung w\u00e4hlen
-sciorganizationpublication.ui.projects.none=Diese Publikation ist nicht Teil einer Publikationsliste eines Projektes
-sciorganizationpublication.ui.project.addPublication=Publikation der Publikationsliste eines Projektes hinzuf\u00fcgen
-sciorganization.ui.selectProject=Projekt w\u00e4hlen
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsAddForm.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsAddForm.java
deleted file mode 100644
index ee51c5bd9..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsAddForm.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.FormData;
-import com.arsdigita.bebop.FormProcessException;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.event.FormInitListener;
-import com.arsdigita.bebop.event.FormProcessListener;
-import com.arsdigita.bebop.event.FormSectionEvent;
-import com.arsdigita.cms.ContentType;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciProjectPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
-import com.arsdigita.cms.ui.ItemSearchWidget;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectPublicationsAddForm
- extends BasicItemForm
- implements FormInitListener,
- FormProcessListener {
-
- private ItemSearchWidget itemSearch;
- private final String ITEM_SEARCH = "publications";
-
- public SciProjectPublicationsAddForm(final ItemSelectionModel itemModel) {
- super("SciProjectPublicationsAddForm", itemModel);
- }
-
- @Override
- public void addWidgets() {
- add(new Label((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganization.ui.selectPublication").localize()));
- itemSearch = new ItemSearchWidget(ITEM_SEARCH, ContentType.
- findByAssociatedObjectType(Publication.class.getName()));
- add(itemSearch);
- }
-
- @Override
- public void init(final FormSectionEvent fse) throws FormProcessException {
- PageState state = fse.getPageState();
-
- setVisible(state, true);
- }
-
- @Override
- public void process(final FormSectionEvent fse) throws FormProcessException {
- FormData data = fse.getFormData();
- PageState state = fse.getPageState();
- SciProjectWithPublications project =
- (SciProjectWithPublications) getItemSelectionModel().
- getSelectedObject(state);
-
- if (this.getSaveCancelSection().getSaveButton().isSelected(state)) {
- Publication publication = (Publication) data.get(ITEM_SEARCH);
- publication = (Publication) publication.getContentBundle().
- getInstance(project.getLanguage());
- project.addPublication(publication);
- }
-
- init(fse);
- }
-
- @Override
- public void validate(final FormSectionEvent fse) throws FormProcessException {
- final PageState state = fse.getPageState();
- final FormData data = fse.getFormData();
-
- if (data.get(ITEM_SEARCH) == null) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciproject.ui.selectPublication.no_publication_selected"));
- return;
- }
-
- SciProjectWithPublications project =
- (SciProjectWithPublications) getItemSelectionModel().
- getSelectedObject(state);
- Publication publication = (Publication) data.get(ITEM_SEARCH);
- if (!(publication.getContentBundle().hasInstance(
- project.getLanguage()))) {
- data.addError(
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciproject.ui.selectPublication.no_suitable_language_variant"));
- return;
- }
-
- publication = (Publication) publication.getContentBundle().getInstance(
- project.getLanguage());
- SciProjectPublicationsCollection publications =
- project.getPublications();
- publications.addFilter(String.format("id = %s", publication.getID().
- toString()));
- if (publications.size() > 0) {
- data.addError(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciproject.ui.selectPublication.already_added"));
- }
-
- publications.close();
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsStep.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsStep.java
deleted file mode 100644
index 21214bf98..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsStep.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.ui.authoring.AuthoringKitWizard;
-import com.arsdigita.cms.ui.authoring.BasicItemForm;
-import com.arsdigita.cms.ui.authoring.SimpleEditStep;
-import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectPublicationsStep extends SimpleEditStep {
-
- private String ADD_PUBLICATION_SHEET_NAME = "addPublication";
-
- public SciProjectPublicationsStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent) {
- this(itemModel, parent, null);
- }
-
- public SciProjectPublicationsStep(final ItemSelectionModel itemModel,
- final AuthoringKitWizard parent,
- final String prefix) {
- super(itemModel, parent, prefix);
-
- BasicItemForm addPublicationSheet = new SciProjectPublicationsAddForm(itemModel);
- add(ADD_PUBLICATION_SHEET_NAME,
- (String) SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.project.addPublication").localize(),
- new WorkflowLockedComponentAccess(addPublicationSheet, itemModel),
- addPublicationSheet.getSaveCancelSection().getCancelButton());
-
- SciProjectPublicationsTable publicationTable = new SciProjectPublicationsTable(itemModel);
- setDisplayComponent(publicationTable);
-
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsTable.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsTable.java
deleted file mode 100644
index 1da215821..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsTable.java
+++ /dev/null
@@ -1,276 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.Component;
-import com.arsdigita.bebop.ControlLink;
-import com.arsdigita.bebop.Label;
-import com.arsdigita.bebop.Link;
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.bebop.Table;
-import com.arsdigita.bebop.event.TableActionEvent;
-import com.arsdigita.bebop.event.TableActionListener;
-import com.arsdigita.bebop.table.TableCellRenderer;
-import com.arsdigita.bebop.table.TableColumn;
-import com.arsdigita.bebop.table.TableColumnModel;
-import com.arsdigita.bebop.table.TableModel;
-import com.arsdigita.bebop.table.TableModelBuilder;
-import com.arsdigita.cms.CMS;
-import com.arsdigita.cms.ContentSection;
-import com.arsdigita.cms.ItemSelectionModel;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciProjectPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
-import com.arsdigita.cms.dispatcher.ItemResolver;
-import com.arsdigita.cms.dispatcher.Utilities;
-import com.arsdigita.dispatcher.ObjectNotFoundException;
-import com.arsdigita.util.LockableImpl;
-import java.math.BigDecimal;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectPublicationsTable
- extends Table
- implements TableActionListener {
-
- private final String TABLE_COL_EDIT = "table_col_edit";
- private final String TABLE_COL_DEL = "table_col_del";
- private ItemSelectionModel itemModel;
-
- public SciProjectPublicationsTable(final ItemSelectionModel itemModel) {
- super();
- this.itemModel = itemModel;
-
- setEmptyView(new Label(SciOrganizationWithPublicationsGlobalizationUtil.
- globalize("sciorganizationpublication.ui.publications.none")));
-
- TableColumnModel columnModel = getColumnModel();
- columnModel.add(new TableColumn(
- 0,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.publication").localize(),
- TABLE_COL_EDIT));
- columnModel.add(new TableColumn(
- 1,
- SciOrganizationWithPublicationsGlobalizationUtil.globalize(
- "sciorganizationpublication.ui.publication.remove").
- localize(), TABLE_COL_DEL));
-
- setModelBuilder(new SciProjectPublicationsTableModelBuilder(
- itemModel));
-
- columnModel.get(0).setCellRenderer(new EditCellRenderer());
- columnModel.get(1).setCellRenderer(new DeleteCellRenderer());
-
- addTableActionListener(this);
- }
-
- private class SciProjectPublicationsTableModelBuilder
- extends LockableImpl
- implements TableModelBuilder {
-
- private ItemSelectionModel itemModel;
-
- public SciProjectPublicationsTableModelBuilder(
- final ItemSelectionModel itemModel) {
- this.itemModel = itemModel;
- }
-
- public TableModel makeModel(final Table table, final PageState state) {
- table.getRowSelectionModel().clearSelection(state);
- SciProjectWithPublications project =
- (SciProjectWithPublications) itemModel.
- getSelectedObject(state);
-
- return new SciProjectPublicationsTableModel(table,
- state,
- project);
- }
- }
-
- private class SciProjectPublicationsTableModel implements TableModel {
-
- private Table table;
- private SciProjectPublicationsCollection publications;
- private Publication publication;
-
- public SciProjectPublicationsTableModel(
- final Table table,
- final PageState state,
- final SciProjectWithPublications project) {
- this.table = table;
- publications = project.getPublications();
- }
-
- public int getColumnCount() {
- return table.getColumnModel().size();
- }
-
- public boolean nextRow() {
- boolean ret;
-
- if ((publications != null) && publications.next()) {
- publication = publications.getPublication();
- ret = true;
- } else {
- ret = false;
- }
-
- return ret;
- }
-
- public Object getElementAt(int columnIndex) {
- switch (columnIndex) {
- case 0:
- return publication.getTitle();
- case 1:
- return SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.publiction.remove").
- localize();
- default:
- return null;
- }
- }
-
- public Object getKeyAt(int columnIndex) {
- return publication.getID();
- }
- }
-
- private class EditCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(final Table table,
- final PageState state,
- final Object value,
- final boolean isSelected,
- final Object key,
- final int row,
- final int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciProjectWithPublications project =
- (SciProjectWithPublications) itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.EDIT_ITEM,
- project);
-
- if (canEdit) {
- Publication publication;
- try {
- publication = new Publication((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
-
- ContentSection section = CMS.getContext().getContentSection();
- ItemResolver resolver = section.getItemResolver();
- Link link = new Link(String.format("%s (%s)",
- value.toString(),
- publication.getLanguage()),
- resolver.generateItemURL(state,
- publication,
- section,
- publication.
- getVersion()));
-
- return link;
- } else {
- Publication publication;
- try {
- publication = new Publication((BigDecimal) key);
- } catch (ObjectNotFoundException ex) {
- return new Label(value.toString());
- }
- Label label =
- new Label(String.format("%s (%s)",
- value.toString(),
- publication.getLanguage()));
- return label;
- }
- }
- }
-
- private class DeleteCellRenderer
- extends LockableImpl
- implements TableCellRenderer {
-
- public Component getComponent(Table table,
- PageState state,
- Object value,
- boolean isSelected,
- Object key,
- int row,
- int column) {
- com.arsdigita.cms.SecurityManager securityManager = Utilities.
- getSecurityManager(state);
- SciProjectWithPublications project =
- (SciProjectWithPublications) itemModel.
- getSelectedObject(state);
-
- boolean canEdit = securityManager.canAccess(
- state.getRequest(),
- com.arsdigita.cms.SecurityManager.DELETE_ITEM,
- project);
-
- if (canEdit) {
- ControlLink link = new ControlLink(value.toString());
- link.setConfirmation((String) SciOrganizationWithPublicationsGlobalizationUtil.
- globalize(
- "sciorganizationpublication.ui.publication.confirm.remove").
- localize());
- return link;
- } else {
- Label label = new Label(value.toString());
- return label;
- }
- }
- }
-
- public void cellSelected(final TableActionEvent event) {
- PageState state = event.getPageState();
-
- Publication publication =
- new Publication(new BigDecimal(event.getRowKey().toString()));
-
- SciProjectWithPublications project =
- (SciProjectWithPublications) itemModel.
- getSelectedObject(state);
-
- TableColumn column = getColumnModel().get(event.getColumn().intValue());
-
- if (TABLE_COL_EDIT.equals(column.getHeaderKey().toString())) {
- //Nothing to do here
- } else if (TABLE_COL_DEL.equals(column.getHeaderKey().toString())) {
- project.removePublication(publication);
- }
- }
-
- public void headSelected(final TableActionEvent event) {
- //Nothing to do.
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectWithPublicationsPanel.java b/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectWithPublicationsPanel.java
deleted file mode 100644
index 3c4583ffe..000000000
--- a/ccm-sci-types-organizationwithpublications/src/com/arsdigita/cms/contenttypes/ui/SciProjectWithPublicationsPanel.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (c) 2011 Jens Pelzetter,
- * for the Center of Social Politics of the University of Bremen
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- */
-package com.arsdigita.cms.contenttypes.ui;
-
-import com.arsdigita.bebop.PageState;
-import com.arsdigita.cms.ContentItem;
-import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit;
-import com.arsdigita.cms.contenttypes.Publication;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublications;
-import com.arsdigita.cms.contenttypes.SciOrganizationWithPublicationsConfig;
-import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.cms.contenttypes.SciProjectPublicationsCollection;
-import com.arsdigita.cms.contenttypes.SciProjectSubProjectsCollection;
-import com.arsdigita.cms.contenttypes.SciProjectWithPublications;
-import com.arsdigita.cms.contenttypes.SciPublicationTitleComparator;
-import com.arsdigita.xml.Element;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-/**
- *
- * @author Jens Pelzetter
- */
-public class SciProjectWithPublicationsPanel extends SciProjectPanel {
-
- public static final String SHOW_PUBLICATIONS = "publications";
- public static final String SHOW_WORKING_PAPERS = "workingPapers";
- private boolean displayPublications = true;
- private boolean displayWorkingPapers = true;
-
- public SciProjectWithPublicationsPanel() {
- }
-
- @Override
- public Class extends ContentItem> getAllowedClass() {
- return SciProjectWithPublications.class;
- }
-
- @Override
- protected String getPanelName() {
- return SciProject.class.getSimpleName();
- }
-
- public boolean isDisplayPublications() {
- return displayPublications;
- }
-
- public void setDisplayPublications(final boolean displayPublications) {
- this.displayPublications = displayPublications;
- }
-
- public boolean isDisplayWorkingPapers() {
- return displayWorkingPapers;
- }
-
- public void setDisplayWorkingPapers(final boolean displayWorkingPapers) {
- this.displayWorkingPapers = displayWorkingPapers;
- }
-
- @Override
- public void generateAvailableDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
- SciProject project = (SciProject) orga;
-
- super.generateAvailableDataXml(project, element, state);
-
- SciOrganizationWithPublicationsConfig config =
- SciOrganizationWithPublications.
- getConfig();
-
- SciProjectWithPublications proj =
- (SciProjectWithPublications) project;
-
- if ((proj.hasPublications(config.getOrganizationPublicationsMerge()))
- && displayPublications) {
- element.newChildElement("publications");
- }
- if ((proj.hasWorkingPapers(config.getOrganizationPublicationsMerge()))
- && displayWorkingPapers
- && config.getProjectPublicationsSeparateWorkingPapers()) {
- element.newChildElement("workingPapers");
- }
- }
-
- protected void mergePublications(
- final SciProjectSubProjectsCollection subProjects,
- final List publications,
- final boolean workingPapersOnly) {
- while (subProjects.next()) {
- SciProject proj;
- SciProjectWithPublications project;
- SciProjectPublicationsCollection projectPublications;
-
- proj = subProjects.getSubProject();
- project = (SciProjectWithPublications) proj;
- projectPublications = project.getPublications();
- if (workingPapersOnly) {
- projectPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getProjectPublicationsSeparateWorkingPapers()) {
- projectPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- if (publications instanceof ArrayList) {
- ((ArrayList) publications).ensureCapacity(
- publications.size() + (int) projectPublications.size());
- }
-
- Publication publication;
- while (projectPublications.next()) {
- publication = projectPublications.getPublication();
- publications.add(publication);
- }
-
- SciProjectSubProjectsCollection subSubProjects =
- proj.getSubProjects();
-
- if ((subSubProjects != null) && subSubProjects.size() > 0) {
- mergePublications(subSubProjects, publications,
- workingPapersOnly);
- }
- }
- }
-
- protected void generatePublicationsXml(final SciProject project,
- final Element parent,
- final PageState state,
- final boolean workingPapersOnly) {
- final SciProjectWithPublications proj =
- (SciProjectWithPublications) project;
-
- if (SciOrganizationWithPublications.getConfig().
- getOrganizationPublicationsMerge()) {
- List publications;
- SciProjectPublicationsCollection projectPublications = proj.
- getPublications();
- if (workingPapersOnly) {
- projectPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getProjectPublicationsSeparateWorkingPapers()) {
- projectPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- publications =
- new ArrayList((int) projectPublications.size());
-
- Publication publication;
- while (projectPublications.next()) {
- publication = projectPublications.getPublication();
- publications.add(publication);
- }
-
- mergePublications(project.getSubProjects(),
- publications,
- workingPapersOnly);
-
- Set publicationsSet;
- List publicationsWithoutDoubles;
- publicationsSet = new HashSet(publications);
- publicationsWithoutDoubles = new LinkedList(
- publicationsSet);
- Collections.sort(publicationsWithoutDoubles,
- new SciPublicationTitleComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publicationsWithoutDoubles.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, publicationsWithoutDoubles.
- size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(parent, pageNumber, pageCount, begin, end,
- count, publicationsWithoutDoubles.size());
- List publicationsToShow = publicationsWithoutDoubles.
- subList((int) begin, (int) end);
-
- for (Publication pub : publicationsToShow) {
- PublicationXmlHelper xmlHelper = new PublicationXmlHelper(parent,
- pub);
- xmlHelper.generateXml();
- }
- } else {
- SciProjectPublicationsCollection projectPublications = proj.
- getPublications();
- if (workingPapersOnly) {
- projectPublications.addFilter(
- "objectType = 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- } else if (SciOrganizationWithPublications.getConfig().
- getProjectPublicationsSeparateWorkingPapers()) {
- projectPublications.addFilter(
- "objectType != 'com.arsdigita.cms.contenttypes.WorkingPaper'");
- }
-
- List publications = new LinkedList();
-
- while (projectPublications.next()) {
- publications.add(projectPublications.getPublication());
- }
-
- Collections.sort(publications, new SciPublicationTitleComparator());
-
- long pageNumber = getPageNumber(state);
- long pageCount = getPageCount(publications.size());
- long begin = getPaginatorBegin(pageNumber);
- long count = getPaginatorCount(begin, publications.size());
- long end = getPaginatorEnd(begin, count);
- pageNumber = normalizePageNumber(pageCount, pageNumber);
-
- createPaginatorElement(parent, pageNumber, pageCount, begin, end,
- count, publications.size());
- List publicationsToShow = publications.subList(
- (int) begin, (int) end);
-
- for (Publication publication : publicationsToShow) {
- PublicationXmlHelper xmlHelper =
- new PublicationXmlHelper(parent,
- publication);
- xmlHelper.generateXml();
- }
- }
- }
-
- @Override
- public void generateDataXml(final GenericOrganizationalUnit orga,
- final Element element,
- final PageState state) {
- String show = getShowParam(state);
-
- if (SHOW_PUBLICATIONS.equals(show)) {
- generatePublicationsXml((SciProject) orga, element, state, false);
- } else if (SHOW_WORKING_PAPERS.equals(show)) {
- generatePublicationsXml((SciProject) orga, element, state, true);
- } else {
- super.generateDataXml(orga, element, state);
- }
- }
-}
diff --git a/ccm-sci-types-organizationwithpublications/src/empty.pdl.mf b/ccm-sci-types-organizationwithpublications/src/empty.pdl.mf
deleted file mode 100644
index e69de29bb..000000000