use of org.apache.jackrabbit.oak.jcr.delegate.VersionManagerDelegate in project jackrabbit-oak by apache.
the class NodeImpl method createNode.
@Nonnull
public static NodeImpl<? extends NodeDelegate> createNode(@Nonnull NodeDelegate delegate, @Nonnull SessionContext context) throws RepositoryException {
PropertyDelegate pd = delegate.getPropertyOrNull(JCR_PRIMARYTYPE);
String type = pd != null ? pd.getString() : null;
if (JcrConstants.NT_VERSION.equals(type)) {
VersionManagerDelegate vmd = VersionManagerDelegate.create(context.getSessionDelegate());
return new VersionImpl(vmd.createVersion(delegate), context);
} else if (JcrConstants.NT_VERSIONHISTORY.equals(type)) {
VersionManagerDelegate vmd = VersionManagerDelegate.create(context.getSessionDelegate());
return new VersionHistoryImpl(vmd.createVersionHistory(delegate), context);
} else {
return new NodeImpl<NodeDelegate>(delegate, context);
}
}
Aggregations