Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-2066

A second ContentUtil.getOrCreateContent() method mentioned in Javadoc, but missing in the class file

    XMLWordPrintable

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, RepositoryException
        Unknown macro: { Content res = null; try { res = node.getContent(name); } catch (PathNotFoundException e) { res = node.createContent(name, contentType); node.save(); } return res; }

      Checklists

        Acceptance criteria

        Attachments

          Activity

            People

              gjoseph Magnolia International
              giancarlo Giancarlo Berner
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Checklists

                  Bug DoR
                  Task DoD