use of org.openforis.idm.metamodel.LanguageSpecificText in project collect by openforis.
the class UIOptionsSerializer method writeTab.
protected void writeTab(XmlSerializer serializer, UITab tab, String defaultLanguage) throws IOException {
serializer.startTag(UI_NAMESPACE_URI, TAB);
serializer.attribute("", NAME, tab.getName());
List<LanguageSpecificText> labels = tab.getLabels();
for (LanguageSpecificText label : labels) {
writeLabel(serializer, label, defaultLanguage);
}
List<UITab> tabs = tab.getTabs();
for (UITab innerTab : tabs) {
writeTab(serializer, innerTab, defaultLanguage);
}
serializer.endTag(UI_NAMESPACE_URI, TAB);
}
use of org.openforis.idm.metamodel.LanguageSpecificText in project collect by openforis.
the class LanguageSpecificTextPR method processText.
/**
* Override this method to handle "type" attribute for other label types
* @param lang
* @param type
* @param text
* @throws XmlParseException
*/
protected void processText(String lang, String type, String text) throws XmlParseException {
LanguageSpecificText lst = new LanguageSpecificText(lang, text.trim());
processText(lst);
}
use of org.openforis.idm.metamodel.LanguageSpecificText in project collect by openforis.
the class LanguageSpecificTextPR method processText.
/**
* Override this method to handle "type" attribute for other label types
* @param lang
* @param type
* @param text
* @throws XmlParseException
*/
protected void processText(String lang, String type, String text) throws XmlParseException {
LanguageSpecificText lst = new LanguageSpecificText(lang, text.trim());
processText(lst);
}
use of org.openforis.idm.metamodel.LanguageSpecificText in project collect by openforis.
the class CodeListImportTask method processLevel.
protected CodeListItem processLevel(CodeListItem parent, CodeListLine line, int levelIdx, boolean lastLevel) {
CodeListItem result;
// validate code
List<String> codes = line.getLevelCodes();
if (codes.isEmpty()) {
addEmptyCodeColumnError(line, levelIdx);
}
String code = codes.get(levelIdx);
if (lastLevel && isDuplicate(code, parent)) {
addDuplicateCodeError(line, levelIdx);
}
// validate labels
List<LanguageSpecificText> labels = line.getLabelItems(levelIdx);
for (LanguageSpecificText label : labels) {
if (hasDifferentLabel(code, label, parent)) {
addDifferentLabelError(line, levelIdx, label.getLanguage());
}
}
result = getChildItem(parent, code);
if (result == null) {
result = codeList.createItem(levelIdx + 1);
List<LanguageSpecificText> descriptions = line.getDescriptionItems(levelIdx);
fillItem(result, code, labels, descriptions);
if (parent == null) {
codeToRootItem.put(code, result);
} else {
parent.addChildItem(result);
}
}
return result;
}
use of org.openforis.idm.metamodel.LanguageSpecificText in project collect by openforis.
the class CodeListImportProcess method processLevel.
protected CodeListItem processLevel(CodeListItem parent, CodeListLine line, int levelIdx, boolean lastLevel) {
CodeListItem result;
// validate code
List<String> codes = line.getLevelCodes();
if (codes.isEmpty()) {
addEmptyCodeColumnError(line, levelIdx);
}
String code = codes.get(levelIdx);
if (lastLevel && isDuplicate(code, parent)) {
addDuplicateCodeError(line, levelIdx);
}
// validate labels
List<LanguageSpecificText> labels = line.getLabelItems(levelIdx);
if (CollectionUtils.isEmpty(labels)) {
addMissingDefaultLanguageLabelError(line, levelIdx);
} else {
for (LanguageSpecificText label : labels) {
if (hasDifferentLabel(code, label, parent)) {
addDifferentLabelError(line, levelIdx, label.getLanguage());
}
}
}
result = getChildItem(parent, code);
if (result == null) {
result = codeList.createItem(levelIdx + 1);
List<LanguageSpecificText> descriptions = line.getDescriptionItems(levelIdx);
fillItem(result, code, labels, descriptions);
if (parent == null) {
codeToRootItem.put(code, result);
} else {
parent.addChildItem(result);
}
}
return result;
}
Aggregations