com.nedap.archie.xml.adapters.StringDictionaryUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aom Show documentation
Show all versions of aom Show documentation
An OpenEHR archetype object model implementation, plus parser
package com.nedap.archie.xml.adapters;
import com.nedap.archie.xml.types.StringDictionaryItem;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Created by pieter.bos on 01/08/16.
*/
public class StringDictionaryUtil {
public static ArrayList convertUriMapIntoStringDictionaryList(Map terms) {
if(terms == null) {
return null;
}
ArrayList items = new ArrayList<>();
for(String termId: terms.keySet()) {
StringDictionaryItem item = new StringDictionaryItem();
item.setId(termId);
item.setValue(terms.get(termId).toString());
items.add(item);
}
return items;
}
public static ArrayList convertStringMapIntoStringDictionaryList(Map terms) {
if(terms == null) {
return null;
}
ArrayList items = new ArrayList<>();
for(String termId: terms.keySet()) {
StringDictionaryItem item = new StringDictionaryItem();
item.setId(termId);
item.setValue(terms.get(termId));
items.add(item);
}
return items;
}
public static Map convertStringDictionaryListToUriMap(List items) throws URISyntaxException {
if(items == null) {
return null;
}
Map termMap = new LinkedHashMap<>();
for(StringDictionaryItem term:items) {
termMap.put(term.getId(), new URI(term.getValue()));
}
return termMap;
}
public static LinkedHashMap convertStringDictionaryListToStringMap(List items) {
if(items == null) {
return null;
}
LinkedHashMap termMap = new LinkedHashMap<>();
for(StringDictionaryItem term:items) {
termMap.put(term.getId(),term.getValue());
}
return termMap;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy