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/08 16:44:42 UTC

svn commit: r1444083 - in /syncope/branches/1_0_X: client/src/main/java/org/apache/syncope/client/to/ console/src/main/java/org/apache/syncope/console/pages/ console/src/main/resources/org/apache/syncope/console/pages/ core/src/main/java/org/apache/syn...

Author: ilgrosso
Date: Fri Feb  8 15:44:42 2013
New Revision: 1444083

URL: http://svn.apache.org/r1444083
Log:
[SYNCOPE-311] Button added in ApprovalModalPage for read-only access to user details

Added:
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java   (with props)
Modified:
    syncope/branches/1_0_X/client/src/main/java/org/apache/syncope/client/to/WorkflowFormTO.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ApprovalModalPage.java
    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/ReportModalPage.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/Todo.java
    syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.html
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.properties
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage_it.properties
    syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/Todo.html
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserDAOImpl.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/ActivitiUserWorkflowAdapter.java
    syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/activiti/Update.java
    syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java

Modified: syncope/branches/1_0_X/client/src/main/java/org/apache/syncope/client/to/WorkflowFormTO.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/client/src/main/java/org/apache/syncope/client/to/WorkflowFormTO.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/client/src/main/java/org/apache/syncope/client/to/WorkflowFormTO.java (original)
+++ syncope/branches/1_0_X/client/src/main/java/org/apache/syncope/client/to/WorkflowFormTO.java Fri Feb  8 15:44:42 2013
@@ -25,13 +25,15 @@ import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
-import org.codehaus.jackson.annotate.JsonIgnore;
 import org.apache.syncope.client.AbstractBaseBean;
+import org.codehaus.jackson.annotate.JsonIgnore;
 
 public class WorkflowFormTO extends AbstractBaseBean {
 
     private static final long serialVersionUID = -7044543391316529128L;
 
+    private long userId;
+
     private String taskId;
 
     private String key;
@@ -50,6 +52,14 @@ public class WorkflowFormTO extends Abst
         properties = new ArrayList<WorkflowFormPropertyTO>();
     }
 
+    public long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(long userId) {
+        this.userId = userId;
+    }
+
     public String getTaskId() {
         return taskId;
     }

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ApprovalModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ApprovalModalPage.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ApprovalModalPage.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ApprovalModalPage.java Fri Feb  8 15:44:42 2013
@@ -27,6 +27,18 @@ import java.util.Date;
 import java.util.List;
 import java.util.Map;
 import org.apache.commons.lang.StringUtils;
+import org.apache.syncope.client.to.WorkflowFormPropertyTO;
+import org.apache.syncope.client.to.WorkflowFormTO;
+import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
+import org.apache.syncope.console.commons.MapChoiceRenderer;
+import org.apache.syncope.console.rest.ApprovalRestClient;
+import org.apache.syncope.console.rest.UserRestClient;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxNumberFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.DateTimeFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
+import org.apache.wicket.Page;
 import org.apache.wicket.PageReference;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.ajax.markup.html.form.AjaxButton;
@@ -41,24 +53,23 @@ import org.apache.wicket.model.IModel;
 import org.apache.wicket.model.LoadableDetachableModel;
 import org.apache.wicket.model.Model;
 import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.syncope.client.to.WorkflowFormPropertyTO;
-import org.apache.syncope.client.to.WorkflowFormTO;
-import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
-import org.apache.syncope.console.commons.MapChoiceRenderer;
-import org.apache.syncope.console.rest.ApprovalRestClient;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxNumberFieldPanel;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.console.wicket.markup.html.form.DateTimeFieldPanel;
-import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
 
 public class ApprovalModalPage extends BaseModalPage {
 
     private static final long serialVersionUID = -8847854414429745216L;
 
+    private final static int USER_WIN_HEIGHT = 550;
+
+    private final static int USER_WIN_WIDTH = 800;
+
     @SpringBean
     private ApprovalRestClient restClient;
 
+    @SpringBean
+    private UserRestClient userRestClient;
+
+    private final ModalWindow editUserWin;
+
     public ApprovalModalPage(final PageReference callerPageRef, final ModalWindow window, final WorkflowFormTO formTO) {
         super();
 
@@ -146,6 +157,35 @@ public class ApprovalModalPage extends B
             }
         };
 
