Hello,
I have an app that allows users to upload binary files to a Jackrabbit
repository.  There are also a few pieces of metadata that I am tracking
withing each file.  For example, description, document id, user, etc. The
other requirement is that the files be versioned and have access to
historical versions.  This is all working beautifully except for one small
problem...

Whenever the user changes something like the description, the version
number for the file goes up one.  I really only want a new version to occur
when the actual file is replaced with a new one.
Can someone tell me how I can store unversioned metadata with my versioned
node?  Would be much appreciated.  Thanks!


Here is some sample code to illustrate how I am doing it now....


When the session starts, I register a custom property type....
-------------------------------------------------------------------------------------------------
NodeTypeManager nodeTypeManager = (NodeTypeManager)
session.getWorkspace().getNodeTypeManager();
NodeTypeTemplate nodeType = nodeTypeManager.createNodeTypeTemplate();
nodeType.setDeclaredSuperTypeNames(new String[] {"nt:resource"});
nodeType.setName("fileContent");

PropertyDefinitionTemplate property =
nodeTypeManager.createPropertyDefinitionTemplate();
property.setName("description");
property.setMultiple(false);
property.setRequiredType(type);
template.getPropertyDefinitionTemplates().add(property);
nodeTypeManager.registerNodeType(nodeType, true);
-------------------------------------------------------------------------------------------------



To change property value....
-------------------------------------------------------------------------------------------------

VersionManager vman = session.getWorkspace().getVersionManager();
Node fileNode = session.getNodeByIdentifier(id);
Node resNode = fileNode.getNode("jcr:content");
vman.checkout(fileNode.getPath());
resNode.setProperty("description", description);
session.save();
vman.checkin(fileNode.getPath());
-------------------------------------------------------------------------------------------------

Reply via email to