jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From freak182 <eman.noll...@gmail.com>
Subject Help on versioning
Date Wed, 16 Sep 2009 10:46:18 GMT

Hello,

Im doing a versioning on file but for no apparent reason i cannot make it to
work.


	    Node folder = (rootNode.hasNode(path)) ? rootNode.getNode(path)
		    : RepositoryHelper.createFolder(session, path, rootNode);
	    Node file = folder.addNode(name, "nt:file");
	    Node fileContent = file.addNode("jcr:content", "nt:resource");
	    fileContent.addMixin(JcrConstants.MIX_VERSIONABLE);
	    fileContent.addMixin(JcrConstants.MIX_REFERENCEABLE);
	    fileContent.setProperty("jcr:mimeType", mimeType);
	    fileContent.setProperty("jcr:lastModified", Calendar.getInstance());
	    fileContent.setProperty("jcr:data", fileStream);
	    session.save();
	    fileContent.checkin();
	    uuid = fileContent.getUUID();

//add new version
	    String clildpath = path + name;
	          Node child = rootNode.getNode(clildpath);
	          child.checkout();
	          child.setProperty("anyProperty", "Blah2");
	          session.save();
	          child.checkin();

	    
	  VersionHistory history = child.getVersionHistory();
	  VersionIterator ite = history.getAllVersions();
	  while (ite.hasNext())
	  {
        	Version ver = (Version) ite.next();
        	System.out.println("version successor:"+ver.getName());
        	System.out.println("created time:"+ver.getCreated().getTime());
	  }

javax.jcr.UnsupportedRepositoryOperationException: Unable to perform a
versioning operation on a non versionable node: node
/photo/upload/test/Sangat_Island.jpg
     at
org.apache.jackrabbit.core.NodeImpl.checkVersionable(NodeImpl.java:3681)
     at org.apache.jackrabbit.core.NodeImpl.checkout(NodeImpl.java:3401)

...what im missing?

thanks a lot.
cheers.

-- 
View this message in context: http://www.nabble.com/Help-on-versioning-tp25469946p25469946.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message