1 | package org.apache.maven.continuum.web.action.notifier; |
2 | |
3 | /* |
4 | * Licensed to the Apache Software Foundation (ASF) under one |
5 | * or more contributor license agreements. See the NOTICE file |
6 | * distributed with this work for additional information |
7 | * regarding copyright ownership. The ASF licenses this file |
8 | * to you under the Apache License, Version 2.0 (the |
9 | * "License"); you may not use this file except in compliance |
10 | * with the License. You may obtain a copy of the License at |
11 | * |
12 | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | * |
14 | * Unless required by applicable law or agreed to in writing, |
15 | * software distributed under the License is distributed on an |
16 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
17 | * KIND, either express or implied. See the License for the |
18 | * specific language governing permissions and limitations |
19 | * under the License. |
20 | */ |
21 | |
22 | import java.util.HashMap; |
23 | import java.util.Map; |
24 | |
25 | import org.apache.maven.continuum.model.project.ProjectGroup; |
26 | import org.apache.maven.continuum.model.project.ProjectNotifier; |
27 | import org.apache.maven.continuum.notification.AbstractContinuumNotifier; |
28 | import org.codehaus.plexus.util.StringUtils; |
29 | |
30 | /** |
31 | * Action that edits a {@link ProjectNotifier} of type 'Mail' from the |
32 | * specified {@link ProjectGroup}. |
33 | * |
34 | * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a> |
35 | * @version $Id: MailGroupNotifierEditAction.java 766895 2009-04-20 22:02:13Z evenisse $ |
36 | * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="mailGroupNotifierEdit" |
37 | * @since 1.1 |
38 | */ |
39 | public class MailGroupNotifierEditAction |
40 | extends AbstractGroupNotifierEditAction |
41 | { |
42 | private String address; |
43 | |
44 | private boolean committers; |
45 | |
46 | protected void initConfiguration( Map<String, String> configuration ) |
47 | { |
48 | if ( StringUtils.isNotEmpty( configuration.get( AbstractContinuumNotifier.ADDRESS_FIELD ) ) ) |
49 | { |
50 | address = configuration.get( AbstractContinuumNotifier.ADDRESS_FIELD ); |
51 | } |
52 | |
53 | if ( StringUtils.isNotEmpty( configuration.get( AbstractContinuumNotifier.COMMITTER_FIELD ) ) ) |
54 | { |
55 | committers = Boolean.parseBoolean( configuration.get( AbstractContinuumNotifier.COMMITTER_FIELD ) ); |
56 | } |
57 | } |
58 | |
59 | protected void setNotifierConfiguration( ProjectNotifier notifier ) |
60 | { |
61 | HashMap<String, Object> configuration = new HashMap<String, Object>(); |
62 | |
63 | if ( StringUtils.isNotEmpty( address ) ) |
64 | { |
65 | configuration.put( AbstractContinuumNotifier.ADDRESS_FIELD, address ); |
66 | } |
67 | |
68 | configuration.put( AbstractContinuumNotifier.COMMITTER_FIELD, String.valueOf( committers ) ); |
69 | |
70 | notifier.setConfiguration( configuration ); |
71 | } |
72 | |
73 | public String getAddress() |
74 | { |
75 | return address; |
76 | } |
77 | |
78 | public void setAddress( String address ) |
79 | { |
80 | this.address = address; |
81 | } |
82 | |
83 | public boolean isCommitters() |
84 | { |
85 | return committers; |
86 | } |
87 | |
88 | public void setCommitters( boolean committers ) |
89 | { |
90 | this.committers = committers; |
91 | } |
92 | } |