Search in sources :

Example 1 with QNameConverter

use of org.eclipse.winery.repository.rest.resources.apiData.converter.QNameConverter in project winery by eclipse.

the class TemplatesOfOneType method getJSON.

/**
 * returns a list of all implementations of a type using the getAllImplementations method
 */
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getJSON() {
    Collection<? extends DefinitionsChildId> allImplementations = this.getAllImplementations();
    List<QNameApiData> res = new ArrayList<>(allImplementations.size());
    QNameConverter adapter = new QNameConverter();
    for (DefinitionsChildId id : allImplementations) {
        res.add(adapter.marshal(id.getQName()));
    }
    return Response.ok().entity(res).build();
}
Also used : QNameApiData(org.eclipse.winery.repository.rest.resources.apiData.QNameApiData) DefinitionsChildId(org.eclipse.winery.common.ids.definitions.DefinitionsChildId) ArrayList(java.util.ArrayList) QNameConverter(org.eclipse.winery.repository.rest.resources.apiData.converter.QNameConverter) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 2 with QNameConverter

use of org.eclipse.winery.repository.rest.resources.apiData.converter.QNameConverter in project winery by eclipse.

the class ImplementationsOfOneNodeTypeResource method getJSON.

@Override
public Response getJSON() {
    Collection<NodeTypeImplementationId> allImplementations = RepositoryFactory.getRepository().getAllElementsReferencingGivenType(NodeTypeImplementationId.class, this.getTypeId().getQName());
    List<QNameApiData> res = new ArrayList<>(allImplementations.size());
    QNameConverter adapter = new QNameConverter();
    for (NodeTypeImplementationId id : allImplementations) {
        res.add(adapter.marshal(id.getQName()));
    }
    return Response.ok().entity(res).build();
}
Also used : NodeTypeImplementationId(org.eclipse.winery.common.ids.definitions.NodeTypeImplementationId) QNameApiData(org.eclipse.winery.repository.rest.resources.apiData.QNameApiData) ArrayList(java.util.ArrayList) QNameConverter(org.eclipse.winery.repository.rest.resources.apiData.converter.QNameConverter)

Example 3 with QNameConverter

use of org.eclipse.winery.repository.rest.resources.apiData.converter.QNameConverter in project winery by eclipse.

the class ImplementationsOfOneRelationshipTypeResource method getJSON.

@Override
public Response getJSON() {
    Collection<RelationshipTypeImplementationId> allImplementations = RepositoryFactory.getRepository().getAllElementsReferencingGivenType(RelationshipTypeImplementationId.class, this.getTypeId().getQName());
    List<QNameApiData> res = new ArrayList<>(allImplementations.size());
    QNameConverter adapter = new QNameConverter();
    for (RelationshipTypeImplementationId id : allImplementations) {
        res.add(adapter.marshal(id.getQName()));
    }
    return Response.ok().entity(res).build();
}
Also used : QNameApiData(org.eclipse.winery.repository.rest.resources.apiData.QNameApiData) ArrayList(java.util.ArrayList) RelationshipTypeImplementationId(org.eclipse.winery.common.ids.definitions.RelationshipTypeImplementationId) QNameConverter(org.eclipse.winery.repository.rest.resources.apiData.converter.QNameConverter)

Aggregations

ArrayList (java.util.ArrayList)3 QNameApiData (org.eclipse.winery.repository.rest.resources.apiData.QNameApiData)3 QNameConverter (org.eclipse.winery.repository.rest.resources.apiData.converter.QNameConverter)3 GET (javax.ws.rs.GET)1 Produces (javax.ws.rs.Produces)1 DefinitionsChildId (org.eclipse.winery.common.ids.definitions.DefinitionsChildId)1 NodeTypeImplementationId (org.eclipse.winery.common.ids.definitions.NodeTypeImplementationId)1 RelationshipTypeImplementationId (org.eclipse.winery.common.ids.definitions.RelationshipTypeImplementationId)1