1 /*******************************************************************************
2 * Copyright (c) 2014 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.servicetemplates.boundarydefinitions.policies;
14 import java.util.List;
16 import javax.ws.rs.PUT;
17 import javax.ws.rs.core.Response;
19 import org.eclipse.winery.model.tosca.TPolicy;
20 import org.eclipse.winery.repository.backend.BackendUtils;
21 import org.eclipse.winery.repository.resources._support.IPersistable;
22 import org.eclipse.winery.repository.resources._support.collections.withoutid.EntityWithoutIdCollectionResource;
24 import com.sun.jersey.api.view.Viewable;
26 public class PoliciesResource extends EntityWithoutIdCollectionResource<PolicyResource, TPolicy> {
28 public PoliciesResource(List<TPolicy> list, IPersistable res) {
29 super(PolicyResource.class, TPolicy.class, list, res);
33 public Viewable getHTML() {
34 throw new IllegalStateException("Not required: boundarydefinitions.jsp also includes the content of the Policy tab.");
38 public Response replaceAll(List<TPolicy> newList) {
40 for (TPolicy policy : newList) {
41 this.list.add(policy);
43 return BackendUtils.persist(this.res);