cancel
Showing results for 
Search instead for 
Did you mean: 

customProperties for sites

tgmweb
Champ in-the-making
Champ in-the-making
Hi.

I can see there are some custom properties available for sites. The site webscript:

<#if site.customProperties?size != 0>
      "customProperties" :
      {
         <#list site.customProperties?keys as prop>
            "${prop}" :
            {
               "name" : "${prop}",
               "value" : "${site.customProperties[prop].value?string}",
               "type" : "${site.customProperties[prop].type}",
               "title" : "${site.customProperties[prop].title}"
            }
            <#if prop_has_next>,</#if>
         </#list>   
      },
   </#if>

How do I create these custom properties in my webscripts?
6 REPLIES 6

tgmweb
Champ in-the-making
Champ in-the-making
no-one knows how to use these custom properties?

mikeh
Star Contributor
Star Contributor
They're built from properties on the site node having the {http://www.alfresco.org/model/sitecustomproperty/1.0} namespace ("stcp:" in short qname form).

They're currently unused, which is why nobody's replied - I suspect you're the only person outside of Alfresco to have found them!

Thanks,
Mike

tgmweb
Champ in-the-making
Champ in-the-making
Hi Mike,

Thanks for the reply.

When you say they're "unused", does that mean I can't use them?

At the moment I have a seperate database to store my site metadata (address, phone number etc) - but that's a bit lame, and it's the *only* thing in my seperate database! So I'd really like to bring this meta into alfresco.

Any help would be appreciated!

Thanks,


Tom.

luke
Champ in-the-making
Champ in-the-making
Hi Mike,
    What's the excat mean "unused"?
    Does 3.3 will support that? or currently, can we do something to fit our requirements?

mikeh
Star Contributor
Star Contributor
By "unused" I mean the Site Service supports them, but no code uses them yet.

Thanks,
Mike

fast3r
Champ on-the-rise
Champ on-the-rise
Hello,

I still don't get one point about this topic: can I add custom properties to a site within the create-site webscript, somehow?

I tried to add a "customProperties" map to the clientResponse in create-site.post.json.js but data isn't saved at all.

In the Alfresco Java code I can see that in the SiteServiceTest class, custom properties are added for a site with this code:


        // Create a site with a custom property
        SiteInfo siteInfo = this.siteService.createSite("testPreset", "mySiteWithCustomProperty2", "testTitle", "testDescription", SiteVisibility.PUBLIC);
        NodeRef siteNodeRef = siteInfo.getNodeRef();
        Map<QName, Serializable> properties = new HashMap<QName, Serializable>(1);
        properties.put(QName.createQName(SiteModel.SITE_CUSTOM_PROPERTY_URL, "additionalInformation"), "information");
        this.nodeService.addAspect(siteNodeRef, QName.createQName(SiteModel.SITE_MODEL_URL, "customSiteProperties"), properties);
        this.createdSites.add("mySiteWithCustomProperty2");

How can I put the same properties within webscripts?

Thank you for any help…