{
JSMediaType _c = (JSMediaType)_it.next();
// create a new Media
try
{
MediaType mediaType = caps.createMediaType(_c.getName());
/** THE KEY_OVERWRITE_EXISTING test IS required for media types, since they carry no other information than the name
* Used here for consistency, though
*/
if ((this.getSetting(JetspeedSerializer.KEY_OVERWRITE_EXISTING)) || (mediaType.getMediatypeId() == 0))
{
// set object fields
mediaType.setCharacterSet(_c.getCharacterSet());
mediaType.setTitle(_c.getTitle());
mediaType.setDescription(_c.getDescription());
try
{
_line = _c.getMimeTypesString().toString();
ArrayList list = this.getTokens(_line);
if ((list != null) && (list.size()>0))
{
Iterator _it1 = list.iterator();
int added = 0;
while (_it1.hasNext())
{
MimeType _mt = caps.createMimeType((String)_it1.next());
if (_mt != null)
mediaType.addMimetype(_mt);
added++;
}
}
}
catch (Exception e1)
{
e1.printStackTrace();
}
try
{
_line = _c.getCapabilitiesString().toString();
ArrayList list = this.getTokens(_line);
if ((list != null) && (list.size()>0))
{
Iterator _it1 = list.iterator();
if ((list != null) && (list.size()>0))
{
int added = 0;
while (_it1.hasNext())
{
Capability _ct = caps.createCapability((String)_it1.next());
if (_ct != null)
mediaType.addCapability(_ct);
added++;
}
}
}
}