[Registry-dev] svn commit r18948 - in trunk/registry/modules: core/src/main/java/org/wso2/registry/jdbc webapps/src/main/java/org/wso2/registry/web/actions webapps/src/main/webapp/admin

chathura at wso2.com chathura at wso2.com
Tue Jul 8 00:57:18 PDT 2008


Author: chathura
Date: Tue Jul  8 00:57:17 2008
New Revision: 18948
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=18948

Log:

Implemented resource add and resource update as seperate actions in the activity log.



Modified:
   trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/BasicRegistry.java
   trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java
   trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RecentActivityAction.java
   trunk/registry/modules/webapps/src/main/webapp/admin/recent-activity.jsp

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/BasicRegistry.java
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/BasicRegistry.java?rev=18948&r1=18947&r2=18948&view=diff
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/BasicRegistry.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/BasicRegistry.java	Tue Jul  8 00:57:17 2008
@@ -212,8 +212,6 @@
             }
         }
 
-        logsDAO.addLog(suggestedPath, CurrentSession.getUser(), LogEntry.UPDATE, null);
-
         if (actualPath == null) {
             return suggestedPath;
         } else {

Modified: trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java?rev=18948&r1=18947&r2=18948&view=diff
==============================================================================
--- trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java	(original)
+++ trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/Repository.java	Tue Jul  8 00:57:17 2008
@@ -48,9 +48,7 @@
     private ResourceDAO resourceDAO;
     private ResourceVersionDAO resourceVersionDAO;
     private AssociationDAO associationDAO;
-    private TagsDAO tagsDAO;
-    private CommentsDAO commentsDAO;
-    private RatingsDAO ratingsDAO;
+    private LogsDAO logsDAO;
 
     /**
      * Datasource is set on all resources get from the repository.
@@ -62,9 +60,7 @@
         resourceDAO = new ResourceDAO();
         resourceVersionDAO = new ResourceVersionDAO();
         associationDAO = new AssociationDAO();
-        tagsDAO = new TagsDAO();
-        commentsDAO = new CommentsDAO();
-        ratingsDAO = new RatingsDAO();
+        logsDAO = new LogsDAO();
     }
 
     /**
@@ -404,6 +400,7 @@
         }
 
         // then add the new resource/collection
+        logsDAO.addLog(path, CurrentSession.getUser(), LogEntry.ADD, null);
         resourceDAO.add(path, parentID, (ResourceImpl) resource);
 
         // set authorizations for the newly added resource
@@ -451,6 +448,7 @@
             throw new AuthorizationFailedException(msg);
         }
 
+        logsDAO.addLog(path, CurrentSession.getUser(), LogEntry.UPDATE, null);
         resourceDAO.update(resourceID, (ResourceImpl) resource);
 
     }
@@ -499,6 +497,7 @@
                     }
 
                     CollectionImpl collection = new CollectionImpl();
+                    logsDAO.addLog(currentPath, CurrentSession.getUser(), LogEntry.ADD, null);
                     resourceDAO.add(currentPath, idOfLastExistingParent, collection);
 
                     AuthorizationUtils.copyAuthorizations(idOfLastExistingParent, collection.getId());
@@ -517,6 +516,7 @@
                 String currentParentID = ResourceDAO.getResourceID(currentParentPath);
 
                 CollectionImpl collection = new CollectionImpl();
+                logsDAO.addLog(currentPath, CurrentSession.getUser(), LogEntry.ADD, null);
                 resourceDAO.add(currentPath, currentParentID, collection);
 
                 AuthorizationUtils.copyAuthorizations(idOfLastExistingParent, collection.getId());

Modified: trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RecentActivityAction.java
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RecentActivityAction.java?rev=18948&r1=18947&r2=18948&view=diff
==============================================================================
--- trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RecentActivityAction.java	(original)
+++ trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RecentActivityAction.java	Tue Jul  8 00:57:17 2008
@@ -73,7 +73,10 @@
         }
 
         int filterValue = -1;
-        if (filter.equals("resourceActions")) {
+        if (filter.equals("resourceAdd")) {
+            filterValue = LogEntry.ADD;
+
+        } else if (filter.equals("resourceUpdate")) {
             filterValue = LogEntry.UPDATE;
 
         } else if (filter.equals("commentings")) {
@@ -104,7 +107,11 @@
 
             LogEntry logEntry = logs[i];
 
-            if (logEntry.getAction() == LogEntry.UPDATE) {
+            if (logEntry.getAction() == LogEntry.ADD) {
+                String entry = "<a href='/wso2registry/system/people/" + logEntry.getUserName() + "'>" + logEntry.getUserName() + "</a>" + " has added the resource '" + "<a href='/wso2registry/web" + logEntry.getResourcePath() + "'>" + logEntry.getResourcePath() + "</a> on " + CommonUtil.formatDate(logEntry.getDate()) + ".";
+                activity.add(entry);
+
+            } else if (logEntry.getAction() == LogEntry.UPDATE) {
                 String entry = "<a href='/wso2registry/system/people/" + logEntry.getUserName() + "'>" + logEntry.getUserName() + "</a>" + " has updated the resource '" + "<a href='/wso2registry/web" + logEntry.getResourcePath() + "'>" + logEntry.getResourcePath() + "</a> on " + CommonUtil.formatDate(logEntry.getDate()) + ".";
                 activity.add(entry);
 

Modified: trunk/registry/modules/webapps/src/main/webapp/admin/recent-activity.jsp
URL: http://wso2.org/svn/browse/wso2/trunk/registry/modules/webapps/src/main/webapp/admin/recent-activity.jsp?rev=18948&r1=18947&r2=18948&view=diff
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/recent-activity.jsp	(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/recent-activity.jsp	Tue Jul  8 00:57:17 2008
@@ -113,7 +113,8 @@
                     <td>
                         <select name="filter" id="filter">
                             <option value ="all">All</option>
-                            <option value ="resourceActions">Resource Updates</option>
+                            <option value ="resourceAdd">Resource Add</option>
+                            <option value ="resourceUpdate">Resource Updates</option>
                             <option value ="delete">Resource Deletes</option>
                             <option value ="restore">Resource Restores</option>
                             <option value ="commentings">Comments</option>



More information about the Registry-dev mailing list