diff --git a/ccm-cms-dabinimporter/src/com/arsdigita/cms/dabin/DaBInImporter.java b/ccm-cms-dabinimporter/src/com/arsdigita/cms/dabin/DaBInImporter.java
index 4e8b2ba52..1df7442a6 100644
--- a/ccm-cms-dabinimporter/src/com/arsdigita/cms/dabin/DaBInImporter.java
+++ b/ccm-cms-dabinimporter/src/com/arsdigita/cms/dabin/DaBInImporter.java
@@ -2864,6 +2864,7 @@ public class DaBInImporter extends Program {
download.setTargetType(Link.INTERNAL_LINK);
download.setTargetItem(fsi);
download.setLinkOwner(workingPaperDe);
+ download.setLinkListName("NONE");
download = new RelatedLink();
download.setTitle(config.getProperty(
@@ -2871,6 +2872,7 @@ public class DaBInImporter extends Program {
download.setTargetType(Link.INTERNAL_LINK);
download.setTargetItem(fsi);
download.setLinkOwner(workingPaperEn);
+ download.setLinkListName("NONE");
files.addItem(bundle);
}
diff --git a/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml b/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml
index 00888819e..d26634bfe 100644
--- a/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml
+++ b/ccm-cms/src/WEB-INF/content-types/GenericOrganizationalUnit.xml
@@ -22,6 +22,15 @@
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
ordering="1"
/>
+
+
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java
index 3e580692e..626fa99c2 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPanel.java
@@ -41,8 +41,8 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
public static final String SHOW_CONTACTS = "contacts";
public static final String SHOW_MEMBERS = "members";
- private boolean displayContacts;
- private boolean displayMembers;
+ private boolean displayContacts = true;
+ private boolean displayMembers = true;
@Override
protected String getDefaultForShowParam() {
diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java
index 30f4a210d..4f9e662cb 100644
--- a/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java
+++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/ui/GenericOrganizationalUnitPropertiesStep.java
@@ -126,9 +126,14 @@ public class GenericOrganizationalUnitPropertiesStep extends SimpleEditStep {
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.contact");
+ /* jensp, 2011-05-01:
+ * Member step is now a full step, to improve performence of the
+ * content center gui.
addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel,
parent),
"cms.contenttypes.ui.orgaunit.persons");
+
+ */
}
/**
diff --git a/ccm-core/src/com/arsdigita/persistence/TransactionContext.java b/ccm-core/src/com/arsdigita/persistence/TransactionContext.java
index 1d8aa9b48..a0e1a5187 100755
--- a/ccm-core/src/com/arsdigita/persistence/TransactionContext.java
+++ b/ccm-core/src/com/arsdigita/persistence/TransactionContext.java
@@ -66,6 +66,7 @@ public class TransactionContext {
**/
public void beginTxn() {
+ s_cat.debug("Beginning transaction...");
// Do nothing. This is implicit now.
if (m_inTxn) {
throw new IllegalStateException("double begin");
@@ -82,6 +83,7 @@ public class TransactionContext {
**/
public void commitTxn() {
+ s_cat.debug("Commiting transaction...");
boolean success = false;
try {
fireBeforeCommitEvent();
@@ -91,9 +93,14 @@ public class TransactionContext {
success = true;
m_inTxn = false;
fireCommitEvent();
+ s_cat.debug("Done.");
} finally {
+ s_cat.debug("Cleaning up...");
clearAttributes();
if (!success) { m_ossn.invalidateDataObjects(false, true); }
+ if (m_inTxn) {
+ s_cat.warn("Warning: Cleanup after commit was reached, but m_inTxn is true.");
+ }
}
}
@@ -126,6 +133,7 @@ public class TransactionContext {
**/
public void abortTxn() {
+ s_cat.warn("Aborting transaction...");
boolean success = false;
try {
try {
@@ -141,6 +149,7 @@ public class TransactionContext {
fireAbortEvent();
clearAttributes();
}
+ s_cat.warn("Transaction aborted.");
}
/**
diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl
index ff86d7b3d..66472f5be 100644
--- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl
+++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciDepartment.pdl
@@ -36,4 +36,130 @@ association {
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 departmentId;
+
+ do {
+ select ct_sciorga_departments_subdepartments_map.department_id
+ from ct_sciorga_departments_subdepartments_map
+ where ct_sciorga_departments_subdepartments_map.department_id = :department
+ } map {
+ departmentId = ct_sciorga_departments_subdepartments_map;
+ }
+}
+
+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/SciOrganization.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl
index 1d801c527..b2099a9e4 100644
--- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl
+++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciOrganization.pdl
@@ -41,4 +41,129 @@ association {
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;
+ }
+}
+
+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
index e377fec24..ba6238d25 100644
--- a/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciProject.pdl
+++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-types/SciProject.pdl
@@ -28,4 +28,92 @@ association {
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/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
index 08404bac2..43a9e72f5 100644
--- 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
@@ -4,35 +4,62 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
-
-
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+ ordering="6"/>
+
+
+
-
-
-
-
-
+
\ 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
index 575e21a32..7b079d97c 100644
--- 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
@@ -4,34 +4,55 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
-
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
\ 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
index 007d443a7..27f3f2a18 100644
--- 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
@@ -12,7 +12,7 @@
-
-
+
+
+
+
+
+
+
+
+
+ component="com.arsdigita.cms.contenttypes.ui.SciProjectPublicationsStep"
+ ordering="6"/>
diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java
index 5e5aa841f..8cd8b572b 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciDepartment.java
@@ -23,9 +23,13 @@ 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;
/**
@@ -89,6 +93,21 @@ public class SciDepartment extends GenericOrganizationalUnit {
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);
}
@@ -177,6 +196,11 @@ public class SciDepartment extends GenericOrganizationalUnit {
}
}
+ /*public boolean hasSuperDepartment() {
+
+
+
+ }*/
public SciOrganization getOrganization() {
DataCollection collection;
@@ -233,10 +257,6 @@ public class SciDepartment extends GenericOrganizationalUnit {
remove(SUBDEPARTMENTS, subDepartment);
}
- public boolean hasSubDepartments() {
- return !this.getSubDepartments().isEmpty();
- }
-
public SciDepartmentProjectsCollection getProjects() {
return new SciDepartmentProjectsCollection(
(DataCollection) get(PROJECTS));
@@ -260,7 +280,341 @@ public class SciDepartment extends GenericOrganizationalUnit {
remove(PROJECTS, project);
}
- public boolean hasProjects() {
- return !this.getProjects().isEmpty();
+ @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(
+ "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.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(
+ "departmentId");
+ 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 (query.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", 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 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(
+ "departmentId");
+ 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/SciOrganization.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java
index a8216abd1..6e5062b83 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciOrganization.java
@@ -22,9 +22,13 @@ 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;
/**
@@ -81,6 +85,21 @@ public class SciOrganization extends GenericOrganizationalUnit {
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);
}
@@ -117,6 +136,344 @@ public class SciOrganization extends GenericOrganizationalUnit {
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?
+ * @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 (query.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.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(
+ "departmentId");
+ 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 (query.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", 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 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(
+ "departmentId");
+ 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);
}
@@ -142,10 +499,6 @@ public class SciOrganization extends GenericOrganizationalUnit {
remove(DEPARTMENTS, department);
}
- public boolean hasDepartments() {
- return !this.getDepartments().isEmpty();
- }
-
public SciOrganizationProjectsCollection getProjects() {
return new SciOrganizationProjectsCollection(
(DataCollection) get(PROJECTS));
@@ -155,7 +508,7 @@ public class SciOrganization extends GenericOrganizationalUnit {
Assert.exists(project, SciProject.class);
DataObject link = add(PROJECTS, project);
- link.set(PROJECT_ORDER, Integer.valueOf((int) getProjects().size()));
+ link.set(PROJECT_ORDER, Integer.valueOf((int) getProjects().size()));
link.set(SciProject.ORGANIZATIONS_ORDER, Integer.valueOf((int) project.
getOrganizations().size()));
link.save();
@@ -166,8 +519,5 @@ public class SciOrganization extends GenericOrganizationalUnit {
remove(PROJECTS, project);
}
-
- public boolean hasProjects() {
- return !this.getProjects().isEmpty();
- }
+
}
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
index 6f9c2e5e2..b529bc89f 100644
--- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java
+++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/SciProject.java
@@ -22,7 +22,9 @@ 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;
@@ -92,6 +94,21 @@ public class SciProject extends GenericOrganizationalUnit {
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);
}
@@ -187,10 +204,6 @@ public class SciProject extends GenericOrganizationalUnit {
remove(SUBPROJECTS, project);
}
- public boolean hasSubProjects() {
- return !this.getSubProjects().isEmpty();
- }
-
public SciProjectOrganizationsCollection getOrganizations() {
return new SciProjectOrganizationsCollection((DataCollection) get(
ORGANIZATIONS));
@@ -204,7 +217,7 @@ public class SciProject extends GenericOrganizationalUnit {
link.set(ORGANIZATIONS_ORDER,
Integer.valueOf((int) getOrganizations().size()));
link.set(SciOrganization.PROJECT_ORDER,
- Integer.valueOf((int) orga.getProjects().size()));
+ Integer.valueOf((int) orga.getProjects().size()));
link.save();
}
@@ -284,4 +297,200 @@ public class SciProject extends GenericOrganizationalUnit {
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/ui/SciDepartmentPanel.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPanel.java
index dee192bcc..365b7cdfd 100644
--- 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
@@ -30,7 +30,6 @@ import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
import com.arsdigita.cms.contenttypes.SciProject;
-import com.arsdigita.persistence.DataCollection;
import com.arsdigita.xml.Element;
import java.util.Collections;
import java.util.LinkedList;
@@ -54,10 +53,10 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
public static final String SHOW_PROJECTS_ONGOING = "projectsOngoing";
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
public static final String SHOW_PUBLICATIONS = "publications";
- private boolean displayDescription;
- private boolean displaySubDepartments;
- private boolean displayProjects;
- private boolean displayPublications;
+ private boolean displayDescription = true;
+ private boolean displaySubDepartments = true;
+ private boolean displayProjects = true;
+ private boolean displayPublications = true;
@Override
protected String getDefaultForShowParam() {
@@ -101,69 +100,42 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
this.displaySubDepartments = displaySubDepartments;
}
- protected boolean hasMembers(final SciDepartment department,
- final List filters) {
- if (department.getPersons() != null) {
- GenericOrganizationalUnitPersonCollection persons;
- persons = department.getPersons();
- for (String filter : filters) {
- persons.addFilter(filter);
- }
- if (persons.size() > 0) {
- return true;
- }
- }
-
- boolean hasMembers;
- hasMembers = false;
-
- if (SciDepartment.getConfig().getOrganizationMembersMerge()) {
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
- while (subDepartments.next()) {
- SciDepartment subDepartment = subDepartments.getSubDepartment();
-
- hasMembers = hasMembers(subDepartment, filters);
- if (hasMembers) {
- return true;
- }
- }
- }
-
- return false;
+ 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,
- final List filters) {
- if (department.getProjects() != null) {
- SciDepartmentProjectsCollection projects;
- projects = department.getProjects();
- for (String filter : filters) {
- projects.addFilter(filter);
- }
- if (projects.size() > 0) {
- return true;
- }
- }
+ protected boolean hasProjects(final SciDepartment department) {
+ return department.hasProjects(SciDepartment.getConfig().
+ getOrganizationProjectsMerge(),
+ SciDepartment.ProjectStatus.ALL);
+ }
- boolean hasProjects;
- hasProjects = false;
+ protected boolean hasOngoingProjects(final SciDepartment department) {
+ return department.hasProjects(SciDepartment.getConfig().
+ getOrganizationProjectsMerge(),
+ SciDepartment.ProjectStatus.ONGOING);
+ }
- if (SciDepartment.getConfig().getOrganizationProjectsMerge()) {
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
-
- while (subDepartments.next()) {
- SciDepartment subDepartment = subDepartments.getSubDepartment();
-
- hasProjects = hasProjects(subDepartment, filters);
- if (hasProjects) {
- return true;
- }
- }
- }
-
- return false;
+ protected boolean hasFinishedProjects(final SciDepartment department) {
+ return department.hasProjects(SciDepartment.getConfig().
+ getOrganizationProjectsMerge(),
+ SciDepartment.ProjectStatus.FINISHED);
}
protected void generateSubDepartmentsXML(final SciDepartment department,
@@ -184,8 +156,8 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
pageNumber = normalizePageNumber(pageCount, pageNumber);
createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count, subDepartments.
- size());
+ parent, pageNumber, pageCount, begin, end, count,
+ subDepartments.size());
subDepartments.setRange((int) begin, (int) end);
while (subDepartments.next()) {
@@ -194,7 +166,8 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
Element subDepartmentElem = subDepartmentsElem.newChildElement(
"department");
- subDepartmentElem.addAttribute("order", Integer.toString(subDepartments.
+ subDepartmentElem.addAttribute("order",
+ Integer.toString(subDepartments.
getSubDepartmentOrder()));
subDepartmentElem.addAttribute("oid", subDepartment.getOID().
toString());
@@ -452,58 +425,52 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
&& displayDescription) {
availableData.newChildElement("description");
}
- if ((department.getContacts() != null)
- && (department.getContacts().size() > 0)
+ if (department.hasContacts()
&& isDisplayContacts()) {
availableData.newChildElement("contacts");
}
- if ((department.getSubDepartments() != null)
- && (department.getSubDepartments().size() > 0)
+ if (department.hasSubDepartments()
&& displaySubDepartments) {
availableData.newChildElement("subDepartments");
}
if (config.getOrganizationMembersAllInOne()) {
- if (hasMembers(department, new LinkedList())
+ if (hasMembers(department)
&& isDisplayMembers()) {
availableData.newChildElement("members");
}
} else {
- if (hasMembers(department, getFiltersForActiveMembers())
+ if (hasActiveMembers(department)
&& isDisplayMembers()) {
availableData.newChildElement("membersActive");
}
- if (hasMembers(department, getFiltersForAssociatedMembers())
+ if (hasAssociatedMembers(department)
&& isDisplayMembers()) {
availableData.newChildElement("membersAssociated");
}
- if (hasMembers(department, getFiltersForFormerMembers())
+ if (hasFormerMembers(department)
&& isDisplayMembers()) {
availableData.newChildElement("membersFormer");
}
}
if (config.getOrganizationProjectsAllInOne()) {
- if (hasProjects(department, new LinkedList())
+ if (hasProjects(department)
&& displayProjects) {
availableData.newChildElement("projects");
}
- } else {
- if (hasProjects(department, getFiltersForOngoingProjects())
+ } else {
+ if (hasOngoingProjects(department)
&& displayProjects) {
availableData.newChildElement("projectsOngoing");
- }
- if (hasProjects(department, getFiltersForFinishedProjects())
+ }
+ if (hasFinishedProjects(department)
&& displayProjects) {
availableData.newChildElement("projectsFinished");
}
}
- DataCollection publicationLinks =
- RelatedLink.getRelatedLinks(department,
- "SciDepartmentPublications");
- if ((publicationLinks != null)
- && (publicationLinks.size() > 0)
- && displayPublications) {
+ if (department.hasPublications()
+ && displayPublications) {
availableData.newChildElement("publications");
- }
+ }
String show = getShowParam(state);
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
index 1d87738b4..04419d42f 100644
--- 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
@@ -102,30 +102,36 @@ public class SciDepartmentPropertiesStep
"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),
@@ -133,6 +139,7 @@ public class SciDepartmentPropertiesStep
"sciorganization.ui.department.organization"));
}
+ /*
ContentTypeCollection contentTypes = ContentType.getAllContentTypes();
contentTypes.addFilter("associatedObjectType = :type").set(
"type",
@@ -143,10 +150,10 @@ public class SciDepartmentPropertiesStep
* Must add this step manually since the basic class is not
* SimpleEditStep...
*/
- getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
+ /* 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/SciOrganizationPanel.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationPanel.java
index 817b8af34..321b67d5e 100644
--- 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
@@ -100,144 +100,40 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
this.displayProjects = displayProjects;
}
- /**
- *
- * @param orga
- * @param filters
- * @return
- */
- protected boolean hasMembers(final SciOrganization orga,
- final List filters) {
-
- if (orga.getPersons() != null) {
- GenericOrganizationalUnitPersonCollection persons;
- persons = orga.getPersons();
- for (String filter : filters) {
- persons.addFilter(filter);
- }
- if (persons.size() > 0) {
- return true;
- }
- }
-
- if (SciOrganization.getConfig().getOrganizationMembersMerge()) {
- boolean hasMembers;
- hasMembers = false;
- SciOrganizationDepartmentsCollection departments;
- departments = orga.getDepartments();
- while (departments.next()) {
- SciDepartment department = departments.getDepartment();
-
- hasMembers = hasMembers(department, filters);
- if (hasMembers) {
- return true;
- }
- }
- }
- return false;
+ protected boolean hasMembers(final SciOrganization orga) {
+ return orga.hasMembers(true, SciOrganization.MemberStatus.ALL);
}
- protected boolean hasMembers(final SciDepartment department,
- final List filters) {
-
- if (department.getPersons() != null) {
- GenericOrganizationalUnitPersonCollection persons;
- persons = department.getPersons();
- for (String filter : filters) {
- persons.addFilter(filter);
- }
- if (persons.size() > 0) {
- return true;
- }
- } else {
-
- boolean hasMembers;
- hasMembers = false;
-
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
- while (subDepartments.next()) {
- SciDepartment subDepartment = subDepartments.getSubDepartment();
-
- hasMembers = hasMembers(subDepartment, filters);
- if (hasMembers) {
- return true;
- }
- }
- }
-
- return false;
+ protected boolean hasActiveMembers(final SciOrganization orga) {
+ return orga.hasMembers(true, SciOrganization.MemberStatus.ACTIVE);
}
- /**
- *
- * @param orga
- * @param filters
- * @return
- */
- protected boolean hasProjects(final SciOrganization orga,
- final List filters) {
- if (orga.getProjects() != null) {
- SciOrganizationProjectsCollection projects;
- projects = orga.getProjects();
- for (String filter : filters) {
- projects.addFilter(filter);
- }
- if (projects.size() > 0) {
- return true;
- }
- }
-
- boolean hasProjects;
- hasProjects = false;
-
- if (SciOrganization.getConfig().getOrganizationProjectsMerge()) {
- SciOrganizationDepartmentsCollection departments;
- departments = orga.getDepartments();
-
- while (departments.next()) {
- SciDepartment department = departments.getDepartment();
-
- hasProjects = hasProjects(department, filters);
- if (hasProjects) {
- return true;
- }
- }
- }
-
- return false;
+ protected boolean hasAssociatedMembers(final SciOrganization orga) {
+ return orga.hasMembers(true, SciOrganization.MemberStatus.ASSOCIATED);
}
- protected boolean hasProjects(final SciDepartment department,
- final List filters) {
- if (department.getProjects() != null) {
- SciDepartmentProjectsCollection projects;
- projects = department.getProjects();
- for (String filter : filters) {
- projects.addFilter(filter);
- }
- if (projects.size() > 0) {
- return true;
- }
- }
-
- boolean hasProjects;
- hasProjects = false;
-
- SciDepartmentSubDepartmentsCollection subDepartments;
- subDepartments = department.getSubDepartments();
- while (subDepartments.next()) {
- SciDepartment subDepartment = subDepartments.getSubDepartment();
-
- hasProjects = hasProjects(subDepartment, filters);
- if (hasProjects) {
- return true;
- }
- }
-
- return false;
+ 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) {
@@ -473,11 +369,11 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
pageNumber = normalizePageNumber(pageCount, pageNumber);
createPaginatorElement(
- parent, pageNumber, pageCount, begin, end, count, projectsWithoutDoubles.
- size());
- List projectsWithoutDoublesToShow = projectsWithoutDoubles.
- subList((int) begin,
- (int) end);
+ parent, pageNumber, pageCount, begin, end, count,
+ projectsWithoutDoubles.size());
+ List projectsWithoutDoublesToShow =
+ projectsWithoutDoubles.subList((int) begin,
+ (int) end);
Element projectsWithoutDoublesElem = parent.newChildElement(
"projects");
@@ -541,58 +437,52 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
&& displayDescription) {
availableData.newChildElement("description");
}
- if ((orga.getContacts() != null)
- && (orga.getContacts().size() > 0)
+ if (orga.hasContacts()
&& isDisplayContacts()) {
availableData.newChildElement("contacts");
}
- if ((orga.getDepartments() != null)
- && (orga.getDepartments().size() > 0)
+ if (orga.hasDepartments()
&& displayDepartments) {
availableData.newChildElement("departments");
}
if (config.getOrganizationMembersAllInOne()) {
- if (hasMembers(orga, new LinkedList())
+ if (hasMembers(orga)
&& isDisplayMembers()) {
availableData.newChildElement("members");
}
} else {
- if (hasMembers(orga, getFiltersForActiveMembers())
+ if (hasActiveMembers(orga)
&& isDisplayMembers()) {
availableData.newChildElement("membersActive");
}
- if (hasMembers(orga, getFiltersForAssociatedMembers())
+ if (hasAssociatedMembers(orga)
&& isDisplayMembers()) {
availableData.newChildElement("membersAssociated");
}
- if (hasMembers(orga, getFiltersForFormerMembers())
+ if (hasFormerMembers(orga)
&& isDisplayMembers()) {
availableData.newChildElement("membersFormer");
}
}
if (config.getOrganizationProjectsAllInOne()) {
- if (hasProjects(orga, new LinkedList())
+ if (hasProjects(orga)
&& displayProjects) {
availableData.newChildElement("projects");
}
} else {
- if (hasProjects(orga, getFiltersForOngoingProjects())
+ if (hasOngoingProjects(orga)
&& displayProjects) {
availableData.newChildElement("projectsOngoing");
}
- if (hasProjects(orga, getFiltersForFinishedProjects())
+ if (hasFinishedProjects(orga)
&& displayProjects) {
availableData.newChildElement("projectsFinished");
}
}
- DataCollection publicationLinks =
- RelatedLink.getRelatedLinks(orga,
- "SciOrganizationPublications");
- if ((publicationLinks != null)
- && (publicationLinks.size() > 0)
- && displayPublications) {
+ if (orga.hasPublications()
+ && displayPublications) {
availableData.newChildElement("publications");
- }
+ }
String show = getShowParam(state);
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
index 5d34eadaf..a2affc2c5 100644
--- 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
@@ -86,6 +86,7 @@ public class SciOrganizationPropertiesStep
"sciorganization.ui.organization.contacts"));
}
+ /* This steps are now separate steps in the left box.
if (!config.getOrganizationAddPersonHide()) {
addStep(new SciOrganizationMemberStep(itemModel,
parent),
@@ -103,7 +104,7 @@ public class SciOrganizationPropertiesStep
addStep(new SciOrganizationProjectsStep(itemModel, parent),
SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.organization.projects"));
- }
+ }*/
}
public static Component getSciOrganizationPropertySheet(
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
index 9a42813d5..df8b7ee83 100644
--- 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
@@ -82,54 +82,34 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
this.displaySubProjects = displaySubProjects;
}
- protected boolean hasMembers(final SciProject project,
- final List filters) {
- if (project.getPersons() != null) {
- GenericOrganizationalUnitPersonCollection persons;
- persons = project.getPersons();
- for (String filter : filters) {
- persons.addFilter(filter);
- }
- if (persons.size() > 0) {
- return true;
- }
- }
-
- boolean hasMembers;
- hasMembers = false;
- if (SciProject.getConfig().getOrganizationMembersMerge()) {
- SciProjectSubProjectsCollection subProjects;
- subProjects = project.getSubProjects();
-
- while (subProjects.next()) {
- SciProject subProject = subProjects.getSubProject();
-
- hasMembers = hasMembers(subProject, filters);
- if (hasMembers) {
- return true;
- }
- }
- }
-
- return false;
+ protected boolean hasMembers(final SciProject project) {
+ return project.hasMembers(SciProject.getConfig().
+ getOrganizationMembersMerge(),
+ SciProject.MemberStatus.ALL);
}
- protected boolean hasSubProjects(final SciProject project,
- final List filters) {
- if (project.getSubProjects() != null) {
-
- SciProjectSubProjectsCollection subProjects;
- subProjects = project.getSubProjects();
- for (String filter : filters) {
- subProjects.addFilter(filter);
- }
- if (subProjects.size() > 0) {
- return true;
- }
- }
- return false;
+ 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,
@@ -151,8 +131,8 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
long end = getPaginatorEnd(begin, count);
pageNumber = normalizePageNumber(pageCount, pageNumber);
- createPaginatorElement(parent, pageNumber, pageCount, begin, end, count, subProjects.
- size());
+ createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
+ subProjects.size());
subProjects.setRange((int) begin, (int) end);
@@ -237,43 +217,37 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
&& displayDescription) {
availableData.newChildElement("description");
}
- if ((project.getContacts() != null)
- && (project.getContacts().size() > 0)
+ if (project.hasContacts()
&& isDisplayContacts()) {
availableData.newChildElement("contacts");
}
- if ((project.getSubProjects() != null)
- && (project.getSubProjects().size() > 0)
+ if (hasSubProjects(project)
&& displaySubProjects) {
availableData.newChildElement("subProjects");
}
if (config.getProjectMembersAllInOne()) {
- if (hasMembers(project, new LinkedList())
+ if (hasMembers(project)
&& isDisplayMembers()) {
availableData.newChildElement("members");
}
} else {
- if (hasMembers(project, getFiltersForActiveMembers())
+ if (hasActiveMembers(project)
&& isDisplayMembers()) {
availableData.newChildElement("activeMembers");
}
- if (hasMembers(project, getFiltersForAssociatedMembers())
+ if (hasAssociatedMembers(project)
&& isDisplayMembers()) {
availableData.newChildElement("associatedMembers");
}
- if (hasMembers(project, getFiltersForFormerMembers())
+ if (hasFormerMembers(project)
&& isDisplayMembers()) {
availableData.newChildElement("formerMembers");
}
}
- DataCollection publicationLinks =
- RelatedLink.getRelatedLinks(project,
- "SciProjectPublications");
- if ((publicationLinks != null)
- && (publicationLinks.size() > 0)
- && displayPublications) {
+ if (project.hasPublications()
+ && displayPublications) {
availableData.newChildElement("publications");
- }
+ }
String show = getShowParam(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
index 3f3dd790b..86c6f8426 100644
--- 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
@@ -139,12 +139,12 @@ public class SciProjectPropertiesStep
"sciorganization.ui.project.contacts"));
}
- if (!config.getProjectAddPersonHide()) {
+ /* if (!config.getProjectAddPersonHide()) {
addStep(new SciProjectMemberStep(itemModel,
parent),
SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.members"));
- }
+ }*/
if (!config.getProjectSetSuperProjectHide()) {
addStep(new SciProjectSuperProjectStep(itemModel,
@@ -153,12 +153,12 @@ public class SciProjectPropertiesStep
"sciorganization.ui.project.superproject"));
}
- if (!config.getProjectAddSubProjectHide()) {
+ /* if (!config.getProjectAddSubProjectHide()) {
addStep(new SciProjectSubprojectsStep(itemModel,
parent),
SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.subprojects"));
- }
+ }*/
if (!config.getProjectAddOrganizationHide()) {
addStep(new SciProjectOrganizationsStep(itemModel, parent),
@@ -166,7 +166,7 @@ public class SciProjectPropertiesStep
"sciorganization.ui.project.organizations"));
}
- if (!config.getProjectAddDepartmentHide()) {
+ /*if (!config.getProjectAddDepartmentHide()) {
addStep(new SciProjectDepartmentsStep(itemModel, parent),
SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.departments"));
@@ -182,10 +182,10 @@ public class SciProjectPropertiesStep
* Must add this step manually since the basic class is not
* SimpleEditStep...
*/
- getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
+ /* getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
globalize("sciorganization.ui.project.publications")),
new SciProjectPublicationsStep(
itemModel, parent));
- }
+ }*/
}
}
diff --git a/tools-ng/devel/lib/postgresql-9.0-801.jdbc4.jar b/tools-ng/devel/lib/postgresql-9.0-801.jdbc4.jar
new file mode 100644
index 000000000..63e54165e
Binary files /dev/null and b/tools-ng/devel/lib/postgresql-9.0-801.jdbc4.jar differ
diff --git a/tools-ng/devel/lib/postgresql-jdbc.jar b/tools-ng/devel/lib/postgresql-jdbc.jar
index 85d5d0818..63e54165e 100644
Binary files a/tools-ng/devel/lib/postgresql-jdbc.jar and b/tools-ng/devel/lib/postgresql-jdbc.jar differ
diff --git a/tools-ng/ecdc/scriptlib/build-runtime.xml b/tools-ng/ecdc/scriptlib/build-runtime.xml
index ac0678930..98e2048be 100644
--- a/tools-ng/ecdc/scriptlib/build-runtime.xml
+++ b/tools-ng/ecdc/scriptlib/build-runtime.xml
@@ -29,7 +29,7 @@
todir="${app.server.shared.dir}/endorsed" preservelastmodified="true"/>
-