{
try
{
PortletRegistry registry = ((AbstractAdminWebApplication) getApplication()).getServiceLocator().getPortletRegistry();
PortletApplication app = registry.getPortletApplication(paNodeBean.getApplicationName());
PortletDefinition def = null;
if (paNodeBean.getName() != null)
{
def = PortletApplicationUtils.getPortletOrClone(app, paNodeBean.getName());
}
if (newName != null && newValue != null && newLocale != null)
{
GenericMetadata metadata = (def == null ? app.getMetadata() : def.getMetadata());
LocalizedFieldBean fieldBean = new LocalizedFieldBean(metadata.createLocalizedField());
fieldBean.setName(newName);
fieldBean.setLocaleString(newLocale);
fieldBean.setValue(newValue);
metadata.addField(fieldBean.getLocalizedField());