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 / nodetypes / reqandcapdefs / RequirementDefinitionsResource.java
1 /*******************************************************************************
2  * Copyright (c) 2012-2013 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.nodetypes.reqandcapdefs;
13
14 import java.util.Collection;
15 import java.util.List;
16 import java.util.SortedSet;
17
18 import javax.xml.namespace.QName;
19
20 import org.eclipse.winery.common.ids.definitions.RequirementTypeId;
21 import org.eclipse.winery.model.tosca.TRequirementDefinition;
22 import org.eclipse.winery.repository.backend.BackendUtils;
23 import org.eclipse.winery.repository.backend.Repository;
24 import org.eclipse.winery.repository.resources.entitytypes.nodetypes.NodeTypeResource;
25
26 import com.sun.jersey.api.view.Viewable;
27
28 public class RequirementDefinitionsResource extends RequirementOrCapabilityDefinitionsResource<RequirementDefinitionResource, TRequirementDefinition> {
29         
30         public RequirementDefinitionsResource(NodeTypeResource res, List<TRequirementDefinition> defs) {
31                 super(RequirementDefinitionResource.class, TRequirementDefinition.class, defs, res);
32         }
33         
34         @Override
35         public Viewable getHTML() {
36                 return new Viewable("/jsp/entitytypes/nodetypes/reqandcapdefs/reqdefs.jsp", this);
37         }
38         
39         @Override
40         public Collection<QName> getAllTypes() {
41                 SortedSet<RequirementTypeId> allTOSCAComponentIds = Repository.INSTANCE.getAllTOSCAComponentIds(RequirementTypeId.class);
42                 return BackendUtils.convertTOSCAComponentIdCollectionToQNameCollection(allTOSCAComponentIds);
43         }
44         
45 }