jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sunil Dhage <sunil.dh...@coreobjects.com>
Subject Versioning problem
Date Fri, 18 Sep 2009 11:14:05 GMT
Hi,

I have a structure of

Root-> dept ->emp->photo-> content-> some properties.  One of the property
holds photo of the employee.

I have a requirement of storing versions of employee photos.

I have added mix:versionable property to content node.

Its not adding to repository.  On commenting of the version related stuff(beginning with *
in below code), it works fine.

Is there any restriction like on primary node type for being versionable in nature.

node = node.addNode(empname);
                            node.setProperty("emp ", employee.getName());
                            node.setProperty("emp:empphoto", employee.getName());
                            InputStream in = employee.getPhoto().getInputStream();
                            Node attachments = node.addNode("photo",JcrConstants.NT_FILE);
                            log.info("Creating an attachments node.. "+attachments);
                            photo = attachments.addNode("content", JcrConstants.NT_RESOURCE);
                            *photo.addMixin("mix:versionable");
                            *photo.setProperty("versionId", 1L);
                            photo.setProperty(JcrConstants.JCR_MIMETYPE, "application/octet-stream");
                            photo.setProperty(JcrConstants.JCR_DATA, in);
                            Calendar lastModified = Calendar.getInstance();
                            lastModified.setTimeInMillis(System.currentTimeMillis());
                            photo.setProperty(JcrConstants.JCR_LASTMODIFIED, lastModified);
                            IOUtils.closeQuietly(in);
                            session.save();
                            *photo.checkin();
                            log.info("Saved node.  node={} " + node);

Quick help is appreciated.
/Sunil

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message