Jörn Nettingsmeier wrote:
Doug Chestnut wrote:



Jörn Nettingsmeier wrote:

[EMAIL PROTECTED] wrote:

Author: chestnut
Date: Mon Sep 25 00:30:55 2006
New Revision: 449591

URL: http://svn.apache.org/viewvc?view=rev&rev=449591
Log:
allow for multivalue metadata when creating a document (Array param values returned as comma separated string)



i like multivalue metadata. but does that mean that metadata entries cannot contain commas any longer? if so, that is certainly going to bite someone badly at some point.

Sure they can, it is just a way to handle multiple values (which was not supported before, the first value was stored only).

<select name="dublincore.subject" multiple="multiple">
  <option value="Reading,Writing,Arithmetic">General Subjects</option>
  <option>Art</option>
  <option>History</option>
</select>



+     protected String getDublinCoreParameter(String name) {
+        Object param = getParameter(DUBLIN_CORE_PREFIX + name);
+ if (param != null && getParameter(DUBLIN_CORE_PREFIX + name).getClass().isArray()) { + String[] values = (String[]) getParameter(DUBLIN_CORE_PREFIX + name);

say values[] = { "simplestring", "another, more complicated string" };

+            String paramValue = new String("");
+            for (int i = 0; i < values.length; i++ ) {
+                String value = values[i];
+                if (i > 0)
+                    paramValue = paramValue + ',' + value;
+                else
+                    paramValue = value;
+            }
+            return paramValue;

now paramValue will be "simplestring,another, more complicated string".
which looks like three tokens. in your example, this does not hurt, since you are using the concatenated string as-is, without looking inside. but what if i need to get at the single tokens?

Short term: Use whatever solution you had when multivalue selects were ignored :)

I guess that these metadata values need to be stored in separate elements, and accessed as arrays. This digs deeper into the code base than I have time for today, but I will look into this asap unless someone else beats me to it ;).

--Doug




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to