You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@syncope.apache.org by il...@apache.org on 2013/02/01 10:50:14 UTC

svn commit: r1441364 - in /syncope/branches/1_0_X/console/src/main: java/org/apache/syncope/console/pages/ java/org/apache/syncope/console/pages/panels/ resources/org/apache/syncope/console/pages/

Author: ilgrosso
Date: Fri Feb  1 09:50:14 2013
New Revision: 1441364

URL: http://svn.apache.org/viewvc?rev=1441364&view=rev
Log:
[SYNCOPE-294] UserTO re-read from REST before opening the edit modal page

Modified:
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ResourceModalPage.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.html
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.properties
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage_it.properties

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java?rev=1441364&r1=1441363&r2=1441364&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/EditUserModalPage.java Fri Feb  1 09:50:14 2013
@@ -23,15 +23,15 @@ import java.util.List;
 import org.apache.syncope.client.mod.UserMod;
 import org.apache.syncope.client.to.UserTO;
 import org.apache.syncope.client.util.AttributableOperations;
+import org.apache.syncope.console.commons.StatusBean;
+import org.apache.syncope.console.pages.panels.AccountInformationPanel;
+import org.apache.syncope.console.pages.panels.StatusPanel;
+import org.apache.syncope.console.rest.UserRestClient;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.syncope.console.commons.StatusBean;
-import org.apache.syncope.console.pages.panels.AccountInformationPanel;
-import org.apache.syncope.console.pages.panels.StatusPanel;
-import org.apache.syncope.console.rest.UserRestClient;
 
 /**
  * Modal window with User form.
@@ -44,7 +44,6 @@ public class EditUserModalPage extends U
     private UserTO initialUserTO = null;
 
     public EditUserModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO) {
-
         super(callerPageRef, window, userTO, Mode.ADMIN, true);
 
         this.initialUserTO = AttributableOperations.clone(userTO);

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ResourceModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ResourceModalPage.java?rev=1441364&r1=1441363&r2=1441364&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ResourceModalPage.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ResourceModalPage.java Fri Feb  1 09:50:14 2013
@@ -18,23 +18,26 @@
  */
 package org.apache.syncope.console.pages;
 
+import org.apache.commons.lang.StringUtils;
+import org.apache.syncope.client.to.ResourceTO;
+import org.apache.syncope.client.to.SchemaMappingTO;
+import org.apache.syncope.console.pages.panels.ResourceConnConfPanel;
+import org.apache.syncope.console.pages.panels.ResourceDetailsPanel;
+import org.apache.syncope.console.pages.panels.ResourceMappingPanel;
+import org.apache.syncope.console.pages.panels.ResourceSecurityPanel;
+import org.apache.syncope.console.rest.ResourceRestClient;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.form.AjaxButton;
 import org.apache.wicket.authroles.authorization.strategies.role.metadata.MetaDataRoleAuthorizationStrategy;
 import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
 import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.basic.Label;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.model.Model;
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.syncope.client.to.ResourceTO;
-import org.apache.syncope.client.to.SchemaMappingTO;
-import org.apache.syncope.console.pages.panels.ResourceConnConfPanel;
-import org.apache.syncope.console.pages.panels.ResourceDetailsPanel;
-import org.apache.syncope.console.pages.panels.ResourceMappingPanel;
-import org.apache.syncope.console.pages.panels.ResourceSecurityPanel;
-import org.apache.syncope.console.rest.ResourceRestClient;
 
 /**
  * Modal window with Resource form.
@@ -51,6 +54,14 @@ public class ResourceModalPage extends B
 
         super();
 
+        this.add(new Label("new", StringUtils.isBlank(resourceTO.getName())
+                ? new ResourceModel("new")
+                : new Model("")));
+
+        this.add(new Label("name", StringUtils.isBlank(resourceTO.getName())
+                ? ""
+                : resourceTO.getName()));
+
         final Form form = new Form("form");
         form.setModel(new CompoundPropertyModel(resourceTO));
 
@@ -130,8 +141,8 @@ public class ResourceModalPage extends B
 
         MetaDataRoleAuthorizationStrategy.authorize(submit, ENABLE, xmlRolesReader.getAllAllowedRoles("Resources",
                 createFlag
-                        ? "create"
-                        : "update"));
+                ? "create"
+                : "update"));
     }
 
     /**

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java?rev=1441364&r1=1441363&r2=1441364&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java Fri Feb  1 09:50:14 2013
@@ -116,7 +116,7 @@ public class ResultSetPanel extends Pane
      * User rest client.
      */
     @SpringBean
