You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Thomas Kratz <th...@eiswind.de> on 2008/12/07 10:04:04 UTC
AW: WG: Still Stuck with Versioning
Hi, I still don't get this ...
I tried this with a late 1.5.0 build because of a dependency conflict.
Even if I have only the nt:file node versionable it doesn't work. Can someone point me to a testcase or sth where I can have a look how to do it ?
Regards Thomas
-----Ursprüngliche Nachricht-----
Von: 류대원 [mailto:dworyu@nhncorp.com]
Gesendet: Montag, 24. November 2008 03:46
An: users@jackrabbit.apache.org
Betreff: RE: WG: Still Stuck with Versioning
Hi,
Well, I don't think you have to make child node (nt:file) versionable, you just have to give the mix:versionale to the parent node.
I guess the problem is from the bug of the jackrabbit.
What version of the jackrabbit-core are you using? There are some versioning bugs on the core-1.4, so replace it with core-1.4.6.
I guess it will help you.
By won
-----Original Message-----
From: Thomas Kratz [mailto:thomas.kratz@eiswind.de]
Sent: Monday, November 24, 2008 12:28 AM
To: users@jackrabbit.apache.org
Subject: WG: WG: Still Stuck with Versioning
This is how I store the new version, from the comments you can see what I ve
been trying:
public void persistDocumentAsNewVersion(Long userId, byte[] file,
DocumentPath path) throws Exception {
if (path.getKeyNodeUuid() == null) {
throw new UnsupportedOperationException(
"Document cant have new version");
}
Repository repository = Server.getRepository();
Session session = repository.login(new
SimpleCredentials("system", ""
.toCharArray()));
try {
Node key = null;
key = session.getNodeByUUID(path.getKeyNodeUuid());
key.checkout();
User user = userDAO.findUserById(userId);
key.setProperty("user", user.getLogin());
key.setProperty("userid", userId);
Node fileNode = null;
try {
fileNode = key.getNode(path.getFilename());
} catch (PathNotFoundException x) {
throw new IllegalStateException("File Not
found in node", x);
}
// fileNode.checkout();
Node resNode = fileNode.getNode("jcr:content");
// resNode.checkout();
resNode.setProperty("jcr:data", new
ByteArrayInputStream(file));
Calendar lastModified = Calendar.getInstance();
resNode.setProperty("jcr:lastModified",
lastModified);
session.save();
// resNode.checkin();
// fileNode.checkin();
key.checkin();
} catch (Exception x) {
log.error("Adding Version", x);
throw x;
} finally {
session.logout();
}
}
I can get a versioned node of the nt:unstructured, but when I access the
nt:file like
VersionHistory h =
keynode.getVersionHistory();
VersionIterator ito =
h.getAllVersions();
ito.nextVersion();
while (ito.hasNext()) {
Version v =
ito.nextVersion();
NodeIterator ito2 =
v.getNodes("jcr:frozenNode");
if (ito2.hasNext()) {
Node nextNode =
ito2.nextNode();
System.out.println(v.getCreated().getTime());
try {
System.out.println(nextNode.getName());
System.out.println(nextNode.getProperty("user")
.getString());
System.out.println(nextNode.getNodes()
.nextNode().getPrimaryNodeType().getName());
I get an nt:file as child of the frozen node that has no content and no
uuid.
Regards Thomas
-----Ursprüngliche Nachricht-----
Von: Julian Reschke [mailto:julian.reschke@gmx.de]
Gesendet: Sonntag, 23. November 2008 16:09
An: users@jackrabbit.apache.org
Betreff: Re: WG: Still Stuck with Versioning
Thomas Kratz wrote:
> I investigated somewhat further.
>
>
>
> Now I have made the nt:file child versionable, the versioned parent node
of
> nt:unstructured truly has a child of nt:file but I don't get it right. The
> nt:file child has no neither a uuid (as the original node has) and is not
> of nt:frozenNode (what I would have expected). I would expect to see
> frozenNodes as children of my VersionHistory node ???
>
> ...
The nt:versionHistory node should have child nodes of type nt:version.
BR, Julian