Author: chathura
Date: Fri Jan 11 01:54:03 2008
New Revision: 12146
Log:
Resolved a set of JIRAs.
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/TagsDAO.java
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/GetDescriptionAction.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RecentActivityAction.java
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/AdvancedResourceQuery.java
trunk/registry/modules/webapps/src/main/webapp/admin/advanced-search.jsp
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/TagsDAO.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/TagsDAO.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/jdbc/dao/TagsDAO.java
Fri Jan 11 01:54:03 2008
@@ -148,7 +148,7 @@
String sql = null;
if (tags.length == 1) {
- sql = "SELECT R.PATH FROM ARTIFACTS R, TAGS T WHERE R.AID=T.AID
AND T.TAG_NAME=?";
+ sql = "SELECT DISTINCT R.PATH FROM ARTIFACTS R, TAGS T WHERE
R.AID=T.AID AND T.TAG_NAME=?";
} else if (tags.length == 2) {
sql =
"SELECT DISTINCT R.PATH FROM ARTIFACTS R, TAGS T WHERE
R.AID=T.AID AND (T.TAG_NAME=? OR T.TAG_NAME=?)";
Modified:
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
==============================================================================
---
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
(original)
+++
trunk/registry/modules/core/src/main/java/org/wso2/registry/secure/SecureRegistry.java
Fri Jan 11 01:54:03 2008
@@ -167,28 +167,6 @@
public boolean resourceExists(String resourcePath) throws
RegistryException {
- // if the user has permission to the current version, he will get
permission to all
- // previous versions of the same resource
- String authorizationPath = resourcePath;
- if (resourcePath.indexOf("?") > 0) {
- authorizationPath = resourcePath.split("\\?")[0];
- } else if (resourcePath.indexOf(";")>0) {
- authorizationPath = resourcePath.split("\\;")[0];
- }
-
- try {
- if (!authorizer.isUserAuthorized(userID, authorizationPath,
ActionConstants.GET)) {
- String msg = "User: " + userID + " is not authorized to check
the existence of the resource: " +
- authorizationPath;
- log.info(msg);
- throw new AuthorizationFailedException(msg);
- }
- } catch (UserManagerException e) {
- String msg = "Could not check authorization. \nCaused by " +
e.getMessage();
- log.error(msg, e);
- throw new RegistryException(msg);
- }
-
User.setCurrentUser(userID);
return registry.resourceExists(resourcePath);
}
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/GetDescriptionAction.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/GetDescriptionAction.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/GetDescriptionAction.java
Fri Jan 11 01:54:03 2008
@@ -34,6 +34,10 @@
Registry registry = getRegistry();
Resource resource = registry.get(resourcePath);
description = resource.getDescription();
+
+ if (description == null) {
+ description = "";
+ }
}
public String getResourcePath() {
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/RecentActivityAction.java
==============================================================================
---
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
Fri Jan 11 01:54:03 2008
@@ -20,8 +20,7 @@
import org.wso2.registry.secure.SecureRegistry;
import javax.servlet.http.HttpServletRequest;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.*;
public class RecentActivityAction extends AbstractRegistryAction {
@@ -73,7 +72,7 @@
}
SecureRegistry secureRegistry = (SecureRegistry) getRegistry();
- LogEntry[] logs = secureRegistry.getLogs(resourcePath, filterValue,
userName, null, null, true);
+ LogEntry[] logs = secureRegistry.getLogs(resourcePath, filterValue,
userName, computeDate(fromDate), computeDate(toDate), true);
for (int i = 0; i < logs.length; i++) {
@@ -83,6 +82,10 @@
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 " + logEntry.getDate().toString()
+ ".";
activity.add(entry);
+ } else if (logEntry.getAction() == LogEntry.DELETE_RESOURCE) {
+ String entry = "<a href='/wso2registry/system/people/" +
logEntry.getUserName() + "'>" + logEntry.getUserName() + "</a>" + " has deleted
the resource '" + "<a href='/wso2registry/web" + logEntry.getResourcePath() +
"'>" + logEntry.getResourcePath() + "</a> on " + logEntry.getDate().toString()
+ ".";
+ activity.add(entry);
+
} else if (logEntry.getAction() == LogEntry.COMMENT) {
String entry = "<a href='/wso2registry/system/people/" +
logEntry.getUserName() + "'>" + logEntry.getUserName() + "</a>" + " has
commented on resource '" + "<a href='/wso2registry/web" +
logEntry.getResourcePath() + "'>" + logEntry.getResourcePath() + "</a> on " +
logEntry.getDate().toString() + " with the following comment.<br/>" +
logEntry.getActionData();
activity.add(entry);
@@ -148,4 +151,48 @@
public void setActivity(List activity) {
this.activity = activity;
}
+
+ /**
+ * Converts given strings to Dates
+ *
+ * @param dateString Allowed formats
+ * year/month/day:hour/minute/second
+ * year/month/day
+ *
+ * @return Date corresponding to the given string date
+ */
+ private Date computeDate(String dateString) {
+
+ if (dateString == null || dateString.length() == 0) {
+ return null;
+ }
+
+ if (dateString.indexOf(":") > 0) {
+ String[] dateTime = dateString.split(":");
+ if (dateTime.length == 2) {
+ String[] dateParts = dateTime[0].split("/");
+ String[] timeParts = dateTime[1].split("/");
+ Calendar calendar = new GregorianCalendar(
+ Integer.parseInt(dateParts[0]),
+ Integer.parseInt(dateParts[1]) - 1, // month value is
zero based
+ Integer.parseInt(dateParts[2]),
+ Integer.parseInt(timeParts[0]),
+ Integer.parseInt(timeParts[1]),
+ Integer.parseInt(timeParts[2]));
+
+ return calendar.getTime();
+ }
+ } else {
+
+ String[] dateParts = dateString.split("/");
+ Calendar calendar = new GregorianCalendar(
+ Integer.parseInt(dateParts[0]),
+ Integer.parseInt(dateParts[1]),
+ Integer.parseInt(dateParts[2]));
+
+ return calendar.getTime();
+ }
+
+ return null;
+ }
}
\ No newline at end of file
Modified:
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/AdvancedResourceQuery.java
==============================================================================
---
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/AdvancedResourceQuery.java
(original)
+++
trunk/registry/modules/webapps/src/main/java/org/wso2/registry/web/actions/utils/AdvancedResourceQuery.java
Fri Jan 11 01:54:03 2008
@@ -59,7 +59,7 @@
// else, create new query and execute
String queryPath = computeQueryPath();
- if (!registry.resourceExists(queryPath)) {
+ if (!queryExist(queryPath)) {
defineQuery();
}
@@ -197,6 +197,14 @@
this.commentWords = commentWords;
}
+ private boolean queryExist(String queryPath) throws RegistryException {
+
+ SecureRegistry systemRegistry =
+ (SecureRegistry)
System.getProperties().get(RegistryConstants.SYSTEM_REGISTRY);
+
+ return systemRegistry.resourceExists(queryPath);
+ }
+
private void defineQuery() throws RegistryException {
SecureRegistry systemRegistry =
Modified:
trunk/registry/modules/webapps/src/main/webapp/admin/advanced-search.jsp
==============================================================================
--- trunk/registry/modules/webapps/src/main/webapp/admin/advanced-search.jsp
(original)
+++ trunk/registry/modules/webapps/src/main/webapp/admin/advanced-search.jsp
Fri Jan 11 01:54:03 2008
@@ -39,12 +39,21 @@
<%
AdvancedSearchAction advancedSearchAction = (AdvancedSearchAction)
request.getSession().getAttribute(UIConstants.ADVANCED_SEARCH_BEAN);
+
+ String errorMessage = (String)
request.getSession().getAttribute(UIConstants.ERROR_MESSAGE);
+ if (errorMessage != null) {
+ request.getSession().setAttribute(UIConstants.ERROR_MESSAGE, null);
+ }
%>
<!-- START header content -->
<jsp:include page="header.jsp" />
<! START body content -->
+<% if (errorMessage != null) { %>
+<div class="error-message"><%=errorMessage%></div>
+<% } %>
+
<div class="content">
<h1 class="headding-search">Advanced Search</h1>
<!-- Hear comes the box1 table -->
_______________________________________________
Registry-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/registry-dev