1
2
3
4 package org.apache.maven.continuum.web.action.notifier;
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import org.apache.maven.continuum.ContinuumException;
26 import org.apache.maven.continuum.model.project.ProjectGroup;
27 import org.apache.maven.continuum.model.project.ProjectNotifier;
28 import org.apache.maven.continuum.web.action.ContinuumActionSupport;
29 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
30 import org.codehaus.plexus.util.StringUtils;
31
32
33
34
35
36
37
38
39
40
41 public class AddGroupNotifierAction
42 extends ContinuumActionSupport
43 {
44
45
46
47 private int projectGroupId;
48
49
50
51
52 private String notifierType;
53
54 private String projectGroupName = "";
55
56
57
58
59
60
61
62 public String execute()
63 throws ContinuumException
64 {
65 try
66 {
67 checkAddProjectGroupNotifierAuthorization( getProjectGroupName() );
68 }
69 catch ( AuthorizationRequiredException authzE )
70 {
71 addActionError( authzE.getMessage() );
72 return REQUIRES_AUTHORIZATION;
73 }
74
75 return notifierType + "_" + INPUT;
76 }
77
78
79 public String doDefault()
80 throws ContinuumException
81 {
82 return input();
83 }
84
85 public String input()
86 throws ContinuumException
87 {
88 try
89 {
90 checkAddProjectGroupNotifierAuthorization( getProjectGroupName() );
91 }
92 catch ( AuthorizationRequiredException authzE )
93 {
94 addActionError( authzE.getMessage() );
95 return REQUIRES_AUTHORIZATION;
96 }
97
98 return INPUT;
99 }
100
101
102
103
104
105
106
107 public String getNotifierType()
108 {
109 return notifierType;
110 }
111
112
113
114
115
116
117
118 public void setNotifierType( String notifierType )
119 {
120 this.notifierType = notifierType;
121 }
122
123
124
125
126
127
128 public int getProjectGroupId()
129 {
130 return projectGroupId;
131 }
132
133
134
135
136
137
138 public void setProjectGroupId( int projectGroupId )
139 {
140 this.projectGroupId = projectGroupId;
141 }
142
143 public String getProjectGroupName()
144 throws ContinuumException
145 {
146 if ( StringUtils.isEmpty( projectGroupName ) )
147 {
148 projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
149 }
150
151 return projectGroupName;
152 }
153 }