public static MediaTypeValueList getMediaTypeParameterValues(UserRegistry registry, String mediaType) throws RegistryException {
// String[] strings = {"Name", "1", "2", "3"};
// String[] strings2 = {"4", "5", "7", "6"};
// mediatypeParameterList.put("text", strings);
// mediatypeParameterList.put("image",strings2);
MediaTypeValueList bean = new MediaTypeValueList();
try {
List<String> returnList = new ArrayList<String>();
if (!registry.resourceExists(parameterListResourcePath)) {
Map<String, String[]> types = new HashMap<String, String[]>();
types.put("application/wsdl+xml", new String[]{"WSDL Validation",
"WSI Validation"});
types.put("application/x-xsd+xml", new String[]{"Schema Validation",
"targetNamespace"});
for (Map.Entry<String, String[]> e : types.entrySet()) {
Resource resource = registry.newResource();
for (String value : e.getValue()) {
resource.setProperty(value, "true");
}
registry.put(parameterListResourcePath + e.getKey().replace("/", "-").
replace(".","-").replace("+","-"), resource);
}
}
if (!("".equals(mediaType))) {
Resource resource = registry.get(parameterListResourcePath + mediaType.replace("/", "-").replace(".", "-").
replace("+", "-"));
Properties property = resource.getProperties();
for (Map.Entry<Object, Object> entry : property.entrySet()) {
if (((ArrayList) entry.getValue()).contains("true")) {
returnList.add(entry.getKey().toString());
}
}
}
bean.setMediaType(mediaType);
if (returnList.size() > 0) {
String[] tempString = new String[returnList.size()];
tempString = returnList.toArray(tempString);
bean.setSearchFields(tempString);
}
} catch (RegistryException e) {
throw new RegistryException("No parameters are set for this media type", e);