continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject svn commit: r781924 - in /continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache: continuum/web/action/admin/ continuum/web/util/ maven/continuum/web/action/ maven/continuum/web/action/admin/
Date Fri, 05 Jun 2009 06:42:54 GMT
Author: ctan
Date: Fri Jun  5 06:42:54 2009
New Revision: 781924

URL: http://svn.apache.org/viewvc?rev=781924&view=rev
Log:
[CONTINUUM-2260]
- (consistency in logging) use project id and project group id instead of names
- added logs in other actions

Modified:
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
    continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildQueueAction.java

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/BuildAgentAction.java
Fri Jun  5 06:42:54 2009
@@ -22,6 +22,8 @@
 import org.apache.continuum.configuration.BuildAgentConfiguration;
 import org.apache.continuum.configuration.BuildAgentGroupConfiguration;
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.configuration.ConfigurationService;
 import org.apache.maven.continuum.model.system.Installation;
@@ -170,9 +172,14 @@
             }
         }
 
+        AuditLog event = new AuditLog( "Build Agent URL=" + buildAgent.getUrl(), AuditLogConstants.MODIFY_BUILD_AGENT
);
+        event.setCategory( AuditLogConstants.BUILD_AGENT );
+        event.setCurrentUser( getPrincipal() );
+
         if ( !found )
         {
             configuration.addBuildAgent( buildAgent );
+            event.setAction( AuditLogConstants.ADD_BUILD_AGENT );
         }
         else
         {
@@ -184,6 +191,7 @@
         }
 
         getContinuum().getDistributedBuildManager().reload();
+        event.log();
 
         return SUCCESS;
     }
@@ -227,6 +235,12 @@
                 if ( buildAgent.getUrl().equals( agent.getUrl() ) )
                 {
                     configuration.removeBuildAgent( agent );
+
+                    AuditLog event = new AuditLog( "Build Agent URL=" + agent.getUrl(), AuditLogConstants.REMOVE_BUILD_AGENT
);
+                    event.setCategory( AuditLogConstants.BUILD_AGENT );
+                    event.setCurrentUser( getPrincipal() );
+                    event.log();
+
                     return SUCCESS;
                 }
             }
@@ -261,6 +275,12 @@
             if ( buildAgentGroup.getName().equals( group.getName() ) )
             {
                 configuration.removeBuildAgentGroup( group );
+
+                AuditLog event = new AuditLog( "Build Agent Group=" + group.getName(), AuditLogConstants.REMOVE_BUILD_AGENT_GROUP
);
+                event.setCategory( AuditLogConstants.BUILD_AGENT );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
+
                 return SUCCESS;
             }
         }
@@ -305,10 +325,15 @@
             }
         }
 
+        AuditLog event = new AuditLog( "Build Agent Group=" + buildAgentGroup.getName(),
AuditLogConstants.MODIFY_BUILD_AGENT_GROUP );
+        event.setCategory( AuditLogConstants.BUILD_AGENT );
+        event.setCurrentUser( getPrincipal() );
+
         if ( !found )
         {
             buildAgentGroup.setBuildAgents( selectedbuildAgents );
             configuration.addBuildAgentGroup( buildAgentGroup );
+            event.setAction( AuditLogConstants.ADD_BUILD_AGENT_GROUP );
         }
         else
         // found
@@ -326,6 +351,7 @@
         }
 
         getContinuum().getDistributedBuildManager().reload();
+        event.log();
 
         return SUCCESS;
     }

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/action/admin/LocalRepositoryAction.java
Fri Jun  5 06:42:54 2009
@@ -30,6 +30,8 @@
 import org.apache.continuum.purge.PurgeConfigurationService;
 import org.apache.continuum.repository.RepositoryService;
 import org.apache.continuum.taskqueue.manager.TaskQueueManager;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.model.project.ProjectGroup;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
 import org.apache.maven.continuum.web.action.ContinuumConfirmAction;
@@ -248,6 +250,11 @@
             if ( purgeConfig != null )
             {
                 purgeManager.purgeRepository( purgeConfig );
+
+                AuditLog event = new AuditLog( "Repository id=" + repository.getId(), AuditLogConstants.PURGE_LOCAL_REPOSITORY
);
+                event.setCategory( AuditLogConstants.LOCAL_REPOSITORY );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
             }
         }
         return SUCCESS;

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/continuum/web/util/AuditLogConstants.java
Fri Jun  5 06:42:54 2009
@@ -36,6 +36,14 @@
 
     public static final String PROJECT_GROUP = "PROJECT_GROUP";
 
