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 2012/10/29 13:49:35 UTC
svn commit: r1403272 [1/2] - in /incubator/syncope/trunk:
client/src/main/java/org/apache/syncope/client/mod/
client/src/main/java/org/apache/syncope/client/util/
console/src/main/java/org/apache/syncope/console/pages/
console/src/main/java/org/apache/...
Author: ilgrosso
Date: Mon Oct 29 12:49:32 2012
New Revision: 1403272
URL: http://svn.apache.org/viewvc?rev=1403272&view=rev
Log:
[SYNCOPE-225] Updated admin console for managing role owner
Added:
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java (with props)
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleOwnerSelectModalPage.java
- copied, changed from r1402498, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserOwnerSelectModalPage.java
- copied, changed from r1402498, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/MembershipsPanel.java
- copied, changed from r1402498, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolesPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java (with props)
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java
- copied, changed from r1402405, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/RoleOwnerSelectModalPage.html (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/UserOwnerSelectModalPage.html (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/UserOwnerSelectModalPage.properties (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/UserOwnerSelectModalPage_it.properties (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/MembershipsPanel.html
- copied unchanged from r1402498, incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolesPanel.html
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/MembershipsPanel.properties (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/MembershipsPanel_it.properties
- copied unchanged from r1402498, incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolesPanel_it.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleDetailsPanel.html (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleDetailsPanel.properties (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleDetailsPanel_it.properties (with props)
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolePanel.html
- copied, changed from r1402405, incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleAttributesPanel.html
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolePanel.properties
- copied unchanged from r1402405, incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleAttributesPanel.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolePanel_it.properties
- copied, changed from r1402405, incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleAttributesPanel_it.properties
incubator/syncope/trunk/console/src/main/webapp/img/actions/select.png (with props)
Removed:
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolesPanel.java
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleAttributesPanel.html
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleAttributesPanel.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleAttributesPanel_it.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolesPanel.html
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolesPanel.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RolesPanel_it.properties
Modified:
incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/ReferenceMod.java
incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/RoleMod.java
incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/util/AttributableOperations.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BaseModalPage.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/RoleRestClient.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/UserRestClient.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/ActionLink.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/ActionLinksPanel.java
incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/RoleModalPage.html
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/RoleModalPage.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/RoleModalPage_it.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/UserModalPage.html
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleTabPanel.html
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleTabPanel.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/panels/RoleTabPanel_it.properties
incubator/syncope/trunk/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/ActionLinksPanel.html
incubator/syncope/trunk/console/src/test/java/org/apache/syncope/console/RoleTestITCase.java
incubator/syncope/trunk/core/src/main/java/org/apache/syncope/core/rest/data/RoleDataBinder.java
Modified: incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/ReferenceMod.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/ReferenceMod.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/ReferenceMod.java (original)
+++ incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/ReferenceMod.java Mon Oct 29 12:49:32 2012
@@ -21,9 +21,8 @@ package org.apache.syncope.client.mod;
import org.apache.syncope.client.AbstractBaseBean;
/**
- * This class is used to specify the willing to modify an external reference id.
- * Use 'null' ReferenceMod to keep the current reference id; use a ReferenceMod
- * with a null id to try to reset the reference id; use a ReferenceMod with a
+ * This class is used to specify the willing to modify an external reference id. Use 'null' ReferenceMod to keep the
+ * current reference id; use a ReferenceMod with a null id to try to reset the reference id; use a ReferenceMod with a
* not null id to specify a new reference id.
*/
public class ReferenceMod extends AbstractBaseBean {
@@ -33,6 +32,11 @@ public class ReferenceMod extends Abstra
private Long id;
public ReferenceMod() {
+ this.id = null;
+ }
+
+ public ReferenceMod(final Long id) {
+ this.id = id;
}
public Long getId() {
Modified: incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/RoleMod.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/RoleMod.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/RoleMod.java (original)
+++ incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/mod/RoleMod.java Mon Oct 29 12:49:32 2012
@@ -148,8 +148,9 @@ public class RoleMod extends AbstractAtt
@JsonIgnore
@Override
public boolean isEmpty() {
- return super.isEmpty() && name == null && inheritAccountPolicy == null && inheritPasswordPolicy == null
+ return super.isEmpty() && name == null && userOwner == null && roleOwner == null
+ && inheritOwner == null && inheritAccountPolicy == null && inheritPasswordPolicy == null
&& inheritAttributes == null && inheritDerivedAttributes == null && inheritVirtualAttributes == null
- && accountPolicy == null && passwordPolicy == null && entitlements.isEmpty();
+ && accountPolicy == null && passwordPolicy == null && (entitlements == null || entitlements.isEmpty());
}
}
Modified: incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/util/AttributableOperations.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/util/AttributableOperations.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/util/AttributableOperations.java (original)
+++ incubator/syncope/trunk/client/src/main/java/org/apache/syncope/client/util/AttributableOperations.java Mon Oct 29 12:49:32 2012
@@ -283,6 +283,7 @@ public final class AttributableOperation
diff(updated, original, result, false);
// 1. inheritance
+ result.setInheritOwner(updated.isInheritOwner());
result.setInheritAccountPolicy(updated.isInheritAccountPolicy());
result.setInheritPasswordPolicy(updated.isInheritPasswordPolicy());
result.setInheritAttributes(updated.isInheritAttributes());
@@ -290,13 +291,8 @@ public final class AttributableOperation
result.setInheritVirtualAttributes(updated.isInheritVirtualAttributes());
// 2. policies
- ReferenceMod refAccountPolicy = new ReferenceMod();
- refAccountPolicy.setId(updated.getAccountPolicy());
- result.setAccountPolicy(refAccountPolicy);
-
- ReferenceMod refPasswordPolicy = new ReferenceMod();
- refPasswordPolicy.setId(updated.getPasswordPolicy());
- result.setPasswordPolicy(refPasswordPolicy);
+ result.setAccountPolicy(new ReferenceMod(updated.getAccountPolicy()));
+ result.setPasswordPolicy(new ReferenceMod(updated.getPasswordPolicy()));
// 3. name
if (!original.getName().equals(updated.getName())) {
@@ -312,6 +308,10 @@ public final class AttributableOperation
result.setEntitlements(updated.getEntitlements());
}
+ // 5. owner
+ result.setUserOwner(new ReferenceMod(updated.getUserOwner()));
+ result.setRoleOwner(new ReferenceMod(updated.getRoleOwner()));
+
return result;
}
Added: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java?rev=1403272&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java Mon Oct 29 12:49:32 2012
@@ -0,0 +1,75 @@
+/*
+ * 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.console.commons.XMLRolesReader;
+import org.apache.wicket.markup.html.WebPage;
+import org.apache.wicket.markup.html.panel.FeedbackPanel;
+import org.apache.wicket.request.mapper.parameter.PageParameters;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AbstractBasePage extends WebPage {
+
+ private static final long serialVersionUID = 8611724965544132636L;
+
+ /**
+ * Logger.
+ */
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractBasePage.class);
+
+ @SpringBean
+ protected XMLRolesReader xmlRolesReader;
+
+ protected FeedbackPanel feedbackPanel;
+
+ /**
+ * Response flag set by the Modal Window after the operation is completed.
+ */
+ protected boolean modalResult = false;
+
+ public AbstractBasePage() {
+ super();
+ setupFeedbackPanel();
+ }
+
+ public AbstractBasePage(final PageParameters parameters) {
+ super(parameters);
+ setupFeedbackPanel();
+ }
+
+ protected final void setupFeedbackPanel() {
+ feedbackPanel = new FeedbackPanel("feedback");
+ feedbackPanel.setOutputMarkupId(true);
+ add(feedbackPanel);
+ }
+
+ public FeedbackPanel getFeedbackPanel() {
+ return feedbackPanel;
+ }
+
+ public boolean isModalResult() {
+ return modalResult;
+ }
+
+ public void setModalResult(final boolean operationResult) {
+ this.modalResult = operationResult;
+ }
+}
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/AbstractBasePage.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BaseModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BaseModalPage.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BaseModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BaseModalPage.java Mon Oct 29 12:49:32 2012
@@ -19,39 +19,17 @@
package org.apache.syncope.console.pages;
import org.apache.syncope.console.commons.CloseOnESCBehavior;
-import org.apache.wicket.markup.html.WebPage;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
-import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.apache.syncope.console.commons.XMLRolesReader;
/**
* Syncope Modal Window.
*/
-public abstract class BaseModalPage extends WebPage {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(BasePage.class);
+public abstract class BaseModalPage extends AbstractBasePage {
private static final long serialVersionUID = -1443079028368471943L;
- @SpringBean
- protected XMLRolesReader xmlRolesReader;
-
- protected FeedbackPanel feedbackPanel;
-
protected CloseOnESCBehavior closeOnEscBehavior;
public BaseModalPage() {
- feedbackPanel = new FeedbackPanel("feedback");
- feedbackPanel.setOutputMarkupId(true);
- add(feedbackPanel);
- }
-
- public FeedbackPanel getFeedbackPanel() {
- return feedbackPanel;
+ super();
}
}
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/BasePage.java Mon Oct 29 12:49:32 2012
@@ -21,7 +21,6 @@ package org.apache.syncope.console.pages
import org.apache.syncope.client.to.UserTO;
import org.apache.syncope.console.SyncopeApplication;
import org.apache.syncope.console.SyncopeSession;
-import org.apache.syncope.console.commons.XMLRolesReader;
import org.apache.syncope.console.rest.UserRequestRestClient;
import org.apache.syncope.console.wicket.markup.html.form.LinkPanel;
import org.apache.wicket.Component;
@@ -34,27 +33,18 @@ import org.apache.wicket.extensions.ajax
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.ComponentTag;
import org.apache.wicket.markup.html.WebMarkupContainer;
-import org.apache.wicket.markup.html.WebPage;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.link.BookmarkablePageLink;
-import org.apache.wicket.markup.html.panel.FeedbackPanel;
import org.apache.wicket.markup.html.panel.Fragment;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.request.mapper.parameter.PageParameters;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Syncope Wicket base-page.
*/
-public class BasePage extends WebPage implements IAjaxIndicatorAware {
-
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(BasePage.class);
+public class BasePage extends AbstractBasePage implements IAjaxIndicatorAware {
private static final long serialVersionUID = 1571997737305598502L;
@@ -65,30 +55,15 @@ public class BasePage extends WebPage im
@SpringBean
private UserRequestRestClient profileRestClient;
- @SpringBean
- protected XMLRolesReader xmlRolesReader;
-
@SpringBean(name = "version")
private String version;
- protected FeedbackPanel feedbackPanel;
-
- /**
- * Response flag set by the Modal Window after the operation is completed.
- */
- protected boolean modalResult = false;
-
public BasePage() {
super();
pageSetup();
}
- /**
- * Constructor that is invoked when page is invoked without a session.
- *
- * @param PageParameters parameters
- */
public BasePage(final PageParameters parameters) {
super(parameters);
@@ -98,10 +73,6 @@ public class BasePage extends WebPage im
private void pageSetup() {
((SyncopeApplication) getApplication()).setupNavigationPanel(this, xmlRolesReader, true, version);
- feedbackPanel = new FeedbackPanel("feedback");
- feedbackPanel.setOutputMarkupId(true);
- add(feedbackPanel);
-
final String kind = getClass().getSimpleName().toLowerCase();
final BookmarkablePageLink kindLink = (BookmarkablePageLink) get(kind);
if (kindLink != null) {
@@ -183,18 +154,6 @@ public class BasePage extends WebPage im
return "veil";
}
- public FeedbackPanel getFeedbackPanel() {
- return feedbackPanel;
- }
-
- public boolean isModalResult() {
- return modalResult;
- }
-
- public void setModalResult(final boolean operationResult) {
- this.modalResult = operationResult;
- }
-
/**
* Set a WindowClosedCallback for a ModalWindow instance.
*
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java Mon Oct 29 12:49:32 2012
@@ -18,24 +18,21 @@
*/
package org.apache.syncope.console.pages;
-import org.apache.wicket.PageReference;
+import org.apache.syncope.client.to.MembershipTO;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.console.commons.CloseOnESCBehavior;
import org.apache.syncope.console.pages.panels.AttributesPanel;
+import org.apache.syncope.console.pages.panels.DerivedAttributesPanel;
+import org.apache.syncope.console.pages.panels.VirtualAttributesPanel;
+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.IndicatingAjaxButton;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.ResourceModel;
-import org.apache.syncope.client.to.MembershipTO;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.console.commons.CloseOnESCBehavior;
-import org.apache.syncope.console.pages.panels.DerivedAttributesPanel;
-import org.apache.syncope.console.pages.panels.VirtualAttributesPanel;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-/**
- * MembershipModalPage.
- */
public class MembershipModalPage extends BaseModalPage {
private static final long serialVersionUID = -4360802478081432549L;
@@ -52,6 +49,7 @@ public class MembershipModalPage extends
form.setModel(new CompoundPropertyModel(membershipTO));
submit = new AjaxButton("submit", new ResourceModel("submit")) {
+
private static final long serialVersionUID = -958724007591692537L;
@Override
@@ -67,14 +65,14 @@ public class MembershipModalPage extends
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
-
target.add(feedbackPanel);
}
};
form.add(submit);
-
+
final IndicatingAjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {
+
private static final long serialVersionUID = -958724007591692537L;
@Override
@@ -86,7 +84,7 @@ public class MembershipModalPage extends
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
}
};
-
+
cancel.setDefaultFormProcessing(false);
form.add(cancel);
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleModalPage.java Mon Oct 29 12:49:32 2012
@@ -24,7 +24,7 @@ import org.apache.syncope.client.mod.Rol
import org.apache.syncope.client.to.RoleTO;
import org.apache.syncope.client.util.AttributableOperations;
import org.apache.syncope.console.commons.CloseOnESCBehavior;
-import org.apache.syncope.console.pages.panels.RoleAttributesPanel;
+import org.apache.syncope.console.pages.panels.RolePanel;
import org.apache.syncope.console.rest.RoleRestClient;
import org.apache.wicket.PageReference;
import org.apache.wicket.ajax.AjaxRequestTarget;
@@ -67,9 +67,8 @@ public class RoleModalPage extends BaseM
form.setModel(new CompoundPropertyModel(roleTO));
- final RoleAttributesPanel attributesPanel = new RoleAttributesPanel("attributesPanel", form, roleTO);
-
- form.add(attributesPanel);
+ final RolePanel rolePanel = new RolePanel("rolePanel", form, roleTO);
+ form.add(rolePanel);
final AjaxButton submit = new IndicatingAjaxButton("submit", new ResourceModel("submit")) {
private static final long serialVersionUID = -958724007591692537L;
@@ -79,18 +78,18 @@ public class RoleModalPage extends BaseM
final RoleTO roleTO = (RoleTO) form.getDefaultModelObject();
try {
- final List<String> entitlementList = new ArrayList<String>(attributesPanel.getEntitlementsPalette()
+ final List<String> entitlementList = new ArrayList<String>(rolePanel.getEntitlementsPalette()
.getModelCollection());
roleTO.setEntitlements(entitlementList);
if (createFlag) {
- roleRestClient.createRole(roleTO);
+ roleRestClient.create(roleTO);
} else {
RoleMod roleMod = AttributableOperations.diff(roleTO, originalRoleTO);
// update role just if it is changed
if (!roleMod.isEmpty()) {
- roleRestClient.updateRole(roleMod);
+ roleRestClient.update(roleMod);
}
}
((Roles) callerPageRef.getPage()).setModalResult(true);
Copied: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleOwnerSelectModalPage.java (from r1402498, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java)
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleOwnerSelectModalPage.java?p2=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleOwnerSelectModalPage.java&p1=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java&r1=1402498&r2=1403272&rev=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/RoleOwnerSelectModalPage.java Mon Oct 29 12:49:32 2012
@@ -18,97 +18,53 @@
*/
package org.apache.syncope.console.pages;
+import javax.swing.tree.DefaultMutableTreeNode;
+import org.apache.syncope.client.to.RoleTO;
+import org.apache.syncope.console.commons.CloseOnESCBehavior;
+import org.apache.syncope.console.commons.RoleTreeBuilder;
+import org.apache.syncope.console.pages.panels.RoleDetailsPanel;
import org.apache.wicket.PageReference;
-import org.apache.syncope.console.pages.panels.AttributesPanel;
import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.event.Broadcast;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
-import org.apache.wicket.markup.html.form.Form;
-import org.apache.wicket.model.CompoundPropertyModel;
-import org.apache.wicket.model.ResourceModel;
-import org.apache.syncope.client.to.MembershipTO;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.console.commons.CloseOnESCBehavior;
-import org.apache.syncope.console.pages.panels.DerivedAttributesPanel;
-import org.apache.syncope.console.pages.panels.VirtualAttributesPanel;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-
-/**
- * MembershipModalPage.
- */
-public class MembershipModalPage extends BaseModalPage {
+import org.apache.wicket.markup.html.tree.BaseTree;
+import org.apache.wicket.markup.html.tree.LinkTree;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
- private static final long serialVersionUID = -4360802478081432549L;
+public class RoleOwnerSelectModalPage extends BaseModalPage {
- private AjaxButton submit;
+ private static final long serialVersionUID = 2106489458494696439L;
- public MembershipModalPage(final PageReference pageRef, final ModalWindow window, final MembershipTO membershipTO,
- final boolean templateMode) {
+ @SpringBean
+ private RoleTreeBuilder roleTreeBuilder;
- final Form form = new Form("MembershipForm");
+ public RoleOwnerSelectModalPage(final PageReference pageRef, final ModalWindow window) {
- final UserTO userTO = ((UserModalPage) pageRef.getPage()).getUserTO();
+ super();
- form.setModel(new CompoundPropertyModel(membershipTO));
+ BaseTree tree = new LinkTree("treeTable", roleTreeBuilder.build()) {
- submit = new AjaxButton("submit", new ResourceModel("submit")) {
- private static final long serialVersionUID = -958724007591692537L;
+ private static final long serialVersionUID = -5514696922119256101L;
@Override
- protected void onSubmit(final AjaxRequestTarget target, final Form form) {
-
- userTO.removeMembership(membershipTO);
- userTO.addMembership(membershipTO);
-
- ((UserModalPage) pageRef.getPage()).setUserTO(userTO);
-
- window.close(target);
+ protected IModel getNodeTextModel(final IModel model) {
+ return new PropertyModel(model, "userObject.displayName");
}
@Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
+ protected void onNodeLinkClicked(final Object node, final BaseTree tree, final AjaxRequestTarget target) {
+ final RoleTO roleTO = (RoleTO) ((DefaultMutableTreeNode) node).getUserObject();
- target.add(feedbackPanel);
- }
- };
-
- form.add(submit);
-
- final IndicatingAjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {
- private static final long serialVersionUID = -958724007591692537L;
-
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ send(pageRef.getPage(), Broadcast.BREADTH, new RoleDetailsPanel.RoleOwnerSelectPayload(roleTO.getId()));
window.close(target);
}
-
- @Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- }
};
-
- cancel.setDefaultFormProcessing(false);
- form.add(cancel);
-
- //--------------------------------
- // Attributes panel
- //--------------------------------
- form.add(new AttributesPanel("attributes", membershipTO, form, templateMode));
- //--------------------------------
-
- //--------------------------------
- // Derived attributes container
- //--------------------------------
- form.add(new DerivedAttributesPanel("derivedAttributes", membershipTO));
- //--------------------------------
-
- //--------------------------------
- // Virtual attributes container
- //--------------------------------
- form.add(new VirtualAttributesPanel("virtualAttributes", membershipTO, templateMode));
- //--------------------------------
+ tree.setOutputMarkupId(true);
+ tree.getTreeState().expandAll();
+ this.add(tree);
- add(form);
add(new CloseOnESCBehavior(window));
}
}
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Roles.java Mon Oct 29 12:49:32 2012
@@ -18,14 +18,14 @@
*/
package org.apache.syncope.console.pages;
+import org.apache.syncope.console.pages.panels.RoleSummaryPanel;
+import org.apache.syncope.console.pages.panels.RoleSummaryPanel.TreeNodeClickUpdate;
+import org.apache.syncope.console.wicket.markup.html.tree.TreeRolePanel;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.event.Broadcast;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.request.mapper.parameter.PageParameters;
-import org.apache.syncope.console.pages.panels.RoleSummaryPanel;
-import org.apache.syncope.console.pages.panels.RoleSummaryPanel.TreeNodeClickUpdate;
-import org.apache.syncope.console.wicket.markup.html.tree.TreeRolePanel;
/**
* Roles WebPage.
@@ -38,7 +38,7 @@ public class Roles extends BasePage {
private static final int WIN_HEIGHT = 500;
- private static final int WIN_WIDTH = 700;
+ private static final int WIN_WIDTH = 750;
private final WebMarkupContainer container;
@@ -60,11 +60,9 @@ public class Roles extends BasePage {
treePanel.setOutputMarkupId(true);
container.add(treePanel);
- final RoleSummaryPanel nodePanel = new RoleSummaryPanel("summaryPanel", createRoleWin, Roles.this
- .getPageReference());
-
+ final RoleSummaryPanel nodePanel = new RoleSummaryPanel("summaryPanel", createRoleWin,
+ Roles.this.getPageReference());
nodePanel.setOutputMarkupId(true);
-
container.add(nodePanel);
createRoleWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java Mon Oct 29 12:49:32 2012
@@ -23,7 +23,7 @@ import org.apache.syncope.console.common
import org.apache.syncope.console.pages.panels.AttributesPanel;
import org.apache.syncope.console.pages.panels.DerivedAttributesPanel;
import org.apache.syncope.console.pages.panels.ResourcesPanel;
-import org.apache.syncope.console.pages.panels.RolesPanel;
+import org.apache.syncope.console.pages.panels.MembershipsPanel;
import org.apache.syncope.console.pages.panels.UserDetailsPanel;
import org.apache.syncope.console.pages.panels.UserManagementResultPanel;
import org.apache.syncope.console.pages.panels.VirtualAttributesPanel;
@@ -163,7 +163,7 @@ public abstract class UserModalPage exte
//--------------------------------
// Roles panel
//--------------------------------
- form.add(new RolesPanel("roles", userTO, mode == Mode.TEMPLATE));
+ form.add(new MembershipsPanel("memberships", userTO, mode == Mode.TEMPLATE));
//--------------------------------
final AjaxButton submit = getOnSubmit();
Copied: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserOwnerSelectModalPage.java (from r1402498, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java)
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserOwnerSelectModalPage.java?p2=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserOwnerSelectModalPage.java&p1=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java&r1=1402498&r2=1403272&rev=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/MembershipModalPage.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserOwnerSelectModalPage.java Mon Oct 29 12:49:32 2012
@@ -18,97 +18,67 @@
*/
package org.apache.syncope.console.pages;
+import org.apache.syncope.client.search.NodeCond;
+import org.apache.syncope.console.commons.CloseOnESCBehavior;
+import org.apache.syncope.console.pages.panels.ResultSetPanel;
+import org.apache.syncope.console.pages.panels.SelectOnlyResultSetPanel;
+import org.apache.syncope.console.pages.panels.UserSearchPanel;
import org.apache.wicket.PageReference;
-import org.apache.syncope.console.pages.panels.AttributesPanel;
+import org.apache.wicket.Session;
import org.apache.wicket.ajax.AjaxRequestTarget;
-import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+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.form.Form;
-import org.apache.wicket.model.CompoundPropertyModel;
import org.apache.wicket.model.ResourceModel;
-import org.apache.syncope.client.to.MembershipTO;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.console.commons.CloseOnESCBehavior;
-import org.apache.syncope.console.pages.panels.DerivedAttributesPanel;
-import org.apache.syncope.console.pages.panels.VirtualAttributesPanel;
-import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
-/**
- * MembershipModalPage.
- */
-public class MembershipModalPage extends BaseModalPage {
+public class UserOwnerSelectModalPage extends BaseModalPage {
- private static final long serialVersionUID = -4360802478081432549L;
+ private static final long serialVersionUID = 2106489458494696439L;
- private AjaxButton submit;
+ public UserOwnerSelectModalPage(final PageReference pageRef, final ModalWindow window) {
- public MembershipModalPage(final PageReference pageRef, final ModalWindow window, final MembershipTO membershipTO,
- final boolean templateMode) {
+ super();
- final Form form = new Form("MembershipForm");
+ final SelectOnlyResultSetPanel searchResult =
+ new SelectOnlyResultSetPanel("searchResult", true, null, pageRef, window);
+ add(searchResult);
- final UserTO userTO = ((UserModalPage) pageRef.getPage()).getUserTO();
+ final Form searchForm = new Form("searchForm");
+ add(searchForm);
- form.setModel(new CompoundPropertyModel(membershipTO));
+ final UserSearchPanel searchPanel = new UserSearchPanel("searchPanel");
+ searchForm.add(searchPanel);
+
+ searchForm.add(new IndicatingAjaxButton("search", new ResourceModel("search")) {
- submit = new AjaxButton("submit", new ResourceModel("submit")) {
private static final long serialVersionUID = -958724007591692537L;
@Override
- protected void onSubmit(final AjaxRequestTarget target, final Form form) {
-
- userTO.removeMembership(membershipTO);
- userTO.addMembership(membershipTO);
-
- ((UserModalPage) pageRef.getPage()).setUserTO(userTO);
+ protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
+ final NodeCond searchCond = searchPanel.buildSearchCond();
+ doSearch(target, searchCond, searchResult);
- window.close(target);
+ Session.get().getFeedbackMessages().clear();
+ target.add(searchPanel.getSearchFeedback());
}
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
-
- target.add(feedbackPanel);
+ target.add(searchPanel.getSearchFeedback());
}
- };
+ });
- form.add(submit);
-
- final IndicatingAjaxButton cancel = new IndicatingAjaxButton("cancel", new ResourceModel("cancel")) {
- private static final long serialVersionUID = -958724007591692537L;
+ add(new CloseOnESCBehavior(window));
+ }
- @Override
- protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- window.close(target);
- }
+ private void doSearch(final AjaxRequestTarget target, final NodeCond searchCond,
+ final ResultSetPanel resultsetPanel) {
- @Override
- protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- }
- };
-
- cancel.setDefaultFormProcessing(false);
- form.add(cancel);
-
- //--------------------------------
- // Attributes panel
- //--------------------------------
- form.add(new AttributesPanel("attributes", membershipTO, form, templateMode));
- //--------------------------------
-
- //--------------------------------
- // Derived attributes container
- //--------------------------------
- form.add(new DerivedAttributesPanel("derivedAttributes", membershipTO));
- //--------------------------------
-
- //--------------------------------
- // Virtual attributes container
- //--------------------------------
- form.add(new VirtualAttributesPanel("virtualAttributes", membershipTO, templateMode));
- //--------------------------------
+ if (searchCond == null || !searchCond.checkValidity()) {
+ error(getString("search_error"));
+ return;
+ }
- add(form);
- add(new CloseOnESCBehavior(window));
+ resultsetPanel.search(searchCond, target);
}
}
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/Users.java Mon Oct 29 12:49:32 2012
@@ -117,7 +117,8 @@ public class Users extends BasePage {
});
}
- private void doSearch(final AjaxRequestTarget target, final NodeCond searchCond, final ResultSetPanel resultsetPanel) {
+ private void doSearch(final AjaxRequestTarget target, final NodeCond searchCond,
+ final ResultSetPanel resultsetPanel) {
if (searchCond == null || !searchCond.checkValidity()) {
error(getString("search_error"));
Copied: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/MembershipsPanel.java (from r1402498, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolesPanel.java)
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/MembershipsPanel.java?p2=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/MembershipsPanel.java&p1=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolesPanel.java&r1=1402498&r2=1403272&rev=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolesPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/MembershipsPanel.java Mon Oct 29 12:49:32 2012
@@ -20,6 +20,13 @@ package org.apache.syncope.console.pages
import java.util.List;
import javax.swing.tree.DefaultMutableTreeNode;
+import org.apache.syncope.client.to.MembershipTO;
+import org.apache.syncope.client.to.RoleTO;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.console.commons.RoleTreeBuilder;
+import org.apache.syncope.console.pages.MembershipModalPage;
+import org.apache.syncope.console.pages.UserModalPage;
+import org.apache.syncope.console.wicket.ajax.markup.html.IndicatingDeleteOnConfirmAjaxLink;
import org.apache.wicket.Page;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.markup.html.AjaxLink;
@@ -36,15 +43,8 @@ import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.syncope.client.to.MembershipTO;
-import org.apache.syncope.client.to.RoleTO;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.console.commons.RoleTreeBuilder;
-import org.apache.syncope.console.pages.MembershipModalPage;
-import org.apache.syncope.console.pages.UserModalPage;
-import org.apache.syncope.console.wicket.ajax.markup.html.IndicatingDeleteOnConfirmAjaxLink;
-public class RolesPanel extends Panel {
+public class MembershipsPanel extends Panel {
private static final long serialVersionUID = -2559791301973107191L;
@@ -55,8 +55,7 @@ public class RolesPanel extends Panel {
private UserTO userTO = null;
- public RolesPanel(final String id, final UserTO userTO, final boolean templateMode) {
-
+ public MembershipsPanel(final String id, final UserTO userTO, final boolean templateMode) {
super(id);
this.userTO = userTO;
@@ -93,10 +92,9 @@ public class RolesPanel extends Panel {
public Page createPage() {
for (MembershipTO memberTO : membershipsView.getList()) {
-
if (memberTO.getRoleId() == roleTO.getId()) {
- return new MembershipModalPage(getPage().getPageReference(), membershipWin, memberTO,
- templateMode);
+ return new MembershipModalPage(getPage().getPageReference(),
+ membershipWin, memberTO, templateMode);
}
}
membershipTO = new MembershipTO();
@@ -179,7 +177,7 @@ public class RolesPanel extends Panel {
public void onClose(final AjaxRequestTarget target) {
final UserTO updatedUserTO = ((UserModalPage) getPage()).getUserTO();
- RolesPanel.this.userTO.setMemberships(updatedUserTO.getMemberships());
+ MembershipsPanel.this.userTO.setMemberships(updatedUserTO.getMemberships());
target.add(container);
}
});
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResultSetPanel.java Mon Oct 29 12:49:32 2012
@@ -30,7 +30,7 @@ import org.apache.syncope.console.common
import org.apache.syncope.console.commons.PreferenceManager;
import org.apache.syncope.console.commons.UserDataProvider;
import org.apache.syncope.console.commons.XMLRolesReader;
-import org.apache.syncope.console.pages.BasePage;
+import org.apache.syncope.console.pages.AbstractBasePage;
import org.apache.syncope.console.pages.DisplayAttributesModalPage;
import org.apache.syncope.console.pages.EditUserModalPage;
import org.apache.syncope.console.pages.StatusModalPage;
@@ -132,23 +132,23 @@ public class ResultSetPanel extends Pane
/**
* Number of rows per page.
*/
- private int rows;
+ private final int rows;
/**
* Container used to refresh table.
*/
- final protected WebMarkupContainer container;
+ protected final WebMarkupContainer container;
/**
* Feedback panel specified by the caller.
*/
- final private FeedbackPanel feedbackPanel;
+ private final FeedbackPanel feedbackPanel;
/**
* Specify if results are about a filtered search or not. Using this attribute it is possible to use this panel to
* show results about user list and user search.
*/
- private boolean filtered;
+ private final boolean filtered;
/**
* Filter used in case of filtered search.
@@ -173,25 +173,26 @@ public class ResultSetPanel extends Pane
/**
* Modal window to be used for attributes choosing to display in tables.
*/
- final ModalWindow displaymodal = new ModalWindow("displayModal");
+ private final ModalWindow displaymodal = new ModalWindow("displayModal");
/**
* Modal window to be used for user status management.
*/
- final ModalWindow statusmodal = new ModalWindow("statusModal");
+ private final ModalWindow statusmodal = new ModalWindow("statusModal");
/**
* Owner page.
*/
- private final BasePage page;
+ private final AbstractBasePage page;
public <T extends AbstractAttributableTO> ResultSetPanel(final String id, final boolean filtered,
final NodeCond searchCond, final PageReference callerRef) {
+
super(id);
setOutputMarkupId(true);
- page = (BasePage) callerRef.getPage();
+ page = (AbstractBasePage) callerRef.getPage();
this.filtered = filtered;
this.filter = searchCond;
@@ -277,10 +278,11 @@ public class ResultSetPanel extends Pane
container.add(displayAttrsLink);
final AjaxLink reload = new IndicatingAjaxLink("reload") {
+
private static final long serialVersionUID = -7978723352517770644L;
@Override
- public void onClick(AjaxRequestTarget target) {
+ public void onClick(final AjaxRequestTarget target) {
if (target != null) {
target.add(resultTable);
}
@@ -288,6 +290,7 @@ public class ResultSetPanel extends Pane
};
reload.add(new Behavior() {
+
private static final long serialVersionUID = 1469628524240283489L;
@Override
@@ -302,7 +305,7 @@ public class ResultSetPanel extends Pane
}
}
});
-
+
container.add(reload);
// ---------------------------
@@ -340,7 +343,6 @@ public class ResultSetPanel extends Pane
}
public void search(final NodeCond searchCond, final AjaxRequestTarget target) {
-
this.filter = searchCond;
dataProvider.setSearchCond(filter);
target.add(container);
@@ -369,7 +371,7 @@ public class ResultSetPanel extends Pane
container.addOrReplace(resultTable);
}
- private List<IColumn<UserTO>> getColumns() {
+ protected List<IColumn<UserTO>> getColumns() {
final List<IColumn<UserTO>> columns = new ArrayList<IColumn<UserTO>>();
for (String name : prefMan.getList(getRequest(), Constants.PREF_USERS_DETAILS_VIEW)) {
Added: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java?rev=1403272&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java Mon Oct 29 12:49:32 2012
@@ -0,0 +1,271 @@
+/*
+ * 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.panels;
+
+import org.apache.syncope.client.to.RoleTO;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.console.pages.RoleOwnerSelectModalPage;
+import org.apache.syncope.console.pages.UserOwnerSelectModalPage;
+import org.apache.syncope.console.rest.RoleRestClient;
+import org.apache.syncope.console.rest.UserRestClient;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.types.AttributableType;
+import org.apache.wicket.Page;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.IEvent;
+import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.markup.html.WebMarkupContainer;
+import org.apache.wicket.markup.html.form.Form;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class RoleDetailsPanel extends Panel {
+
+ private static final long serialVersionUID = 855618618337931784L;
+
+ @SpringBean
+ private UserRestClient userRestClient;
+
+ @SpringBean
+ private RoleRestClient roleRestClient;
+
+ private final WebMarkupContainer ownerContainer;
+
+ private final OwnerModel userOwnerModel;
+
+ private final OwnerModel roleOwnerModel;
+
+ public RoleDetailsPanel(final String id, final RoleTO roleTO, final Form form) {
+ super(id);
+
+ ownerContainer = new WebMarkupContainer("ownerContainer");
+ ownerContainer.setOutputMarkupId(true);
+ this.add(ownerContainer);
+
+ final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin");
+ userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal");
+ this.add(userOwnerSelectWin);
+ final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin");
+ roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
+ roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal");
+ this.add(roleOwnerSelectWin);
+
+ final AjaxTextFieldPanel name =
+ new AjaxTextFieldPanel("name", "name", new PropertyModel<String>(roleTO, "name"));
+ name.addRequiredLabel();
+ this.add(name);
+
+ userOwnerModel = new OwnerModel(roleTO, AttributableType.USER);
+ final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
+ userOwner.setReadOnly(true);
+ userOwner.setOutputMarkupId(true);
+ ownerContainer.add(userOwner);
+ final IndicatingAjaxLink userOwnerSelect = new IndicatingAjaxLink("userOwnerSelect") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ userOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin);
+ }
+ });
+ userOwnerSelectWin.show(target);
+ }
+ };
+ ownerContainer.add(userOwnerSelect);
+ final IndicatingAjaxLink userOwnerReset = new IndicatingAjaxLink("userOwnerReset") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ userOwnerModel.setObject(null);
+ target.add(userOwner);
+ }
+ };
+ ownerContainer.add(userOwnerReset);
+
+ roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE);
+ final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel);
+ roleOwner.setReadOnly(true);
+ roleOwner.setOutputMarkupId(true);
+ ownerContainer.add(roleOwner);
+ final IndicatingAjaxLink roleOwnerSelect = new IndicatingAjaxLink("roleOwnerSelect") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ roleOwnerSelectWin.setPageCreator(new ModalWindow.PageCreator() {
+
+ private static final long serialVersionUID = -7834632442532690940L;
+
+ @Override
+ public Page createPage() {
+ return new RoleOwnerSelectModalPage(getPage().getPageReference(), roleOwnerSelectWin);
+ }
+ });
+ roleOwnerSelectWin.show(target);
+ }
+ };
+ ownerContainer.add(roleOwnerSelect);
+ final IndicatingAjaxLink roleOwnerReset = new IndicatingAjaxLink("roleOwnerReset") {
+
+ private static final long serialVersionUID = -7978723352517770644L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ roleOwnerModel.setObject(null);
+ target.add(roleOwner);
+ }
+ };
+ ownerContainer.add(roleOwnerReset);
+
+ final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner",
+ new PropertyModel<Boolean>(roleTO, "inheritOwner"));
+ this.add(inhOwner);
+ }
+
+ /**
+ * This is waiting for events from opened modal windows: first to get the selected user / role, then to update the
+ * respective text panel.
+ *
+ * {@inheritDoc }
+ */
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ super.onEvent(event);
+
+ if (event.getPayload() instanceof UserOwnerSelectPayload) {
+ userOwnerModel.setObject(((UserOwnerSelectPayload) event.getPayload()).getUserId());
+ }
+ if (event.getPayload() instanceof RoleOwnerSelectPayload) {
+ roleOwnerModel.setObject(((RoleOwnerSelectPayload) event.getPayload()).getRoleId());
+ }
+ if (event.getPayload() instanceof AjaxRequestTarget) {
+ ((AjaxRequestTarget) event.getPayload()).add(ownerContainer);
+ }
+ }
+
+ private class OwnerModel implements IModel {
+
+ private static final long serialVersionUID = -3865621970810102714L;
+
+ private final RoleTO roleTO;
+
+ private final AttributableType type;
+
+ public OwnerModel(final RoleTO roleTO, final AttributableType type) {
+ this.roleTO = roleTO;
+ this.type = type;
+ }
+
+ @Override
+ public Object getObject() {
+ String object = null;
+
+ switch (type) {
+ case USER:
+ if (roleTO.getUserOwner() != null) {
+ UserTO user = userRestClient.read(roleTO.getUserOwner());
+ if (user == null) {
+ object = String.valueOf(roleTO.getUserOwner());
+ } else {
+ object = user.getId() + " " + user.getUsername();
+ }
+ }
+ break;
+
+ case ROLE:
+ if (roleTO.getRoleOwner() != null) {
+ RoleTO role = roleRestClient.read(roleTO.getRoleOwner());
+ if (role == null) {
+ object = String.valueOf(roleTO.getRoleOwner());
+ } else {
+ object = role.getDisplayName();
+ }
+ }
+ break;
+
+ case MEMBERSHIP:
+ default:
+ }
+
+ return object;
+ }
+
+ @Override
+ public void setObject(final Object object) {
+ switch (type) {
+ case USER:
+ roleTO.setUserOwner((Long) object);
+ break;
+
+ case ROLE:
+ roleTO.setRoleOwner((Long) object);
+ break;
+
+ case MEMBERSHIP:
+ default:
+ }
+ }
+
+ @Override
+ public void detach() {
+ // ignore
+ }
+ }
+
+ public static class UserOwnerSelectPayload {
+
+ private final Long userId;
+
+ public UserOwnerSelectPayload(final Long userId) {
+ this.userId = userId;
+ }
+
+ public Long getUserId() {
+ return userId;
+ }
+ }
+
+ public static class RoleOwnerSelectPayload {
+
+ private final Long roleId;
+
+ public RoleOwnerSelectPayload(final Long roleId) {
+ this.roleId = roleId;
+ }
+
+ public Long getRoleId() {
+ return roleId;
+ }
+ }
+}
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Copied: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java (from r1402405, incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java)
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java?p2=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java&p1=incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java&r1=1402405&r2=1403272&rev=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleAttributesPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java Mon Oct 29 12:49:32 2012
@@ -18,39 +18,33 @@
*/
package org.apache.syncope.console.pages.panels;
+import org.apache.syncope.client.to.RoleTO;
+import org.apache.syncope.console.commons.SelectChoiceRenderer;
+import org.apache.syncope.console.rest.EntitlementRestClient;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.wicket.extensions.markup.html.form.palette.Palette;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.util.ListModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.apache.syncope.client.to.RoleTO;
-import org.apache.syncope.console.commons.SelectChoiceRenderer;
-import org.apache.syncope.console.rest.EntitlementRestClient;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
-public class RoleAttributesPanel extends Panel {
+public class RolePanel extends Panel {
private static final long serialVersionUID = 4216376097320768369L;
@SpringBean
private EntitlementRestClient entitlementRestClient;
- final Palette<String> entitlementsPalette;
-
- public RoleAttributesPanel(final String id, final Form form, final RoleTO roleTO) {
+ private final Palette<String> entitlementsPalette;
+ public RolePanel(final String id, final Form form, final RoleTO roleTO) {
super(id);
+ this.add(new RoleDetailsPanel("details", roleTO, form));
+
//--------------------------------
// Attributes panel
- //--------------------------------
- final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name",
- new PropertyModel<String>(roleTO, "name"));
- name.addRequiredLabel();
- this.add(name);
-
this.add(new AttributesPanel("attributes", roleTO, form, false));
final AjaxCheckBoxPanel inhAttributes = new AjaxCheckBoxPanel("inheritAttributes", "inheritAttributes",
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleSummaryPanel.java Mon Oct 29 12:49:32 2012
@@ -56,21 +56,21 @@ public class RoleSummaryPanel extends Pa
this.callerPageRef = callerPageRef;
this.window = window;
- fragment = new Fragment("rolePanel", this.selectedNode == null
+ fragment = new Fragment("rolePanel",
+ this.selectedNode == null
? "fakerootFrag"
- : (this.selectedNode.getId() != 0
- ? "roleViewPanel"
- : "rootPanel"), this);
+ : (this.selectedNode.getId() == 0 ? "rootPanel" : "roleViewPanel"),
+ this);
if (this.selectedNode != null) {
- if (this.selectedNode.getId() != 0) {
- roleTabPanel = new RoleTabPanel("nodeViewPanel", selectedNode, window, callerPageRef);
- roleTabPanel.setOutputMarkupId(true);
- fragment.add(roleTabPanel);
- } else {
+ if (this.selectedNode.getId() == 0) {
actionLink = new TreeActionLinkPanel("actionLink", this.selectedNode.getId(),
new CompoundPropertyModel(this.selectedNode), window, callerPageRef);
fragment.add(actionLink);
+ } else {
+ roleTabPanel = new RoleTabPanel("nodeViewPanel", selectedNode, window, callerPageRef);
+ roleTabPanel.setOutputMarkupId(true);
+ fragment.add(roleTabPanel);
}
}
@@ -89,14 +89,13 @@ public class RoleSummaryPanel extends Pa
final TreeNodeClickUpdate update = (TreeNodeClickUpdate) event.getPayload();
- this.selectedNode = restClient.readRole(update.getSelectedNodeId());
+ this.selectedNode = restClient.read(update.getSelectedNodeId());
fragment = new Fragment("rolePanel", (update.getSelectedNodeId() != 0
? "roleViewPanel"
: "rootPanel"), this);
if (update.getSelectedNodeId() != 0) {
-
roleTabPanel = new RoleTabPanel("nodeViewPanel", this.selectedNode, window, callerPageRef);
roleTabPanel.setOutputMarkupId(true);
fragment.addOrReplace(roleTabPanel);
@@ -124,7 +123,9 @@ public class RoleSummaryPanel extends Pa
this.selectedNodeId = selectedNodeId;
}
- /** @return ajax request target */
+ /**
+ * @return ajax request target
+ */
public AjaxRequestTarget getTarget() {
return target;
}
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleTabPanel.java Mon Oct 29 12:49:32 2012
@@ -58,11 +58,9 @@ public class RoleTabPanel extends Panel
form.setModel(new CompoundPropertyModel(roleTO));
form.setOutputMarkupId(true);
- final RoleAttributesPanel attributesPanel = new RoleAttributesPanel("attributesPanel", form, roleTO);
-
- attributesPanel.setEnabled(false);
-
- form.add(attributesPanel);
+ final RolePanel rolePanel = new RolePanel("rolePanel", form, roleTO);
+ rolePanel.setEnabled(false);
+ form.add(rolePanel);
final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");
Added: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java?rev=1403272&view=auto
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java (added)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java Mon Oct 29 12:49:32 2012
@@ -0,0 +1,99 @@
+/*
+ * 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.panels;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.apache.syncope.client.search.NodeCond;
+import org.apache.syncope.client.to.AbstractAttributableTO;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.console.pages.DisplayAttributesModalPage;
+import org.apache.syncope.console.wicket.markup.html.form.ActionLink;
+import org.apache.syncope.console.wicket.markup.html.form.ActionLinksPanel;
+import org.apache.wicket.PageReference;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
+import org.apache.wicket.extensions.markup.html.repeater.data.grid.ICellPopulator;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn;
+import org.apache.wicket.extensions.markup.html.repeater.data.table.PropertyColumn;
+import org.apache.wicket.markup.repeater.Item;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.ResourceModel;
+
+public class SelectOnlyResultSetPanel extends ResultSetPanel {
+
+ private static final long serialVersionUID = 2146781496050131930L;
+
+ private final PageReference callerRef;
+
+ private final ModalWindow window;
+
+ public <T extends AbstractAttributableTO> SelectOnlyResultSetPanel(final String id, final boolean filtered,
+ final NodeCond searchCond, final PageReference callerRef, final ModalWindow window) {
+
+ super(id, filtered, searchCond, callerRef);
+
+ this.callerRef = callerRef;
+ this.window = window;
+
+ container.get("reload").setEnabled(false);
+ container.get("reload").setVisible(false);
+
+ container.get("displayAttrsLink").setEnabled(false);
+ container.get("displayAttrsLink").setVisible(false);
+ }
+
+ @Override
+ protected List<IColumn<UserTO>> getColumns() {
+ final List<IColumn<UserTO>> columns = new ArrayList<IColumn<UserTO>>();
+ for (String name : DisplayAttributesModalPage.DEFAULT_SELECTION) {
+ columns.add(new PropertyColumn<UserTO>(new ResourceModel(name, name), name, name));
+ }
+
+ columns.add(new AbstractColumn<UserTO>(new ResourceModel("actions", "")) {
+
+ private static final long serialVersionUID = 8263694778917279290L;
+
+ @Override
+ public void populateItem(final Item<ICellPopulator<UserTO>> cellItem, final String componentId,
+ final IModel<UserTO> rowModel) {
+
+ final ActionLinksPanel panel = new ActionLinksPanel(componentId, rowModel);
+
+ panel.add(new ActionLink() {
+
+ private static final long serialVersionUID = -3722207913631435501L;
+
+ @Override
+ public void onClick(final AjaxRequestTarget target) {
+ send(callerRef.getPage(), Broadcast.BREADTH, new RoleDetailsPanel.UserOwnerSelectPayload(
+ rowModel.getObject().getId()));
+ window.close(target);
+ }
+ }, ActionLink.ActionType.SELECT, "Users", "read");
+
+ cellItem.add(panel);
+ }
+ });
+
+ return columns;
+ }
+}
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SelectOnlyResultSetPanel.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserDetailsPanel.java Mon Oct 29 12:49:32 2012
@@ -18,6 +18,10 @@
*/
package org.apache.syncope.console.pages.panels;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
+import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
import org.apache.wicket.Component;
import org.apache.wicket.behavior.Behavior;
import org.apache.wicket.markup.ComponentTag;
@@ -30,26 +34,21 @@ import org.apache.wicket.markup.html.pan
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
-import org.apache.syncope.client.to.AbstractAttributableTO;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxPasswordFieldPanel;
-import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
-import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
public class UserDetailsPanel extends Panel {
private static final long serialVersionUID = 6592027822510220463L;
- public <T extends AbstractAttributableTO> UserDetailsPanel(final String id, final UserTO userTO, final Form form,
- final boolean resetPassword, final boolean templateMode) {
+ public UserDetailsPanel(final String id, final UserTO userTO, final Form form, final boolean resetPassword,
+ final boolean templateMode) {
super(id);
// ------------------------
// Username
// ------------------------
- final FieldPanel<String> username = new AjaxTextFieldPanel("username", "username", new PropertyModel<String>(userTO,
- "username"));
+ final FieldPanel<String> username = new AjaxTextFieldPanel("username", "username",
+ new PropertyModel<String>(userTO, "username"));
if (!templateMode) {
username.addRequiredLabel();
}
@@ -59,9 +58,9 @@ public class UserDetailsPanel extends Pa
// ------------------------
// Password
// ------------------------
- final FieldPanel<String> password;
- final Label confirmPasswordLabel = new Label("confirmPasswordLabel", new ResourceModel("confirmPassword"));
- final FieldPanel<String> confirmPassword;
+ FieldPanel<String> password;
+ Label confirmPasswordLabel = new Label("confirmPasswordLabel", new ResourceModel("confirmPassword"));
+ FieldPanel<String> confirmPassword;
if (templateMode) {
password = new AjaxTextFieldPanel("password", "password", new PropertyModel<String>(userTO, "password"));
@@ -70,7 +69,8 @@ public class UserDetailsPanel extends Pa
confirmPassword.setEnabled(false);
confirmPassword.setVisible(false);
} else {
- password = new AjaxPasswordFieldPanel("password", "password", new PropertyModel<String>(userTO, "password"));
+ password = new AjaxPasswordFieldPanel("password", "password",
+ new PropertyModel<String>(userTO, "password"));
password.setRequired(userTO.getId() == 0);
((PasswordTextField) password.getField()).setResetPassword(resetPassword);
Modified: incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchPanel.java
URL: http://svn.apache.org/viewvc/incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchPanel.java?rev=1403272&r1=1403271&r2=1403272&view=diff
==============================================================================
--- incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchPanel.java (original)
+++ incubator/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchPanel.java Mon Oct 29 12:49:32 2012
@@ -23,6 +23,21 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import org.apache.syncope.client.search.AttributeCond;
+import org.apache.syncope.client.search.MembershipCond;
+import org.apache.syncope.client.search.NodeCond;
+import org.apache.syncope.client.search.ResourceCond;
+import org.apache.syncope.client.search.SyncopeUserCond;
+import org.apache.syncope.client.to.ResourceTO;
+import org.apache.syncope.client.to.RoleTO;
+import org.apache.syncope.client.to.UserTO;
+import org.apache.syncope.console.commons.SearchCondWrapper;
+import org.apache.syncope.console.commons.SearchCondWrapper.FilterType;
+import org.apache.syncope.console.commons.SearchCondWrapper.OperationType;
+import org.apache.syncope.console.rest.ResourceRestClient;
+import org.apache.syncope.console.rest.RoleRestClient;
+import org.apache.syncope.console.rest.SchemaRestClient;
+import org.apache.syncope.types.AttributableType;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
@@ -47,21 +62,6 @@ import org.apache.wicket.model.ResourceM
import org.apache.wicket.spring.injection.annot.SpringBean;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.apache.syncope.client.search.AttributeCond;
-import org.apache.syncope.client.search.MembershipCond;
-import org.apache.syncope.client.search.NodeCond;
-import org.apache.syncope.client.search.ResourceCond;
-import org.apache.syncope.client.search.SyncopeUserCond;
-import org.apache.syncope.client.to.ResourceTO;
-import org.apache.syncope.client.to.RoleTO;
-import org.apache.syncope.client.to.UserTO;
-import org.apache.syncope.console.commons.SearchCondWrapper;
-import org.apache.syncope.console.commons.SearchCondWrapper.FilterType;
-import org.apache.syncope.console.commons.SearchCondWrapper.OperationType;
-import org.apache.syncope.console.rest.ResourceRestClient;
-import org.apache.syncope.console.rest.RoleRestClient;
-import org.apache.syncope.console.rest.SchemaRestClient;
-import org.apache.syncope.types.AttributableType;
public class UserSearchPanel extends Panel {
@@ -72,8 +72,9 @@ public class UserSearchPanel extends Pan
*/
private static final Logger LOG = LoggerFactory.getLogger(UserSearchPanel.class);
- private List<String> ATTRIBUTES_NOTINCLUDED = Arrays.asList(new String[]{"attributes", "derivedAttributes",
- "virtualAttributes", "serialVersionUID", "memberships", "resources", "password", "propagationStatusMap"});
+ private List<String> ATTRIBUTES_NOTINCLUDED = Arrays.asList(new String[]{
+ "attributes", "derivedAttributes", "virtualAttributes", "serialVersionUID", "memberships", "resources",
+ "password", "propagationStatusMap"});
@SpringBean
private SchemaRestClient schemaRestClient;
@@ -156,15 +157,16 @@ public class UserSearchPanel extends Pan
}
};
- final private IModel<List<AttributeCond.Type>> attributeTypes = new LoadableDetachableModel<List<AttributeCond.Type>>() {
+ final private IModel<List<AttributeCond.Type>> attributeTypes =
+ new LoadableDetachableModel<List<AttributeCond.Type>>() {
- private static final long serialVersionUID = 5275935387613157437L;
+ private static final long serialVersionUID = 5275935387613157437L;
- @Override
- protected List<AttributeCond.Type> load() {
- return Arrays.asList(AttributeCond.Type.values());
- }
- };
+ @Override
+ protected List<AttributeCond.Type> load() {
+ return Arrays.asList(AttributeCond.Type.values());
+ }
+ };
final private IModel<List<FilterType>> filterTypes = new LoadableDetachableModel<List<FilterType>>() {
@@ -358,7 +360,7 @@ public class UserSearchPanel extends Pan
return null;
}
- LOG.debug("Search conditions: fname {}; ftype {}; fvalue {}; OP {}; type {}; isnot {}", new Object[] {
+ LOG.debug("Search conditions: fname {}; ftype {}; fvalue {}; OP {}; type {}; isnot {}", new Object[]{
searchConditionWrapper.getFilterName(), searchConditionWrapper.getFilterType(),
searchConditionWrapper.getFilterValue(), searchConditionWrapper.getOperationType(),
searchConditionWrapper.getType(), searchConditionWrapper.isNotOperator()});