When using JcrUtil.createPath to create a folder (directory) in DAM Asset in AEM, an exception is thrown with error OakConstraint0025: /content/dam/upload/Type/99/MBT/front[[nt:file]]: Mandatory child node jcr:content not found in a new node. It may mean that the child jcr:content node needs to be created in the same time with the directory. So I really do not know how to resolve this problem.
// get resource resolver
ResourceResolver resourceResolver = resourceResolverFactory.getResourceResolver(Collections.<String, Object>singletonMap(JcrResourceConstants.AUTHENTICATION_INFO_SESSION, session));
AssetManager assetMgr = resourceResolver.adaptTo(AssetManager.class);
// creating directory in DAM Asset
Node newParentNode = JcrUtil.createPath(splitParentPath, true, "sling:OrderedFolder", "nt:file", session, true);
newParentNode.addNode("jcr:content", "nt:resource");
// moving DAM Asset
assetMgr.moveAsset(fileNode.getPath(), splitParentPath + "/" + newFileName);
I did follow this JCRUtil API https://helpx.adobe.com/experience-manager/6-2/sites/developing/using/reference-materials/javadoc/com/day/cq/commons/jcr/JcrUtil.html#createPath(Node,%20java.lang.String,%20boolean,%20java.lang.String,%20java.lang.String,%20Session,%20boolean), and this How to create a directory on the basis of path in cq5?
Please help !