+        final AjaxButton userDetails = new IndicatingAjaxButton("userDetails", new Model(getString("userDetails"))) {
+
+            private static final long serialVersionUID = -4804368561204623354L;
+
+            @Override
+            protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+                editUserWin.setPageCreator(new ModalWindow.PageCreator() {
+
+                    private static final long serialVersionUID = -7834632442532690940L;
+
+                    @Override
+                    public Page createPage() {
+                        return new ViewUserModalPage(ApprovalModalPage.this.getPageReference(), editUserWin,
+                                userRestClient.read(formTO.getUserId())) {
+
+                            @Override
+                            protected void closeAction(final AjaxRequestTarget target, final Form form) {
+                                setResponsePage(ApprovalModalPage.this);
+                            }
+                        };
+                    }
+                });
+
+                editUserWin.show(target);
+            }
+        };
+        MetaDataRoleAuthorizationStrategy.authorize(userDetails, ENABLE,
+                xmlRolesReader.getAllAllowedRoles("Users", "read"));
+
         final AjaxButton submit = new IndicatingAjaxButton("apply", new Model(getString("submit"))) {
 
             private static final long serialVersionUID = -958724007591692537L;
@@ -201,11 +241,19 @@ public class ApprovalModalPage extends B
 
         Form form = new Form("form");
         form.add(propView);
+        form.add(userDetails);
         form.add(submit);
 
         MetaDataRoleAuthorizationStrategy.authorize(form, ENABLE, xmlRolesReader.getAllAllowedRoles("Approval",
                 "submit"));
 
+        editUserWin = new ModalWindow("editUserWin");
+        editUserWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+        editUserWin.setInitialHeight(USER_WIN_HEIGHT);
+        editUserWin.setInitialWidth(USER_WIN_WIDTH);
+        editUserWin.setCookieName("edit-user-modal");
+        add(editUserWin);
+
         add(form);
     }
 }

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=1444083&r1=1444082&r2=1444083&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  8 15:44:42 2013
@@ -38,9 +38,13 @@ import org.apache.wicket.spring.injectio
  */
 public class EditUserModalPage extends UserModalPage {
 
+    private static final long serialVersionUID = -6479209496805705739L;
+
     @SpringBean
     private UserRestClient userRestClient;
 
+    protected Form form;
+
     private UserTO initialUserTO = null;
 
     public EditUserModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO) {
@@ -48,7 +52,7 @@ public class EditUserModalPage extends U
 
         this.initialUserTO = AttributableOperations.clone(userTO);
 
-        Form form = setupEditPanel();
+        form = setupEditPanel();
 
         // add resource assignment details in case of update
         if (userTO.getId() != 0) {
@@ -66,7 +70,6 @@ public class EditUserModalPage extends U
 
     @Override
     protected void submitAction(final AjaxRequestTarget target, final Form form) {
-
         final UserTO updatedUserTO = (UserTO) form.getModelObject();
 
         if (updatedUserTO.getId() == 0) {

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ReportModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ReportModalPage.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ReportModalPage.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ReportModalPage.java Fri Feb  8 15:44:42 2013
@@ -26,6 +26,17 @@ import org.apache.syncope.client.report.
 import org.apache.syncope.client.to.ReportExecTO;
 import org.apache.syncope.client.to.ReportTO;
 import org.apache.syncope.client.validation.SyncopeClientCompositeErrorException;
+import org.apache.syncope.console.commons.DateFormatROModel;
+import org.apache.syncope.console.commons.HttpResourceStream;
+import org.apache.syncope.console.commons.SortableDataProviderComparator;
+import org.apache.syncope.console.markup.html.CrontabContainer;
+import org.apache.syncope.console.rest.ReportRestClient;
+import org.apache.syncope.console.wicket.ajax.form.AbstractAjaxDownloadBehavior;
+import org.apache.syncope.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
+import org.apache.syncope.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.SingleColumnPalette;
 import org.apache.syncope.types.ReportExecStatus;
 import org.apache.wicket.Page;
 import org.apache.wicket.PageReference;
@@ -57,18 +68,6 @@ import org.apache.wicket.model.ResourceM
 import org.apache.wicket.spring.injection.annot.SpringBean;
 import org.apache.wicket.util.resource.IResourceStream;
 import org.springframework.util.StringUtils;
-import org.apache.syncope.console.commons.DateFormatROModel;
-import org.apache.syncope.console.commons.HttpResourceStream;
-import org.apache.syncope.console.commons.SortableDataProviderComparator;
-import org.apache.syncope.console.markup.html.CrontabContainer;
-import org.apache.syncope.console.rest.ReportRestClient;
-import org.apache.syncope.console.wicket.ajax.form.AbstractAjaxDownloadBehavior;
-import org.apache.syncope.console.wicket.extensions.markup.html.repeater.data.table.DatePropertyColumn;
-import org.apache.syncope.console.wicket.markup.html.form.ActionLink;
-import org.apache.syncope.console.wicket.markup.html.form.ActionLinksPanel;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.console.wicket.markup.html.form.SingleColumnPalette;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
 
 public class ReportModalPage extends BaseModalPage {
 

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/Todo.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/Todo.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/Todo.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/Todo.java Fri Feb  8 15:44:42 2013
@@ -173,8 +173,8 @@ public class Todo extends BasePage {
 
                         editApprovalWin.show(target);
                     }
-                }, ActionLink.ActionType.EDIT, "Approval", "read", SyncopeSession.get().getUserId().equals(
-                        formTO.getOwner()));
+                }, ActionLink.ActionType.EDIT, "Approval", "read",
+                        SyncopeSession.get().getUserId().equals(formTO.getOwner()));
 
                 cellItem.add(panel);
             }

