use of org.eclipse.winery.common.interfaces.QNameWithName in project winery by eclipse.
the class WineryUtil method convertQNameWithNameListToNamespaceToLocalNameNamePairList.
public static SortedMap<String, SortedSet<LocalNameNamePair>> convertQNameWithNameListToNamespaceToLocalNameNamePairList(List<QNameWithName> list) {
if (list == null) {
throw new IllegalArgumentException("list may not be null");
}
SortedMap<String, SortedSet<LocalNameNamePair>> res = new TreeMap<>();
for (QNameWithName qnameWithName : list) {
SortedSet<LocalNameNamePair> localNameNamePairSet = res.get(qnameWithName.qname.getNamespaceURI());
if (localNameNamePairSet == null) {
localNameNamePairSet = new TreeSet<>();
res.put(qnameWithName.qname.getNamespaceURI(), localNameNamePairSet);
}
LocalNameNamePair pair = new LocalNameNamePair(qnameWithName.qname.getLocalPart(), qnameWithName.name);
localNameNamePairSet.add(pair);
}
return res;
}
use of org.eclipse.winery.common.interfaces.QNameWithName in project winery by eclipse.
the class WineryRepositoryClient method getListOfAllInstances.
@Override
public Collection<QNameWithName> getListOfAllInstances(Class<? extends DefinitionsChildId> clazz) {
// inspired by getQNameListOfAllTypes
String path = Util.getRootPathFragment(clazz);
Map<WebResource, List<NamespaceIdOptionalName>> wRtoNamespaceAndIdListMapOfAllTypes = this.getWRtoNamespaceAndIdListMapOfAllTypes(path);
Collection<List<NamespaceIdOptionalName>> namespaceAndIdListCollection = wRtoNamespaceAndIdListMapOfAllTypes.values();
List<QNameWithName> res = new ArrayList<QNameWithName>(namespaceAndIdListCollection.size());
for (List<NamespaceIdOptionalName> namespaceAndIdList : namespaceAndIdListCollection) {
for (NamespaceIdOptionalName namespaceAndId : namespaceAndIdList) {
QNameWithName qn = new QNameWithName();
qn.qname = new QName(namespaceAndId.getNamespace(), namespaceAndId.getId());
qn.name = namespaceAndId.getName();
res.add(qn);
}
}
return res;
}
Aggregations