- Docmgr still used old content section name, changed to new name info

- Publishing did not work if an image was attached due to a bug in the ItemImageAttachment, 
  maybe caused by the changes made in r2418 to make sorting images attachment possible.


git-svn-id: https://svn.libreccm.org/ccm/trunk@2517 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2014-02-11 14:03:55 +00:00
parent 9f8705134e
commit d7360e8ae7
2 changed files with 19 additions and 18 deletions

View File

@ -36,7 +36,6 @@ import java.math.BigDecimal;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
/** /**
* @version $Revision: #3 $ $Date: 2004/04/08 $
* @version $Id: $ * @version $Id: $
* *
* @author unknown * @author unknown
@ -61,7 +60,8 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
/** /**
* Data object type for this domain object * Data object type for this domain object
*/ */
public static final String BASE_DATA_OBJECT_TYPE = "com.arsdigita.cms.contentassets.ItemImageAttachment"; public static final String BASE_DATA_OBJECT_TYPE
= "com.arsdigita.cms.contentassets.ItemImageAttachment";
private static final Logger s_log = Logger.getLogger(ItemImageAttachment.class); private static final Logger s_log = Logger.getLogger(ItemImageAttachment.class);
private static final ItemImageAttachmentConfig s_config = ItemImageAttachmentConfig.instanceOf(); private static final ItemImageAttachmentConfig s_config = ItemImageAttachmentConfig.instanceOf();
@ -92,15 +92,16 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
/** /**
* Before saving this object, make sure SORTKEY is set * Before saving this object, make sure SORTKEY is set
*/ */
@Override @Override
protected void beforeSave() { protected void beforeSave() {
if(isNew() || getSortKey() == null || getSortKey() == 0) { if ((isNew() || getSortKey() == null || getSortKey() == 0)
setSortKey(getNextSortKey(getItem())); && (get(ITEM) != null)) {
} setSortKey(getNextSortKey(getItem()));
super.beforeSave(); }
} super.beforeSave();
}
public static ItemImageAttachment retrieve(OID oid) { public static ItemImageAttachment retrieve(OID oid) {
return (ItemImageAttachment) DomainObjectFactory.newInstance(oid); return (ItemImageAttachment) DomainObjectFactory.newInstance(oid);
} }
@ -204,16 +205,15 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
*/ */
@Override @Override
public boolean copyProperty(final CustomCopy source, public boolean copyProperty(final CustomCopy source,
final Property property, final Property property,
final ItemCopier copier) { final ItemCopier copier) {
String attribute = property.getName(); String attribute = property.getName();
if (ItemCopier.VERSION_COPY == copier.getCopyType() if (ItemCopier.VERSION_COPY == copier.getCopyType()
&& IMAGE.equals(attribute)) { && IMAGE.equals(attribute)) {
ItemImageAttachment attachment = (ItemImageAttachment) source; ItemImageAttachment attachment = (ItemImageAttachment) source;
ReusableImageAsset image = attachment.getImage(); ReusableImageAsset image = attachment.getImage();
ReusableImageAsset liveImage = ReusableImageAsset liveImage = (ReusableImageAsset) image.getLiveVersion();
(ReusableImageAsset) image.getLiveVersion();
if (null == liveImage) { if (null == liveImage) {
liveImage = (ReusableImageAsset) image.createLiveVersion(); liveImage = (ReusableImageAsset) image.createLiveVersion();
@ -254,13 +254,14 @@ public class ItemImageAttachment extends ACSObject implements CustomCopy {
} }
/** /**
* Get the next sort key for the list of {@link ItemImageAttachment}s for an * Get the next sort key for the list of {@link ItemImageAttachment}s for an item.
* item.
* *
* @param item The {@link ContentItem} the list of images is looked up for * @param item The {@link ContentItem} the list of images is looked up for
*
* @return the next sortkey, basically length of the list + 1 * @return the next sortkey, basically length of the list + 1
*/ */
public static Integer getNextSortKey(ContentItem item) { public static Integer getNextSortKey(ContentItem item) {
return new Integer((int) ItemImageAttachment.getImageAttachments(item).size() + 1); return new Integer((int) ItemImageAttachment.getImageAttachments(item).size() + 1);
} }
} }

View File

@ -55,7 +55,7 @@ public final class DocMgrConfig extends AbstractConfig {
private Parameter m_contentSection = new StringParameter private Parameter m_contentSection = new StringParameter
("com.arsdigita.cms.docmgr.content_section", ("com.arsdigita.cms.docmgr.content_section",
Parameter.REQUIRED, Parameter.REQUIRED,
"main"); "info");
private Parameter m_legacyFolderName = new StringParameter private Parameter m_legacyFolderName = new StringParameter
("com.arsdigita.cms.docmgr.legacy_folder_name", ("com.arsdigita.cms.docmgr.legacy_folder_name",
Parameter.REQUIRED, Parameter.REQUIRED,