-    private UserRestClient userRestClient;
+    private UserRestClient restClient;
 
     /**
      * Application preferences.
@@ -322,7 +322,7 @@ public class ResultSetPanel extends Pane
     }
 
     private void updateResultTable(final boolean create, final int rows) {
-        dataProvider = new UserDataProvider(userRestClient, rows, filtered);
+        dataProvider = new UserDataProvider(restClient, rows, filtered);
         dataProvider.setSearchCond(filter);
 
         final int currentPage = resultTable != null
@@ -424,7 +424,9 @@ public class ResultSetPanel extends Pane
 
                             @Override
                             public Page createPage() {
-                                return new EditUserModalPage(page.getPageReference(), editmodal, model.getObject());
+                                // SYNCOPE-294: re-read userTO before edit
+                                UserTO userTO = restClient.read(model.getObject().getId());
+                                return new EditUserModalPage(page.getPageReference(), editmodal, userTO);
                             }
                         });
 
@@ -439,7 +441,7 @@ public class ResultSetPanel extends Pane
                     @Override
                     public void onClick(final AjaxRequestTarget target) {
                         try {
-                            final UserTO userTO = userRestClient.delete(model.getObject().getId());
+                            final UserTO userTO = restClient.delete(model.getObject().getId());
 
                             page.setModalResult(true);
 

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.html?rev=1441364&r1=1441363&r2=1441364&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.html (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.html Fri Feb  1 09:50:14 2013
@@ -1,81 +1,88 @@
 <!--
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- under the License.
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
 -->
 <wicket:head>
-    <style type="text/css">
-        /* Style for autocomplete field */
-        div.wicket-aa {
-            font-family: "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana;
-            font-size: 12px;
-            background-color: white;
-            border-width: 1px;
-            border-color: #cccccc;
-            border-style: solid;
-            padding: 2px;
-            margin: 1px 0 0 0;
-            text-align:left;
-        }
-        div.wicket-aa ul {
-            list-style:none;
-            padding: 2px;
-            margin:0;
-        }
-        div.wicket-aa ul li.selected {
-            background-color: #FFFF00;
-            padding: 2px;
-            margin:0;
-        }
-    </style>
+  <style type="text/css">
+    /* Style for autocomplete field */
+    div.wicket-aa {
+      font-family: "Lucida Grande","Lucida Sans Unicode",Tahoma,Verdana;
+      font-size: 12px;
+      background-color: white;
+      border-width: 1px;
+      border-color: #cccccc;
+      border-style: solid;
+      padding: 2px;
+      margin: 1px 0 0 0;
+      text-align:left;
+    }
+    div.wicket-aa ul {
+      list-style:none;
+      padding: 2px;
+      margin:0;
+    }
+    div.wicket-aa ul li.selected {
+      background-color: #FFFF00;
+      padding: 2px;
+      margin:0;
+    }
+  </style>
 </wicket:head>
 <wicket:extend>
-    <div style="margin:10px">
-        <p class="ui-widget ui-corner-all ui-widget-header"><wicket:message key="title"/></p>
-        <form wicket:id="form">
-            <div id="tabs">
-                <ul>
-                    <li  class="tabs-selected"><a href="#resource"><span><wicket:message key="resource"/></span></a></li>
-                    <li><a href="#mappings"><span><wicket:message key="mappings"/></span></a></li>
-                    <li><a href="#connectorProperties"><span><wicket:message key="connectorProperties"/></span></a></li>
-                    <li><a href="#security"><span><wicket:message key="security"/></span></a></li>
-                </ul>
-                <div id="resource">
-                    <span wicket:id="details">[details]</span>
-                </div>
-                <div id="mappings">
-                    <span wicket:id="mapping">[mapping]</span>
-                </div>
-
-                <div id="connectorProperties">
-                    <span wicket:id="connconf">[connconf]</span>
-                </div>
-
-                <div id="security">
-                    <span wicket:id="security">[security]</span>
-                </div>
-
-                <script type="text/javascript">
-                    $(function() {
-                        $('div#security div#formtable div.tablerow:even').addClass("alt");
-                    });
-                </script>
-            </div>
-
-            <div style="margin: 20px 10px 0">
-                <input type="submit"
-                       class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
-                       wicket:id="apply"/>
-            </div>
-        </form>
-    </div>
+  <div style="margin:10px">
+    <p class="ui-widget ui-corner-all ui-widget-header">
+      <span wicket:id="new"/>&nbsp;<wicket:message key="title"/>&nbsp;<span wicket:id="name"/>
+    </p>
+
+    <form wicket:id="form">
+      <div id="tabs">
+        <ul>
+          <li  class="tabs-selected"><a href="#resource"><span><wicket:message key="resource"/></span></a></li>
+          <li><a href="#mappings"><span><wicket:message key="mappings"/></span></a></li>
+          <li><a href="#connectorProperties"><span><wicket:message key="connectorProperties"/></span></a></li>
+          <li><a href="#security"><span><wicket:message key="security"/></span></a></li>
+        </ul>
+        <div id="resource">
+          <span wicket:id="details">[details]</span>
+        </div>
+        <div id="mappings">
+          <span wicket:id="mapping">[mapping]</span>
+        </div>
+
+        <div id="connectorProperties">
+          <span wicket:id="connconf">[connconf]</span>
+        </div>
+
+        <div id="security">
+          <span wicket:id="security">[security]</span>
+        </div>
+
+        <script type="text/javascript">
+          $(function() {
+            $('div#security div#formtable div.tablerow:even').addClass("alt");
+          });
+        </script>
+      </div>
+
+      <div style="margin: 20px 10px 0">
+        <input type="submit"
+               class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+               wicket:id="apply"/>
+      </div>
+    </form>
+  </div>
 </wicket:extend>

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.properties?rev=1441364&r1=1441363&r2=1441364&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.properties (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage.properties Fri Feb  1 09:50:14 2013
@@ -54,3 +54,4 @@ resetToken=Reset Token
 success_connection=Successful connection
 error_connection=Connection failure
 check=Check connection
+new=New

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage_it.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage_it.properties?rev=1441364&r1=1441363&r2=1441364&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage_it.properties (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ResourceModalPage_it.properties Fri Feb  1 09:50:14 2013
@@ -55,3 +55,4 @@ resetToken=Reset Token
 success_connection=Connessione avvenuta con successo
 error_connection=Connessione non riuscita
 check=Verifica connessione
+new=Nuova