- 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-94f89814c4dfmaster
parent
2e3535c491
commit
0e77a923bb
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,15 @@
|
|||
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:authoring-kit>
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -37,3 +37,129 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,3 +29,91 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
@ -20,13 +20,40 @@
|
|||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<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"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.department.description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciDepartmentDescriptionStep"
|
||||
ordering="2"/>
|
||||
|
||||
ordering="6"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,12 +20,33 @@
|
|||
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<ctd:authoring-step
|
||||
labelKey="sciorganization.ui.organization_members"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.organization_members.title.description"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciOrganizationMemberStep"
|
||||
ordering="2"/>
|
||||
|
||||
<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-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: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="2"/>
|
||||
ordering="5"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,12 +20,41 @@
|
|||
component="com.arsdigita.cms.contenttypes.ui.SciProjectPropertiesStep"
|
||||
ordering="1"/>
|
||||
|
||||
<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"
|
||||
labelBundle="com.arsdigita.cms.contenttypes.ui.SciOrganizationResources"
|
||||
descriptionKey="sciorganization.ui.project_description.title"
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectDescriptionStep"
|
||||
ordering="2"/>
|
||||
component="com.arsdigita.cms.contenttypes.ui.SciProjectPublicationsStep"
|
||||
ordering="6"/>
|
||||
|
||||
<ctd:include href="/WEB-INF/content-types/assign-categories-step.xml"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
@ -167,7 +520,4 @@ public class SciOrganization extends GenericOrganizationalUnit {
|
|||
remove(PROJECTS, project);
|
||||
}
|
||||
|
||||
public boolean hasProjects() {
|
||||
return !this.getProjects().isEmpty();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<String> filters) {
|
||||
if (department.getPersons() != null) {
|
||||
GenericOrganizationalUnitPersonCollection persons;
|
||||
persons = department.getPersons();
|
||||
for (String filter : filters) {
|
||||
persons.addFilter(filter);
|
||||
}
|
||||
if (persons.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
protected boolean hasMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.ALL);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
protected boolean hasActiveMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.ACTIVE);
|
||||
}
|
||||
|
||||
return false;
|
||||
protected boolean hasAssociatedMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.ASSOCIATED);
|
||||
}
|
||||
|
||||
protected boolean hasProjects(final SciDepartment department,
|
||||
final List<String> 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 hasFormerMembers(final SciDepartment department) {
|
||||
return department.hasMembers(SciDepartment.getConfig().getOrganizationMembersMerge(),
|
||||
SciDepartment.MemberStatus.FORMER);
|
||||
}
|
||||
|
||||
boolean hasProjects;
|
||||
hasProjects = false;
|
||||
|
||||
if (SciDepartment.getConfig().getOrganizationProjectsMerge()) {
|
||||
SciDepartmentSubDepartmentsCollection subDepartments;
|
||||
subDepartments = department.getSubDepartments();
|
||||
|
||||
while (subDepartments.next()) {
|
||||
SciDepartment subDepartment = subDepartments.getSubDepartment();
|
||||
|
||||
hasProjects = hasProjects(subDepartment, filters);
|
||||
if (hasProjects) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
protected boolean hasProjects(final SciDepartment department) {
|
||||
return department.hasProjects(SciDepartment.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciDepartment.ProjectStatus.ALL);
|
||||
}
|
||||
|
||||
return false;
|
||||
protected boolean hasOngoingProjects(final SciDepartment department) {
|
||||
return department.hasProjects(SciDepartment.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciDepartment.ProjectStatus.ONGOING);
|
||||
}
|
||||
|
||||
protected boolean hasFinishedProjects(final SciDepartment department) {
|
||||
return department.hasProjects(SciDepartment.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciDepartment.ProjectStatus.FINISHED);
|
||||
}
|
||||
|
||||
protected void generateSubDepartmentsXML(final SciDepartment department,
|
||||
|
|
@ -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,55 +425,49 @@ 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<String>())
|
||||
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<String>())
|
||||
if (hasProjects(department)
|
||||
&& displayProjects) {
|
||||
availableData.newChildElement("projects");
|
||||
}
|
||||
} else {
|
||||
if (hasProjects(department, getFiltersForOngoingProjects())
|
||||
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)
|
||||
if (department.hasPublications()
|
||||
&& displayPublications) {
|
||||
availableData.newChildElement("publications");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,18 +102,22 @@ 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),
|
||||
|
|
@ -121,11 +125,13 @@ public class SciDepartmentPropertiesStep
|
|||
"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));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -100,142 +100,38 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
|||
this.displayProjects = displayProjects;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
protected boolean hasMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.ALL);
|
||||
}
|
||||
|
||||
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 hasActiveMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.ACTIVE);
|
||||
}
|
||||
|
||||
protected boolean hasMembers(final SciDepartment department,
|
||||
final List<String> 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;
|
||||
}
|
||||
}
|
||||
protected boolean hasAssociatedMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.ASSOCIATED);
|
||||
}
|
||||
|
||||
return false;
|
||||
protected boolean hasFormerMembers(final SciOrganization orga) {
|
||||
return orga.hasMembers(true, SciOrganization.MemberStatus.FORMER);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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;
|
||||
}
|
||||
protected boolean hasProjects(final SciOrganization orga) {
|
||||
return orga.hasProjects(SciOrganization.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciOrganization.ProjectStatus.ALL);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
protected boolean hasOngoingProjects(final SciOrganization orga) {
|
||||
return orga.hasProjects(SciOrganization.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciOrganization.ProjectStatus.ONGOING);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected boolean hasProjects(final SciDepartment department,
|
||||
final List<String> 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 hasFinishedProjects(final SciOrganization orga) {
|
||||
return orga.hasProjects(SciOrganization.getConfig().
|
||||
getOrganizationProjectsMerge(),
|
||||
SciOrganization.ProjectStatus.FINISHED);
|
||||
}
|
||||
|
||||
protected void generateDepartmentsXML(final SciOrganization orga,
|
||||
|
|
@ -473,10 +369,10 @@ public class SciOrganizationPanel extends SciOrganizationBasePanel {
|
|||
pageNumber = normalizePageNumber(pageCount, pageNumber);
|
||||
|
||||
createPaginatorElement(
|
||||
parent, pageNumber, pageCount, begin, end, count, projectsWithoutDoubles.
|
||||
size());
|
||||
List<SciProject> projectsWithoutDoublesToShow = projectsWithoutDoubles.
|
||||
subList((int) begin,
|
||||
parent, pageNumber, pageCount, begin, end, count,
|
||||
projectsWithoutDoubles.size());
|
||||
List<SciProject> projectsWithoutDoublesToShow =
|
||||
projectsWithoutDoubles.subList((int) begin,
|
||||
(int) end);
|
||||
|
||||
Element projectsWithoutDoublesElem = parent.newChildElement(
|
||||
|
|
@ -541,55 +437,49 @@ 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<String>())
|
||||
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<String>())
|
||||
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)
|
||||
if (orga.hasPublications()
|
||||
&& displayPublications) {
|
||||
availableData.newChildElement("publications");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -82,52 +82,32 @@ public class SciProjectPanel extends SciOrganizationBasePanel {
|
|||
this.displaySubProjects = displaySubProjects;
|
||||
}
|
||||
|
||||
protected boolean hasMembers(final SciProject project,
|
||||
final List<String> filters) {
|
||||
if (project.getPersons() != null) {
|
||||
GenericOrganizationalUnitPersonCollection persons;
|
||||
persons = project.getPersons();
|
||||
for (String filter : filters) {
|
||||
persons.addFilter(filter);
|
||||
}
|
||||
if (persons.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
protected boolean hasMembers(final SciProject project) {
|
||||
return project.hasMembers(SciProject.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciProject.MemberStatus.ALL);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
protected boolean hasActiveMembers(final SciProject project) {
|
||||
return project.hasMembers(SciProject.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciProject.MemberStatus.ACTIVE);
|
||||
}
|
||||
|
||||
return false;
|
||||
protected boolean hasAssociatedMembers(final SciProject project) {
|
||||
return project.hasMembers(SciProject.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciProject.MemberStatus.ASSOCIATED);
|
||||
}
|
||||
|
||||
protected boolean hasSubProjects(final SciProject project,
|
||||
final List<String> filters) {
|
||||
if (project.getSubProjects() != null) {
|
||||
protected boolean hasFormerMembers(final SciProject project) {
|
||||
return project.hasMembers(SciProject.getConfig().
|
||||
getOrganizationMembersMerge(),
|
||||
SciProject.MemberStatus.FORMER);
|
||||
}
|
||||
|
||||
SciProjectSubProjectsCollection subProjects;
|
||||
subProjects = project.getSubProjects();
|
||||
for (String filter : filters) {
|
||||
subProjects.addFilter(filter);
|
||||
}
|
||||
if (subProjects.size() > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
protected boolean hasSubProjects(final SciProject project) {
|
||||
return project.hasSubProjects();
|
||||
}
|
||||
|
||||
protected void generateSubProjectsXML(final SciProject project,
|
||||
|
|
@ -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,40 +217,34 @@ 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<String>())
|
||||
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)
|
||||
if (project.hasPublications()
|
||||
&& displayPublications) {
|
||||
availableData.newChildElement("publications");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
}*/
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -29,7 +29,7 @@
|
|||
todir="${app.server.shared.dir}/endorsed" preservelastmodified="true"/>
|
||||
<copy file="tools-ng/devel/lib/ojdbc14.jar"
|
||||
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"/>
|
||||
</target>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue