From 79c52a2665c8fa56ba1a04917026a8ae13f0d62d Mon Sep 17 00:00:00 2001 From: jensp Date: Sun, 23 Oct 2011 13:47:51 +0000 Subject: [PATCH] =?UTF-8?q?SciProject:=20AuthoringStep=20und=20Anzeige=20i?= =?UTF-8?q?m=20ProjectSummaryTab=20f=C3=BCr=20an=20einem=20Projekt=20betei?= =?UTF-8?q?ligte=20Organisationen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://svn.libreccm.org/ccm/trunk@1192 8810af33-2d31-482b-a856-94f89814c4df --- .../cms/contenttypes/SciProjectConfig.java | 60 +++++--- .../SciProjectConfig_parameter.properties | 5 + .../contenttypes/SciProjectInitializer.java | 56 +++++--- .../SciProjectInvolvedOrganizationsStep.java | 135 ++++++++++++++++++ .../ui/SciProjectResources.properties | 17 +++ .../ui/SciProjectResources_de.properties | 17 +++ .../contenttypes/ui/SciProjectSummaryTab.java | 70 ++++++++- .../ui/SciProjectSuperProjectsStep.java | 2 +- 8 files changed, 316 insertions(+), 46 deletions(-) create mode 100644 ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectInvolvedOrganizationsStep.java diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java index cf4e1fcd9..6f356c640 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig.java @@ -16,6 +16,7 @@ public class SciProjectConfig extends AbstractConfig { private final Parameter enableSubProjectsStep; private final Parameter enableSuperProjectsStep; + private final Parameter enableInvolvedOrgasStep; private final Parameter shortDescMaxLength; private final Parameter enableDescriptionDhtml; private final Parameter enableMembersAllInOne; @@ -41,6 +42,12 @@ public class SciProjectConfig extends AbstractConfig { Parameter.REQUIRED, Boolean.TRUE); + enableInvolvedOrgasStep = + new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step", + Parameter.REQUIRED, + Boolean.TRUE); + shortDescMaxLength = new IntegerParameter( "com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length", Parameter.REQUIRED, @@ -67,41 +74,46 @@ public class SciProjectConfig extends AbstractConfig { "com.arsdigita.cms.contenttypes.sciproject.enable_funding", Parameter.REQUIRED, Boolean.TRUE); - + enableFundingDhtml = new BooleanParameter( "com.arsdigita.cms.contenttypes.sciproject.enable_funding_dhtml", Parameter.REQUIRED, Boolean.TRUE); - - enableFundingVolume = new BooleanParameter( - "com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume", - Parameter.REQUIRED, + + enableFundingVolume = + new BooleanParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_funding_volume", + Parameter.REQUIRED, Boolean.TRUE); - - fundingVolumeLength = new IntegerParameter( - "com.arsdigita.cms.contenttypes.sciproject.enable_funding_length", - Parameter.REQUIRED, + + fundingVolumeLength = + new IntegerParameter( + "com.arsdigita.cms.contenttypes.sciproject.enable_funding_length", + Parameter.REQUIRED, 128); - - permittedPersonType = new StringParameter( + + permittedPersonType = + new StringParameter( "com.arsdigita.cms.contenttypes.sciproject.permitted_person_type", Parameter.REQUIRED, "com.arsdigita.cms.contenttypes.GenericPerson"); - - tabs = new StringParameter( + + tabs = + new StringParameter( "com.arsdigita.cms.contenttypes.sciproject.tabs", Parameter.REQUIRED, "summary:com.arsdigita.cms.contenttypes.ui.SciProjectSummaryTab;desc:com.arsdigita.cms.contenttypes.ui.SciProjectDescTab"); register(enableSubProjectsStep); register(enableSuperProjectsStep); + register(enableInvolvedOrgasStep); register(shortDescMaxLength); register(enableDescriptionDhtml); register(enableMembersAllInOne); register(enableMembersMerge); register(enableFunding); register(enableFundingDhtml); - register(enableFundingVolume); + register(enableFundingVolume); register(fundingVolumeLength); register(permittedPersonType); register(tabs); @@ -117,6 +129,10 @@ public class SciProjectConfig extends AbstractConfig { return (Boolean) get(enableSuperProjectsStep); } + public final boolean getEnableInvolvedOrgasStep() { + return (Boolean) get(enableInvolvedOrgasStep); + } + public final int getShortDescMaxLength() { return (Integer) get(shortDescMaxLength); } @@ -132,29 +148,29 @@ public class SciProjectConfig extends AbstractConfig { public final boolean getEnableMembersMerge() { return (Boolean) get(enableMembersMerge); } - + public final boolean getEnableFunding() { - return (Boolean) get(enableFunding); + return (Boolean) get(enableFunding); } - + public final boolean getEnableFundingDhtml() { - return (Boolean) get(enableFundingDhtml); + return (Boolean) get(enableFundingDhtml); } - + public final boolean getEnableFundingVolume() { Object value = get(enableFundingVolume); return (Boolean) value; //return (Boolean) get(enableFundingVolume); } - + public final int getFundingVolumeLength() { return (Integer) get(fundingVolumeLength); } - + public final String getPermittedPersonType() { return (String) get(permittedPersonType); } - + public final String getTabs() { return (String) get(tabs); } diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties index e7e7a8960..cf0815682 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectConfig_parameter.properties @@ -8,6 +8,11 @@ com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.purpose = E com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.exampe = false com.arsdigita.cms.contenttypes.sciproject.enable_super_projects_step.format = [Boolean] +com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step.title = Show involved organizations step? +com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step.purpose = Enables authoring step form managing organizations involved with the project +com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step.example = true +com.arsdigita.cms.contenttypes.sciproject.enable_involved_orgas_step.format = [Boolean] + com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length.title = Short description maximum length com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length.purpose = Maximum length for the short description of a SciProject item in characters. com.arsdigita.cms.contenttypes.sciproject.shortdesc.max_length.example = 500 diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java index 2f1d2affc..5f4501fbb 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/SciProjectInitializer.java @@ -1,6 +1,7 @@ package com.arsdigita.cms.contenttypes; import com.arsdigita.cms.contenttypes.ui.SciProjectGlobalizationUtil; +import com.arsdigita.cms.contenttypes.ui.SciProjectInvolvedOrganizationsStep; import com.arsdigita.cms.contenttypes.ui.SciProjectSubProjectsStep; import com.arsdigita.cms.contenttypes.ui.SciProjectSuperProjectsStep; import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; @@ -12,42 +13,59 @@ import com.arsdigita.runtime.DomainInitEvent; * @version $Id$ */ public class SciProjectInitializer extends ContentTypeInitializer { - + public SciProjectInitializer() { super("ccm-sci-types-project.pdl.mf", SciProject.BASE_DATA_OBJECT_TYPE); } - + @Override public void init(final DomainInitEvent event) { super.init(event); - + final SciProjectConfig config = SciProject.getConfig(); - + if (config.getEnableSubProjectsStep()) { - AuthoringKitWizard.registerAssetStep(SciProject.BASE_DATA_OBJECT_TYPE, - SciProjectSubProjectsStep.class, - SciProjectGlobalizationUtil.globalize("sciproject.ui.subprojects.title"), - SciProjectGlobalizationUtil.globalize("sciproject.ui.subprojects.description"), + AuthoringKitWizard.registerAssetStep( + SciProject.BASE_DATA_OBJECT_TYPE, + SciProjectSubProjectsStep.class, + SciProjectGlobalizationUtil. + globalize("sciproject.ui.subprojects.title"), + SciProjectGlobalizationUtil. + globalize("sciproject.ui.subprojects.description"), 10); } - + if (config.getEnableSuperProjectsStep()) { - AuthoringKitWizard.registerAssetStep(SciProject.BASE_DATA_OBJECT_TYPE, - SciProjectSuperProjectsStep.class, - SciProjectGlobalizationUtil.globalize("sciproject.ui.superprojects.title"), - SciProjectGlobalizationUtil.globalize("sciproject.ui.superprojects.description"), - 10); + AuthoringKitWizard.registerAssetStep( + SciProject.BASE_DATA_OBJECT_TYPE, + SciProjectSuperProjectsStep.class, + SciProjectGlobalizationUtil. + globalize("sciproject.ui.superprojects.title"), + SciProjectGlobalizationUtil. + globalize("sciproject.ui.superprojects.description"), + 20); + } + + if (config.getEnableInvolvedOrgasStep()) { + AuthoringKitWizard.registerAssetStep( + SciProject.BASE_DATA_OBJECT_TYPE, + SciProjectInvolvedOrganizationsStep.class, + SciProjectGlobalizationUtil. + globalize("sciproject.ui.involved_orgas.title"), + SciProjectGlobalizationUtil. + globalize("sciproject.ui.involved_orgas.description"), + 30); } } - + @Override public String[] getStylesheets() { - return new String[] { - "/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl" - }; + return new String[]{ + "/static/content-types/com/arsdigita/cms/contenttypes/SciProject.xsl" + }; } - + @Override public String getTraversalXML() { return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contenttypes/SciProject.xml"; diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectInvolvedOrganizationsStep.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectInvolvedOrganizationsStep.java new file mode 100644 index 000000000..4cd7d9c91 --- /dev/null +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectInvolvedOrganizationsStep.java @@ -0,0 +1,135 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; +import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; +import com.arsdigita.cms.ui.authoring.BasicItemForm; +import com.arsdigita.cms.ui.authoring.SimpleEditStep; +import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; + +/** + * + * @author Jens Pelzetter + * @version $Id$ + */ +public class SciProjectInvolvedOrganizationsStep extends SimpleEditStep { + + private final static String ADD_INVOLVED_ORGANIZATION_STEP = + "SciProjectAddInvolvedOrganization"; + public final static String ASSOC_TYPE = "InvolvedOrganization"; + + public SciProjectInvolvedOrganizationsStep( + final ItemSelectionModel itemModel, + final AuthoringKitWizard parent) { + this(itemModel, parent, null); + } + + public SciProjectInvolvedOrganizationsStep( + final ItemSelectionModel itemModel, + final AuthoringKitWizard parent, + final String prefix) { + super(itemModel, parent, prefix); + + final BasicItemForm addInvolvedOrgaSheet = + new GenericOrganizationalUnitSuperiorOrgaUnitAddForm( + itemModel, + new GenericOrgaUnitSuperiorOrgaUnitAddFormCustomizer() { + + public String getSelectSuperiorOrgaUnitLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.select").localize(); + } + + public String getSuperiorOrgaUnitType() { + return GenericOrganizationalUnit.class.getName(); + } + + public String getAssocType() { + return ASSOC_TYPE; + } + + public String getNothingSelectedMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.select.nothing").localize(); + } + + public String getNoSuitableLanguageVariantMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.no_suitable_language_variant").localize(); + } + + public String getAddingToItselfMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.adding_to_itself").localize(); + } + + public String getAlreadyAddedMessage() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.already_added").localize(); + } + }); + add(ADD_INVOLVED_ORGANIZATION_STEP, + (String) SciProjectGlobalizationUtil.globalize("sciproject.ui.involved_orgas.add").localize(), + new WorkflowLockedComponentAccess(addInvolvedOrgaSheet, itemModel), + addInvolvedOrgaSheet.getSaveCancelSection().getCancelButton()); + + final GenericOrganizationalUnitSuperiorOrgaUnitsTable involvedTable = new GenericOrganizationalUnitSuperiorOrgaUnitsTable( + itemModel, new GenericOrgaUnitSuperiorOrgaUnitsTableCustomizer() { + + public String getEmptyViewLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.empty_view").localize(); + } + + public String getNameColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas..columns.name").localize(); + } + + public String getDeleteColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.columns.delete").localize(); + } + + public String getUpColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.columns.up").localize(); + } + + public String getDownColumnLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.columns.down").localize(); + } + + public String getDeleteLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.delete").localize(); + } + + public String getUpLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.up").localize(); + } + + public String getDownLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.down").localize(); + } + + public String getConfirmRemoveLabel() { + return (String) SciProjectGlobalizationUtil.globalize( + "sciproject.ui.involved_orgas.delete.confirm").localize(); + } + + public String getAssocType() { + return ASSOC_TYPE; + } + }); + + setDisplayComponent(involvedTable); + } +} diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties index db0d3a58a..6724ad605 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources.properties @@ -66,3 +66,20 @@ sciorganization.ui.project.members=Members sciorganization.ui.project_description.title=Description sciproject.ui.edit_basic_sheet=Edit basic properties sciproject.ui.members.add=Add member +sciproject.ui.involved_orgas.select=Select involved organization +sciproject.ui.involved_orgas.select.nothing=No organization selected +sciproject.ui.involved_orgas.no_suitable_language_variant=The selected organization item has no suitable language variant +sciproject.ui.involved_orgas.adding_to_itself=It is not possible to add a project to itself as involved organization. +sciproject.ui.involved_orgas.already_added=The selected organization has already been added to this project as an involved organization. +sciproject.ui.involved_orgas.add=Add involved organization +sciproject.ui.involved_orgas.empty_view=No involved organizations found +sciproject.ui.involved_orgas..columns.name=Name of the organisation +sciproject.ui.involved_orgas.columns.delete=Remove +sciproject.ui.involved_orgas.columns.up=Up +sciproject.ui.involved_orgas.columns.down=Down +sciproject.ui.involved_orgas.delete=Remove +sciproject.ui.involved_orgas.up=Up +sciproject.ui.involved_orgas.down=Down +sciproject.ui.involved_orgas.delete.confirm=Are you sure to remove the selected organization from the organisations involved with this project? +sciproject.ui.involved_orgas.title=Involved Organizations +sciproject.ui.involved_orgas.description=Managed involved organizations diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties index 3bf6653e8..4df474dd0 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectResources_de.properties @@ -67,3 +67,20 @@ sciorganization.ui.project.members=Mitglieder sciorganization.ui.project_description.title=Beschreibung sciproject.ui.edit_basic_sheet=Basiseigenschaften bearbeiten sciproject.ui.members.add=Mitglied hinzuf\u00fcgen +sciproject.ui.involved_orgas.select=Beteiligte Organisation ausw\u00e4hlen +sciproject.ui.involved_orgas.select.nothing=Es wurde keine Organisation ausgew\u00e4hlt +sciproject.ui.involved_orgas.no_suitable_language_variant=F\u00fcr die ausgew\u00e4hlte Organisation existiert keine passende Sprachvariante +sciproject.ui.involved_orgas.adding_to_itself=Es ist nicht m\u00f6glich einem Projekt das Projekt selbst als beteiligte Organisation zuzuweisen. +sciproject.ui.involved_orgas.already_added=Die ausgew\u00e4hlte Organisation wurde dem Projekt bereits als beteiligte Organisation hinzugef\u00fcgt. +sciproject.ui.involved_orgas.add=Beteiligte Organisation hinzuf\u00fcgen +sciproject.ui.involved_orgas.empty_view=Keine beteiligten Organisationen gefunden +sciproject.ui.involved_orgas..columns.name=Name der Organisation +sciproject.ui.involved_orgas.columns.delete=Entfernen +sciproject.ui.involved_orgas.columns.up=Hoch +sciproject.ui.involved_orgas.columns.down=Runter +sciproject.ui.involved_orgas.delete=Entfernen +sciproject.ui.involved_orgas.up=Hoch +sciproject.ui.involved_orgas.down=Runter +sciproject.ui.involved_orgas.delete.confirm=Sind Sie sicher, dass die die ausgew\u00e4hlte Organisation aus den an diesem Projekt beteiligten Organisationen l\u00f6schen wollen? +sciproject.ui.involved_orgas.title=Beteiligte Organisationen +sciproject.ui.involved_orgas.description=Verwalten von am Projekt beteiligten Organisationen diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java index 25bb02040..5f71b3004 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSummaryTab.java @@ -7,6 +7,7 @@ import com.arsdigita.cms.contenttypes.GenericOrganizationalUnit; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitContactCollection; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitPersonCollection; import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSubordinateCollection; +import com.arsdigita.cms.contenttypes.GenericOrganizationalUnitSuperiorCollection; import com.arsdigita.cms.contenttypes.GenericPerson; import com.arsdigita.cms.contenttypes.SciProject; import com.arsdigita.cms.dispatcher.SimpleXMLGenerator; @@ -64,6 +65,10 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { generateContactsXml(project, projectSummaryElem, state); } + if (config.isShowingInvolvedOrgas()) { + generateInvolvedOrgasXml(project, projectSummaryElem, state); + } + if (config.isShowingSubProjects()) { generateSubProjectsXml(project, projectSummaryElem, state); } @@ -83,7 +88,7 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { final SciProject project, final Element parent) { final long start = System.currentTimeMillis(); - if ((project.getAddendum() != null) + if ((project.getAddendum() != null) && !project.getAddendum().trim().isEmpty()) { final Element addendumElem = parent.newChildElement("addendum"); addendumElem.setText(project.getAddendum()); @@ -207,6 +212,10 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { final GenericOrganizationalUnitContactCollection contacts = project. getContacts(); + if ((contacts == null) || contacts.isEmpty()) { + return; + } + final Element contactsElem = parent.newChildElement("contacts"); while (contacts.next()) { @@ -230,17 +239,70 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { System.currentTimeMillis() - start)); } + protected void generateInvolvedOrgasXml(final SciProject project, + final Element parent, + final PageState state) { + final long start = System.currentTimeMillis(); + final GenericOrganizationalUnitSuperiorCollection orgas = project.getSuperiorOrgaUnits(); + + if (orgas == null) { + return; + } + + orgas.addFilter(String.format("link.assocType = '%s'", + SciProjectInvolvedOrganizationsStep.ASSOC_TYPE)); + + if (orgas.isEmpty()) { + return; + } + + final Element involvedElem = parent.newChildElement("involvedOrganizations"); + while(orgas.next()) { + generateInvolvedOrgaXml(orgas.getGenericOrganizationalUnit(), + involvedElem, + state); + } + logger.debug(String.format("Generated XML for involved organizations " + + "of project '%s' in %d ms.", + project.getName(), + System.currentTimeMillis() - start)); + } + + protected void generateInvolvedOrgaXml( + final GenericOrganizationalUnit involved, + final Element parent, + final PageState state) { + final long start = System.currentTimeMillis(); + final XmlGenerator generator = new XmlGenerator(involved); + generator.setUseExtraXml(false); + generator.generateXML(state, parent, ""); + logger.debug(String.format("Generated XML for involved organization " + + "'%s' in %d ms.", + involved.getName(), + System.currentTimeMillis() - start)); + } + protected void generateSubProjectsXml(final SciProject project, final Element parent, final PageState state) { final long start = System.currentTimeMillis(); - final Element subProjectsElem = parent.newChildElement("subProjects"); final GenericOrganizationalUnitSubordinateCollection subProjects = project. getSubordinateOrgaUnits(); + + if (subProjects == null) { + return; + } + subProjects.addFilter( String.format("link.assocType = '%s'", SciProjectSubProjectsStep.ASSOC_TYPE)); + + if (subProjects.isEmpty()) { + return; + } + + final Element subProjectsElem = parent.newChildElement("subProjects"); while (subProjects.next()) { generateSubProjectXml( (SciProject) subProjects.getGenericOrganizationalUnit(), @@ -259,7 +321,7 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { final long start = System.currentTimeMillis(); final XmlGenerator generator = new XmlGenerator(subProject); generator.setUseExtraXml(false); - generator.generateXML(state, parent, ""); + generator.generateXML(state, parent, ""); /*final Element subProjectElem = parent.newChildElement("subProject"); final Element subProjectTitle = subProjectElem.newChildElement("title"); subProjectTitle.setText(subProject.getTitle());*/ @@ -275,7 +337,7 @@ public class SciProjectSummaryTab implements GenericOrgaUnitTab { public XmlGenerator(final ContentItem item) { super(); - this.item = item; + this.item = item; } @Override diff --git a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java index 303697231..9e3a5a12a 100644 --- a/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java +++ b/ccm-sci-types-project/src/com/arsdigita/cms/contenttypes/ui/SciProjectSuperProjectsStep.java @@ -14,7 +14,7 @@ import com.arsdigita.cms.ui.workflow.WorkflowLockedComponentAccess; */ public class SciProjectSuperProjectsStep extends SimpleEditStep { - private String ADD_SUPERPROJECT_SHEET_NAME = "SciProjectAddSuperProject"; + private final static String ADD_SUPERPROJECT_SHEET_NAME = "SciProjectAddSuperProject"; public final static String ASSOC_TYPE = "SubProject"; public SciProjectSuperProjectsStep(final ItemSelectionModel itemModel,