2 Replies Latest reply on Dec 18, 2012 11:49 AM by Anders Roxenhag

    Static node properties

    Anders Roxenhag Newbie

      Is there a way to specify static properties for a node type in ModeShape/JCR? I'd like to set some string properties that are common for all nodes of a type. I know I can add properties with default (possibly also protected) values but I'd like to avoid generating them for each created node.

        • 1. Re: Static node properties
          Randall Hauch Master

          ModeShape currently has no notion of a "static" property that would be appear on all nodes of that type. This wouldn't really be that efficient, and would likely complicate versioning and concurrency.

           

          Probably the best way to do that would be to create a node (or structure) for your static/common information, rather than have it appear on all nodes.

          • 2. Re: Static node properties
            Anders Roxenhag Newbie

            What I really want is to have the properties associated with the primary node type itself, but there is no good way getting them from the NodeType. That's why I thought you might be able to define them "static" and get them through the Node api. I tested creating a property that has a default value and is protected. This way I can get the declared default value from the NodeType, but it's a hack.

             

            I'll keep the separate node/structure alternative in mind, but I'm not sure how I'd connect that to the node type. I'd be back att defining a static reference instead of a static property. But I guess I might have to resort to do the mapping outside the cnd.