Skip to content
Snippets Groups Projects
Commit 18f4cc58 authored by gmantele's avatar gmantele
Browse files

[UWS] Stringify an array parameter (e.g. UPLOAD which is an array of DALIUpload objects in TAP)

parent fa7806a7
No related branches found
No related tags found
No related merge requests found
......@@ -42,7 +42,7 @@ import uws.service.UWSUrl;
* </ul>
*
* @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 4.1 (09/2014)
* @version 4.1 (12/2014)
*
* @see XMLSerializer
* @see JSONSerializer
......@@ -114,9 +114,22 @@ public abstract class UWSSerializer implements Serializable {
// PARAMETER:
String secondAttribute = attributes[1];
Object value = job.getAdditionalParameterValue(secondAttribute);
if (value != null)
return value.toString();
else
if (value != null){
// CASE: array value
if (value.getClass().isArray()){
Object[] items = (Object[])value;
StringBuffer arrayAsString = new StringBuffer();
for(Object item : items){
if (arrayAsString.length() > 0)
arrayAsString.append(' ').append(';').append(' ');
arrayAsString.append(item.toString());
}
return arrayAsString.toString();
}
// DEFAULT:
else
return value.toString();
}else
throw new UWSException(UWSException.NOT_FOUND, "No parameter named \"" + secondAttribute + "\" in the job \"" + job.getJobId() + "\"!");
}
// RESULTS LIST:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment