cancel
Showing results for 
Search instead for 
Did you mean: 

Extending Collaboration Sites with Aspect, Properties

alfcpd
Champ in-the-making
Champ in-the-making
Hello,

Our company wants to extend Share Collaboration Sites by adding an aspect to the site which contains custom properties.  I've done so by defining an aspect called "project" in siteModel.xml.  I have successfully modified sites.post.json.js so that when the user creates a site via the default dashlet, if they choose the project preset from the dropdown, the project aspect is added to the site immediately after creation.  This aspect contains various fields which I intend to pull into a modified site-profile dashlet.

The problem is that when I get the site using the siteservice.getSite(shortName), I am unable to view/update the custom properties.  Looking at the node browser I can see that the aspect has been added to the site, but I cannot see the custom properties.  I know that they haven't been set, so perhaps this is part of the problem.

Sites appear to be different from other nodes.  For instance you modify a site directly by changing site.visibility instead of site.properties["st:visibility"] or something along those lines.  So far I've been referencing custom properties by assigning values to site.node.properties["st:myProjectDept"] and site.getNode().properties["projectStatus"], etc.  I see no errors, but then nothing is inserted and no properties become visible - even after calling site.node.save() or site.getNode().save().

Please help!  Thanks in advance.
2 REPLIES 2

acorona
Champ in-the-making
Champ in-the-making
I have the same problem.Did you ever figure this out?

Nobody in the forum seems to have the answer.

Thanks

ajv
Champ in-the-making
Champ in-the-making
Hi,

I had the same problem too. It seems that site.node.save() doesn't save the modified properties.

My custom code in site.put.json.js was:

for ( var prop in site.node.properties) {
logger.log("BEFORE. " + prop + " —> " + site.node.properties[prop]);
if (prop.indexOf("myprop") != -1) {
site.node.properties[prop] = json.get("myprop");
site.node.save();
}
logger.log("AFTER. " + prop + " —> " + site.node.properties[prop]);
}
The traces show that before and after have the same value, despite changes from site (I tried site.save() too), but nothing.

The only way I found to fix this is replace by a java backed webscript, because it seems that org.alfresco.repo.site.script.ScriptSiteService or org.alfresco.repo.site.script.Site are failing.
It would be nice if the webscript updates any custom properties (site.put.json only is prepared to update title, description and visibility….)

Best regards,
Adrian