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.artifacttypes;
14 import java.util.SortedSet;
16 import javax.ws.rs.GET;
17 import javax.ws.rs.PUT;
18 import javax.ws.rs.Path;
19 import javax.ws.rs.core.Response;
20 import javax.xml.namespace.QName;
22 import org.eclipse.winery.common.constants.Namespaces;
23 import org.eclipse.winery.common.ids.definitions.ArtifactTemplateId;
24 import org.eclipse.winery.common.ids.definitions.ArtifactTypeId;
25 import org.eclipse.winery.model.tosca.TArtifactType;
26 import org.eclipse.winery.model.tosca.TExtensibleElements;
27 import org.eclipse.winery.repository.backend.BackendUtils;
28 import org.eclipse.winery.repository.datatypes.select2.Select2OptGroup;
29 import org.eclipse.winery.repository.resources.EntityTypeResource;
31 public class ArtifactTypeResource extends EntityTypeResource {
33 public ArtifactTypeResource(ArtifactTypeId id) {
38 private final QName qnameFileExtension = new QName(Namespaces.TOSCA_WINERY_EXTENSIONS_NAMESPACE, "fileExtension");
42 * @return the file extension associated with this artifact type. May be
46 @Path("/fileextension")
47 public String getAssociatedFileExtension() {
48 return this.getDefinitions().getOtherAttributes().get(this.qnameFileExtension);
52 @Path("/fileextension")
53 public Response setAssociatedFileExtension(String fileExtension) {
54 this.getDefinitions().getOtherAttributes().put(this.qnameFileExtension, fileExtension);
55 return BackendUtils.persist(this);
59 protected TExtensibleElements createNewElement() {
60 return new TArtifactType();
64 public SortedSet<Select2OptGroup> getListOfAllInstances() {
65 return this.getListOfAllInstances(ArtifactTemplateId.class);