Search in sources :

Example 1 with QNameWithName

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;
}
Also used : QNameWithName(org.eclipse.winery.common.interfaces.QNameWithName)

Example 2 with QNameWithName

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;
}
Also used : QName(javax.xml.namespace.QName) ArrayList(java.util.ArrayList) NamespaceIdOptionalName(org.eclipse.winery.common.beans.NamespaceIdOptionalName) WebResource(com.sun.jersey.api.client.WebResource) List(java.util.List) ArrayList(java.util.ArrayList) LinkedList(java.util.LinkedList) QNameWithName(org.eclipse.winery.common.interfaces.QNameWithName)

Aggregations

QNameWithName (org.eclipse.winery.common.interfaces.QNameWithName)2 WebResource (com.sun.jersey.api.client.WebResource)1 ArrayList (java.util.ArrayList)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1 NamespaceIdOptionalName (org.eclipse.winery.common.beans.NamespaceIdOptionalName)1