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

COVERAGE SUMMARY FOR SOURCE FILE [ProjectViewAction.java]

nameclass, %method, %block, %line, %
ProjectViewAction.java0%   (0/1)0%   (0/9)0%   (0/89)0%   (0/24)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class ProjectViewAction0%   (0/1)0%   (0/9)0%   (0/89)0%   (0/24)
<static initializer> 0%   (0/1)0%   (0/4)0%   (0/1)
ProjectViewAction (): void 0%   (0/1)0%   (0/3)0%   (0/1)
execute (): String 0%   (0/1)0%   (0/59)0%   (0/14)
getLastBuildDateTime (): String 0%   (0/1)0%   (0/3)0%   (0/1)
getProject (): Project 0%   (0/1)0%   (0/3)0%   (0/1)
getProjectGroup (): ProjectGroup 0%   (0/1)0%   (0/6)0%   (0/1)
getProjectId (): int 0%   (0/1)0%   (0/3)0%   (0/1)
setLastBuildDateTime (String): 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;
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 java.util.Date;
23 
24import org.apache.maven.continuum.ContinuumException;
25import org.apache.maven.continuum.model.project.BuildResult;
26import org.apache.maven.continuum.model.project.Project;
27import org.apache.maven.continuum.model.project.ProjectGroup;
28import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
29import org.slf4j.Logger;
30import org.slf4j.LoggerFactory;
31 
32/**
33 * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
34 * @version $Id: ProjectViewAction.java 765340 2009-04-15 20:22:00Z evenisse $
35 * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="projectView"
36 */
37public class ProjectViewAction
38    extends ContinuumActionSupport
39{
40    private static final Logger logger = LoggerFactory.getLogger( ProjectViewAction.class );
41 
42    private Project project;
43 
44    private int projectId;
45 
46    private String lastBuildDateTime;
47 
48    public String execute()
49        throws ContinuumException
50    {
51        ProjectGroup projectGroup = getProjectGroup();
52 
53        try
54        {
55            checkViewProjectGroupAuthorization( projectGroup.getName() );
56        }
57        catch ( AuthorizationRequiredException e )
58        {
59            return REQUIRES_AUTHORIZATION;
60        }
61 
62        project = getContinuum().getProjectWithAllDetails( projectId );
63        if ( project.getLatestBuildId() > 0 )
64        {
65            try
66            {
67                BuildResult lastBuildResult = getContinuum().getBuildResult( project.getLatestBuildId() );
68                if ( lastBuildResult != null )
69                {
70                    this.setLastBuildDateTime( dateFormatter.format( new Date( lastBuildResult.getEndTime() ) ) );
71                }
72            }
73            catch ( ContinuumException e )
74            {
75                logger.info( "buildResult with id " + project.getLatestBuildId() + " has been deleted" );
76            }
77        }
78 
79        return SUCCESS;
80    }
81 
82    public void setProjectId( int projectId )
83    {
84        this.projectId = projectId;
85    }
86 
87    public Project getProject()
88    {
89        return project;
90    }
91 
92    public int getProjectId()
93    {
94        return projectId;
95    }
96 
97    /**
98     * Returns the {@link ProjectGroup} instance obtained for
99     * the specified project group Id, or null if it were not set.
100     *
101     * @return the projectGroup
102     */
103    public ProjectGroup getProjectGroup()
104        throws ContinuumException
105    {
106        return getContinuum().getProjectGroupByProjectId( projectId );
107    }
108 
109    public String getLastBuildDateTime()
110    {
111        return lastBuildDateTime;
112    }
113 
114    public void setLastBuildDateTime( String lastBuildDateTime )
115    {
116        this.lastBuildDateTime = lastBuildDateTime;
117    }
118}

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