Bug 103387

Summary: ObjectCopier fails with an optional association with link attributes
Product: [Retired] Red Hat Enterprise CMS Reporter: Daniel BerrangĂ© <berrange>
Component: otherAssignee: Archit Shah <archit.shah>
Status: CLOSED RAWHIDE QA Contact: Jon Orris <jorris>
Severity: medium Docs Contact:
Priority: medium    
Version: nightly   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-10-07 21:35:06 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 100952    

Description Daniel Berrangé 2003-08-29 17:07:59 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 Galeon/1.2.9 (X11; Linux i686; U;) Gecko/20030314

Description of problem:
When the following PDL is added to the system:

association {
     composite FreeformContentItem[0..1] item = join cms_assets.asset_id to
                                         ff_content_item_asset_map.asset_id,
                                    join ff_content_item_asset_map.item_id to
                                         ff_freeform_content_items.item_id;
     component Asset[0..n] assets = join ff_freeform_content_items.item_id to
                                         ff_content_item_asset_map.item_id,
                                      join ff_content_item_asset_map.asset_id to
                                         cms_assets.asset_id;
 
     Integer[1..1] rank = ff_content_item_asset_map.rank;
 }

All attempts to publish an item containing a text asset fail with:

java.lang.IllegalStateException: Warning: unsupported property type
com.redhat.persistence.PersistentObjectSource$1
        at com.arsdigita.cms.ObjectCopier.copyAssociations(ObjectCopier.java:512)
        at com.arsdigita.cms.ObjectCopier.copyObject(ObjectCopier.java:284)
        at com.arsdigita.cms.ObjectCopier.copyObject(ObjectCopier.java:210)
        at com.arsdigita.cms.ObjectCopier.copyACSObject(ObjectCopier.java:150)
        at com.arsdigita.cms.ObjectCopier.copyItem(ObjectCopier.java:195)
        at com.arsdigita.cms.VersionCopier.copyItem(VersionCopier.java:113)
        at com.arsdigita.cms.VersionCopier.copyItem(VersionCopier.java:179)
        at com.arsdigita.cms.TextPage.copyProperty(TextPage.java:150)
        at com.arsdigita.cms.Article.copyProperty(Article.java:187)
        at com.arsdigita.cms.ObjectCopier.copyAssociations(ObjectCopier.java:438)
        at com.arsdigita.cms.ObjectCopier.copyObject(ObjectCopier.java:284)
        at com.arsdigita.cms.ObjectCopier.copyObject(ObjectCopier.java:210)
        at com.arsdigita.cms.ObjectCopier.copyACSObject(ObjectCopier.java:150)
        at com.arsdigita.cms.ObjectCopier.copyItem(ObjectCopier.java:195)
        at com.arsdigita.cms.VersionCopier.copyItem(VersionCopier.java:113)
        at com.arsdigita.cms.ContentItem.createPendingVersion(ContentItem.java:1502)
        at com.arsdigita.cms.ContentItem.publish(ContentItem.java:1171)
        at
com.arsdigita.cms.ui.lifecycle.ItemLifecycleSelectForm$ProcessListener.process(ItemLifecycleSelectForm.java:412)
        at com.arsdigita.bebop.FormSection.fireProcess(FormSection.java:491)
        at com.arsdigita.bebop.FormSection$4.process(FormSection.java:465)
        at com.arsdigita.bebop.FormModel.fireFormProcess(FormModel.java:478)
        at com.arsdigita.bebop.FormModel.process(FormModel.java:345)
        at com.arsdigita.bebop.Form.process(Form.java:440)
        at com.arsdigita.bebop.Form.respond(Form.java:281)
        at com.arsdigita.bebop.PageState.respond(PageState.java:368)
        at com.arsdigita.bebop.Page.process(Page.java:696)
        at com.arsdigita.bebop.Page.process(Page.java:678)
        at com.arsdigita.bebop.Page.buildDocument(Page.java:732)
        at com.arsdigita.cms.dispatcher.CMSPage$1.excurse(CMSPage.java:280)
        at com.arsdigita.cms.CMSExcursion$1.excurse(CMSExcursion.java:82)


Turning on log4j on the ObjectCopier produces:

