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
10 * Oliver Kopp - initial API and implementation
11 *******************************************************************************/
12 package org.eclipse.winery.repository.resources.interfaces;
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.model.tosca.TBoolean;
23 import org.eclipse.winery.model.tosca.TParameter;
24 import org.eclipse.winery.repository.backend.BackendUtils;
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;
29 public class ParameterResource extends EntityWithIdResource<TParameter> {
31 public ParameterResource(IIdDetermination<TParameter> idDetermination, TParameter o, int idx, List<TParameter> list, IPersistable res) {
32 super(idDetermination, o, idx, list, res);
37 public String getType() {
38 return this.o.getType();
43 public Response putType(@FormParam(value = "type") String type) {
45 return BackendUtils.persist(this.res);
50 public String getRequired() {
51 return this.o.getRequired().toString();
56 public Response putRequired(@FormParam(value = "required") String required) {
57 TBoolean tb = TBoolean.valueOf(required);
58 this.o.setRequired(tb);
59 return BackendUtils.persist(this.res);