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

adds multiple value handling for properties (NodeData)

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • 4.0
    • 3.1 M1
    • core, gui
    • None

      lets you save and get properties with multiple values

      To save a property with multiple values you need a custom SaveHandlerImpl (this is java5 for client project):

      protected void processMultiple(Content content, String name, int type, String[] strings) throws RepositoryException,
      PathNotFoundException, AccessDeniedException {

      List<Value> values = new ArrayList<Value>();
      NodeData data = NodeDataUtil.getOrCreate(content, name);
      if (strings != null && strings.length != 0) {
      for (String string : strings) {
      Value value = getValue(string, type);
      if (value != null)

      { values.add(value); }

      }
      data.setValue(values.toArray(new Value[values.size()]));
      } else

      { data.delete(); }

      }

      So there should be a switch for multiple nodes and multiple values later in related classes.

      XML export looks like so:

      <sv:property sv:name="product:colors" sv:type="String">
      <sv:value>black</sv:value>
      <sv:value>blue</sv:value>
      </sv:property>

        Acceptance criteria

          1. Content.java.diff
            1 kB
          2. ControlImpl.java.diff
            3 kB
          3. DialogControlImpl.java.diff
            2 kB
          4. NodeData.java.diff
            4 kB
          5. NodeDataUtil.java.diff
            2 kB

              tmiyar Teresa Miyar
              olli Oliver Lietz
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Task DoD