* The value of the property in the specified language.
*/
public void setLanguagePropertyValue(String qualifiedName, String language,
String value) {
AbstractField property = getAbstractProperty(qualifiedName);
ComplexProperty prop;
if (property != null) {
// Analyzing content of property
if (property instanceof ComplexProperty) {
prop = (ComplexProperty) 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("xml:lang").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 = new TextType(metadata, "rdf", "li",
value);
langValue.setAttribute(new Attribute(null, "xml",
"lang", language));
prop.getContainer().addProperty(langValue);
}
reorganizeAltOrder(prop.getContainer());
return;
}
}
// if no definition found, we add a new one
TextType langValue;
langValue = new TextType(metadata, "rdf", "li", value);
langValue.setAttribute(new Attribute(null, "xml", "lang",
language));
prop.getContainer().addProperty(langValue);
reorganizeAltOrder(prop.getContainer());
}
} else {
String[] splittedQualifiedName = qualifiedName.split(":");
prop = new ComplexProperty(metadata, splittedQualifiedName[0],
splittedQualifiedName[1], ComplexProperty.ALTERNATIVE_ARRAY);
TextType langValue;
langValue = new TextType(metadata, "rdf", "li", value);
langValue
.setAttribute(new Attribute(null, "xml", "lang", language));
prop.getContainer().addProperty(langValue);
content.addProperty(prop);
}
}