cancel
Showing results for 
Search instead for 
Did you mean: 

Setting the WCMAppModel.PROP_RENDITIONS PropertyValue

kooktroop
Champ in-the-making
Champ in-the-making
Hi,

I'm having trouble setting the WCMAppModel.PROP_RENDITIONS PropertyValue. I'm able to set string values, thanks to Eyestreet's Harry Moore.

I want to end up with a property that looks like:


{http://www.alfresco.org/model/wcmappmodel/1.0}renditions=PropertyValue[actual-type=SERIALIZABLE, multi-valued=true, value-type=SERIALIZABLE, value=[/www/avm_webapps/ROOT/content/output/processunits/test/goal.html, /www/avm_webapps/ROOT/content/output/processunits/test/description.html]]

I've tried just a simple approach:



setPropertyValue( …, WCMAppModel.PROP_RENDITIONS, "[/www/avm_webapps/ROOT/content/html/processunits/test/goal.html, /www/avm_webapps/ROOT/content/html/processunits/test/description.html]" );

    public void setPropertyValue( AVMNodeDescriptor nodeDesc, QName propertyQName, String value )
    {
       PropertyValue propValue = new PropertyValue( propertyQName, value );
       fAVMRemote.setNodeProperty( nodeDesc.getPath(), propertyQName, propValue );
       getPropertyValue( nodeDesc, propertyQName );
    }

But I end up with


{http://www.alfresco.org/model/wcmappmodel/1.0}renditions=PropertyValue[actual-type=SERIALIZABLE, multi-valued=true, value-type=STRING, value=[/www/avm_webapps/ROOT/content/html/processunits/Alternative Evaluation/goal.html, /www/avm_webapps/ROOT/content/html/processunits/Alternative Evaluation/description.html]]

I've also tried:


public void setPropertyMultiValue( AVMNodeDescriptor nodeDesc, QName propertyQName, String value )
    {
       PropertyValue propValue = new PropertyValue();// propertyQName, value );
       
       propValue.setSerializableValue( value );
       propValue.setMultiValued( true );
       propValue.setActualType( "SERIALIZABLE" );
       //propValue.setStringValue( value );
       
       fAVMRemote.setNodeProperty( nodeDesc.getPath(), propertyQName, propValue );
       
       getPropertyValue( nodeDesc, propertyQName );
    }

I'm guessing there is an Alfresco SDK object I should be passing to PropertyValue as the value.

Any help is much appreciated!
2 REPLIES 2

arielb
Champ in-the-making
Champ in-the-making
you want to use something along the lines of:

Collection<Serializable> renditions = new HashSet<Serializable>();
renditions.add("/www/avm_webapps/ROOT/content/output/processunits/test/goal.html");
renditions.add("/www/avm_webapps/ROOT/content/output/processunits/test/description.html");

avmRemote.setNodeProperty(nodeDesc.getPath(), WCMAppModel.PROP_RENDITIONS, new PropertyValue(DataTypeDefinition.TEXT, (Serializable)renditions));

that should work.  however, i'm not quite sure what you're hoping to accomplish with this.  the renditions property should be managed by the create web content wizard - i'm not sure why you'd want to modify the rendition list.

kooktroop
Champ in-the-making
Champ in-the-making
Thanks for that Ariel.

The reason I am doing this is because we're importing web content into Alfresco, that is we're importing XML and associating it with the appropriate Web Form, because we have so much content that doing it by hand isn't an option.

So when I import the XML and associate it with a form, I also need to import the renditions and associate the renditions with the form. By the looks of it from http://forums.alfresco.com/viewtopic.php?t=5888 Alfresco offers no way to trigger renditions, so we are doing this as a workaround.

That is, I am rendering each rendition outside of Alfresco then importing it with the XML and linking it all up via the properties and aspects programmatically.