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
10 * Oliver Kopp - initial API and implementation
11 *******************************************************************************/
12 package org.eclipse.winery.repository.resources.entitytypes.policytypes;
14 import java.util.SortedSet;
16 import javax.ws.rs.Path;
18 import org.eclipse.winery.common.ids.definitions.PolicyTemplateId;
19 import org.eclipse.winery.common.ids.definitions.PolicyTypeId;
20 import org.eclipse.winery.model.tosca.TExtensibleElements;
21 import org.eclipse.winery.model.tosca.TPolicyType;
22 import org.eclipse.winery.repository.datatypes.select2.Select2OptGroup;
23 import org.eclipse.winery.repository.resources.EntityTypeResource;
24 import org.slf4j.Logger;
25 import org.slf4j.LoggerFactory;
27 public final class PolicyTypeResource extends EntityTypeResource {
29 private static final Logger logger = LoggerFactory.getLogger(PolicyTypeResource.class);
33 * Constructor has to be public because of test cases
35 public PolicyTypeResource(PolicyTypeId id) {
40 * Convenience method to avoid casting at the caller's side.
42 public TPolicyType getPolicyType() {
43 return (TPolicyType) this.getElement();
47 protected TExtensibleElements createNewElement() {
48 return new TPolicyType();
52 public AppliesToResource getAppliesTo() {
53 return new AppliesToResource(this);
57 public LanguageResource getLanguage() {
58 return new LanguageResource(this);
62 public SortedSet<Select2OptGroup> getListOfAllInstances() {
63 return this.getListOfAllInstances(PolicyTemplateId.class);