diff --git a/ccm-cms-assets-relatedlink/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/RelatedLink.xml b/ccm-cms-assets-relatedlink/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/RelatedLink.xml index e5bbff061..74d8d0278 100755 --- a/ccm-cms-assets-relatedlink/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/RelatedLink.xml +++ b/ccm-cms-assets-relatedlink/src/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/RelatedLink.xml @@ -3,7 +3,9 @@ - + diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkInitializer.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkInitializer.java index fd0b53d8e..bc0193202 100755 --- a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkInitializer.java +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkInitializer.java @@ -29,6 +29,10 @@ import com.arsdigita.globalization.GlobalizedMessage; public class RelatedLinkInitializer extends ContentAssetInitializer { + protected RelatedLinkInitializer(final String manifestFile) { + super(manifestFile); + } + /** * */ diff --git a/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkTraversalAdapter.java b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkTraversalAdapter.java new file mode 100644 index 000000000..df45a1ac9 --- /dev/null +++ b/ccm-cms-assets-relatedlink/src/com/arsdigita/cms/contentassets/RelatedLinkTraversalAdapter.java @@ -0,0 +1,53 @@ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.cms.ContentBundle; +import com.arsdigita.cms.contenttypes.LinkTraversalAdapter; +import com.arsdigita.dispatcher.DispatcherHelper; +import com.arsdigita.domain.DomainObject; +import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; +import com.arsdigita.persistence.metadata.Property; + +/** + * + * @author Jens Pelzetter + */ +public class RelatedLinkTraversalAdapter extends LinkTraversalAdapter { + + public RelatedLinkTraversalAdapter() { + super(); + } + + public RelatedLinkTraversalAdapter( + SimpleDomainObjectTraversalAdapter adapter) { + super(adapter); + } + + public String getLinkListName() { + return "NONE"; + } + + @Override + public boolean processProperty(DomainObject obj, + String path, + Property prop, + String context) { + DomainObject nObj = obj; + + if (obj instanceof ContentBundle) { + + nObj = ((ContentBundle) obj).negotiate(DispatcherHelper.getRequest(). + getLocales()); + } + + if (nObj instanceof RelatedLink) { + RelatedLink link = (RelatedLink) nObj; + if (getLinkListName().equals(link.getLinkListName())) { + return super.processProperty(nObj, path, prop, context); + } else { + return false; + } + } else { + return super.processProperty(nObj, path, prop, context); + } + } +} diff --git a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml index f44b951e9..83333942f 100755 --- a/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml +++ b/ccm-cms/src/WEB-INF/resources/cms-item-adapters.xml @@ -43,7 +43,7 @@ - + diff --git a/ccm-cms/src/com/arsdigita/cms/contenttypes/LinkTraversalAdapter.java b/ccm-cms/src/com/arsdigita/cms/contenttypes/LinkTraversalAdapter.java index 8df5bd30f..1d9605f02 100644 --- a/ccm-cms/src/com/arsdigita/cms/contenttypes/LinkTraversalAdapter.java +++ b/ccm-cms/src/com/arsdigita/cms/contenttypes/LinkTraversalAdapter.java @@ -25,7 +25,6 @@ import com.arsdigita.persistence.metadata.Property; import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; import com.arsdigita.domain.DomainObject; - /** * An adapter for Links allowing pluggable * assets to extend the traversal. @@ -35,16 +34,16 @@ import com.arsdigita.domain.DomainObject; * * @author Sören Bernstein (Quasimodo) */ -public class LinkTraversalAdapter - extends ContentItemTraversalAdapter { - - private static final Logger s_log = - Logger.getLogger(LinkTraversalAdapter.class); - +public class LinkTraversalAdapter + extends ContentItemTraversalAdapter { + + private static final Logger s_log = + Logger.getLogger(LinkTraversalAdapter.class); + public LinkTraversalAdapter() { super(); } - + public LinkTraversalAdapter(SimpleDomainObjectTraversalAdapter adapter) { super(adapter); } @@ -54,20 +53,21 @@ public class LinkTraversalAdapter * to the asset's adapter, otherwise delegates to * the content item's primary adapter */ + @Override public boolean processProperty(DomainObject obj, String path, Property prop, String context) { DomainObject nObj = obj; - + if (obj instanceof ContentBundle) { - if (s_log.isDebugEnabled()) { - s_log.debug("Found a link to a content bundle. Resolve this link to negotiated language."); - } + s_log.debug( + "Found a link to a content bundle. Resolve this link to negotiated language."); - nObj = ((ContentBundle) obj).negotiate(DispatcherHelper.getRequest().getLocales()); + nObj = ((ContentBundle) obj).negotiate(DispatcherHelper.getRequest(). + getLocales()); } return super.processProperty(nObj, path, prop, context); diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciDepartmentPublicationLink.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciDepartmentPublicationLink.pdl new file mode 100644 index 000000000..db3ec769d --- /dev/null +++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciDepartmentPublicationLink.pdl @@ -0,0 +1,7 @@ +model com.arsdigita.cms.contentassets; + +object type SciDepartmentPublicationLink extends RelatedLink { + + reference key (ct_sciorga_department_publication_link.publication_link_id); + +} \ No newline at end of file diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciOrganizationPublicationLink.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciOrganizationPublicationLink.pdl new file mode 100644 index 000000000..fc8fd862c --- /dev/null +++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciOrganizationPublicationLink.pdl @@ -0,0 +1,7 @@ +model com.arsdigita.cms.contentassets; + +object type SciOrganizationPublicationLink extends RelatedLink { + + reference key (ct_sciorga_organization_publication_link.publication_link_id); + +} \ No newline at end of file diff --git a/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciProjectPublicationLink.pdl b/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciProjectPublicationLink.pdl new file mode 100644 index 000000000..92491546e --- /dev/null +++ b/ccm-sci-types-organization/pdl/com/arsdigita/content-assets/SciProjectPublicationLink.pdl @@ -0,0 +1,7 @@ +model com.arsdigita.cms.contentassets; + +object type SciProjectPublicationLink extends RelatedLink { + + reference key (ct_sciorga_project_publication_link.publication_link_id); + +} \ No newline at end of file diff --git a/ccm-sci-types-organization/src/ccm-sci-types-organization.load b/ccm-sci-types-organization/src/ccm-sci-types-organization.load index 6e9c6c1cf..4b04d5ff1 100644 --- a/ccm-sci-types-organization/src/ccm-sci-types-organization.load +++ b/ccm-sci-types-organization/src/ccm-sci-types-organization.load @@ -3,6 +3,7 @@
+
@@ -14,6 +15,9 @@ + + + @@ -21,5 +25,8 @@ + + + \ No newline at end of file diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLink.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLink.java new file mode 100644 index 000000000..3e8d5f869 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLink.java @@ -0,0 +1,36 @@ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentPublicationLink extends RelatedLink { + + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.contentassets.SciDepartmentPublicationLink"; + + public SciDepartmentPublicationLink() { + this(BASE_DATA_OBJECT_TYPE); + } + + public SciDepartmentPublicationLink(BigDecimal id) { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public SciDepartmentPublicationLink(OID oid) { + super(oid); + } + + public SciDepartmentPublicationLink(DataObject dobj) { + super(dobj); + } + + public SciDepartmentPublicationLink(String type) { + super(type); + } + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkInitializer.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkInitializer.java new file mode 100644 index 000000000..0ade8013a --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkInitializer.java @@ -0,0 +1,18 @@ +package com.arsdigita.cms.contentassets; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentPublicationLinkInitializer extends RelatedLinkInitializer { + + public SciDepartmentPublicationLinkInitializer() { + super("empty.pdl.mf"); + } + + @Override + public String getTraversalXML() { + return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/SciDepartmentPublicationLink.xml"; + } + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkLoader.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkLoader.java new file mode 100644 index 000000000..50e696a77 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkLoader.java @@ -0,0 +1,9 @@ +package com.arsdigita.cms.contentassets; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentPublicationLinkLoader extends RelatedLinkLoader { + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkTraversalAdapter.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkTraversalAdapter.java new file mode 100644 index 000000000..fde3fb097 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciDepartmentPublicationLinkTraversalAdapter.java @@ -0,0 +1,25 @@ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentPublicationLinkTraversalAdapter + extends RelatedLinkTraversalAdapter { + + public SciDepartmentPublicationLinkTraversalAdapter() { + super(); + } + + public SciDepartmentPublicationLinkTraversalAdapter( + SimpleDomainObjectTraversalAdapter adapter) { + super(adapter); + } + + @Override + public String getLinkListName() { + return "SciDepartmentPublications"; + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLink.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLink.java new file mode 100644 index 000000000..7116531ca --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLink.java @@ -0,0 +1,35 @@ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + */ +public class SciOrganizationPublicationLink extends RelatedLink { + + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.contentassets.SciOrganizationPublicationLink"; + + public SciOrganizationPublicationLink() { + this(BASE_DATA_OBJECT_TYPE); + } + + public SciOrganizationPublicationLink(BigDecimal id) { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public SciOrganizationPublicationLink(OID oid) { + super(oid); + } + + public SciOrganizationPublicationLink(DataObject dobj) { + super(dobj); + } + + public SciOrganizationPublicationLink(String type) { + super(type); + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkInitializer.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkInitializer.java new file mode 100644 index 000000000..3a5aa7d9e --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkInitializer.java @@ -0,0 +1,17 @@ +package com.arsdigita.cms.contentassets; + +/** + * + * @author Jens Pelzetter + */ +public class SciOrganizationPublicationLinkInitializer extends RelatedLinkInitializer { + + public SciOrganizationPublicationLinkInitializer() { + super("empty.pdl.mf"); + } + + @Override + public String getTraversalXML() { + return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/SciOrganizationPublicationLink.xml"; + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkLoader.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkLoader.java new file mode 100644 index 000000000..f0b01e01a --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkLoader.java @@ -0,0 +1,9 @@ +package com.arsdigita.cms.contentassets; + +/** + * + * @author Jens Pelzetter + */ +public class SciOrganizationPublicationLinkLoader extends RelatedLinkLoader { + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkTraversalAdapter.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkTraversalAdapter.java new file mode 100644 index 000000000..57c7a2a24 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciOrganizationPublicationLinkTraversalAdapter.java @@ -0,0 +1,26 @@ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; + +/** + * + * @author Jens Pelzetter + */ +public class SciOrganizationPublicationLinkTraversalAdapter + extends RelatedLinkTraversalAdapter { + + public SciOrganizationPublicationLinkTraversalAdapter() { + super(); + } + + public SciOrganizationPublicationLinkTraversalAdapter( + SimpleDomainObjectTraversalAdapter adapter) { + super(adapter); + } + + @Override + public String getLinkListName() { + return "SciOrganizationPublications"; + } + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLink.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLink.java new file mode 100644 index 000000000..39fc680b2 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLink.java @@ -0,0 +1,37 @@ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.persistence.DataObject; +import com.arsdigita.persistence.OID; +import java.math.BigDecimal; + +/** + * + * @author Jens Pelzetter + */ +public class SciProjectPublicationLink extends RelatedLink { + + public static final String BASE_DATA_OBJECT_TYPE = + "com.arsdigita.cms.contentassets.SciProjectPublicationLink"; + + public SciProjectPublicationLink() { + this(BASE_DATA_OBJECT_TYPE); + } + + public SciProjectPublicationLink(BigDecimal id) { + this(new OID(BASE_DATA_OBJECT_TYPE, id)); + } + + public SciProjectPublicationLink(OID oid) { + super(oid); + } + + public SciProjectPublicationLink(DataObject dobj) { + super(dobj); + } + + public SciProjectPublicationLink(String type) { + super(type); + } + + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkInitializer.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkInitializer.java new file mode 100644 index 000000000..7a0cc16e3 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkInitializer.java @@ -0,0 +1,17 @@ +package com.arsdigita.cms.contentassets; + +/** + * + * @author Jens Pelzetter + */ +public class SciProjectPublicationLinkInitializer extends RelatedLinkInitializer { + + public SciProjectPublicationLinkInitializer() { + super("empty.pdl.mf"); + } + + @Override + public String getTraversalXML() { + return "/WEB-INF/traversal-adapters/com/arsdigita/cms/contentassets/SciProjectPublicationLink.xml"; + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkLoader.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkLoader.java new file mode 100644 index 000000000..3c05bcdc5 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkLoader.java @@ -0,0 +1,9 @@ +package com.arsdigita.cms.contentassets; + +/** + * + * @author Jens Pelzetter + */ +public class SciProjectPublicationLinkLoader extends RelatedLinkLoader { + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkTraversalAdapter.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkTraversalAdapter.java new file mode 100644 index 000000000..223628eed --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contentassets/SciProjectPublicationLinkTraversalAdapter.java @@ -0,0 +1,25 @@ +package com.arsdigita.cms.contentassets; + +import com.arsdigita.domain.SimpleDomainObjectTraversalAdapter; + +/** + * + * @author Jens Pelzetter + */ +public class SciProjectPublicationLinkTraversalAdapter + extends RelatedLinkTraversalAdapter { + + public SciProjectPublicationLinkTraversalAdapter() { + super(); + } + + public SciProjectPublicationLinkTraversalAdapter( + SimpleDomainObjectTraversalAdapter adapter) { + super(adapter); + } + + @Override + public String getLinkListName() { + return "SciProjectPublications"; + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationLinkPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationLinkPropertyForm.java new file mode 100644 index 000000000..b52ffc8e0 --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationLinkPropertyForm.java @@ -0,0 +1,43 @@ +package com.arsdigita.cms.contenttypes.ui; + + +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contentassets.SciDepartmentPublicationLink; +import com.arsdigita.cms.contentassets.ui.RelatedLinkPropertyForm; +import com.arsdigita.cms.contenttypes.Link; +import com.arsdigita.util.Assert; + +/** + * + * @author Jens Pelzetter + */ +public class SciDepartmentPublicationLinkPropertyForm extends RelatedLinkPropertyForm { + + public SciDepartmentPublicationLinkPropertyForm(ItemSelectionModel itemModel, + LinkSelectionModel linkModel, + String linkListName) { + this(itemModel, linkModel, linkListName, null); + } + + public SciDepartmentPublicationLinkPropertyForm(ItemSelectionModel itemModel, + LinkSelectionModel linkModel, + String linkListName, + ContentType contentType) { + super(itemModel, linkModel, linkListName, contentType); + } + + @Override + protected Link createLink(PageState state) { + ContentItem item = getContentItem(state); + Assert.exists(item, ContentItem.class); + SciDepartmentPublicationLink link = new SciDepartmentPublicationLink(); + + link.setLinkOwner(item); + + return link; + } + +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsStep.java index a30874193..745264527 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciDepartmentPublicationsStep.java @@ -19,6 +19,7 @@ */ package com.arsdigita.cms.contenttypes.ui; +import com.arsdigita.bebop.FormSection; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contentassets.ui.RelatedLinkPropertiesStep; @@ -31,7 +32,7 @@ import com.arsdigita.cms.ui.authoring.AuthoringKitWizard; public class SciDepartmentPublicationsStep extends RelatedLinkPropertiesStep { public SciDepartmentPublicationsStep(ItemSelectionModel itemModel, - AuthoringKitWizard parent) { + AuthoringKitWizard parent) { super(itemModel, parent); } @@ -40,6 +41,14 @@ public class SciDepartmentPublicationsStep extends RelatedLinkPropertiesStep { super.setLinkSelectionModel(); linkListName = "SciDepartmentPublications"; contentType = ContentType.findByAssociatedObjectType( - "com.arsdigita.cms.contenttypes.Publication"); + "com.arsdigita.cms.contenttypes.Publication"); + } + + protected FormSection getEditSheet() { + return new SciDepartmentPublicationLinkPropertyForm( + getItemSelectionModel(), + getLinkSelectionModel(), + linkListName, + contentType); } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationBasePanel.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationBasePanel.java index 8562cc8a6..d5668eb93 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationBasePanel.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciOrganizationBasePanel.java @@ -104,8 +104,9 @@ public abstract class SciOrganizationBasePanel return false; } final MemberListItem other = (MemberListItem) obj; - if (this.member != other.member && (this.member == null || !this.member. - equals(other.member))) { + if (this.member != other.member && (this.member == null + || !this.member.equals( + other.member))) { return false; } if ((this.role == null) ? (other.role != null) @@ -155,7 +156,7 @@ public abstract class SciOrganizationBasePanel public int compare(SciProject project1, SciProject project2) { /*int result = 0; - + if (project1.getBegin() == null) { return -1; } else if (project2.getBegin() == null) { @@ -163,7 +164,7 @@ public abstract class SciOrganizationBasePanel } else { result = project1.getBegin().compareTo(project2.getBegin()); } - + if (result == 0) { if (project1.getEnd() == null) { return -1; @@ -176,7 +177,7 @@ public abstract class SciOrganizationBasePanel result = project1.getEnd().compareTo(project2.getEnd()); } } - + return result;*/ return project1.getTitle().compareTo(project2.getTitle()); @@ -348,11 +349,11 @@ public abstract class SciOrganizationBasePanel pageNumber = normalizePageNumber(pageCount, pageNumber); createPaginatorElement( - parent, pageNumber, pageCount, begin, end, count, membersWithoutDoubles. - size()); - List membersWithoutDoublesToShow = membersWithoutDoubles. - subList((int) begin, - (int) end); + parent, pageNumber, pageCount, begin, end, count, + membersWithoutDoubles.size()); + List membersWithoutDoublesToShow = + membersWithoutDoubles.subList((int) begin, + (int) end); Element membersWithoutDoublesElem = parent.newChildElement( "members"); @@ -464,7 +465,7 @@ public abstract class SciOrganizationBasePanel final Element parent, final PageState state) { RelatedLink link; - ContentItem publication; + ContentItem publication; List publications; publications = new ArrayList(); @@ -482,10 +483,20 @@ public abstract class SciOrganizationBasePanel Integer year1; Integer year2; + if ((o1 == null) && o2 == null) { + return 0; + } else if ((o1 == null) && (o2 != null)) { + return -1; + } else if ((o1 != null) && o2 == null) { + return 1; + } + year1 = (Integer) o1.get("yearOfPublication"); year2 = (Integer) o2.get("yearOfPublication"); - if (year1.compareTo(year2) == 0) { + + if (year1.compareTo(year2) + == 0) { String title1; String title2; @@ -512,21 +523,25 @@ public abstract class SciOrganizationBasePanel (int) end); for (ContentItem pub : publicationsToShow) { - generatePublicationXML(pub, parent, state); + generatePublicationXML(pub, parent, state); } } - + protected void generatePublicationXML(final ContentItem publication, final Element parent, final PageState state) { Element publicationElem; ContentItemXMLRenderer renderer; + if (publication == null) { + return; + } + publicationElem = parent.newChildElement("publications"); renderer = new ContentItemXMLRenderer(publicationElem); renderer.setWrapAttributes(true); - renderer.walk(publication, SimpleXMLGenerator.class.getName()); - } + renderer.walk(publication, SimpleXMLGenerator.class.getName()); + } } diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationLinkPropertyForm.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationLinkPropertyForm.java new file mode 100644 index 000000000..08b5bc0ce --- /dev/null +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationLinkPropertyForm.java @@ -0,0 +1,41 @@ +package com.arsdigita.cms.contenttypes.ui; + +import com.arsdigita.bebop.PageState; +import com.arsdigita.cms.ContentItem; +import com.arsdigita.cms.ContentType; +import com.arsdigita.cms.ItemSelectionModel; +import com.arsdigita.cms.contentassets.SciProjectPublicationLink; +import com.arsdigita.cms.contentassets.ui.RelatedLinkPropertyForm; +import com.arsdigita.cms.contenttypes.Link; +import com.arsdigita.util.Assert; + +/** + * + * @author Jens Pelzetter + */ +public class SciProjectPublicationLinkPropertyForm extends RelatedLinkPropertyForm { + + public SciProjectPublicationLinkPropertyForm(ItemSelectionModel itemModel, + LinkSelectionModel linkModel, + String linkListName) { + this(itemModel, linkModel, linkListName, null); + } + + public SciProjectPublicationLinkPropertyForm(ItemSelectionModel itemModel, + LinkSelectionModel linkModel, + String linkListName, + ContentType contentType) { + super(itemModel, linkModel, linkListName, contentType); + } + + @Override + protected Link createLink(PageState state) { + ContentItem item = getContentItem(state); + Assert.exists(item, ContentItem.class); + SciProjectPublicationLink link = new SciProjectPublicationLink(); + + link.setLinkOwner(item); + + return link; + } +} diff --git a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsStep.java b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsStep.java index e34f70a41..1f66526bf 100644 --- a/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsStep.java +++ b/ccm-sci-types-organization/src/com/arsdigita/cms/contenttypes/ui/SciProjectPublicationsStep.java @@ -19,6 +19,7 @@ */ package com.arsdigita.cms.contenttypes.ui; +import com.arsdigita.bebop.FormSection; import com.arsdigita.cms.ContentType; import com.arsdigita.cms.ItemSelectionModel; import com.arsdigita.cms.contentassets.ui.RelatedLinkPropertiesStep; @@ -42,4 +43,13 @@ public class SciProjectPublicationsStep extends RelatedLinkPropertiesStep { contentType = ContentType.findByAssociatedObjectType( "com.arsdigita.cms.contenttypes.Publication"); } + + @Override + protected FormSection getEditSheet() { + return new SciProjectPublicationLinkPropertyForm( + getItemSelectionModel(), + getLinkSelectionModel(), + linkListName, + contentType); + } }