/*******************************************************************************
 * Copyright (c) 2012-2013 University of Stuttgart.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * and the Apache License 2.0 which both accompany this distribution,
 * and are available at http://www.eclipse.org/legal/epl-v10.html
 * and http://www.apache.org/licenses/LICENSE-2.0
 *
 * Contributors:
 *     Oliver Kopp - initial API and implementation
 *******************************************************************************/
package org.eclipse.winery.repository.resources.interfaces;

import java.util.List;

import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

import org.eclipse.winery.model.tosca.TBoolean;
import org.eclipse.winery.model.tosca.TParameter;
import org.eclipse.winery.repository.backend.BackendUtils;
import org.eclipse.winery.repository.resources._support.IPersistable;
import org.eclipse.winery.repository.resources._support.collections.IIdDetermination;
import org.eclipse.winery.repository.resources._support.collections.withid.EntityWithIdResource;

public class ParameterResource extends EntityWithIdResource<TParameter> {
	
	public ParameterResource(IIdDetermination<TParameter> idDetermination, TParameter o, int idx, List<TParameter> list, IPersistable res) {
		super(idDetermination, o, idx, list, res);
	}
	
	@GET
	@Path("type")
	public String getType() {
		return this.o.getType();
	}
	
	@PUT
	@Path("type")
	public Response putType(@FormParam(value = "type") String type) {
		this.o.setType(type);
		return BackendUtils.persist(this.res);
	}
	
	@GET
	@Path("required")
	public String getRequired() {
		return this.o.getRequired().toString();
	}
	
	@PUT
	@Path("required")
	public Response putRequired(@FormParam(value = "required") String required) {
		TBoolean tb = TBoolean.valueOf(required);
		this.o.setRequired(tb);
		return BackendUtils.persist(this.res);
	}
	
	@GET
	@Produces(MediaType.APPLICATION_JSON)
	public TParameter getJSONRepresentation() {
		return this.o;
	}
	
}

@@ -100,16 +100,21 @@
 012-2013
+,2015
  Univers
@@ -804,72 +804,8 @@
 th;%0A
-import javax.ws.rs.Produces;%0Aimport javax.ws.rs.core.MediaType;%0A
 impo
@@ -2075,118 +2075,6 @@
 %7D%0A%09%0A
-%09@GET%0A%09@Produces(MediaType.APPLICATION_JSON)%0A%09public TParameter getJSONRepresentation() %7B%0A%09%09return this.o;%0A%09%7D%0A%09%0A
 %7D%0A

Fix loading of parameters at the GUI