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 org.apache.continuum.web.util.AuditLog;
23 import org.apache.continuum.web.util.AuditLogConstants;
24 import org.apache.maven.continuum.ContinuumException;
25 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
26
27 import java.io.File;
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 1372260 2012-08-13 04:29:09Z brett $
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,
46 checkProtocol, scmUseCache,
47 this.getBuildDefinitionTemplateId() );
48
49 AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M1_PROJECT );
50 event.setCategory( AuditLogConstants.PROJECT );
51 event.setCurrentUser( getPrincipal() );
52
53 if ( result == null || result.hasErrors() )
54 {
55 event.setAction( AuditLogConstants.ADD_M1_PROJECT_FAILED );
56 }
57
58 event.log();
59
60 return result;
61 }
62
63 /**
64 * @deprecated Use {@link #getPom()} instead
65 */
66 public String getM1Pom()
67 {
68 return getPom();
69 }
70
71 /**
72 * @deprecated Use {@link #setPom(String)} instead
73 */
74 public void setM1Pom( String pom )
75 {
76 setPom( pom );
77 }
78
79 /**
80 * @deprecated Use {@link #getPomFile()} instead
81 */
82 public File getM1PomFile()
83 {
84 return getPomFile();
85 }
86
87 /**
88 * @deprecated Use {@link #setPomFile(File)} instead
89 */
90 public void setM1PomFile( File pomFile )
91 {
92 setPomFile( pomFile );
93 }
94
95 /**
96 * @deprecated Use {@link #getPomUrl()} instead
97 */
98 public String getM1PomUrl()
99 {
100 return getPomUrl();
101 }
102
103 /**
104 * @deprecated Use {@link #setPomUrl(String)} instead
105 */
106 public void setM1PomUrl( String pomUrl )
107 {
108 setPomUrl( pomUrl );
109 }
110 }