2003-08-29 17:21:31,776 [042-1] DEBUG cms.ObjectCopier - Considering property
section for copying
2003-08-29 17:21:31,776 [042-1] DEBUG cms.ObjectCopier - The property has passed
all tests and will now be copied
2003-08-29 17:21:32,030 [042-1] DEBUG cms.ObjectCopier - Considering property
language for copying
2003-08-29 17:21:32,030 [042-1] DEBUG cms.ObjectCopier - The property is not a
role; skipping it
2003-08-29 17:21:32,030 [042-1] DEBUG cms.ObjectCopier - Considering property
ancestors for copying
2003-08-29 17:21:32,030 [042-1] DEBUG cms.ObjectCopier - The property is not a
role; skipping it
2003-08-29 17:21:32,030 [042-1] DEBUG cms.ObjectCopier - Considering property
parent for copying
2003-08-29 17:21:32,034 [042-1] DEBUG cms.ObjectCopier - The property has passed
all tests and will now be copied
2003-08-29 17:21:32,035 [042-1] DEBUG cms.ObjectCopier - Considering property
slaveVersions for copying
2003-08-29 17:21:32,036 [042-1] DEBUG cms.ObjectCopier - The item overrides the
default behavior to propogate the property; skipping past it
2003-08-29 17:21:32,036 [042-1] DEBUG cms.ObjectCopier - Considering property
masterVersion for copying
2003-08-29 17:21:32,036 [042-1] DEBUG cms.ObjectCopier - The property has passed
all tests and will now be copied
2003-08-29 17:21:32,081 [042-1] DEBUG cms.ObjectCopier - Considering property
links for copying
2003-08-29 17:21:32,082 [042-1] DEBUG cms.ObjectCopier - The property has passed
all tests and will now be copied
2003-08-29 17:21:32,119 [042-1] DEBUG cms.ObjectCopier - Considering property
itemsLinkedFrom for copying
2003-08-29 17:21:32,119 [042-1] DEBUG cms.ObjectCopier - The property has passed
all tests and will now be copied
2003-08-29 17:21:32,159 [042-1] DEBUG cms.ObjectCopier - Considering property
item for copying
2003-08-29 17:21:32,159 [042-1] DEBUG cms.ObjectCopier - The property has passed
all tests and will now be copied

Related AIM transcript:

[17:35:37] <Rafael Schloming> I think I know what the problem is.
[17:36:07] <Rafael Schloming> Try killing the link attribute.
[17:36:15] <Rafael Schloming> See what happens then.
[17:36:26] <dan> ok
[17:37:56] <Rafael Schloming> It's a slightly odd case in that it is a link
attribute for a 1 to n association.
[17:38:13] <Rafael Schloming> We probably don't have a test case for it.
[17:38:31] <dan> ah i see
[17:38:49] <Rafael Schloming> In fact the API doesn't even really cover it.
[17:39:04] <Rafael Schloming> There is no way to recover the value of the link
when traversing the 0..1 side of the association.
[17:39:22] <Rafael Schloming> Since getLink() is on DataAssociation.
[17:39:59] <Rafael Schloming> I believe what is happing is that the get is
returning the link object rather than the object at the other end of the
association.
[17:41:05] <Rafael Schloming> It should be a simple fix.
[17:41:33] <dan> yep, removing the link attribute made it work

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1. Create an association similar to the above
2. Create an article
3. Enter some text
4. Publish the article
    

Additional info:

Comment 1 Richard Li 2003-08-29 17:25:11 UTC
persistence bug

Comment 2 Archit Shah 2003-08-29 19:47:46 UTC
This bug report exposes multiple bugs in the code that deals with link
attributes when one side of the association is 0..1. (Both sides 0..1 is not
really supported by the API). 35493 should fix the reported exception. But if
you try setting the 0..1 side of the association you will get an exception.

Remaining work for this bug:

1) fix set of 0..1 with link attributes
2) add tests (MetaTest may need more metadata for link attributes)

Comment 3 Archit Shah 2003-09-03 15:32:44 UTC
fixed on branch (35624) and tip (35493,35622). getting and setting of 0..1
associations with link attributes works approximately as expected. I did not
make any metadata changes.