cancel
Showing results for 
Search instead for 
Did you mean: 

Integrity Check problem when adding a node?

blatwurst
Champ in-the-making
Champ in-the-making
Can someone please help me understand what's going on here?  Why does this:

        obj.addAspect("app:configurable");
        obj = obj.createNode("app:configurations", "app:configurations", "app:configurations");
produce this error:

Invalid property value: 
   Node: workspace://SpacesStore/c3764e1f-8235-11dc-b853-a9503a1a1ee3
   Type: {http://www.alfresco.org/model/application/1.0}configurations
   Property: {http://www.alfresco.org/model/content/1.0}name
   Constraint: Value 'app:configurations' matches regular expression: (.*[\"\*\\\>\<\?\/\:\|]+.*)|(.*[\.]?.*[\.]+$)|(.*[ ]+$)

It's complaining about the ':' in the name of the association (the first parameter to createNode).  I tried this too, with the same result:

        obj.addAspect("app:configurable");
        var props = new Array();
        props["cm:name"] = "blah blah blah";
        obj = obj.createNode("app:configurations", "app:configurations", props, "app:configurations");

This code succeeds:

        obj.addAspect("app:configurable");
        obj = obj.createNode("configurations", "app:configurations", "app:configurations");

but then the name of the resulting association is "cm:configurations" rather than "app:configurations".  The fact that this works says to me that what I'm trying to do should work.  That is, the value I'm providing should be able to be qualified with a namespace since the default namespace is added to the value I provide if I don't specify one explicitly.

Do I have to turn off integrity checks to make this node? That seems harsh.  BTW, I'm trying to reproduce the same node relationship that exists below each "person" node.

Any help would be appreciated.
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
The cm:name field (the first parameter to the createNode() call) has restriction on the characters that can be used - so it is valid for CIFS/FTP/Windows/Webdav etc.etc. as this is the actual display name of the node.

So this is correct:

        obj.addAspect("app:configurable");
        obj = obj.createNode("Some Config Folder", "app:configurations", "app:configurations");

You say:
then the name of the resulting association is "cm:configurations"

The association name should be 'app:configurations' as that is the third param to the call.

I've just tested this with a quick test script:

document.addAspect("app:configurable");
document.createNode("Some Config Folder", "app:configurations", "app:configurations");
Running this (as a script action) against a document and then examining the document in the Node Browser shows that it has a single child node with the association type:
{http://www.alfresco.org/model/application/1.0}configurations
and name of:
{http://www.alfresco.org/model/content/1.0}Some Config Folder

Which is correct.

Thanks,

Kevin

blatwurst
Champ in-the-making
Champ in-the-making
Thanks Kevin for the quick reply.

In the Node Browser, view a "person" node.  Look at the Children section of the report, and notice that the Child Name for the "configurations" child is "{http://www.alfresco.org/model/application/1.0}configurations".  The interesting thing here is that the name "configurations" is not in the "cm" namespace but rather the "app" namespace.  I'm wondering how I reproduce this situation; to have the Child Name be in my own namespace.

One thing I just noticed is that the actual "cm:name" property for this node is something different…it's the GUID of the node.  So I guess that name is different so that it satisfies the integrity contstraint on a name.  So then, maybe my question is how you can build a parent-child relationship such that the Child Name is one thing but the child node's "cm:name" property is something else (as is the case for person->configurations).

Maybe this doesn't matter much.  Maybe it's just the case that all nodes produced by the JavaScript API must have a Child Name that matches the "cm:name" property, and that name must always be in the "cm" namespace.  I just want to make sure…I'm thinking that without a namespace qualification, a collision will be somewhat inevitable.

Thanks for your help!