1 /*
2 * ----------------------------------------------------------------------
3 * Copyright (C) 2009 Enrique Lara (k957@68k.org)
4 *
5 * TinLizard is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public License
7 * as published by the Free Software Foundation; either version 3.0
8 * of the License, or (at your option) any later version.
9 *
10 * TinLizard is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with TinLizard. If not, see http://www.gnu.org/licenses/.
17 * ----------------------------------------------------------------------
18 */
19 package tinlizard.web;
20
21 import tinlizard.model.Policy;
22
23 import tinlizard.util.Messages;
24
25 import java.util.Collection;
26
27 import org.jvnet.localizer.Localizable;
28
29 import org.kohsuke.stapler.export.Exported;
30
31 /***
32 * Web Accessible Policy Collection.
33 */
34 public final class PolicyCollectionWeb extends ObjectCollectionWeb {
35 public PolicyCollectionWeb(final Collection<Policy> c, final Localizable name) {
36 super(name);
37
38 if (c == null) {
39 throw new IllegalStateException(Messages.error_1019());
40 }
41
42 if (name == null) {
43 throw new IllegalStateException(Messages.error_1014());
44 }
45
46 for (Policy o : c) {
47 getSubject().add(o);
48 getDelegate().add(new PolicyWeb(o));
49 }
50 }
51
52 @Exported(name = "policys")
53 public PolicyCollectionWeb getPolicies() {
54 return this;
55 }
56 }