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.documentation;
14 import java.util.List;
16 import javax.ws.rs.Consumes;
17 import javax.ws.rs.PUT;
18 import javax.ws.rs.Produces;
19 import javax.ws.rs.core.MediaType;
20 import javax.ws.rs.core.Response;
22 import org.eclipse.winery.model.tosca.TDocumentation;
23 import org.eclipse.winery.repository.resources._support.IPersistable;
24 import org.eclipse.winery.repository.resources._support.collections.CollectionsHelper;
25 import org.eclipse.winery.repository.resources._support.collections.withoutid.EntityWithoutIdResource;
27 public class DocumentationResource extends EntityWithoutIdResource<TDocumentation> {
29 public DocumentationResource(TDocumentation o, int idx, List<TDocumentation> list, IPersistable res) {
30 super(o, idx, list, res);
34 @Consumes(MediaType.TEXT_HTML)
35 @Produces(MediaType.TEXT_PLAIN)
36 public Response setValue(String documentation) {
37 this.o.getContent().clear();
38 this.o.getContent().add(documentation);
39 this.list.set(this.idx, this.o);
40 return CollectionsHelper.persist(this.res, this.idDetermination, this.o);