Modified: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java (original)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java Fri Feb  8 15:44:42 2013
@@ -83,7 +83,6 @@ public abstract class UserModalPage exte
     }
 
     public UserModalPage(final ModalWindow window, final UserTO userTO, final Mode mode) {
-
         super();
 
         this.callerPageRef = null;
@@ -112,7 +111,6 @@ public abstract class UserModalPage exte
     }
 
     protected Form setupEditPanel() {
-
         fragment.add(new Label("id", userTO.getId() == 0
                 ? ""
                 : userTO.getUsername()));

Added: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java?rev=1444083&view=auto
==============================================================================
--- syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java (added)
+++ syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java Fri Feb  8 15:44:42 2013
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+package org.apache.syncope.console.pages;
+
+import org.apache.syncope.client.to.UserTO;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.form.Form;
+
+public class ViewUserModalPage extends EditUserModalPage {
+
+    private static final long serialVersionUID = -8715255026876951611L;
+
+    public ViewUserModalPage(final PageReference callerPageRef, final ModalWindow window, final UserTO userTO) {
+        super(callerPageRef, window, userTO);
+        form.setEnabled(false);
+    }
+
+    @Override
+    protected AjaxButton getOnSubmit() {
+        AjaxButton submit = super.getOnSubmit();
+        submit.setVisible(false);
+        return submit;
+    }
+
+    @Override
+    protected void submitAction(final AjaxRequestTarget target, final Form form) {
+        // No submit allowed, read-only form
+    }
+}

Propchange: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: syncope/branches/1_0_X/console/src/main/java/org/apache/syncope/console/pages/ViewUserModalPage.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.html?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.html (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.html Fri Feb  8 15:44:42 2013
@@ -1,54 +1,55 @@
 <!--
- 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:extend>
-    <p class="ui-widget ui-corner-all ui-widget-header"><wicket:message key="title"/></p>
+  <p class="ui-widget ui-corner-all ui-widget-header"><wicket:message key="title"/></p>
+
 <div style="margin:10px">
-    <form wicket:id="form">
-        <div id="tabs">
-            <ul>
-                <li class="tabs-selected">
-                    <a href="#tabs-1"><span><wicket:message key="tab1"/></span></a>
-                </li>
-            </ul>
-            <div id="tabs-1">
-                <div id="formtable">
-                    <div class="tablerow" wicket:id="propView">
-                        <div class="tablecolumn_label medium_dynamicsize">
-                            <span wicket:id="key">[key]</span>
-                        </div>
-                        <div class="tablecolumn_field medium_dynamicsize">
-                            <span wicket:id="value">[value]</span>
-
-                        </div>
-                    </div>
-
-                    <!-- inside the container in order to re-process javascript -->
-                    <script type="text/javascript">
-                        $(function() {
-                            $('#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>
-            </div>
+  <form wicket:id="form">
+    <div id="formtable">
+      <div class="tablerow" wicket:id="propView">
+        <div class="tablecolumn_label medium_dynamicsize">
+          <span wicket:id="key">[key]</span>
+        </div>
+        <div class="tablecolumn_field medium_dynamicsize">
+          <span wicket:id="value">[value]</span>
+
         </div>
-    </form>
+      </div>
+
+      <!-- inside the container in order to re-process javascript -->
+      <script type="text/javascript">
+        $(function() {
+          $('#formtable div.tablerow:even').addClass("alt");
+        });
+      </script>
+    </div>
+
+    <div style="margin: 20px 0">
+      <input type="button"
+             class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"
+             wicket:id="userDetails"/>
+      <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:id="editUserWin">[Show modal window for editing user under approval]</div>
 </div>
-</wicket:extend>
\ No newline at end of file
+</wicket:extend>

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.properties?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.properties (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage.properties Fri Feb  8 15:44:42 2013
@@ -14,5 +14,5 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-tab1=Approval form
-title=Workflow
+title=Approval form
+userDetails=User details

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage_it.properties
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage_it.properties?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage_it.properties (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/ApprovalModalPage_it.properties Fri Feb  8 15:44:42 2013
@@ -14,5 +14,5 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-tab1=Form di approvazione
-title=Workflow
+title=Form di approvazione
+userDetails=Dettagli utente

Modified: syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/Todo.html
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/Todo.html?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/Todo.html (original)
+++ syncope/branches/1_0_X/console/src/main/resources/org/apache/syncope/console/pages/Todo.html Fri Feb  8 15:44:42 2013
@@ -1,61 +1,63 @@
 <!--
- 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:extend>
+  <div id="tabs">
+    <ul>
+      <li class="tabs-selected"><a href="#tabs-1"><span><wicket:message key="approvals"/></span></a></li>
+      <li><a href="#tabs-2"><span><wicket:message key="userRequests"/></span></a></li>
+    </ul>
+    <div id="tabs-1">
+
+      <div id="users-contain" class="ui-widget" style="width:inherit;">
+        <span wicket:id="approvalContainer">
+          <table class="ui-widget ui-widget-content table-hover"
+                 wicket:id="approvalTable"/>
+        </span>
+        <span style="float:right">
+          <form wicket:id="approvalPaginatorForm" style="display:inline">
+            <label><wicket:message key="displayRows"/></label>
+            <select class="text ui-widget-content ui-corner-all"
+                    wicket:id="rowsChooser"/>
+          </form>
+        </span>
+      </div>
 
+      <div wicket:id="editApprovalWin">[Show modal window for editing approval]</div>
+    </div>
+
+    <div id="tabs-2">
 
-    <div id="tabs">
-        <ul>
-            <li class="tabs-selected"><a href="#tabs-1"><span><wicket:message key="approvals"/></span></a></li>
-            <li><a href="#tabs-2"><span><wicket:message key="userRequests"/></span></a></li>
-        </ul>
-        <div id="tabs-1">
-
-            <div id="users-contain" class="ui-widget" style="width:inherit;">
-                <span wicket:id="approvalContainer">
-                    <table class="ui-widget ui-widget-content table-hover"
-                           wicket:id="approvalTable"/>
-                </span>
-                <span style="float:right">
-                    <form wicket:id="approvalPaginatorForm" style="display:inline">
-                        <label><wicket:message key="displayRows"/></label>
-                        <select class="text ui-widget-content ui-corner-all"
-                                wicket:id="rowsChooser"/>
-                    </form>
-                </span>
-            </div>
-
-            <div wicket:id="editApprovalWin">[Show modal window for editing approval]</div>
-        </div>
-
-        <div id="tabs-2">
-
-            <div id="users-contain" class="ui-widget">
-                <span wicket:id="userRequestContainer">
-                    <table class="ui-widget ui-widget-content table-hover"
-                           wicket:id="userRequestTable"/>
-                </span>
-                <span style="float:right">
-                    <form wicket:id="userRequestPaginatorForm" style="display:inline">
-                        <label><wicket:message key="displayRows"/></label>
-                        <select class="text ui-widget-content ui-corner-all"
-                                wicket:id="rowsChooser"/>
-                    </form>
-                </span>
-            </div>
+      <div id="users-contain" class="ui-widget">
+        <span wicket:id="userRequestContainer">
+          <table class="ui-widget ui-widget-content table-hover"
+                 wicket:id="userRequestTable"/>
+        </span>
+        <span style="float:right">
+          <form wicket:id="userRequestPaginatorForm" style="display:inline">
+            <label><wicket:message key="displayRows"/></label>
+            <select class="text ui-widget-content ui-corner-all"
+                    wicket:id="rowsChooser"/>
+          </form>
+        </span>
+      </div>
 
-            <div wicket:id="editUserRequestWin">[Show modal window for editing user request]</div>
-        </div>
+      <div wicket:id="editUserRequestWin">[Show modal window for editing user request]</div>
     </div>
-</wicket:extend>
\ No newline at end of file
+  </div>
+</wicket:extend>

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserDAOImpl.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserDAOImpl.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserDAOImpl.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/persistence/dao/impl/UserDAOImpl.java Fri Feb  8 15:44:42 2013
@@ -104,7 +104,13 @@ public class UserDAOImpl extends Abstrac
                 + " e " + "WHERE e.workflowId = :workflowId", SyncopeUser.class);
         query.setParameter("workflowId", workflowId);
 
-        return query.getSingleResult();
+        SyncopeUser result = null;
+        try {
+            return query.getSingleResult();
+        } catch (NoResultException e) {
+        }
+
+        return result;
     }
 
     /**

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/ActivitiUserWorkflowAdapter.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/ActivitiUserWorkflowAdapter.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/ActivitiUserWorkflowAdapter.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/ActivitiUserWorkflowAdapter.java Fri Feb  8 15:44:42 2013
@@ -26,9 +26,9 @@ import java.io.InputStreamReader;
 import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
+import java.util.AbstractMap.SimpleEntry;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.AbstractMap.SimpleEntry;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -232,8 +232,7 @@ public class ActivitiUserWorkflowAdapter
             propagateEnable = enabled;
         }
 
-        // save resources to be propagated and password for later -
-        // after form submission - propagation
+        // save resources to be propagated and password for later - after form submission - propagation
         PropagationByResource propByRes = new PropagationByResource();
         propByRes.set(PropagationOperation.CREATE, user.getResourceNames());
 
@@ -502,16 +501,23 @@ public class ActivitiUserWorkflowAdapter
         return result;
     }
 
-    private WorkflowFormTO getFormTO(final Task task, final TaskFormData formData) {
+    @SuppressWarnings("unchecked")
+    private WorkflowFormTO getFormTO(final Task task, final TaskFormData formData) throws NotFoundException {
         WorkflowFormTO formTO = new WorkflowFormTO();
+
+        SyncopeUser user = userDAO.findByWorkflowId(task.getProcessInstanceId());
+        if (user == null) {
+            throw new NotFoundException("User with workflow id " + task.getProcessInstanceId());
+        }
+        formTO.setUserId(user.getId());
+
         formTO.setTaskId(task.getId());
         formTO.setKey(formData.getFormKey());
 
         BeanUtils.copyProperties(task, formTO);
 
-        WorkflowFormPropertyTO propertyTO;
         for (FormProperty fProp : formData.getFormProperties()) {
-            propertyTO = new WorkflowFormPropertyTO();
+            WorkflowFormPropertyTO propertyTO = new WorkflowFormPropertyTO();
             BeanUtils.copyProperties(fProp, propertyTO, PROPERTY_IGNORE_PROPS);
             propertyTO.setType(fromActivitiFormType(fProp.getType()));
 
@@ -532,17 +538,16 @@ public class ActivitiUserWorkflowAdapter
     public List<WorkflowFormTO> getForms() {
         List<WorkflowFormTO> forms = new ArrayList<WorkflowFormTO>();
 
-        TaskFormData formData;
         for (Task task : taskService.createTaskQuery().taskVariableValueEquals(TASK_IS_FORM, Boolean.TRUE).list()) {
             try {
-                formData = formService.getTaskFormData(task.getId());
+                TaskFormData formData = formService.getTaskFormData(task.getId());
+                if (formData != null && !formData.getFormProperties().isEmpty()) {
+                    forms.add(getFormTO(task, formData));
+                }
             } catch (ActivitiException e) {
                 LOG.debug("No form found for task {}", task.getId(), e);
-                formData = null;
-            }
-
-            if (formData != null && !formData.getFormProperties().isEmpty()) {
-                forms.add(getFormTO(task, formData));
+            } catch (NotFoundException e) {
+                LOG.error("While fetching forms", e);
             }
         }
 
@@ -560,12 +565,11 @@ public class ActivitiUserWorkflowAdapter
             throw new WorkflowException(e);
         }
 
-        TaskFormData formData;
+        TaskFormData formData = null;
         try {
             formData = formService.getTaskFormData(task.getId());
         } catch (ActivitiException e) {
             LOG.debug("No form found for task {}", task.getId(), e);
-            formData = null;
         }
 
         WorkflowFormTO result = null;

Modified: syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/activiti/Update.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/activiti/Update.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/activiti/Update.java (original)
+++ syncope/branches/1_0_X/core/src/main/java/org/apache/syncope/core/workflow/activiti/Update.java Fri Feb  8 15:44:42 2013
@@ -28,7 +28,6 @@ public class Update extends AbstractActi
 
     @Override
     protected void doExecute(final DelegateExecution execution) throws Exception {
-
         SyncopeUser user = (SyncopeUser) execution.getVariable(ActivitiUserWorkflowAdapter.SYNCOPE_USER);
         UserMod userMod = (UserMod) execution.getVariable(ActivitiUserWorkflowAdapter.USER_MOD);
 

Modified: syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java
URL: http://svn.apache.org/viewvc/syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java?rev=1444083&r1=1444082&r2=1444083&view=diff
==============================================================================
--- syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java (original)
+++ syncope/branches/1_0_X/core/src/test/java/org/apache/syncope/core/rest/UserTestITCase.java Fri Feb  8 15:44:42 2013
@@ -674,11 +674,12 @@ public class UserTestITCase extends Abst
         WorkflowFormTO form = restTemplate.getForObject(BASE_URL + "user/workflow/form/{userId}", WorkflowFormTO.class,
                 userTO.getId());
         assertNotNull(form);
+        assertNotNull(form.getUserId());
+        assertEquals(userTO.getId(), form.getUserId());
         assertNotNull(form.getTaskId());
         assertNull(form.getOwner());
 
-        // 3. claim task from user1, not in role 7 (designated for 
-        // approval in workflow definition): fail
+        // 3. claim task from user1, not in role 7 (designated for approval in workflow definition): fail
         PreemptiveAuthHttpRequestFactory requestFactory = ((PreemptiveAuthHttpRequestFactory) restTemplate.
                 getRequestFactory());
         ((DefaultHttpClient) requestFactory.getHttpClient()).getCredentialsProvider().setCredentials(