Adding properties to auto-generated nodes

2014-01-08 Thread Buzzterrier
We are using :nameHint to create a node. We would like to add some properties
to the this node when it is created. Is there a way to do this?



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Adding-properties-to-auto-generated-nodes-tp4030116.html
Sent from the Sling - Users mailing list archive at Nabble.com.


Mixin questions

2014-01-08 Thread Buzzterrier
Still getting my feet wet with Sling and jcr. We would like to add some
metadata to the a node of nt:file type. It looks like mixins are the way to
go, but I am having trouble figuring them out. It looks like you create them
in a .cnd file. But where do you put the file? It would be slick to just
drop it somewhere in the sling OSGi structure and have it pick it up on
startup.  Is that possible? Otherwise do I put in the the
bundles/jcr/resource/src/main/resources/SLING-INF/nodetype directory and
rebuild the project?

Also I am a bit confused on what is the best way to create a mixin that
extends nt:file.  One example I read has you just do the following:

[acme:taggable] mixin
- acme:tags (STRING) multiple


But I do not see how that gets mixed in the nt:file definition.

Rather would you do something like this?

[acme:taggable]  nt:file mixin
- acme:tags (STRING) multiple

Also, is there anything special I should know about using mixins with rest
calls? All of the examples add content with Mixins using the sling api.

Thx.



--
View this message in context: 
http://apache-sling.73963.n3.nabble.com/Mixin-questions-tp4030123.html
Sent from the Sling - Users mailing list archive at Nabble.com.


Re: Adding properties to auto-generated nodes

2014-01-08 Thread Alexander Klimetschek
On 08.01.2014, at 08:36, Buzzterrier tje...@blueorigin.com wrote:

 We are using :nameHint to create a node. We would like to add some properties
 to the this node when it is created. Is there a way to do this?

Just specify the properties normally using the sling post servlet. For 
:nameHint, you will use an URL ending with / or /*. All the properties set like 
myproperty=foo as request parameter will be relative to the node addressed in 
the URL, which in case of the wildcard will be that newly created node.

Here is an example (from the top off my head):

POST /content/*
:nameHint = blogpost
jcr:title = My first post
jcr:description = This is my first post.

Cheers,
Alex