Details
-
Bug
-
Resolution: Not an issue
-
Minor
-
None
-
3.5.4
-
None
-
None
-
Magnolia 3.5.4 EE
Description
In the javadoc on http://dev.magnolia.info/ref/latest/apidocs/index.html there are two 'getOrCreateContent()' methods.
In the ContentUtil.java file however the method
public static Content getOrCreateContent(Content node, String name, ItemType contentType, boolean save)
is missing.
Including the following method into ContentUtil.java should do the job:
/**
- If the node doesn't exist just create it. If the parameter save is true the parent node is saved.
- @param node The node object to return
- @param name The name of the node object. Will be used to create the new node
- @param contentType The type of the node. Will be used to create the new node
- @param save <code>true</code> Will save the new node after creation
- @return the existing or created <code>node</code>
- @throws AccessDeniedException
- @throws RepositoryException
*/
public static Content getOrCreateContent(Content node, String name, ItemType contentType, boolean save)
throws AccessDeniedException, RepositoryExceptionUnknown macro: { Content res = null; try { res = node.getContent(name); } catch (PathNotFoundException e) { res = node.createContent(name, contentType); node.save(); } return res; }
Checklists
Acceptance criteria