+    public static final String BUILD_RESULT = "BUILD_RESULT";
+
+    public static final String BUILD_QUEUE = "BUILD_QUEUE";
+
+    public static final String BUILD_AGENT = "BUILD_AGENT";
+
+    public static final String LOCAL_REPOSITORY = "LOCAL_REPOSITORY";
+
     // events
     public static final String FORCE_BUILD = "Forced Project Build";
 
@@ -51,6 +59,12 @@
 
     public static final String ADD_M2_PROJECT = "Added M2 Project";
 
+    public static final String ADD_M2_PROJECT_FAILED = "Failed Adding M2 Project";
+
+    public static final String ADD_M1_PROJECT = "Added M1 Project";
+
+    public static final String ADD_M1_PROJECT_FAILED = "Failed Adding M1 Project";
+
     public static final String ADD_PROJECT = "Added Project";
 
     public static final String MODIFY_PROJECT = "Modified Project";
@@ -80,5 +94,25 @@
     public static final String MODIFY_TEMPLATE = "Modified Build Definition Template";
 
     public static final String REMOVE_TEMPLATE = "Removed Build Definition Template";
+
+    public static final String REMOVE_BUILD_RESULT = "Removed Build Result";
+
+    public static final String ADD_BUILD_QUEUE = "Added Build Queue";
+
+    public static final String REMOVE_BUILD_QUEUE = "Removed Build Queue";
+
+    public static final String PURGE_LOCAL_REPOSITORY = "Purged Local Repository";
+
+    public static final String ADD_BUILD_AGENT = "Added Build Agent";
+
+    public static final String ADD_BUILD_AGENT_GROUP = "Added Build Agent Group";
+
+    public static final String MODIFY_BUILD_AGENT = "Modified Build Agent";
+
+    public static final String MODIFY_BUILD_AGENT_GROUP = "Modified Build Agent Group";
+
+    public static final String REMOVE_BUILD_AGENT = "Removed Build Agent";
+
+    public static final String REMOVE_BUILD_AGENT_GROUP = "Removed Build Agent Group";
 }
 

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenOneProjectAction.java
Fri Jun  5 06:42:54 2009
@@ -21,6 +21,8 @@
 
 import java.io.File;
 
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.project.builder.ContinuumProjectBuildingResult;
 
