View Javadoc

1   package 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  
22  import java.io.File;
23  
24  import org.apache.continuum.web.util.AuditLog;
25  import org.apache.continuum.web.util.AuditLogConstants;
26  import org.apache.maven.continuum.ContinuumException;
27  import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
28  
29  /**
30   * Add a Maven 1 project to Continuum.
31   *
32   * @author Nick Gonzalez
33   * @author <a href="mailto:carlos@apache.org">Carlos Sanchez</a>
34   * @version $Id: AddMavenOneProjectAction.java 781924 2009-06-05 06:42:54Z ctan $
35   * @plexus.component role="com.opensymphony.xwork2.Action" role-hint="addMavenOneProject"
36   */
37  public class AddMavenOneProjectAction
38      extends AddMavenProjectAction
39  {
40  
41      protected ContinuumProjectBuildingResult doExecute( String pomUrl, int selectedProjectGroup, boolean checkProtocol,
42                                                          boolean scmUseCache )
43          throws ContinuumException
44      {
45          ContinuumProjectBuildingResult result = getContinuum().addMavenOneProject( pomUrl, selectedProjectGroup, checkProtocol, scmUseCache,
46                                                    this.getBuildDefinitionTemplateId() );
47  
48          AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M1_PROJECT );
49          event.setCategory( AuditLogConstants.PROJECT );
50          event.setCurrentUser( getPrincipal() );
51  
52          if ( result == null || result.hasErrors() )
53          {
54              event.setAction( AuditLogConstants.ADD_M1_PROJECT_FAILED );
55          }
56  
57          event.log();
58  
59          return result;
60      }
61  
62      /**
63       * @deprecated Use {@link #getPom()} instead
64       */
65      public String getM1Pom()
66      {
67          return getPom();
68      }
69  
70      /**
71       * @deprecated Use {@link #setPom(String)} instead
72       */
73      public void setM1Pom( String pom )
74      {
75          setPom( pom );
76      }
77  
78      /**
79       * @deprecated Use {@link #getPomFile()} instead
80       */
81      public File getM1PomFile()
82      {
83          return getPomFile();
84      }
85  
86      /**
87       * @deprecated Use {@link #setPomFile(File)} instead
88       */
89      public void setM1PomFile( File pomFile )
90      {
91          setPomFile( pomFile );
92      }
93  
94      /**
95       * @deprecated Use {@link #getPomUrl()} instead
96       */
97      public String getM1PomUrl()
98      {
99          return getPomUrl();
100     }
101 
102     /**
103      * @deprecated Use {@link #setPomUrl(String)} instead
104      */
105     public void setM1PomUrl( String pomUrl )
106     {
107         setPomUrl( pomUrl );
108     }
109 }