[Yanel-commits] rev 48901 - public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager

michi at wyona.com michi at wyona.com
Tue Apr 20 07:54:16 CEST 2010


Author: michi
Date: 2010-04-20 07:54:15 +0200 (Tue, 20 Apr 2010)
New Revision: 48901

Modified:
   public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyManagerResource.java
Log:
differentiate between XML and XHTML

Modified: public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyManagerResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyManagerResource.java	2010-04-19 20:40:15 UTC (rev 48900)
+++ public/yanel/trunk/src/contributions/resources/policymanager/src/java/org/wyona/yanel/impl/resources/policymanager/PolicyManagerResource.java	2010-04-20 05:54:15 UTC (rev 48901)
@@ -74,12 +74,15 @@
      */
     @Override
     protected InputStream getContentXML(String viewId) throws Exception {
+
         // For example ?policy-path=/foo/bar.html
         String policyPath = request.getParameter(PARAMETER_EDIT_PATH);
         if (policyPath == null) {
             log.info("No policy path specified (e.g. ?policy-path=/foo/bar.html). Request path used as default: " + getPath());
             policyPath = getPath();
         }
+
+
         // For example ?yanel.policy=read
         String policyUsecase = "read";
         if (request.getParameter(PARAMETER_USECASE) != null) {
@@ -89,7 +92,9 @@
         }
         
         String backToRealm = org.wyona.yanel.core.util.PathUtil.backToRealm(getPath());
+
         StringBuilder sb = new StringBuilder("");
+
             if (policyUsecase.equals("read")) {
 
                 // Either order by usecases or identities
@@ -107,8 +112,17 @@
                 if (showTabsParam != null) showTabs = new Boolean(showTabsParam).booleanValue();
 
                 boolean showAbbreviatedLabels = false;
-                if (getResourceConfigProperty("show-abbreviated-labels") != null) showAbbreviatedLabels = Boolean.valueOf(getResourceConfigProperty("show-abbreviated-labels"));
-                sb.append(PolicyViewer.getXHTMLView(getRealm().getPolicyManager(), getRealm().getIdentityManager().getGroupManager(), getPath(), null, orderedBy, showParents, showTabs, showAbbreviatedLabels));
+                if (getResourceConfigProperty("show-abbreviated-labels") != null) {
+                    showAbbreviatedLabels = Boolean.valueOf(getResourceConfigProperty("show-abbreviated-labels"));
+                }
+
+                if (viewId != null && viewId.equals("get-xml")) {
+                    log.warn("DEBUG: Get XML version of policy ...");
+                    sb.append("<?xml version=\"1.0\"?><policy-viewer xmlns=\"http://www.wyona.org/security/1.0\"><usecases></usecases></policy-viewer>");
+                } else {
+                    log.warn("DEBUG: Get XHTML version of policy ...");
+                    sb.append(PolicyViewer.getXHTMLView(getRealm().getPolicyManager(), getRealm().getIdentityManager().getGroupManager(), getPath(), null, orderedBy, showParents, showTabs, showAbbreviatedLabels));
+                }
             } else if (policyUsecase.equals("update")) {
                 String getXML = request.getParameter("get");
                 String postXML = request.getParameter("post");



More information about the Yanel-commits mailing list