How can I convert non-versionable node into first version in the most effective way?So far I came up with this:
public static void addAspect(NodeRef nodeRef, String comment) {
CheckOutCheckInService checkOutCheckInService = AlfrescoServices.getServiceRegistry().getCheckOutCheckInService();
AlfrescoServices.getNodeService().addAspect(nodeRef, ContentModel.ASPECT_VERSIONABLE, null);
NodeRef nodeRefWorkingCopy = checkOutCheckInService.checkout(nodeRef);
checkOutCheckInService.checkin(nodeRefWorkingCopy, Utils.getMinorVersionProperties(comment));
}
public static Map<String, Serializable> getMinorVersionProperties(final String comment) {
Map<String, Serializable> versionProperties = new HashMap<String, Serializable>();
versionProperties.put(Version.PROP_DESCRIPTION, comment);
versionProperties.put(VersionModel.PROP_VERSION_TYPE, VersionType.MINOR);
return versionProperties;
}
This way I get created 1.0 version, but the current user is noted as 1.0 version creator, not the original creator.Is there a way to modify the code so that the original creator is noted as 1.0 version creator?