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.properties.winery;
14 import java.util.List;
16 import javax.ws.rs.FormParam;
17 import javax.ws.rs.GET;
18 import javax.ws.rs.PUT;
19 import javax.ws.rs.Path;
20 import javax.ws.rs.core.Response;
22 import org.eclipse.winery.common.propertydefinitionkv.PropertyDefinitionKV;
23 import org.eclipse.winery.repository.backend.BackendUtils;
24 import org.eclipse.winery.repository.resources.AbstractComponentInstanceResource;
25 import org.eclipse.winery.repository.resources._support.IPersistable;
26 import org.eclipse.winery.repository.resources._support.collections.IIdDetermination;
27 import org.eclipse.winery.repository.resources._support.collections.withid.EntityWithIdResource;
28 import org.restdoc.annotations.RestDoc;
31 * Models a definition of one property
33 * This is NOT in line with CSPRD01, which forces one element of one type
35 public class PropertyDefinitionKVResource extends EntityWithIdResource<PropertyDefinitionKV> {
37 public PropertyDefinitionKVResource(IIdDetermination<PropertyDefinitionKV> idDetermination, PropertyDefinitionKV o, int idx, List<PropertyDefinitionKV> list, AbstractComponentInstanceResource res) {
38 super(idDetermination, o, idx, list, res);
41 public PropertyDefinitionKVResource(IIdDetermination<PropertyDefinitionKV> idDetermination, PropertyDefinitionKV o, int idx, List<PropertyDefinitionKV> list, IPersistable res) {
42 super(idDetermination, o, idx, list, res);
46 @RestDoc(methodDescription = "@return type is the 'id' of the type ('shortType'), not the full type name")
48 public String getType() {
49 return this.o.getType();
53 @RestDoc(methodDescription = "@return type is the 'id' of the type ('shortType'), not the full type name")
55 public Response setType(@FormParam("type") String type) {
57 return BackendUtils.persist(this.res);