Merge "Fix build errors in autorelease full clean build"
[vfc/nfvo/wfengine.git] / winery / org.eclipse.winery.repository / src / main / java / org / eclipse / winery / repository / resources / entitytypes / ImplementationsOfOneType.java
1 /*******************************************************************************
2  * Copyright (c) 2012-2013,2015 University of Stuttgart.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * and the Apache License 2.0 which both accompany this distribution,
6  * and are available at http://www.eclipse.org/legal/epl-v10.html
7  * and http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Contributors:
10  *     Oliver Kopp - initial API and implementation
11  *******************************************************************************/
12 package org.eclipse.winery.repository.resources.entitytypes;
13
14 import java.util.Collection;
15
16 import javax.ws.rs.GET;
17 import javax.ws.rs.Produces;
18 import javax.ws.rs.core.MediaType;
19 import javax.ws.rs.core.Response;
20
21 import org.eclipse.winery.common.ids.Namespace;
22 import org.eclipse.winery.common.ids.definitions.TopologyGraphElementEntityTypeId;
23 import org.eclipse.winery.repository.resources.admin.NamespacesResource;
24
25 import com.sun.jersey.api.view.Viewable;
26
27 /**
28  * specifies the methods required by implementations.jsp
29  */
30 public abstract class ImplementationsOfOneType {
31         
32         private final TopologyGraphElementEntityTypeId typeId;
33         
34         
35         public ImplementationsOfOneType(TopologyGraphElementEntityTypeId typeId) {
36                 this.typeId = typeId;
37         }
38         
39         public TopologyGraphElementEntityTypeId getTypeId() {
40                 return this.typeId;
41         }
42         
43         @GET
44         @Produces(MediaType.TEXT_HTML)
45         public Response getHTML() {
46                 Viewable viewable = new Viewable("/jsp/entitytypes/implementations.jsp", this);
47                 return Response.ok().entity(viewable).build();
48         }
49         
50         @GET
51         @Produces(MediaType.APPLICATION_JSON)
52         public abstract Response getJSON();
53         
54         public Collection<Namespace> getNamespaceAutocompletionList() {
55                 return NamespacesResource.getNamespaces();
56         }
57         
58         /**
59          * @return a list of type implementations implementing the associated node
60          *         type
61          */
62         public abstract String getImplementationsTableData();
63         
64         /**
65          * The string used as URL part
66          */
67         public abstract String getType();
68         
69         /**
70          * The string displayed to the user
71          */
72         public abstract String getTypeStr();
73         
74 }