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
Branches
Tags
No related merge requests found
...@@ -42,7 +42,7 @@ import uws.service.UWSUrl; ...@@ -42,7 +42,7 @@ import uws.service.UWSUrl;
* </ul> * </ul>
* *
* @author Gr&eacute;gory Mantelet (CDS;ARI) * @author Gr&eacute;gory Mantelet (CDS;ARI)
* @version 4.1 (09/2014) * @version 4.1 (12/2014)
* *
* @see XMLSerializer * @see XMLSerializer
* @see JSONSerializer * @see JSONSerializer
...@@ -114,9 +114,22 @@ public abstract class UWSSerializer implements Serializable { ...@@ -114,9 +114,22 @@ public abstract class UWSSerializer implements Serializable {
// PARAMETER: // PARAMETER:
String secondAttribute = attributes[1]; String secondAttribute = attributes[1];
Object value = job.getAdditionalParameterValue(secondAttribute); Object value = job.getAdditionalParameterValue(secondAttribute);
if (value != null) if (value != null){
return value.toString(); // 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 else
return value.toString();
}else
throw new UWSException(UWSException.NOT_FOUND, "No parameter named \"" + secondAttribute + "\" in the job \"" + job.getJobId() + "\"!"); throw new UWSException(UWSException.NOT_FOUND, "No parameter named \"" + secondAttribute + "\" in the job \"" + job.getJobId() + "\"!");
} }
// RESULTS LIST: // RESULTS LIST:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment