[Yanel-commits] rev 34759 -
public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager
michi at wyona.com
michi at wyona.com
Thu Apr 3 15:52:59 CEST 2008
Author: michi
Date: 2008-04-03 15:52:58 +0200 (Thu, 03 Apr 2008)
New Revision: 34759
Modified:
public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyViewer.java
Log:
use previous version of policy viewer
Modified: public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyViewer.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyViewer.java 2008-04-03 13:51:16 UTC (rev 34758)
+++ public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyViewer.java 2008-04-03 13:52:58 UTC (rev 34759)
@@ -43,7 +43,7 @@
if(showParents) {
// Show also all parent policies
if (showTabs) {
- sb.append("<p><a href=\"?policy-path=" + path + "&yanel.policy=read&orderedBy=" + orderedBy + "&showParents=false\">Tab: Node Policy</a> | Tab: Parent Policies</p>");
+ sb.append("<p><a href=\"?yanel.policy=read&orderedBy=" + orderedBy + "&showParents=false\">Tab: Node Policy</a> | Tab: Parent Policies</p>");
}
sb.append("<p>Access Policies for Path (and its parents) <i>" + path);
@@ -51,27 +51,31 @@
sb.append("</i>:</p>");
sb.append("<p>(Policy Repository: "+pm.getPoliciesRepository().getName()+", "+pm.getPoliciesRepository().getConfigFile()+")</p>");
- sb.append(getOrderByLink(orderedBy, showParents, path));
+ sb.append(getOrderByLink(orderedBy, showParents));
sb.append("<p><table border=\"1\">");
sb.append("<tr><td>Path</td>" + getSplittedPath(pm, path, contentItemId) + "</tr>");
- sb.append("<tr valign=\"top\"><td>Policy</td>" + getPolicies(pm, path, contentItemId, false, orderedBy) + "</tr>");
- sb.append("<tr valign=\"top\"><td>Aggregated Policy</td>" + getPolicies(pm, path, contentItemId, true, orderedBy) + "</tr>");
+
+ boolean aggregate = false;
+ sb.append("<tr valign=\"top\"><td>Policy</td>" + getPolicies(pm, path, contentItemId, aggregate, orderedBy) + "</tr>");
+
+ aggregate = true;
+ sb.append("<tr valign=\"top\"><td>Aggregated Policy</td>" + getPolicies(pm, path, contentItemId, aggregate, orderedBy) + "</tr>");
sb.append("</table></p>");
} else {
// Show policy of this node only
if (showTabs) {
- sb.append("<p>Tab: Node Policy | <a href=\"?policy-path=" + path + "&yanel.policy=read&orderedBy=" + orderedBy + "&showParents=true\">Tab: Parent Policies</a></p>");
+ sb.append("<p>Tab: Node Policy | <a href=\"?yanel.policy=read&orderedBy=" + orderedBy + "&showParents=true\">Tab: Parent Policies</a></p>");
}
sb.append("<div id=\"path-sentence\"><p>Aggregated Access Policy for Path <i>" + path);
if (contentItemId != null) sb.append("#" + contentItemId);
sb.append("</i>:</p></div>");
- sb.append(getOrderByLink(orderedBy, showParents, path));
+ sb.append(getOrderByLink(orderedBy, showParents));
boolean aggregate = true;
Policy p = pm.getPolicy(path, aggregate);
sb.append("<p><table border=\"1\"><tr>");
- sb.append(getPolicy(p, aggregate, orderedBy, null, path));
+ sb.append(getPolicy(p, aggregate, orderedBy, null));
if (contentItemId != null) {
sb.append("<td>contentItemId (" + contentItemId + ") not implemented yet into API!</td>");
}
@@ -128,8 +132,10 @@
for (int i = 0; i < names.length - 1; i++) {
currentPath.append(names[i] + "/");
Policy p = pm.getPolicy(currentPath.toString(), aggregate);
+ if (p == null) {
+ log.debug("No policy yet: " + currentPath.toString());
+ }
-
String back = "";
if (path.endsWith("/")) {
for (int k = i; k < names.length - 1; k++) {
@@ -147,12 +153,12 @@
//log.debug("Back path: " + i + ", " + names[i] + ", " + back);
- sb.append(getPolicy(p, aggregate, orderedBy, back, path));
+ sb.append(getPolicy(p, aggregate, orderedBy, back));
}
// Show policy of the actual node
Policy p = pm.getPolicy(path, aggregate);
- sb.append(getPolicy(p, aggregate, orderedBy, null, path));
+ sb.append(getPolicy(p, aggregate, orderedBy, null));
// Show policy according to content id
if (contentItemId != null) {
@@ -293,11 +299,11 @@
/**
*
*/
- private static String getOrderByLink(int orderedBy, boolean showParents, String path) {
+ private static String getOrderByLink(int orderedBy, boolean showParents) {
if (orderedBy == ORDERED_BY_USECASES) {
- return "<div id=\"order-by-sentence\"><p>Order by <a href=\"?policy-path=" + path + "&yanel.policy=read&orderedBy=" + ORDERED_BY_IDENTITIES + "&showParents=" + showParents + "\">Identities</a></p></div>";
+ return "<div id=\"order-by-sentence\"><p>Order by <a href=\"?yanel.policy=read&orderedBy=" + ORDERED_BY_IDENTITIES + "&showParents=" + showParents + "\">Identities</a></p></div>";
} else if (orderedBy == ORDERED_BY_IDENTITIES) {
- return "<div id=\"order-by-sentence\"><p>Order by <a href=\"?policy-path=" + path + "&yanel.policy=read&orderedBy=" + ORDERED_BY_USECASES + "&showParents=" + showParents + "\">Usecases</a></p></div>";
+ return "<div id=\"order-by-sentence\"><p>Order by <a href=\"?yanel.policy=read&orderedBy=" + ORDERED_BY_USECASES + "&showParents=" + showParents + "\">Usecases</a></p></div>";
} else {
log.error("No such order by value implemented: " + orderedBy);
return "";
@@ -309,7 +315,7 @@
* @param aggregate If aggregate true, then the policy will be aggregated/merged with existing parent policies, otherwise only the node specific policy will be returned
* @param back ../../../
*/
- static public StringBuffer getPolicy(Policy policy, boolean aggregate, int orderedBy, String back, String path) throws AuthorizationException {
+ static private StringBuffer getPolicy(Policy policy, boolean aggregate, int orderedBy, String back) throws AuthorizationException {
StringBuffer sb = new StringBuffer("<td>");
if (policy != null) {
String showUseInheritedPolicies = "";
@@ -317,9 +323,9 @@
if (!aggregate) {
showUseInheritedPolicies = "<p>Use inherited policies: " + policy.useInheritedPolicies() + "</p>";
if (back != null) {
- editPolicy = "<p><a href=\"" + back + "?policy-path=" + path + "&yanel.policy=update\">Edit policy.</a></p>";
+ editPolicy = "<p><a href=\"" + back + "?yanel.policy=update\">Edit policy.</a></p>";
} else {
- editPolicy = "<p><a href=\"?policy-path=" + path + "&yanel.policy=update\">Edit policy.</a></p>";
+ editPolicy = "<p><a href=\"?yanel.policy=update\">Edit policy.</a></p>";
}
}
@@ -333,9 +339,9 @@
} else {
sb.append("<p>No policy yet!</p>");
if (back != null) {
- sb.append("<p><a href=\"" + back + "?policy-path=" + path + "&yanel.policy=update\">Create new policy.</a></p>");
+ sb.append("<p><a href=\"" + back + "?yanel.policy=update\">Create new policy.</a></p>");
} else {
- sb.append("<p><a href=\"?policy-path=" + path + "&yanel.policy=update\">Create new policy.</a></p>");
+ sb.append("<p><a href=\"?yanel.policy=update\">Create new policy.</a></p>");
}
}
sb.append("</td>");
More information about the Yanel-commits
mailing list