*/
public void setUnqualifiedLanguagePropertyValue(String name, String language, String value)
{
String qualifiedName = name;
AbstractField property = getAbstractProperty(qualifiedName);
ArrayProperty prop;
if (property != null)
{
// Analyzing content of property
if (property instanceof ArrayProperty)
{
prop = (ArrayProperty) property;
Iterator<AbstractField> itCplx = prop.getContainer().getAllProperties().iterator();
// try to find the same lang definition
AbstractField tmp;
// Try to find a definition
while (itCplx.hasNext())
{
tmp = itCplx.next();
// System.err.println(tmp.getAttribute("xml:lang").getStringValue());
if (tmp.getAttribute(XmpConstants.LANG_NAME).getValue().equals(language))
{
// the same language has been found
if (value == null)
{
// if value null, erase this definition
prop.getContainer().removeProperty(tmp);
}
else
{
prop.getContainer().removeProperty(tmp);
TextType langValue;
langValue = createTextType(XmpConstants.LIST_NAME, value);
langValue.setAttribute(new Attribute(XMLConstants.XML_NS_URI, XmpConstants.LANG_NAME,
language));
prop.getContainer().addProperty(langValue);
}
reorganizeAltOrder(prop.getContainer());
return;
}
}
// if no definition found, we add a new one
TextType langValue;
langValue = createTextType(XmpConstants.LIST_NAME, value);
langValue.setAttribute(new Attribute(XMLConstants.XML_NS_URI, XmpConstants.LANG_NAME, language));
prop.getContainer().addProperty(langValue);
reorganizeAltOrder(prop.getContainer());
}
}
else
{
prop = createArrayProperty(name, Cardinality.Alt);
TextType langValue;
langValue = createTextType(XmpConstants.LIST_NAME, value);
langValue.setAttribute(new Attribute(XMLConstants.XML_NS_URI, XmpConstants.LANG_NAME, language));
prop.getContainer().addProperty(langValue);
addProperty(prop);
}
}