- PostgreSQL JDBC Treiber Version 9.0

- Performence Optimierungen für sci-types-organization
- Kleinigkeitne und Logausgaben


git-svn-id: https://svn.libreccm.org/ccm/trunk@887 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2011-05-02 12:38:12 +00:00
parent 2e3535c491
commit 0e77a923bb
23 changed files with 1569 additions and 376 deletions

View File

@ -2864,6 +2864,7 @@ public class DaBInImporter extends Program {
download.setTargetType(Link.INTERNAL_LINK); download.setTargetType(Link.INTERNAL_LINK);
download.setTargetItem(fsi); download.setTargetItem(fsi);
download.setLinkOwner(workingPaperDe); download.setLinkOwner(workingPaperDe);
download.setLinkListName("NONE");
download = new RelatedLink(); download = new RelatedLink();
download.setTitle(config.getProperty( download.setTitle(config.getProperty(
@ -2871,6 +2872,7 @@ public class DaBInImporter extends Program {
download.setTargetType(Link.INTERNAL_LINK); download.setTargetType(Link.INTERNAL_LINK);
download.setTargetItem(fsi); download.setTargetItem(fsi);
download.setLinkOwner(workingPaperEn); download.setLinkOwner(workingPaperEn);
download.setLinkListName("NONE");
files.addItem(bundle); files.addItem(bundle);
} }

View File

@ -22,6 +22,15 @@
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep" component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPropertiesStep"
ordering="1" ordering="1"
/> />
<ctd:authoring-step
labelKey="cms.contenttypes.ui.orgaunit.persons"
labelBundle="com.arsdigita.cms.contenttypes.util.ContenttypesResourceBundle"
descriptionKey="cms.contenttypes.ui.orgaunit.persons.description"
descriptionBundle="com.arsdigita.cms.contenttypes.util.ContenttypesResourceBundle"
component="com.arsdigita.cms.contenttypes.ui.GenericOrganizationalUnitPersonPropertiesStep"
ordering="2"
/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> <ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit> </ctd:authoring-kit>

View File

@ -41,8 +41,8 @@ public class GenericOrganizationalUnitPanel extends CompoundContentItemPanel {
public static final String SHOW_CONTACTS = "contacts"; public static final String SHOW_CONTACTS = "contacts";
public static final String SHOW_MEMBERS = "members"; public static final String SHOW_MEMBERS = "members";
private boolean displayContacts; private boolean displayContacts = true;
private boolean displayMembers; private boolean displayMembers = true;
@Override @Override
protected String getDefaultForShowParam() { protected String getDefaultForShowParam() {

View File

@ -126,9 +126,14 @@ public class GenericOrganizationalUnitPropertiesStep extends SimpleEditStep {
addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel, addStep(new GenericOrganizationalUnitContactPropertiesStep(itemModel,
parent), parent),
"cms.contenttypes.ui.orgaunit.contact"); "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, addStep(new GenericOrganizationalUnitPersonPropertiesStep(itemModel,
parent), parent),
"cms.contenttypes.ui.orgaunit.persons"); "cms.contenttypes.ui.orgaunit.persons");
*/
} }
/** /**

View File

@ -66,6 +66,7 @@ public class TransactionContext {
**/ **/
public void beginTxn() { public void beginTxn() {
s_cat.debug("Beginning transaction...");
// Do nothing. This is implicit now. // Do nothing. This is implicit now.
if (m_inTxn) { if (m_inTxn) {
throw new IllegalStateException("double begin"); throw new IllegalStateException("double begin");
@ -82,6 +83,7 @@ public class TransactionContext {
**/ **/
public void commitTxn() { public void commitTxn() {
s_cat.debug("Commiting transaction...");
boolean success = false; boolean success = false;
try { try {
fireBeforeCommitEvent(); fireBeforeCommitEvent();
@ -91,9 +93,14 @@ public class TransactionContext {
success = true; success = true;
m_inTxn = false; m_inTxn = false;
fireCommitEvent(); fireCommitEvent();
s_cat.debug("Done.");
} finally { } finally {
s_cat.debug("Cleaning up...");
clearAttributes(); clearAttributes();
if (!success) { m_ossn.invalidateDataObjects(false, true); } 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() { public void abortTxn() {
s_cat.warn("Aborting transaction...");
boolean success = false; boolean success = false;
try { try {
try { try {
@ -141,6 +149,7 @@ public class TransactionContext {
fireAbortEvent(); fireAbortEvent();
clearAttributes(); clearAttributes();
} }
s_cat.warn("Transaction aborted.");
} }
/** /**

View File

@ -36,4 +36,130 @@ association {
Integer[0..1] departmentOrder = ct_sciorga_departments_projects_map.departmentOrder INTEGER; Integer[0..1] departmentOrder = ct_sciorga_departments_projects_map.departmentOrder INTEGER;
Integer[0..1] projectOrder = ct_sciorga_departments_projects_map.projectorder 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;
}
} }

View File

@ -41,4 +41,129 @@ association {
Integer[0..1] organizationOrder = ct_sciorga_organizations_projects_map.organization_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;
}
}
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;
}
}

View File

@ -28,4 +28,92 @@ association {
Integer[0..1] subProjectOrder = ct_sciorga_projects_subprojects_map.subprojectorder INTEGER; 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;
}
} }

View File

@ -4,35 +4,62 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type <ctd:content-type
label="SciDepartment" label="SciDepartment"
description="Base type for departments of scientific organizations" description="Base type for departments of scientific organizations"
objectType="com.arsdigita.cms.contenttypes.SciDepartment" objectType="com.arsdigita.cms.contenttypes.SciDepartment"
classname="com.arsdigita.cms.contenttypes.SciDepartment"> classname="com.arsdigita.cms.contenttypes.SciDepartment">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step <ctd:authoring-step
labelKey="sciorganization.ui.department.properties.title" labelKey="sciorganization.ui.department.properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="publications.ui.publication_properties.title.description" descriptionKey="publications.ui.publication_properties.title.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentPropertiesStep" component="com.arsdigita.cms.contenttypes.ui.SciDepartmentPropertiesStep"
ordering="1"/> ordering="1"/>
<ctd:authoring-step <ctd:authoring-step
labelKey="sciorganization.ui.department.members"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.department.members.description.title"
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentMemberStep"
ordering="2"/>
<ctd:authoring-step
labelKey="sciorganization.ui.department.subdepartments"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.department.subdepartments.description.title"
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentSubDepartmentsStep"
ordering="3"/>
<ctd:authoring-step
labelKey="sciorganization.ui.department.projects"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.department.projects.description.title"
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentProjectsStep"
ordering="4"/>
<ctd:authoring-step
labelKey="sciorganization.ui.department.publications"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.department.publications.description.title"
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentPublicationsStep"
ordering="5"/>
<ctd:authoring-step
labelKey="sciorganization.ui.department.description.title" labelKey="sciorganization.ui.department.description.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.department.description.title" descriptionKey="sciorganization.ui.department.description.title"
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentDescriptionStep" component="com.arsdigita.cms.contenttypes.ui.SciDepartmentDescriptionStep"
ordering="2"/> ordering="6"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> </ctd:content-type>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types> </ctd:content-types>

View File

@ -4,34 +4,55 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd"> xsi:schemaLocation="http://xmlns.redhat.com/cms/content-types content-types.xsd">
<ctd:content-type <ctd:content-type
label="SciOrganization" label="SciOrganization"
description="Base type for scientific orgnizations" description="Base type for scientific orgnizations"
objectType="com.arsdigita.cms.contenttypes.SciOrganization" objectType="com.arsdigita.cms.contenttypes.SciOrganization"
classname="com.arsdigita.cms.contenttypes.SciOrganization"> classname="com.arsdigita.cms.contenttypes.SciOrganization">
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step <ctd:authoring-step
labelKey="sciorganization.ui.organization.properties.title" labelKey="sciorganization.ui.organization.properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="publications.ui.publication_properties.title.description" descriptionKey="publications.ui.publication_properties.title.description"
descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" descriptionBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationPropertiesStep" component="com.arsdigita.cms.contenttypes.ui.SciOrganizationPropertiesStep"
ordering="1"/> ordering="1"/>
<ctd:authoring-step <ctd:authoring-step
labelKey="sciorganization.ui.organization.description.title" labelKey="sciorganization.ui.organization_members"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.organization_description.title.description" descriptionKey="sciorganization.ui.organization_members.title.description"
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationDescriptionStep" component="com.arsdigita.cms.contenttypes.ui.SciOrganizationMemberStep"
ordering="2"/> ordering="2"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> <ctd:authoring-step
labelKey="sciorganization.ui.organization.departments"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.organization.departments.description"
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationDepartmentsStep"
ordering="3"/>
</ctd:authoring-kit> <ctd:authoring-step
labelKey="sciorganization.ui.organization.projects"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.organization.projects.description"
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationProjectsStep"
ordering="4"/>
</ctd:content-type> <ctd:authoring-step
labelKey="sciorganization.ui.organization.description.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.organization_description.title.description"
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationDescriptionStep"
ordering="5"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
</ctd:authoring-kit>
</ctd:content-type>
</ctd:content-types> </ctd:content-types>

View File

@ -12,7 +12,7 @@
<ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate"> <ctd:authoring-kit createComponent="com.arsdigita.cms.ui.authoring.PageCreate">
<ctd:authoring-step <ctd:authoring-step
labelKey="sciorganization.ui.project_properties.title" labelKey="sciorganization.ui.project_properties.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project_properties.title" descriptionKey="sciorganization.ui.project_properties.title"
@ -20,12 +20,41 @@
component="com.arsdigita.cms.contenttypes.ui.SciProjectPropertiesStep" component="com.arsdigita.cms.contenttypes.ui.SciProjectPropertiesStep"
ordering="1"/> ordering="1"/>
<ctd:authoring-step <ctd:authoring-step
labelKey="sciorganization.ui.project.members"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project.members.description"
component="com.arsdigita.cms.contenttypes.ui.SciProjectMemberStep"
ordering="2"/>
<ctd:authoring-step
labelKey="sciorganization.ui.project.subprojects"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project.subprojects"
component="com.arsdigita.cms.contenttypes.ui.SciProjectSubprojectsStep"
ordering="3"/>
<ctd:authoring-step
labelKey="sciorganization.ui.project.departments"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project.departments"
component="com.arsdigita.cms.contenttypes.ui.SciProjectDepartmentsStep"
ordering="4"/>
<ctd:authoring-step
labelKey="sciorganization.ui.project.publications"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project.publications"
component="com.arsdigita.cms.contenttypes.ui.SciProjectDepartmentsStep"
ordering="5"/>
<ctd:authoring-step
labelKey="sciorganization.ui.project_description.title" labelKey="sciorganization.ui.project_description.title"
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources" labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
descriptionKey="sciorganization.ui.project_description.title" descriptionKey="sciorganization.ui.project_description.title"
component="com.arsdigita.cms.contenttypes.ui.SciProjectDescriptionStep" component="com.arsdigita.cms.contenttypes.ui.SciProjectPublicationsStep"
ordering="2"/> ordering="6"/>
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/> <ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>

View File

@ -23,9 +23,13 @@ import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.domain.DomainObjectFactory; import com.arsdigita.domain.DomainObjectFactory;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -89,6 +93,21 @@ public class SciDepartment extends GenericOrganizationalUnit {
logger.debug("Static initalizer finished."); logger.debug("Static initalizer finished.");
} }
public enum MemberStatus {
ALL,
ACTIVE,
ASSOCIATED,
FORMER
}
public enum ProjectStatus {
ALL,
ONGOING,
FINISHED
}
public SciDepartment() { public SciDepartment() {
this(BASE_DATA_OBJECT_TYPE); this(BASE_DATA_OBJECT_TYPE);
} }
@ -177,6 +196,11 @@ public class SciDepartment extends GenericOrganizationalUnit {
} }
} }
/*public boolean hasSuperDepartment() {
}*/
public SciOrganization getOrganization() { public SciOrganization getOrganization() {
DataCollection collection; DataCollection collection;
@ -233,10 +257,6 @@ public class SciDepartment extends GenericOrganizationalUnit {
remove(SUBDEPARTMENTS, subDepartment); remove(SUBDEPARTMENTS, subDepartment);
} }
public boolean hasSubDepartments() {
return !this.getSubDepartments().isEmpty();
}
public SciDepartmentProjectsCollection getProjects() { public SciDepartmentProjectsCollection getProjects() {
return new SciDepartmentProjectsCollection( return new SciDepartmentProjectsCollection(
(DataCollection) get(PROJECTS)); (DataCollection) get(PROJECTS));
@ -260,7 +280,341 @@ public class SciDepartment extends GenericOrganizationalUnit {
remove(PROJECTS, project); remove(PROJECTS, project);
} }
public boolean hasProjects() { @Override
return !this.getProjects().isEmpty(); 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;
} }
} }

View File

@ -22,9 +22,13 @@ package com.arsdigita.cms.contenttypes;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Calendar;
import java.util.GregorianCalendar;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
@ -81,6 +85,21 @@ public class SciOrganization extends GenericOrganizationalUnit {
logger.debug("Static initalizer finished."); logger.debug("Static initalizer finished.");
} }
public enum MemberStatus {
ALL,
ACTIVE,
ASSOCIATED,
FORMER
}
public enum ProjectStatus {
ALL,
ONGOING,
FINISHED
}
public SciOrganization() { public SciOrganization() {
this(BASE_DATA_OBJECT_TYPE); this(BASE_DATA_OBJECT_TYPE);
} }
@ -117,6 +136,344 @@ public class SciOrganization extends GenericOrganizationalUnit {
return (String) get(ORGANIZATION_DESCRIPTION); 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) { public void setOrganizationDescription(String description) {
set(ORGANIZATION_DESCRIPTION, description); set(ORGANIZATION_DESCRIPTION, description);
} }
@ -142,10 +499,6 @@ public class SciOrganization extends GenericOrganizationalUnit {
remove(DEPARTMENTS, department); remove(DEPARTMENTS, department);
} }
public boolean hasDepartments() {
return !this.getDepartments().isEmpty();
}
public SciOrganizationProjectsCollection getProjects() { public SciOrganizationProjectsCollection getProjects() {
return new SciOrganizationProjectsCollection( return new SciOrganizationProjectsCollection(
(DataCollection) get(PROJECTS)); (DataCollection) get(PROJECTS));
@ -155,7 +508,7 @@ public class SciOrganization extends GenericOrganizationalUnit {
Assert.exists(project, SciProject.class); Assert.exists(project, SciProject.class);
DataObject link = add(PROJECTS, project); 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. link.set(SciProject.ORGANIZATIONS_ORDER, Integer.valueOf((int) project.
getOrganizations().size())); getOrganizations().size()));
link.save(); link.save();
@ -166,8 +519,5 @@ public class SciOrganization extends GenericOrganizationalUnit {
remove(PROJECTS, project); remove(PROJECTS, project);
} }
public boolean hasProjects() {
return !this.getProjects().isEmpty();
}
} }

View File

@ -22,7 +22,9 @@ package com.arsdigita.cms.contenttypes;
import com.arsdigita.domain.DataObjectNotFoundException; import com.arsdigita.domain.DataObjectNotFoundException;
import com.arsdigita.persistence.DataCollection; import com.arsdigita.persistence.DataCollection;
import com.arsdigita.persistence.DataObject; import com.arsdigita.persistence.DataObject;
import com.arsdigita.persistence.DataQuery;
import com.arsdigita.persistence.OID; import com.arsdigita.persistence.OID;
import com.arsdigita.persistence.SessionManager;
import com.arsdigita.util.Assert; import com.arsdigita.util.Assert;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -92,6 +94,21 @@ public class SciProject extends GenericOrganizationalUnit {
logger.debug("Static initalizer finished."); logger.debug("Static initalizer finished.");
} }
public enum MemberStatus {
ALL,
ACTIVE,
ASSOCIATED,
FORMER
}
public enum ProjectStatus {
ALL,
ONGOING,
FINISHED
}
public SciProject() { public SciProject() {
super(BASE_DATA_OBJECT_TYPE); super(BASE_DATA_OBJECT_TYPE);
} }
@ -187,10 +204,6 @@ public class SciProject extends GenericOrganizationalUnit {
remove(SUBPROJECTS, project); remove(SUBPROJECTS, project);
} }
public boolean hasSubProjects() {
return !this.getSubProjects().isEmpty();
}
public SciProjectOrganizationsCollection getOrganizations() { public SciProjectOrganizationsCollection getOrganizations() {
return new SciProjectOrganizationsCollection((DataCollection) get( return new SciProjectOrganizationsCollection((DataCollection) get(
ORGANIZATIONS)); ORGANIZATIONS));
@ -204,7 +217,7 @@ public class SciProject extends GenericOrganizationalUnit {
link.set(ORGANIZATIONS_ORDER, link.set(ORGANIZATIONS_ORDER,
Integer.valueOf((int) getOrganizations().size())); Integer.valueOf((int) getOrganizations().size()));
link.set(SciOrganization.PROJECT_ORDER, link.set(SciOrganization.PROJECT_ORDER,
Integer.valueOf((int) orga.getProjects().size())); Integer.valueOf((int) orga.getProjects().size()));
link.save(); link.save();
} }
@ -284,4 +297,200 @@ public class SciProject extends GenericOrganizationalUnit {
link.save(); 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;
}
} }

View File

@ -30,7 +30,6 @@ import com.arsdigita.cms.contenttypes.SciDepartmentProjectsCollection;
import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection; import com.arsdigita.cms.contenttypes.SciDepartmentSubDepartmentsCollection;
import com.arsdigita.cms.contenttypes.SciOrganizationConfig; import com.arsdigita.cms.contenttypes.SciOrganizationConfig;
import com.arsdigita.cms.contenttypes.SciProject; import com.arsdigita.cms.contenttypes.SciProject;
import com.arsdigita.persistence.DataCollection;
import com.arsdigita.xml.Element; import com.arsdigita.xml.Element;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList; 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_ONGOING = "projectsOngoing";
public static final String SHOW_PROJECTS_FINISHED = "projectsFinished"; public static final String SHOW_PROJECTS_FINISHED = "projectsFinished";
public static final String SHOW_PUBLICATIONS = "publications"; public static final String SHOW_PUBLICATIONS = "publications";
private boolean displayDescription; private boolean displayDescription = true;
private boolean displaySubDepartments; private boolean displaySubDepartments = true;
private boolean displayProjects; private boolean displayProjects = true;
private boolean displayPublications; private boolean displayPublications = true;
@Override @Override
protected String getDefaultForShowParam() { protected String getDefaultForShowParam() {
@ -101,69 +100,42 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
this.displaySubDepartments = displaySubDepartments; this.displaySubDepartments = displaySubDepartments;
} }
protected boolean hasMembers(final SciDepartment department, protected boolean hasMembers(final SciDepartment department) {
final List<String> filters) { return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
if (department.getPersons() != null) { SciDepartment.MemberStatus.ALL);
GenericOrganizationalUnitPersonCollection persons; }
persons = department.getPersons();
for (String filter : filters) { protected boolean hasActiveMembers(final SciDepartment department) {
persons.addFilter(filter); return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
} SciDepartment.MemberStatus.ACTIVE);
if (persons.size() > 0) { }
return true;
} protected boolean hasAssociatedMembers(final SciDepartment department) {
} return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
SciDepartment.MemberStatus.ASSOCIATED);
boolean hasMembers; }
hasMembers = false;
protected boolean hasFormerMembers(final SciDepartment department) {
if (SciDepartment.getConfig().getOrganizationMembersMerge()) { return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
SciDepartmentSubDepartmentsCollection subDepartments; SciDepartment.MemberStatus.FORMER);
subDepartments = department.getSubDepartments();
while (subDepartments.next()) {
SciDepartment subDepartment = subDepartments.getSubDepartment();
hasMembers = hasMembers(subDepartment, filters);
if (hasMembers) {
return true;
}
}
}
return false;
} }
protected boolean hasProjects(final SciDepartment department, protected boolean hasProjects(final SciDepartment department) {
final List<String> filters) { return department.hasProjects(SciDepartment.getConfig().
if (department.getProjects() != null) { getOrganizationProjectsMerge(),
SciDepartmentProjectsCollection projects; SciDepartment.ProjectStatus.ALL);
projects = department.getProjects(); }
for (String filter : filters) {
projects.addFilter(filter);
}
if (projects.size() > 0) {
return true;
}
}
boolean hasProjects; protected boolean hasOngoingProjects(final SciDepartment department) {
hasProjects = false; return department.hasProjects(SciDepartment.getConfig().
getOrganizationProjectsMerge(),
SciDepartment.ProjectStatus.ONGOING);
}
if (SciDepartment.getConfig().getOrganizationProjectsMerge()) { protected boolean hasFinishedProjects(final SciDepartment department) {
SciDepartmentSubDepartmentsCollection subDepartments; return department.hasProjects(SciDepartment.getConfig().
subDepartments = department.getSubDepartments(); getOrganizationProjectsMerge(),
SciDepartment.ProjectStatus.FINISHED);
while (subDepartments.next()) {
SciDepartment subDepartment = subDepartments.getSubDepartment();
hasProjects = hasProjects(subDepartment, filters);
if (hasProjects) {
return true;
}
}
}
return false;
} }
protected void generateSubDepartmentsXML(final SciDepartment department, protected void generateSubDepartmentsXML(final SciDepartment department,
@ -184,8 +156,8 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
pageNumber = normalizePageNumber(pageCount, pageNumber); pageNumber = normalizePageNumber(pageCount, pageNumber);
createPaginatorElement( createPaginatorElement(
parent, pageNumber, pageCount, begin, end, count, subDepartments. parent, pageNumber, pageCount, begin, end, count,
size()); subDepartments.size());
subDepartments.setRange((int) begin, (int) end); subDepartments.setRange((int) begin, (int) end);
while (subDepartments.next()) { while (subDepartments.next()) {
@ -194,7 +166,8 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
Element subDepartmentElem = subDepartmentsElem.newChildElement( Element subDepartmentElem = subDepartmentsElem.newChildElement(
"department"); "department");
subDepartmentElem.addAttribute("order", Integer.toString(subDepartments. subDepartmentElem.addAttribute("order",
Integer.toString(subDepartments.
getSubDepartmentOrder())); getSubDepartmentOrder()));
subDepartmentElem.addAttribute("oid", subDepartment.getOID(). subDepartmentElem.addAttribute("oid", subDepartment.getOID().
toString()); toString());
@ -452,58 +425,52 @@ public class SciDepartmentPanel extends SciOrganizationBasePanel {
&& displayDescription) { && displayDescription) {
availableData.newChildElement("description"); availableData.newChildElement("description");
} }
if ((department.getContacts() != null) if (department.hasContacts()
&& (department.getContacts().size() > 0)
&& isDisplayContacts()) { && isDisplayContacts()) {
availableData.newChildElement("contacts"); availableData.newChildElement("contacts");
} }
if ((department.getSubDepartments() != null) if (department.hasSubDepartments()
&& (department.getSubDepartments().size() > 0)
&& displaySubDepartments) { && displaySubDepartments) {
availableData.newChildElement("subDepartments"); availableData.newChildElement("subDepartments");
} }
if (config.getOrganizationMembersAllInOne()) { if (config.getOrganizationMembersAllInOne()) {
if (hasMembers(department, new LinkedList<String>()) if (hasMembers(department)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("members"); availableData.newChildElement("members");
} }
} else { } else {
if (hasMembers(department, getFiltersForActiveMembers()) if (hasActiveMembers(department)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("membersActive"); availableData.newChildElement("membersActive");
} }
if (hasMembers(department, getFiltersForAssociatedMembers()) if (hasAssociatedMembers(department)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("membersAssociated"); availableData.newChildElement("membersAssociated");
} }
if (hasMembers(department, getFiltersForFormerMembers()) if (hasFormerMembers(department)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("membersFormer"); availableData.newChildElement("membersFormer");
} }
} }
if (config.getOrganizationProjectsAllInOne()) { if (config.getOrganizationProjectsAllInOne()) {
if (hasProjects(department, new LinkedList<String>()) if (hasProjects(department)
&& displayProjects) { && displayProjects) {
availableData.newChildElement("projects"); availableData.newChildElement("projects");
} }
} else { } else {
if (hasProjects(department, getFiltersForOngoingProjects()) if (hasOngoingProjects(department)
&& displayProjects) { && displayProjects) {
availableData.newChildElement("projectsOngoing"); availableData.newChildElement("projectsOngoing");
} }
if (hasProjects(department, getFiltersForFinishedProjects()) if (hasFinishedProjects(department)
&& displayProjects) { && displayProjects) {
availableData.newChildElement("projectsFinished"); availableData.newChildElement("projectsFinished");
} }
} }
DataCollection publicationLinks = if (department.hasPublications()
RelatedLink.getRelatedLinks(department, && displayPublications) {
"SciDepartmentPublications");
if ((publicationLinks != null)
&& (publicationLinks.size() > 0)
&& displayPublications) {
availableData.newChildElement("publications"); availableData.newChildElement("publications");
} }
String show = getShowParam(state); String show = getShowParam(state);

View File

@ -102,30 +102,36 @@ public class SciDepartmentPropertiesStep
"sciorganization.ui.department.contacts")); "sciorganization.ui.department.contacts"));
} }
/*
if (!config.getDepartmentAddPersonHide()) { if (!config.getDepartmentAddPersonHide()) {
addStep(new SciDepartmentMemberStep(itemModel, addStep(new SciDepartmentMemberStep(itemModel,
parent), parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.department.members")); "sciorganization.ui.department.members"));
} }
*/
/*
if (!config.getDepartmentAddSubDepartmentHide()) { if (!config.getDepartmentAddSubDepartmentHide()) {
addStep(new SciDepartmentSubDepartmentsStep(itemModel, parent), addStep(new SciDepartmentSubDepartmentsStep(itemModel, parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.department.subdepartments")); "sciorganization.ui.department.subdepartments"));
} }
*/
if (!config.getDepartmentSetSuperDepartmentHide()) { if (!config.getDepartmentSetSuperDepartmentHide()) {
addStep(new SciDepartmentSuperDepartmentStep(itemModel, parent), addStep(new SciDepartmentSuperDepartmentStep(itemModel, parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.department.superdepartment")); "sciorganization.ui.department.superdepartment"));
} }
/*
if (!config.getDepartmentAddProjectHide()) { if (!config.getDepartmentAddProjectHide()) {
addStep(new SciDepartmentProjectsStep(itemModel, parent), addStep(new SciDepartmentProjectsStep(itemModel, parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.department.projects")); "sciorganization.ui.department.projects"));
} }
*/
if (!config.getDepartmentSetOrganizationHide()) { if (!config.getDepartmentSetOrganizationHide()) {
addStep(new SciDepartmentOrganizationStep(itemModel, parent), addStep(new SciDepartmentOrganizationStep(itemModel, parent),
@ -133,6 +139,7 @@ public class SciDepartmentPropertiesStep
"sciorganization.ui.department.organization")); "sciorganization.ui.department.organization"));
} }
/*
ContentTypeCollection contentTypes = ContentType.getAllContentTypes(); ContentTypeCollection contentTypes = ContentType.getAllContentTypes();
contentTypes.addFilter("associatedObjectType = :type").set( contentTypes.addFilter("associatedObjectType = :type").set(
"type", "type",
@ -143,10 +150,10 @@ public class SciDepartmentPropertiesStep
* Must add this step manually since the basic class is not * Must add this step manually since the basic class is not
* SimpleEditStep... * SimpleEditStep...
*/ */
getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil. /* getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
globalize("sciorganization.ui.department.publications")), globalize("sciorganization.ui.department.publications")),
new SciDepartmentPublicationsStep( new SciDepartmentPublicationsStep(
itemModel, parent)); itemModel, parent));
} }*/
} }
} }

View File

@ -100,144 +100,40 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
this.displayProjects = displayProjects; this.displayProjects = displayProjects;
} }
/** protected boolean hasMembers(final SciOrganization orga) {
* return orga.hasMembers(true, SciOrganization.MemberStatus.ALL);
* @param orga
* @param filters
* @return
*/
protected boolean hasMembers(final SciOrganization orga,
final List<String> 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 SciDepartment department, protected boolean hasActiveMembers(final SciOrganization orga) {
final List<String> filters) { return orga.hasMembers(true, SciOrganization.MemberStatus.ACTIVE);
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 hasAssociatedMembers(final SciOrganization orga) {
* return orga.hasMembers(true, SciOrganization.MemberStatus.ASSOCIATED);
* @param orga
* @param filters
* @return
*/
protected boolean hasProjects(final SciOrganization orga,
final List<String> 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 hasProjects(final SciDepartment department, protected boolean hasFormerMembers(final SciOrganization orga) {
final List<String> filters) { return orga.hasMembers(true, SciOrganization.MemberStatus.FORMER);
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 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, protected void generateDepartmentsXML(final SciOrganization orga,
final Element parent, final Element parent,
final PageState state) { final PageState state) {
@ -473,11 +369,11 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
pageNumber = normalizePageNumber(pageCount, pageNumber); pageNumber = normalizePageNumber(pageCount, pageNumber);
createPaginatorElement( createPaginatorElement(
parent, pageNumber, pageCount, begin, end, count, projectsWithoutDoubles. parent, pageNumber, pageCount, begin, end, count,
size()); projectsWithoutDoubles.size());
List<SciProject> projectsWithoutDoublesToShow = projectsWithoutDoubles. List<SciProject> projectsWithoutDoublesToShow =
subList((int) begin, projectsWithoutDoubles.subList((int) begin,
(int) end); (int) end);
Element projectsWithoutDoublesElem = parent.newChildElement( Element projectsWithoutDoublesElem = parent.newChildElement(
"projects"); "projects");
@ -541,58 +437,52 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
&& displayDescription) { && displayDescription) {
availableData.newChildElement("description"); availableData.newChildElement("description");
} }
if ((orga.getContacts() != null) if (orga.hasContacts()
&& (orga.getContacts().size() > 0)
&& isDisplayContacts()) { && isDisplayContacts()) {
availableData.newChildElement("contacts"); availableData.newChildElement("contacts");
} }
if ((orga.getDepartments() != null) if (orga.hasDepartments()
&& (orga.getDepartments().size() > 0)
&& displayDepartments) { && displayDepartments) {
availableData.newChildElement("departments"); availableData.newChildElement("departments");
} }
if (config.getOrganizationMembersAllInOne()) { if (config.getOrganizationMembersAllInOne()) {
if (hasMembers(orga, new LinkedList<String>()) if (hasMembers(orga)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("members"); availableData.newChildElement("members");
} }
} else { } else {
if (hasMembers(orga, getFiltersForActiveMembers()) if (hasActiveMembers(orga)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("membersActive"); availableData.newChildElement("membersActive");
} }
if (hasMembers(orga, getFiltersForAssociatedMembers()) if (hasAssociatedMembers(orga)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("membersAssociated"); availableData.newChildElement("membersAssociated");
} }
if (hasMembers(orga, getFiltersForFormerMembers()) if (hasFormerMembers(orga)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("membersFormer"); availableData.newChildElement("membersFormer");
} }
} }
if (config.getOrganizationProjectsAllInOne()) { if (config.getOrganizationProjectsAllInOne()) {
if (hasProjects(orga, new LinkedList<String>()) if (hasProjects(orga)
&& displayProjects) { && displayProjects) {
availableData.newChildElement("projects"); availableData.newChildElement("projects");
} }
} else { } else {
if (hasProjects(orga, getFiltersForOngoingProjects()) if (hasOngoingProjects(orga)
&& displayProjects) { && displayProjects) {
availableData.newChildElement("projectsOngoing"); availableData.newChildElement("projectsOngoing");
} }
if (hasProjects(orga, getFiltersForFinishedProjects()) if (hasFinishedProjects(orga)
&& displayProjects) { && displayProjects) {
availableData.newChildElement("projectsFinished"); availableData.newChildElement("projectsFinished");
} }
} }
DataCollection publicationLinks = if (orga.hasPublications()
RelatedLink.getRelatedLinks(orga, && displayPublications) {
"SciOrganizationPublications");
if ((publicationLinks != null)
&& (publicationLinks.size() > 0)
&& displayPublications) {
availableData.newChildElement("publications"); availableData.newChildElement("publications");
} }
String show = getShowParam(state); String show = getShowParam(state);

View File

@ -86,6 +86,7 @@ public class SciOrganizationPropertiesStep
"sciorganization.ui.organization.contacts")); "sciorganization.ui.organization.contacts"));
} }
/* This steps are now separate steps in the left box.
if (!config.getOrganizationAddPersonHide()) { if (!config.getOrganizationAddPersonHide()) {
addStep(new SciOrganizationMemberStep(itemModel, addStep(new SciOrganizationMemberStep(itemModel,
parent), parent),
@ -103,7 +104,7 @@ public class SciOrganizationPropertiesStep
addStep(new SciOrganizationProjectsStep(itemModel, parent), addStep(new SciOrganizationProjectsStep(itemModel, parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.organization.projects")); "sciorganization.ui.organization.projects"));
} }*/
} }
public static Component getSciOrganizationPropertySheet( public static Component getSciOrganizationPropertySheet(

View File

@ -82,54 +82,34 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
this.displaySubProjects = displaySubProjects; this.displaySubProjects = displaySubProjects;
} }
protected boolean hasMembers(final SciProject project, protected boolean hasMembers(final SciProject project) {
final List<String> filters) { return project.hasMembers(SciProject.getConfig().
if (project.getPersons() != null) { getOrganizationMembersMerge(),
GenericOrganizationalUnitPersonCollection persons; SciProject.MemberStatus.ALL);
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 hasSubProjects(final SciProject project, protected boolean hasActiveMembers(final SciProject project) {
final List<String> filters) { return project.hasMembers(SciProject.getConfig().
if (project.getSubProjects() != null) { getOrganizationMembersMerge(),
SciProject.MemberStatus.ACTIVE);
SciProjectSubProjectsCollection subProjects;
subProjects = project.getSubProjects();
for (String filter : filters) {
subProjects.addFilter(filter);
}
if (subProjects.size() > 0) {
return true;
}
}
return false;
} }
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, protected void generateSubProjectsXML(final SciProject project,
final Element parent, final Element parent,
final PageState state, final PageState state,
@ -151,8 +131,8 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
long end = getPaginatorEnd(begin, count); long end = getPaginatorEnd(begin, count);
pageNumber = normalizePageNumber(pageCount, pageNumber); pageNumber = normalizePageNumber(pageCount, pageNumber);
createPaginatorElement(parent, pageNumber, pageCount, begin, end, count, subProjects. createPaginatorElement(parent, pageNumber, pageCount, begin, end, count,
size()); subProjects.size());
subProjects.setRange((int) begin, (int) end); subProjects.setRange((int) begin, (int) end);
@ -237,43 +217,37 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
&& displayDescription) { && displayDescription) {
availableData.newChildElement("description"); availableData.newChildElement("description");
} }
if ((project.getContacts() != null) if (project.hasContacts()
&& (project.getContacts().size() > 0)
&& isDisplayContacts()) { && isDisplayContacts()) {
availableData.newChildElement("contacts"); availableData.newChildElement("contacts");
} }
if ((project.getSubProjects() != null) if (hasSubProjects(project)
&& (project.getSubProjects().size() > 0)
&& displaySubProjects) { && displaySubProjects) {
availableData.newChildElement("subProjects"); availableData.newChildElement("subProjects");
} }
if (config.getProjectMembersAllInOne()) { if (config.getProjectMembersAllInOne()) {
if (hasMembers(project, new LinkedList<String>()) if (hasMembers(project)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("members"); availableData.newChildElement("members");
} }
} else { } else {
if (hasMembers(project, getFiltersForActiveMembers()) if (hasActiveMembers(project)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("activeMembers"); availableData.newChildElement("activeMembers");
} }
if (hasMembers(project, getFiltersForAssociatedMembers()) if (hasAssociatedMembers(project)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("associatedMembers"); availableData.newChildElement("associatedMembers");
} }
if (hasMembers(project, getFiltersForFormerMembers()) if (hasFormerMembers(project)
&& isDisplayMembers()) { && isDisplayMembers()) {
availableData.newChildElement("formerMembers"); availableData.newChildElement("formerMembers");
} }
} }
DataCollection publicationLinks = if (project.hasPublications()
RelatedLink.getRelatedLinks(project, && displayPublications) {
"SciProjectPublications");
if ((publicationLinks != null)
&& (publicationLinks.size() > 0)
&& displayPublications) {
availableData.newChildElement("publications"); availableData.newChildElement("publications");
} }
String show = getShowParam(state); String show = getShowParam(state);

View File

@ -139,12 +139,12 @@ public class SciProjectPropertiesStep
"sciorganization.ui.project.contacts")); "sciorganization.ui.project.contacts"));
} }
if (!config.getProjectAddPersonHide()) { /* if (!config.getProjectAddPersonHide()) {
addStep(new SciProjectMemberStep(itemModel, addStep(new SciProjectMemberStep(itemModel,
parent), parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.members")); "sciorganization.ui.project.members"));
} }*/
if (!config.getProjectSetSuperProjectHide()) { if (!config.getProjectSetSuperProjectHide()) {
addStep(new SciProjectSuperProjectStep(itemModel, addStep(new SciProjectSuperProjectStep(itemModel,
@ -153,12 +153,12 @@ public class SciProjectPropertiesStep
"sciorganization.ui.project.superproject")); "sciorganization.ui.project.superproject"));
} }
if (!config.getProjectAddSubProjectHide()) { /* if (!config.getProjectAddSubProjectHide()) {
addStep(new SciProjectSubprojectsStep(itemModel, addStep(new SciProjectSubprojectsStep(itemModel,
parent), parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.subprojects")); "sciorganization.ui.project.subprojects"));
} }*/
if (!config.getProjectAddOrganizationHide()) { if (!config.getProjectAddOrganizationHide()) {
addStep(new SciProjectOrganizationsStep(itemModel, parent), addStep(new SciProjectOrganizationsStep(itemModel, parent),
@ -166,7 +166,7 @@ public class SciProjectPropertiesStep
"sciorganization.ui.project.organizations")); "sciorganization.ui.project.organizations"));
} }
if (!config.getProjectAddDepartmentHide()) { /*if (!config.getProjectAddDepartmentHide()) {
addStep(new SciProjectDepartmentsStep(itemModel, parent), addStep(new SciProjectDepartmentsStep(itemModel, parent),
SciOrganizationGlobalizationUtil.globalize( SciOrganizationGlobalizationUtil.globalize(
"sciorganization.ui.project.departments")); "sciorganization.ui.project.departments"));
@ -182,10 +182,10 @@ public class SciProjectPropertiesStep
* Must add this step manually since the basic class is not * Must add this step manually since the basic class is not
* SimpleEditStep... * SimpleEditStep...
*/ */
getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil. /* getSegmentedPanel().addSegment(new Label(SciOrganizationGlobalizationUtil.
globalize("sciorganization.ui.project.publications")), globalize("sciorganization.ui.project.publications")),
new SciProjectPublicationsStep( new SciProjectPublicationsStep(
itemModel, parent)); itemModel, parent));
} }*/
} }
} }

View File

@ -29,7 +29,7 @@
todir="${app.server.shared.dir}/endorsed" preservelastmodified="true"/> todir="${app.server.shared.dir}/endorsed" preservelastmodified="true"/>
<copy file="tools-ng/devel/lib/ojdbc14.jar" <copy file="tools-ng/devel/lib/ojdbc14.jar"
todir="${app.server.shared.dir}" preservelastmodified="true"/> todir="${app.server.shared.dir}" preservelastmodified="true"/>
<copy file="tools-ng/devel/lib/postgresql-jdbc-8.2.506.jar" <copy file="tools-ng/devel/lib/postgresql-jdbc.jar"
todir="${app.server.shared.dir}" preservelastmodified="true"/> todir="${app.server.shared.dir}" preservelastmodified="true"/>
</target> </target>