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 [AbstractProjectNotifierEditAction.java]

nameclass, %method, %block, %line, %
AbstractProjectNotifierEditAction.java0%   (0/1)0%   (0/9)0%   (0/97)0%   (0/23)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractProjectNotifierEditAction0%   (0/1)0%   (0/9)0%   (0/97)0%   (0/23)
AbstractProjectNotifierEditAction (): void 0%   (0/1)0%   (0/6)0%   (0/2)
checkAuthorization (): void 0%   (0/1)0%   (0/13)0%   (0/4)
getNotifier (): ProjectNotifier 0%   (0/1)0%   (0/8)0%   (0/1)
getProjectGroupId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
getProjectGroupName (): String 0%   (0/1)0%   (0/31)0%   (0/5)
getProjectId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
saveNotifier (ProjectNotifier): void 0%   (0/1)0%   (0/25)0%   (0/5)
setProjectGroupId (int): void 0%   (0/1)0%   (0/4)0%   (0/2)
setProjectId (int): void 0%   (0/1)0%   (0/4)0%   (0/2)

1package 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 
22import org.apache.maven.continuum.ContinuumException;
23import org.apache.maven.continuum.model.project.Project;
24import org.apache.maven.continuum.model.project.ProjectGroup;
25import org.apache.maven.continuum.model.project.ProjectNotifier;
26import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
27 
28/**
29 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
30 * @version $Id: AbstractProjectNotifierEditAction.java 729461 2008-12-26 08:38:10Z olamy $
31 */
32public abstract class AbstractProjectNotifierEditAction
33    extends AbstractNotifierEditActionSupport
34{
35 
36    /**
37     * Identifier for the {@link Project} who's {@link ProjectNotifier} is being edited.
38     */
39    private int projectId;
40 
41    /**
42     * Identifier for the {@link ProjectGroup} instance that the current {@link Project} is a member of.
43     */
44    private int projectGroupId;
45 
46    private String projectGroupName = "";
47 
48    /**
49     * Save the notifier for the {@link Project} here.<p>
50     * This is used by the subclasses that create/obtain an instance of
51     * {@link ProjectNotifier} to be saved.
52     *
53     * @see org.apache.maven.continuum.web.action.notifier.AbstractNotifierEditActionSupport#saveNotifier(ProjectNotifier)
54     */
55    protected void saveNotifier( ProjectNotifier notifier )
56        throws ContinuumException
57    {
58        boolean isNew = notifier.getId() <= 0;
59        if ( !isNew )
60        {
61            getContinuum().updateNotifier( projectId, notifier );
62        }
63        else
64        {
65            getContinuum().addNotifier( projectId, notifier );
66        }
67    }
68 
69    /**
70     * @see org.apache.maven.continuum.web.action.notifier.AbstractNotifierEditActionSupport#getNotifier()
71     */
72    protected ProjectNotifier getNotifier()
73        throws ContinuumException
74    {
75        return getContinuum().getNotifier( projectId, getNotifierId() );
76    }
77 
78    /**
79     * Returns the identifier for the current project.
80     *
81     * @return current project's id.
82     */
83    public int getProjectId()
84    {
85        return projectId;
86    }
87 
88    /**
89     * Sets the id of the current project for this action.
90     *
91     * @param projectId current project's id.
92     */
93    public void setProjectId( int projectId )
94    {
95        this.projectId = projectId;
96    }
97 
98    /**
99     * Returns the identifier for the {@link ProjectGroup} that the
100     * {@link Project} is a member of.
101     *
102     * @return the projectGroupId
103     */
104    public int getProjectGroupId()
105    {
106        return projectGroupId;
107    }
108 
109    /**
110     * Sets the identifier for the {@link ProjectGroup} that the
111     * {@link Project} is a member of.
112     *
113     * @param projectGroupId the identifier to set
114     */
115    public void setProjectGroupId( int projectGroupId )
116    {
117        this.projectGroupId = projectGroupId;
118    }
119 
120    protected void checkAuthorization()
121        throws AuthorizationRequiredException, ContinuumException
122    {
123        if ( getNotifier() == null )
124        {
125            checkAddProjectNotifierAuthorization( getProjectGroupName() );
126        }
127        else
128        {
129            checkModifyProjectNotifierAuthorization( getProjectGroupName() );
130        }
131    }
132 
133    public String getProjectGroupName()
134        throws ContinuumException
135    {
136        if ( projectGroupName == null || "".equals( projectGroupName ) )
137        {
138            if ( projectGroupId != 0 )
139            {
140                projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
141            }
142            else
143            {
144                projectGroupName = getContinuum().getProjectGroupByProjectId( projectId ).getName();
145            }
146        }
147 
148        return projectGroupName;
149    }
150 
151}

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