@@ -40,8 +42,21 @@
                                                         boolean scmUseCache )
         throws ContinuumException
     {
-        return getContinuum().addMavenOneProject( pomUrl, selectedProjectGroup, checkProtocol,
scmUseCache,
+        ContinuumProjectBuildingResult result = getContinuum().addMavenOneProject( pomUrl,
selectedProjectGroup, checkProtocol, scmUseCache,
                                                   this.getBuildDefinitionTemplateId() );
+
+        AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M1_PROJECT
);
+        event.setCategory( AuditLogConstants.PROJECT );
+        event.setCurrentUser( getPrincipal() );
+
+        if ( result == null || result.hasErrors() )
+        {
+            event.setAction( AuditLogConstants.ADD_M1_PROJECT_FAILED );
+        }
+
+        event.log();
+
+        return result;
     }
 
     /**

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenProjectAction.java
Fri Jun  5 06:42:54 2009
@@ -291,6 +291,22 @@
         return INPUT;
     }
 
+    protected String hidePasswordInUrl( String url )
+    {
+        int indexAt = url.indexOf( "@" );
+
+        if ( indexAt < 0 )
+        {
+            return url;
+        }
+
+        String s = url.substring( 0, indexAt );
+
+        int pos = s.lastIndexOf( ":" );
+
+        return s.substring( 0, pos + 1 ) + "*****" + url.substring( indexAt );
+    }
+
     private void initializeProjectGroupName()
     {
         if ( disableGroupSelection && selectedProjectGroup != DEFINED_BY_POM_GROUP_ID
)

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddMavenTwoProjectAction.java
Fri Jun  5 06:42:54 2009
@@ -110,14 +110,17 @@
                                                         !this.isNonRecursiveProject(),
                                                         this.getBuildDefinitionTemplateId()
);
         }
-        
-        String projectUrl = hidePasswordInUrl( pomUrl );
-        
-        AuditLog event = new AuditLog( projectUrl, AuditLogConstants.ADD_M2_PROJECT );
+
+        AuditLog event = new AuditLog( hidePasswordInUrl( pomUrl ), AuditLogConstants.ADD_M2_PROJECT
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
-        event.log();
 
+        if ( result == null || result.hasErrors() )
+        {
+            event.setAction( AuditLogConstants.ADD_M2_PROJECT_FAILED );
+        }
+
+        event.log();
         return result;
     }
 
@@ -162,32 +165,4 @@
     {
         this.nonRecursiveProject = nonRecursiveProject;
     }
-    
-    private String hidePasswordInUrl( String pomUrl )
-    {
-        String projectUrl = pomUrl;
-        
-        int idx = projectUrl.indexOf( "@" );
-        
-        if ( idx > 0 )
-        {
-            int pwdIndex = projectUrl.lastIndexOf( ":" );
-            
-            if ( ( pwdIndex > 0 ) && ( pwdIndex > projectUrl.indexOf( "://"
) ) )
-            {
-                String password = projectUrl.substring( pwdIndex, idx + 1 );
-                
-                String newPwd = "@";
-                
-                if ( ( password.length() ) > 2 )
-                {
-                    newPwd = ":*****@";
-                }
-                
-                projectUrl = projectUrl.replace( password, newPwd );
-            }
-        }
-        
-        return projectUrl;
-    }
 }

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectAction.java
Fri Jun  5 06:42:54 2009
@@ -190,8 +190,8 @@
             this.setProjectGroupId( this.getSelectedProjectGroup() );
             return "projectGroupSummary";
         }
-        
-        AuditLog event = new AuditLog( projectNameTrim, AuditLogConstants.ADD_PROJECT );
+
+        AuditLog event = new AuditLog( "Project id=" + project.getId(), AuditLogConstants.ADD_PROJECT
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/AddProjectGroupAction.java
Fri Jun  5 06:42:54 2009
@@ -154,7 +154,7 @@
             return ERROR;
         }
         
-        AuditLog event = new AuditLog( name, AuditLogConstants.ADD_PROJECT_GROUP );
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroup.getId(), AuditLogConstants.ADD_PROJECT_GROUP
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildDefinitionAction.java
Fri Jun  5 06:42:54 2009
@@ -315,7 +315,7 @@
             return REQUIRES_AUTHORIZATION;
         }
         
-        String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+        String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
         AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
         event.setCategory( AuditLogConstants.BUILD_DEFINITION );
         event.setCurrentUser( getPrincipal() );
@@ -367,7 +367,7 @@
 
         if ( projectId != 0 )
         {
-            String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+            String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
             AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
             event.setCategory( AuditLogConstants.BUILD_DEFINITION );
             event.setCurrentUser( getPrincipal() );
@@ -377,6 +377,11 @@
         }
         else
         {
+            String resource = "Project Group id=" + projectGroupId + ":" + goals + " " +
arguments;
+            AuditLog event = new AuditLog( resource, AuditLogConstants.ADD_GOAL );
+            event.setCategory( AuditLogConstants.BUILD_DEFINITION );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
             return "success_group";
         }
     }
@@ -392,7 +397,7 @@
             {
                 getContinuum().removeBuildDefinitionFromProject( projectId, buildDefinitionId
);
                 
-                String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+                String resource = "Project id=" + projectId + ":" +  goals + " " + arguments;
                 AuditLog event = new AuditLog( resource, AuditLogConstants.REMOVE_GOAL );
                 event.setCategory( AuditLogConstants.BUILD_DEFINITION );
                 event.setCurrentUser( getPrincipal() );
@@ -426,7 +431,7 @@
             {
                 getContinuum().removeBuildDefinitionFromProjectGroup( projectGroupId, buildDefinitionId
);
                 
-                String resource = getProjectGroupName() + ":" +  goals + " " + arguments;
+                String resource = "Project Group id=" + projectGroupId + ":" +  goals + "
" + arguments;
                 AuditLog event = new AuditLog( resource, AuditLogConstants.REMOVE_GOAL );
                 event.setCategory( AuditLogConstants.BUILD_DEFINITION );
                 event.setCurrentUser( getPrincipal() );

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultAction.java
Fri Jun  5 06:42:54 2009
@@ -30,6 +30,8 @@
 import org.apache.continuum.builder.distributed.manager.DistributedBuildManager;
 import org.apache.continuum.builder.utils.ContinuumBuildConstant;
 import org.apache.continuum.buildmanager.BuildManagerException;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.configuration.ConfigurationException;
 import org.apache.maven.continuum.model.project.BuildResult;
@@ -152,7 +154,32 @@
         }
         if ( this.isConfirmed() )
         {
-            getContinuum().removeBuildResult( buildId );
+            try
+            {
+                if ( canRemoveBuildResult( getContinuum().getBuildResult( buildId ) ) )
+                {
+                    getContinuum().removeBuildResult( buildId );
+                }
+                else
+                {
+                    addActionError( getText( "buildResult.cannot.delete" ) );
+                }
+            }
+            catch ( ContinuumException e )
+            {
+                addActionError( getText( "buildResult.delete.error", "Unable to delete build
result",
+                                         new Integer( buildId ).toString() ) );
+            }
+            catch ( BuildManagerException e )
+            {
+                throw new ContinuumException( e.getMessage(), e );
+            }
+
+            AuditLog event = new AuditLog( "Build Result id=" + buildId, AuditLogConstants.REMOVE_BUILD_RESULT
);
+            event.setCategory( AuditLogConstants.BUILD_RESULT );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
+            
             return SUCCESS;
         }
 

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/BuildResultsListAction.java
Fri Jun  5 06:42:54 2009
@@ -24,6 +24,8 @@
 import java.util.List;
 
 import org.apache.continuum.buildmanager.BuildManagerException;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildResult;
 import org.apache.maven.continuum.model.project.Project;
@@ -99,6 +101,11 @@
                         logger.info( "Removing BuildResult with id=" + buildId );
 
                         getContinuum().removeBuildResult( buildId );
+
+                        AuditLog event = new AuditLog( "Build Result id=" + buildId, AuditLogConstants.REMOVE_BUILD_RESULT
);
+                        event.setCategory( AuditLogConstants.BUILD_RESULT );
+                        event.setCurrentUser( getPrincipal() );
+                        event.log();
                     }
                     catch ( ContinuumException e )
                     {

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/CancelBuildAction.java
Fri Jun  5 06:42:54 2009
@@ -68,7 +68,7 @@
 
             buildsManager.cancelBuild( projectId );
             
-            AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.CANCEL_BUILD
);
+            AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.CANCEL_BUILD
);
             event.setCategory( AuditLogConstants.PROJECT );
             event.setCurrentUser( getPrincipal() );
             event.log();
@@ -112,7 +112,7 @@
                 
                 getContinuum().getBuildsManager().cancelBuild( projId );
 	            
-  	            AuditLog event = new AuditLog( "Project id=" + projId, AuditLogConstants.CANCEL_BUILD
);
+  	        AuditLog event = new AuditLog( "Project id=" + projId, AuditLogConstants.CANCEL_BUILD
);
                 event.setCategory( AuditLogConstants.PROJECT );
                 event.setCurrentUser( getPrincipal() );
                 event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectEditAction.java
Fri Jun  5 06:42:54 2009
@@ -80,9 +80,8 @@
         project.setScmTag( scmTag );
 
         getContinuum().updateProject( project );
-        
-        String resource = project.getGroupId() + ":" + project.getArtifactId();
-        AuditLog event = new AuditLog( resource, AuditLogConstants.MODIFY_PROJECT );
+
+        AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.MODIFY_PROJECT
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupAction.java
Fri Jun  5 06:42:54 2009
@@ -313,7 +313,7 @@
             return CONFIRM;
         }
 
-        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.REMOVE_PROJECT_GROUP
);
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.REMOVE_PROJECT_GROUP
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();
@@ -536,7 +536,7 @@
             }
         }
 
-        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.MODIFY_PROJECT_GROUP
);
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.MODIFY_PROJECT_GROUP
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();
@@ -566,7 +566,7 @@
             getContinuum().buildProjectGroupWithBuildDefinition( projectGroupId, buildDefinitionId
);
         }
 
-        AuditLog event = new AuditLog( getProjectGroupName(), AuditLogConstants.FORCE_BUILD
);
+        AuditLog event = new AuditLog( "Project Group id=" + projectGroupId, AuditLogConstants.FORCE_BUILD
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
Fri Jun  5 06:42:54 2009
@@ -28,6 +28,8 @@
 import org.apache.maven.continuum.model.project.BuildDefinition;
 import org.apache.maven.continuum.model.project.Project;
 import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.codehaus.plexus.util.StringUtils;
 import org.codehaus.plexus.util.dag.CycleDetectedException;
 import org.slf4j.Logger;
@@ -99,7 +101,7 @@
 
                 try
                 {
-                    AuditLog event = new AuditLog( "Project id=" + selectedProject, AuditLogConstants.REMOVE_PROJECT
);
+                    AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.REMOVE_PROJECT
);
                     event.setCategory( AuditLogConstants.PROJECT );
                     event.setCurrentUser( getPrincipal() );
                     event.log();
@@ -153,6 +155,11 @@
                 int projectId = Integer.parseInt( pId );
                 Project p = getContinuum().getProjectWithAllDetails( projectId );
                 projectsList.add( p );
+
+                AuditLog event = new AuditLog( "Project id=" + projectId, AuditLogConstants.FORCE_BUILD
);
+                event.setCategory( AuditLogConstants.PROJECT );
+                event.setCurrentUser( getPrincipal() );
+                event.log();
             }
 
             List<Project> sortedProjects = getContinuum().getProjectsInBuildOrder(
projectsList );

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePerformAction.java
Fri Jun  5 06:42:54 2009
@@ -262,9 +262,8 @@
             releaseManager.perform( releaseId, performDirectory, goals, arguments, useReleaseProfile,
listener,
                                     repository );
         }
-        
-        String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
-        AuditLog event = new AuditLog( resource, AuditLogConstants.PERFORM_RELEASE );
+
+        AuditLog event = new AuditLog( "ReleaseId=" + releaseId, AuditLogConstants.PERFORM_RELEASE
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleasePrepareAction.java
Fri Jun  5 06:42:54 2009
@@ -356,8 +356,7 @@
                                         workingDirectory, environments, executable );
         }
 
-        String resource = project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
-        AuditLog event = new AuditLog( resource, AuditLogConstants.PREPARE_RELEASE );
+        AuditLog event = new AuditLog( "Release id=" + releaseId, AuditLogConstants.PREPARE_RELEASE
);
         event.setCategory( AuditLogConstants.PROJECT );
         event.setCurrentUser( getPrincipal() );
         event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ReleaseRollbackAction.java
Fri Jun  5 06:42:54 2009
@@ -107,8 +107,8 @@
                     //do nothing
                 }
             }
-            String resource = project.getGroupId() + ":" + project.getArtifactId() + ":"
+ project.getVersion();
-            AuditLog event = new AuditLog( resource, AuditLogConstants.ROLLBACK_RELEASE );
+
+            AuditLog event = new AuditLog( "Release id=" + releaseId, AuditLogConstants.ROLLBACK_RELEASE
);
             event.setCategory( AuditLogConstants.PROJECT );
             event.setCurrentUser( getPrincipal() );
             event.log();

Modified: continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildQueueAction.java
URL: http://svn.apache.org/viewvc/continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildQueueAction.java?rev=781924&r1=781923&r2=781924&view=diff
==============================================================================
--- continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildQueueAction.java
(original)
+++ continuum/branches/continuum-1.3.x/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/admin/BuildQueueAction.java
Fri Jun  5 06:42:54 2009
@@ -22,6 +22,8 @@
 import java.util.List;
 
 import org.apache.continuum.buildmanager.BuildManagerException;
+import org.apache.continuum.web.util.AuditLog;
+import org.apache.continuum.web.util.AuditLogConstants;
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.BuildQueue;
 import org.apache.maven.continuum.security.ContinuumRoleConstants;
@@ -98,6 +100,11 @@
                     BuildQueue addedBuildQueue = getContinuum().addBuildQueue( buildQueue
);
     
                     getContinuum().getBuildsManager().addOverallBuildQueue( addedBuildQueue
);
+
+                    AuditLog event = new AuditLog( "Build Queue id=" + addedBuildQueue.getId(),
AuditLogConstants.ADD_BUILD_QUEUE );
+                    event.setCategory( AuditLogConstants.BUILD_QUEUE );
+                    event.setCurrentUser( getPrincipal() );
+                    event.log();
                 }
                 else
                 {
@@ -145,6 +152,11 @@
             getContinuum().removeBuildQueue( buildQueueToBeDeleted );
 
             this.buildQueueList = getContinuum().getAllBuildQueues();
+
+            AuditLog event = new AuditLog( "Build Queue id=" + buildQueue.getId(), AuditLogConstants.REMOVE_BUILD_QUEUE
);
+            event.setCategory( AuditLogConstants.BUILD_QUEUE );
+            event.setCurrentUser( getPrincipal() );
+            event.log();
         }
         else
         {



Mime
View raw message