Hi,
On 7/27/06, Nicolas <[EMAIL PROTECTED]> wrote:
How can I know that a nodeType already exist? I can look for it in the list
of all NodeTypes (but I need first to build it) or catch the exception but
both are somewhat inelegant. Is there anothe way?
At the moment I'd use the exception:
try {
nodeTypeManager.getNodeType(name);
// exists
} catch (NoSuchNodeTypeException e) {
// does not exist
}
But I agree that a utility method like
NodeTypeManager.hasNodeType(String) would feel nicer for applications
that want to automatically create a node type if it doesn't yet exist.
If you like, a patch for adding such a method to
JackrabbitNodeTypeManager and NodeTypeManagerImpl would be welcome.
Alexander's use of NodeTypeRegistry.isRegistered(QName) is correct.
I'll propose such an addition to JSR 283.
BR,
Jukka Zitting
--
Yukatan - http://yukatan.fi/ - [EMAIL PROTECTED]
Software craftsmanship, JCR consulting, and Java development