{
boolean modified = false;
Iterator fieldsIter = meta.getFields().iterator();
while (fieldsIter.hasNext())
{
LocalizedField field = (LocalizedField) fieldsIter.next();
String id = field.getId().toString();
String value = actionRequest.getParameter(id + ":value");
if (value != null)
{
if (!value.equals(field.getValue()))
{
field.setValue(value);
modified = true;
}
}
}
if (modified)
{
if (pd == null)
{
registry.updatePortletApplication(pa);
}
else
{
registry.savePortletDefinition(pd);
}
}
}
catch (RegistryException e)
{
throw new PortletException("Failed update meta data attributes: "
+ paName + ", " + ((pdName == null) ? "" : pdName), e);
}
}
else if (action.equals("remove_metadata"))
{
String[] ids = actionRequest.getParameterValues("metadata_id");
if (ids != null)
{
try
{
Iterator fieldsIter = meta.getFields().iterator();
int count = 0;
while (fieldsIter.hasNext())
{
LocalizedField field = (LocalizedField) fieldsIter.next();
String id = field.getId().toString();
for(int i=0; i<ids.length; i++)
{
String mid = ids[i];
if(mid.equals(id))