EMMA Coverage Report (generated Sun Sep 18 11:34:27 PHT 2011)
[all classes][org.apache.maven.continuum.web.action.notifier]

COVERAGE SUMMARY FOR SOURCE FILE [AddGroupNotifierAction.java]

nameclass, %method, %block, %line, %
AddGroupNotifierAction.java0%   (0/1)0%   (0/9)0%   (0/76)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AddGroupNotifierAction0%   (0/1)0%   (0/9)0%   (0/76)0%   (0/24)
AddGroupNotifierAction (): void 0%   (0/1)0%   (0/6)0%   (0/2)
doDefault (): String 0%   (0/1)0%   (0/3)0%   (0/1)
execute (): String 0%   (0/1)0%   (0/24)0%   (0/6)
getNotifierType (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getProjectGroupId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getProjectGroupName (): String 0%   (0/1)0%   (0/15)0%   (0/3)
input (): String 0%   (0/1)0%   (0/14)0%   (0/6)
setNotifierType (String): void 0%   (0/1)0%   (0/4)0%   (0/2)
setProjectGroupId (int): void 0%   (0/1)0%   (0/4)0%   (0/2)

1/**
2 *
3 */
4package org.apache.maven.continuum.web.action.notifier;
5 
6/*
7 * Licensed to the Apache Software Foundation (ASF) under one
8 * or more contributor license agreements.  See the NOTICE file
9 * distributed with this work for additional information
10 * regarding copyright ownership.  The ASF licenses this file
11 * to you under the Apache License, Version 2.0 (the
12 * "License"); you may not use this file except in compliance
13 * with the License.  You may obtain a copy of the License at
14 *
15 *   http://www.apache.org/licenses/LICENSE-2.0
16 *
17 * Unless required by applicable law or agreed to in writing,
18 * software distributed under the License is distributed on an
19 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20 * KIND, either express or implied.  See the License for the
21 * specific language governing permissions and limitations
22 * under the License.
23 */
24 
25import org.apache.maven.continuum.ContinuumException;
26import org.apache.maven.continuum.model.project.ProjectGroup;
27import org.apache.maven.continuum.model.project.ProjectNotifier;
28import org.apache.maven.continuum.web.action.ContinuumActionSupport;
29import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
30import org.codehaus.plexus.util.StringUtils;
31 
32/**
33 * WW action that sets up a new {@link ProjectNotifier} instance for
34 * the specified {@link ProjectGroup}.
35 *
36 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
37 * @version $Id: AddGroupNotifierAction.java 729461 2008-12-26 08:38:10Z olamy $
38 * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="addGroupNotifier"
39 * @since 1.1
40 */
41public class AddGroupNotifierAction
42    extends ContinuumActionSupport
43{
44    /**
45     * Target {@link ProjectGroup} instance to add the Notifier for.
46     */
47    private int projectGroupId;
48 
49    /**
50     * String based type identifier for the {@link ProjectNotifier}.
51     */
52    private String notifierType;
53 
54    private String projectGroupName = "";
55 
56    /**
57     * Default action method executed in case no method is specified
58     * for invocation.
59     *
60     * @return a String result that determines the control flow.
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    // TODO: Remove this method because a default method return SUCCESS instead of INPUT
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     * Returns the type identifier for the {@link ProjectNotifier} being
103     * edited as String.
104     *
105     * @return notifier type as String.
106     */
107    public String getNotifierType()
108    {
109        return notifierType;
110    }
111 
112    /**
113     * Sets the notifier type for the {@link ProjectNotifier} instance
114     * being edited.
115     *
116     * @param notifierType notifier type to set.
117     */
118    public void setNotifierType( String notifierType )
119    {
120        this.notifierType = notifierType;
121    }
122 
123    /**
124     * Returns the current {@link ProjectGroup} Identifier.
125     *
126     * @return the projectGroupId
127     */
128    public int getProjectGroupId()
129    {
130        return projectGroupId;
131    }
132 
133    /**
134     * Sets the Id for the target {@link ProjectGroup}.
135     *
136     * @param projectGroupId the projectGroupId to set
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}

[all classes][org.apache.maven.continuum.web.action.notifier]
EMMA 2.0.5312 (C) Vladimir Roubtsov