

![]() | Start a set with this search |
![]() | Include this search in one of my sets |
![]() | Exclude this search from one of my sets |
![]() | Permalink to these results Paste this link in email or IM: |
| Atom feed for tracking future search results Paste this URL into your reader: |
4 messages in org.apache.jackrabbit.usersRe: Can't add Nodes to CND constraine...| From | Sent On | Attachments |
|---|---|---|
| BobHitchins | Oct 9, 2007 1:10 pm | |
| Stefan Guggisberg | Oct 11, 2007 8:42 am | |
| BobHitchins | Oct 11, 2007 11:14 am | |
| Stefan Guggisberg | Oct 12, 2007 4:41 am |

![]() | Permalink for this message Paste this link in email or IM: |
![]() | Permalink for this thread Paste this link in email or IM: |
| Atom feed for this thread Paste this URL into your reader: |
| Subject: | Re: Can't add Nodes to CND constrained Repository | Actions... |
|---|---|---|
| From: | Stefan Guggisberg (stef...@gmail.com) | |
| Date: | Oct 11, 2007 8:42:08 am | |
| List: | org.apache.jackrabbit.users | |
hi bob
On 10/9/07, BobHitchins <robe...@navy.mil> wrote:
Hi All - Need some help plz (JCR newbie)
I have the following CND file (exerpt from ConopsJCR.cnd) that works just fine: <?xml version "1.0" encoding="UTF-8"?> <nodeTypes xmlns:fn....... xmlns:jcr......... xmlns:nt......... xmlns:sv........ xmlns:xs......... xmlns:xml........ <nodeType hasOrderableChildNodes="false" isMixin="true" name="nt:PermissionTemplate" primaryItemName="nt:templateName"> <supertypes> <supertype>mix:versionable</supertype> </supertypes? <propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="nt:description" onParentVersion="VERSION" protected="false" requiredType="String"/> <propertyDefinition autoCreated="false" mandatory="true" multiple="false" name="nt:templateName" onParentVersion="VERSION" protected="false" requiredType="String"/> </nodeType> </nodeTypes>
When I execute the following code (logging code removed), I always get a "no definition found in parent node's node type for new node" error in the log and a Constraint Violation exception. I've looked for some simple implementing code to show me what I should be doing, but haven't been able to find it. Please let me what I'm doing wrong :-)
you defined nt:PermissionTemplate as being a mixin type rather than a primary type,
isMixin="true"
that's the problem. if you change that to a primary type, your sample should work.
cheers stefan
import javax.jcr.Node; import javax.jcr.Repository; import javax.jcr.Session; import javax.jcr.SimpleCredentials; import javax.jcr.Workspace;
import org.apache.jackrabbit.core.TransientRepository;
public class JCRTest { public static void main(String[] args) throws Exception { String user = "bob";
SimpleCredentials myCredentials = new SimpleCredentials(user, user.toCharArray()); Repository repository = new TransientRepository(); Session session = repository.login(myCredentials);
try { Workspace ws = session.getWorkspace(); CustomNodeType.RegisterCustomNodeTypes(ws, "ConopsJCR.cnd"); Node root = session.getRootNode(); root.addNode("PermissionTemplate", "nt:PermissionTemplate"); session.save(); } finally { session.logout(); } } }
Thanks in advance!
Bob
--
View this message in context:
http://www.nabble.com/Can%27t-add-Nodes-to-CND-constrained-Repository-tf4596634.html#a13123797
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.







