continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r1161951 - /continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
Date Fri, 26 Aug 2011 01:01:52 GMT
Author: ctan
Date: Fri Aug 26 01:01:52 2011
New Revision: 1161951

URL: http://svn.apache.org/viewvc?rev=1161951&view=rev
Log:
[CONTINUUM-2660] fixed audit log message when editing a build definition

Modified:
    continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java

Modified: continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java?rev=1161951&r1=1161950&r2=1161951&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
(original)
+++ continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
Fri Aug 26 01:01:52 2011
@@ -305,6 +305,9 @@ public class BuildDefinitionAction
         throws ContinuumException, ProfileException
     {
 
+        AuditLog event = null;
+        String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
+
         try
         {
             if ( buildDefinitionId == 0 )
@@ -312,12 +315,16 @@ public class BuildDefinitionAction
                 checkAddProjectBuildDefinitionAuthorization( getProjectGroupName() );
 
                 getContinuum().addBuildDefinitionToProject( projectId, getBuildDefinitionFromInput()
);
+
+                event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
             }
             else
             {
                 checkModifyProjectBuildDefinitionAuthorization( getProjectGroupName() );
 
                 getContinuum().updateBuildDefinitionForProject( projectId, getBuildDefinitionFromInput()
);
+
+                event = new AuditLog( resource, AuditLogConstants.MODIFY_GOAL );
             }
         }
         catch ( ContinuumActionException cae )
@@ -330,9 +337,7 @@ public class BuildDefinitionAction
             addActionError( authzE.getMessage() );
             return REQUIRES_AUTHORIZATION;
         }
-        
-        String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
-        AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+
         event.setCategory( AuditLogConstants.BUILD_DEFINITION );
         event.setCurrentUser( getPrincipal() );
         event.log();
@@ -384,7 +389,15 @@ public class BuildDefinitionAction
         if ( projectId != 0 )
         {
             String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
-            AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+            AuditLog event = null;
+            if ( buildDefinitionId == 0 )
+            {
+                event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+            }
+            else
+            {
+                event = new AuditLog( resource, AuditLogConstants.MODIFY_GOAL );
+            }
             event.setCategory( AuditLogConstants.BUILD_DEFINITION );
             event.setCurrentUser( getPrincipal() );
             event.log();
@@ -393,7 +406,15 @@ public class BuildDefinitionAction
         else
         {
             String resource = "Project Group id=" + projectGroupId + ":" + goals + " " +
arguments;
-            AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+            AuditLog event = null;
+            if ( buildDefinitionId == 0 )
+            {
+                event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+            }
+            else
+            {
+                event = new AuditLog( resource, AuditLogConstants.MODIFY_GOAL );
+            }
             event.setCategory( AuditLogConstants.BUILD_DEFINITION );
             event.setCurrentUser( getPrincipal() );
             event.log();



Mime
View raw message