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 2014/10/24 17:02:37 UTC
[1/5] git commit: Some deps upgrades: log4j, aspectj, selenium
Repository: syncope
Updated Branches:
refs/heads/1_2_X 7c714f31c -> 0a768e4f9
refs/heads/master b56646a80 -> dbd3a42bf
Some deps upgrades: log4j, aspectj, selenium
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1551f170
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1551f170
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1551f170
Branch: refs/heads/1_2_X
Commit: 1551f1704184c6f7d35165f65cc537a8e3dc91c2
Parents: 7c714f3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 24 17:01:39 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 24 17:01:39 2014 +0200
----------------------------------------------------------------------
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/1551f170/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ee4d4a7..d7315e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -323,7 +323,7 @@ under the License.
<activiti.version>5.16.4</activiti.version>
- <aspectj.version>1.8.2</aspectj.version>
+ <aspectj.version>1.8.3</aspectj.version>
<cxf.version>3.0.2</cxf.version>
<spring.version>4.0.7.RELEASE</spring.version>
@@ -346,12 +346,12 @@ under the License.
<h2.version>1.4.182</h2.version>
- <log4j.version>2.0</log4j.version>
+ <log4j.version>2.1</log4j.version>
<slf4j.version>1.7.7</slf4j.version>
<disruptor.version>3.3.0</disruptor.version>
<junit.version>4.11</junit.version>
- <selenium.version>2.43.1</selenium.version>
+ <selenium.version>2.44.0</selenium.version>
<apacheds.version>1.5.7</apacheds.version>
[5/5] git commit: Merge branch '1_2_X'
Posted by il...@apache.org.
Merge branch '1_2_X'
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/dbd3a42b
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/dbd3a42b
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/dbd3a42b
Branch: refs/heads/master
Commit: dbd3a42bf44fce0912d7fba1624dca5ae778ae22
Parents: b56646a 0a768e4
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 24 17:02:14 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 24 17:02:14 2014 +0200
----------------------------------------------------------------------
.../common/types/ClientExceptionType.java | 1 +
.../syncope/console/commons/AttrLayoutType.java | 98 +++++++++++++++
.../syncope/console/commons/LayoutType.java | 43 -------
.../syncope/console/pages/Configuration.java | 18 +--
.../org/apache/syncope/console/pages/Login.java | 3 +-
.../pages/panels/AttrTemplatesPanel.java | 2 +-
.../console/pages/panels/AttributesPanel.java | 118 +++++++++----------
.../console/pages/panels/LayoutsPanel.java | 77 +++---------
.../console/pages/panels/ResourcesPanel.java | 6 +-
.../console/rest/ConfigurationRestClient.java | 18 +++
.../syncope/console/rest/SchemaRestClient.java | 106 ++---------------
.../markup/html/form/AjaxPalettePanel.java | 10 +-
.../wicket/markup/html/form/NonI18nPalette.java | 12 +-
.../wicket/markup/html/form/NonI18nPalette.html | 24 ++--
console/src/main/webapp/img/add.png | Bin 0 -> 814 bytes
console/src/main/webapp/img/addAll.png | Bin 0 -> 1037 bytes
console/src/main/webapp/img/moveDown.png | Bin 0 -> 833 bytes
console/src/main/webapp/img/moveUp.png | Bin 0 -> 834 bytes
console/src/main/webapp/img/remove.png | Bin 0 -> 825 bytes
console/src/main/webapp/img/removeAll.png | Bin 0 -> 1034 bytes
.../controller/ConfigurationController.java | 19 ++-
core/src/main/resources/content.xml | 16 ++-
core/src/test/resources/content.xml | 14 +++
pom.xml | 6 +-
24 files changed, 284 insertions(+), 307 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/dbd3a42b/pom.xml
----------------------------------------------------------------------
[3/5] git commit: [SYNCOPE-558] Fixing ordering issue
Posted by il...@apache.org.
[SYNCOPE-558] Fixing ordering issue
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/0a768e4f
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/0a768e4f
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/0a768e4f
Branch: refs/heads/master
Commit: 0a768e4f9f95407e1ae9e370deda6789331f4dcb
Parents: 1551f17
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 24 17:02:03 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 24 17:02:03 2014 +0200
----------------------------------------------------------------------
.../common/types/ClientExceptionType.java | 1 +
.../syncope/console/commons/AttrLayoutType.java | 98 +++++++++++++++
.../syncope/console/commons/LayoutType.java | 43 -------
.../syncope/console/pages/Configuration.java | 18 +--
.../org/apache/syncope/console/pages/Login.java | 3 +-
.../pages/panels/AttrTemplatesPanel.java | 2 +-
.../console/pages/panels/AttributesPanel.java | 118 +++++++++----------
.../console/pages/panels/LayoutsPanel.java | 77 +++---------
.../console/pages/panels/ResourcesPanel.java | 6 +-
.../console/rest/ConfigurationRestClient.java | 18 +++
.../syncope/console/rest/SchemaRestClient.java | 106 ++---------------
.../markup/html/form/AjaxPalettePanel.java | 10 +-
.../wicket/markup/html/form/NonI18nPalette.java | 12 +-
.../wicket/markup/html/form/NonI18nPalette.html | 24 ++--
console/src/main/webapp/img/add.png | Bin 0 -> 814 bytes
console/src/main/webapp/img/addAll.png | Bin 0 -> 1037 bytes
console/src/main/webapp/img/moveDown.png | Bin 0 -> 833 bytes
console/src/main/webapp/img/moveUp.png | Bin 0 -> 834 bytes
console/src/main/webapp/img/remove.png | Bin 0 -> 825 bytes
console/src/main/webapp/img/removeAll.png | Bin 0 -> 1034 bytes
.../controller/ConfigurationController.java | 19 ++-
core/src/main/resources/content.xml | 16 ++-
core/src/test/resources/content.xml | 14 +++
23 files changed, 281 insertions(+), 304 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java b/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
index a4545f3..4113ff9 100644
--- a/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
+++ b/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
@@ -33,6 +33,7 @@ public enum ClientExceptionType {
InvalidConnInstance(Response.Status.BAD_REQUEST),
InvalidConnIdConf(Response.Status.BAD_REQUEST),
InvalidPolicy(Response.Status.BAD_REQUEST),
+ InvalidSyncopeConf(Response.Status.BAD_REQUEST),
InvalidSyncopeRole(Response.Status.BAD_REQUEST),
InvalidReportExec(Response.Status.BAD_REQUEST),
InvalidRoles(Response.Status.BAD_REQUEST),
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java b/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java
new file mode 100644
index 0000000..38a51f8
--- /dev/null
+++ b/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java
@@ -0,0 +1,98 @@
+/*
+ * 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.commons;
+
+import org.apache.syncope.common.types.AttributableType;
+
+public enum AttrLayoutType {
+
+ ADMIN_USER("admin.user.layout", Mode.ADMIN, AttributableType.USER),
+ SELF_USER("self.user.layout", Mode.SELF, AttributableType.USER),
+ ADMIN_ROLE("admin.role.layout", Mode.ADMIN, AttributableType.ROLE),
+ SELF_ROLE("self.role.layout", Mode.SELF, AttributableType.ROLE),
+ ADMIN_MEMBERSHIP("admin.membership.layout", Mode.ADMIN, AttributableType.MEMBERSHIP),
+ SELF_MEMBERSHIP("self.membership.layout", Mode.SELF, AttributableType.MEMBERSHIP);
+
+ private final String confKey;
+
+ private final Mode mode;
+
+ private final AttributableType attrType;
+
+ AttrLayoutType(final String confKey, final Mode mode, final AttributableType attrType) {
+ this.confKey = confKey;
+ this.mode = mode;
+ this.attrType = attrType;
+ }
+
+ public String getConfKey() {
+ return confKey;
+ }
+
+ public Mode getMode() {
+ return mode;
+ }
+
+ public AttributableType getAttrType() {
+ return attrType;
+ }
+
+ public static AttrLayoutType valueOf(final Mode mode, final AttributableType attrType) {
+ AttrLayoutType result = null;
+ if (mode == Mode.ADMIN) {
+ switch (attrType) {
+ case USER:
+ result = ADMIN_USER;
+ break;
+
+ case MEMBERSHIP:
+ result = ADMIN_MEMBERSHIP;
+ break;
+
+ case ROLE:
+ result = ADMIN_ROLE;
+ break;
+
+ default:
+ }
+ } else if (mode == Mode.SELF) {
+ switch (attrType) {
+ case USER:
+ result = SELF_USER;
+ break;
+
+ case MEMBERSHIP:
+ result = SELF_MEMBERSHIP;
+ break;
+
+ case ROLE:
+ result = SELF_ROLE;
+ break;
+
+ default:
+ }
+ }
+
+ if (result == null) {
+ throw new IllegalArgumentException("Could not find any valid instance for " + mode + " and " + attrType);
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java b/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java
deleted file mode 100644
index 057a1c6..0000000
--- a/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.commons;
-
-public enum LayoutType {
-
- ADMIN_USER("admin.user.layout"),
- SELF_USER("self.user.layout"),
- ADMIN_ROLE("admin.role.layout"),
- SELF_ROLE("self.role.layout"),
- ADMIN_MEMBERSHIP("admin.membership.layout"),
- SELF_MEMBERSHIP("self.membership.layout");
-
- private final String parameter;
-
- LayoutType(final String parameter) {
- this.parameter = parameter;
- }
-
- public String getParameter() {
- return parameter;
- }
-
- public static LayoutType fromString(final String value) {
- return LayoutType.valueOf(value.toUpperCase());
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/Configuration.java b/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
index 00c087b..fffe657 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
@@ -36,7 +36,7 @@ import org.apache.syncope.common.to.ConfTO;
import org.apache.syncope.common.to.LoggerTO;
import org.apache.syncope.common.to.NotificationTO;
import org.apache.syncope.common.to.SecurityQuestionTO;
-import org.apache.syncope.console.commons.LayoutType;
+import org.apache.syncope.console.commons.AttrLayoutType;
import org.apache.syncope.common.types.LoggerLevel;
import org.apache.syncope.common.types.PolicyType;
import org.apache.syncope.console.commons.Constants;
@@ -245,12 +245,12 @@ public class Configuration extends BasePage {
"Configuration", "logList"));
add(consoleLoggerContainer);
- add(new LayoutsPanel("adminUserLayoutPanel", LayoutType.ADMIN_USER, feedbackPanel));
- add(new LayoutsPanel("selfUserLayoutPanel", LayoutType.SELF_USER, feedbackPanel));
- add(new LayoutsPanel("adminRoleLayoutPanel", LayoutType.ADMIN_ROLE, feedbackPanel));
- add(new LayoutsPanel("selfRoleLayoutPanel", LayoutType.SELF_ROLE, feedbackPanel));
- add(new LayoutsPanel("adminMembershipLayoutPanel", LayoutType.ADMIN_MEMBERSHIP, feedbackPanel));
- add(new LayoutsPanel("selfMembershipLayoutPanel", LayoutType.SELF_MEMBERSHIP, feedbackPanel));
+ add(new LayoutsPanel("adminUserLayoutPanel", AttrLayoutType.ADMIN_USER, feedbackPanel));
+ add(new LayoutsPanel("selfUserLayoutPanel", AttrLayoutType.SELF_USER, feedbackPanel));
+ add(new LayoutsPanel("adminRoleLayoutPanel", AttrLayoutType.ADMIN_ROLE, feedbackPanel));
+ add(new LayoutsPanel("selfRoleLayoutPanel", AttrLayoutType.SELF_ROLE, feedbackPanel));
+ add(new LayoutsPanel("adminMembershipLayoutPanel", AttrLayoutType.ADMIN_MEMBERSHIP, feedbackPanel));
+ add(new LayoutsPanel("selfMembershipLayoutPanel", AttrLayoutType.SELF_MEMBERSHIP, feedbackPanel));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -264,8 +264,8 @@ public class Configuration extends BasePage {
for (Iterator<AttributeTO> it = conf.getAttrs().iterator(); it.hasNext();) {
AttributeTO attr = it.next();
- for (LayoutType type : LayoutType.values()) {
- if (type.getParameter().equals(attr.getSchema())) {
+ for (AttrLayoutType type : AttrLayoutType.values()) {
+ if (type.getConfKey().equals(attr.getSchema())) {
it.remove();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/Login.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/Login.java b/console/src/main/java/org/apache/syncope/console/pages/Login.java
index 0b0bd54..d01ec41 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/Login.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/Login.java
@@ -170,8 +170,7 @@ public class Login extends WebPage {
// anonymous authentication needed for self-registration
authenticate(anonymousUser, anonymousKey);
- return new UserSelfModalPage(
- Login.this.getPageReference(), selfRegModalWin, new UserTO());
+ return new UserSelfModalPage(Login.this.getPageReference(), selfRegModalWin, new UserTO());
}
});
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
index 2d84719..d3e91db 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
@@ -96,7 +96,7 @@ public class AttrTemplatesPanel extends Panel {
ListModel<String> availableSchemas = new ListModel<String>(allSchemas);
return new NonI18nPalette<String>(type.name(), new PropertyModel<List<String>>(roleTO, type.name()),
- availableSchemas, new SelectChoiceRenderer<String>(), 8, false) {
+ availableSchemas, new SelectChoiceRenderer<String>(), 8, false, true) {
private static final long serialVersionUID = 2295567122085510330L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
index 9fc33d7..c59658f 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
@@ -20,6 +20,8 @@ package org.apache.syncope.console.pages.panels;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -42,7 +44,7 @@ import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.common.types.AttributeSchemaType;
import org.apache.syncope.console.commons.JexlHelpUtil;
-import org.apache.syncope.console.commons.LayoutType;
+import org.apache.syncope.console.commons.AttrLayoutType;
import org.apache.syncope.console.commons.Mode;
import org.apache.syncope.console.markup.html.list.AltListView;
import org.apache.syncope.console.pages.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
@@ -65,7 +67,6 @@ import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
@@ -90,8 +91,6 @@ public class AttributesPanel extends Panel {
private final AttrTemplatesPanel attrTemplates;
- private AttributeTO confAttributeTO;
-
private Map<String, SchemaTO> schemas = new LinkedHashMap<String, SchemaTO>();
public <T extends AbstractAttributableTO> AttributesPanel(final String id, final T entityTO, final Form form,
@@ -112,41 +111,38 @@ public class AttributesPanel extends Panel {
setSchemas();
setAttrs();
- final ListView<AttributeTO> attributeView = new AltListView<AttributeTO>("schemas",
- new PropertyModel<List<? extends AttributeTO>>(entityTO, "attrs")) {
+ add(new AltListView<AttributeTO>("schemas", new PropertyModel<List<? extends AttributeTO>>(entityTO, "attrs")) {
- private static final long serialVersionUID = 9101744072914090143L;
+ private static final long serialVersionUID = 9101744072914090143L;
- @Override
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected void populateItem(final ListItem<AttributeTO> item) {
- final AttributeTO attributeTO = (AttributeTO) item.getDefaultModelObject();
+ @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected void populateItem(final ListItem<AttributeTO> item) {
+ final AttributeTO attributeTO = (AttributeTO) item.getDefaultModelObject();
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+ final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
- final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp,
- "questionMarkJexlHelp");
- item.add(questionMarkJexlHelp);
- questionMarkJexlHelp.add(jexlHelp);
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ item.add(questionMarkJexlHelp);
+ questionMarkJexlHelp.add(jexlHelp);
- if (mode != Mode.TEMPLATE) {
- questionMarkJexlHelp.setVisible(false);
- }
+ if (mode != Mode.TEMPLATE) {
+ questionMarkJexlHelp.setVisible(false);
+ }
- item.add(new Label("name", attributeTO.getSchema()));
+ item.add(new Label("name", attributeTO.getSchema()));
- final FieldPanel panel = getFieldPanel(schemas.get(attributeTO.getSchema()), form, attributeTO);
+ final FieldPanel panel = getFieldPanel(schemas.get(attributeTO.getSchema()), form, attributeTO);
- if (mode == Mode.TEMPLATE || !schemas.get(attributeTO.getSchema()).isMultivalue()) {
- item.add(panel);
- } else {
- item.add(new MultiFieldPanel<String>(
- "panel", new PropertyModel<List<String>>(attributeTO, "values"), panel));
- }
- }
- };
-
- add(attributeView);
+ if (mode == Mode.TEMPLATE || !schemas.get(attributeTO.getSchema()).isMultivalue()) {
+ item.add(panel);
+ } else {
+ item.add(new MultiFieldPanel<String>(
+ "panel", new PropertyModel<List<String>>(attributeTO, "values"), panel));
+ }
+ }
+ }
+ );
}
private void filter(final List<SchemaTO> schemaTOs, final Collection<String> allowed) {
@@ -159,12 +155,13 @@ public class AttributesPanel extends Panel {
}
private void setSchemas() {
+ AttributeTO attrLayout = null;
List<SchemaTO> schemaTOs;
if (entityTO instanceof RoleTO) {
final RoleTO roleTO = (RoleTO) entityTO;
- setLayoutConfiguration(mode, AttributableType.ROLE);
+ attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.ROLE));
schemaTOs = schemaRestClient.getSchemas(AttributableType.ROLE);
Set<String> allowed;
if (attrTemplates == null) {
@@ -177,11 +174,11 @@ public class AttributesPanel extends Panel {
}
filter(schemaTOs, allowed);
} else if (entityTO instanceof UserTO) {
+ attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.USER));
schemaTOs = schemaRestClient.getSchemas(AttributableType.USER);
- setLayoutConfiguration(mode, AttributableType.USER);
} else if (entityTO instanceof MembershipTO) {
+ attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.MEMBERSHIP));
schemaTOs = schemaRestClient.getSchemas(AttributableType.MEMBERSHIP);
- setLayoutConfiguration(mode, AttributableType.MEMBERSHIP);
Set<String> allowed = new HashSet<String>(
roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMAttrTemplates());
filter(schemaTOs, allowed);
@@ -190,8 +187,8 @@ public class AttributesPanel extends Panel {
schemaTOs = schemaRestClient.getSchemas(AttributableType.CONFIGURATION);
for (Iterator<SchemaTO> it = schemaTOs.iterator(); it.hasNext();) {
SchemaTO schemaTO = it.next();
- for (LayoutType type : LayoutType.values()) {
- if (type.getParameter().equals(schemaTO.getName())) {
+ for (AttrLayoutType type : AttrLayoutType.values()) {
+ if (type.getConfKey().equals(schemaTO.getName())) {
it.remove();
}
}
@@ -200,30 +197,32 @@ public class AttributesPanel extends Panel {
schemas.clear();
- if (confAttributeTO != null && mode != Mode.TEMPLATE && !(entityTO instanceof ConfTO)) {
- filter(schemaTOs, confAttributeTO.getValues());
- }
- for (SchemaTO schemaTO : schemaTOs) {
- schemas.put(schemaTO.getName(), schemaTO);
- }
- }
+ if (attrLayout != null && mode != Mode.TEMPLATE && !(entityTO instanceof ConfTO)) {
+ // 1. remove attributes not selected for display
+ filter(schemaTOs, attrLayout.getValues());
+ // 2. sort remainig attributes according to configuration, e.g. attrLayout
+ final Map<String, Integer> attrLayoutMap = new HashMap<String, Integer>(attrLayout.getValues().size());
+ for (int i = 0; i < attrLayout.getValues().size(); i++) {
+ attrLayoutMap.put(attrLayout.getValues().get(i), i);
+ }
+ Collections.sort(schemaTOs, new Comparator<SchemaTO>() {
- private void setLayoutConfiguration(final Mode mode, final AttributableType type) {
- switch (type) {
- case ROLE:
- confAttributeTO = confRestClient.read(mode == Mode.ADMIN
- ? LayoutType.ADMIN_ROLE.getParameter() : LayoutType.SELF_ROLE.getParameter());
- break;
+ @Override
+ public int compare(final SchemaTO schema1, final SchemaTO schema2) {
+ int value = 0;
- case MEMBERSHIP:
- confAttributeTO = confRestClient.read(mode == Mode.ADMIN
- ? LayoutType.ADMIN_MEMBERSHIP.getParameter() : LayoutType.SELF_MEMBERSHIP.getParameter());
- break;
+ if (attrLayoutMap.get(schema1.getName()) > attrLayoutMap.get(schema2.getName())) {
+ value = 1;
+ } else if (attrLayoutMap.get(schema1.getName()) < attrLayoutMap.get(schema2.getName())) {
+ value = -1;
+ }
- case USER:
- default:
- confAttributeTO = confRestClient.read(mode == Mode.ADMIN
- ? LayoutType.ADMIN_USER.getParameter() : LayoutType.SELF_USER.getParameter());
+ return value;
+ }
+ });
+ }
+ for (SchemaTO schemaTO : schemaTOs) {
+ schemas.put(schemaTO.getName(), schemaTO);
}
}
@@ -253,8 +252,9 @@ public class AttributesPanel extends Panel {
@SuppressWarnings({ "rawtypes", "unchecked" })
private FieldPanel getFieldPanel(final SchemaTO schemaTO, final Form form, final AttributeTO attributeTO) {
- final boolean required = mode == Mode.TEMPLATE ? false : schemaTO.getMandatoryCondition().equalsIgnoreCase(
- "true");
+ final boolean required = mode == Mode.TEMPLATE
+ ? false
+ : schemaTO.getMandatoryCondition().equalsIgnoreCase("true");
final boolean readOnly = mode == Mode.TEMPLATE ? false : schemaTO.isReadonly();
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
index c061ea9..07b0bf8 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
@@ -18,14 +18,11 @@
*/
package org.apache.syncope.console.pages.panels;
-import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.SchemaTO;
-import org.apache.syncope.common.types.AttributableType;
-import org.apache.syncope.common.types.AttributeSchemaType;
-import org.apache.syncope.console.commons.LayoutType;
+import org.apache.syncope.console.commons.AttrLayoutType;
import org.apache.syncope.console.commons.Constants;
+import org.apache.syncope.console.commons.SelectChoiceRenderer;
import org.apache.syncope.console.commons.XMLRolesReader;
import org.apache.syncope.console.rest.ConfigurationRestClient;
import org.apache.syncope.console.rest.SchemaRestClient;
@@ -66,7 +63,7 @@ public class LayoutsPanel extends Panel {
private ConfigurationRestClient confRestClient;
@SuppressWarnings("unchecked")
- public LayoutsPanel(final String id, final LayoutType layoutType, final NotificationPanel feedbackPanel) {
+ public LayoutsPanel(final String id, final AttrLayoutType attrLayoutType, final NotificationPanel feedbackPanel) {
super(id);
final WebMarkupContainer container = new WebMarkupContainer("container");
@@ -75,28 +72,16 @@ public class LayoutsPanel extends Panel {
final Form<String> form = new Form<String>("form");
form.setOutputMarkupId(true);
- final AttributableType type;
- final AttributeTO attributeTO;
- if (layoutType == LayoutType.ADMIN_USER || layoutType == layoutType.SELF_USER) {
- attributeTO = getConfiguration(layoutType, AttributableType.USER);
- type = AttributableType.USER;
- } else if (layoutType == LayoutType.ADMIN_ROLE || layoutType == layoutType.SELF_ROLE) {
- attributeTO = getConfiguration(layoutType, AttributableType.ROLE);
- type = AttributableType.ROLE;
- } else {
- attributeTO = getConfiguration(layoutType, AttributableType.MEMBERSHIP);
- type = AttributableType.MEMBERSHIP;
- }
-
- form.setModel(new CompoundPropertyModel(attributeTO.getValues()));
-
- final List<String> fields = getAllFields(type);
-
- final ListModel<String> selectedFields = new ListModel<String>(!attributeTO.getValues().isEmpty()
- ? attributeTO.getValues() : fields);
+ final AttributeTO attrLayout = confRestClient.readAttrLayout(attrLayoutType);
+ form.setModel(new CompoundPropertyModel(attrLayout.getValues()));
+
+ final List<String> fields = schemaRestClient.getSchemaNames(attrLayoutType.getAttrType());
+ final ListModel<String> selectedFields =
+ new ListModel<String>(attrLayout.getValues().isEmpty() ? fields : attrLayout.getValues());
final ListModel<String> availableFields = new ListModel<String>(fields);
- form.add(new AjaxPalettePanel<String>("fields", selectedFields, availableFields, true));
+ form.add(new AjaxPalettePanel<String>("fields", selectedFields, availableFields,
+ new SelectChoiceRenderer<String>(), true, true));
final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(APPLY)) {
@@ -105,18 +90,10 @@ public class LayoutsPanel extends Panel {
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
try {
- if (schemaRestClient.readSchema(
- AttributableType.CONFIGURATION, layoutType.getParameter()) == null) {
- final SchemaTO confSchemaTO = new SchemaTO();
- confSchemaTO.setName(layoutType.getParameter());
- confSchemaTO.setMultivalue(true);
- confSchemaTO.setType(AttributeSchemaType.String);
- schemaRestClient.createSchema(AttributableType.CONFIGURATION, confSchemaTO);
- }
- confRestClient.set(attributeTO);
+ confRestClient.set(attrLayout);
info(getString(Constants.OPERATION_SUCCEEDED));
} catch (Exception e) {
- LOG.error("While save layout configuration", e);
+ LOG.error("While saving layout configuration", e);
error(getString(Constants.ERROR) + ": " + e.getMessage());
}
feedbackPanel.refresh(target);
@@ -124,8 +101,7 @@ public class LayoutsPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- LOG.error("While save layout configuration");
- error(getString(Constants.ERROR) + ": While save layout configuration");
+ error(getString(Constants.ERROR) + ": While saving layout configuration");
feedbackPanel.refresh(target);
}
};
@@ -151,29 +127,4 @@ public class LayoutsPanel extends Panel {
container.add(form);
add(container);
}
-
- private AttributeTO getConfiguration(final LayoutType layoutType, final AttributableType type) {
- AttributeTO attributeTO = null;
- try {
- attributeTO = confRestClient.read(layoutType.getParameter());
- } catch (Exception e) {
- // ignore
- }
-
- if (attributeTO == null) {
- attributeTO = new AttributeTO();
- attributeTO.setSchema(layoutType.getParameter());
- attributeTO.getValues().addAll(getAllFields(type));
- }
-
- return attributeTO;
- }
-
- private List<String> getAllFields(final AttributableType type) {
- final List<String> fields = new ArrayList<String>();
- for (SchemaTO item : schemaRestClient.getSchemas(type)) {
- fields.add(item.getName());
- }
- return fields;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
index bf29a5b..a4ab67f 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
@@ -125,15 +125,15 @@ public class ResourcesPanel extends Panel {
public AjaxRecordingPalettePanel(final String id, final IModel<List<T>> model, final ListModel<T> choices,
final StatusPanel statusPanel) {
- super(id, model, choices, new SelectChoiceRenderer<T>(), false);
+ super(id, model, choices, new SelectChoiceRenderer<T>(), false, false);
this.statusPanel = statusPanel;
}
@Override
protected Palette<T> createPalette(final IModel<List<T>> model, final ListModel<T> choices,
- final IChoiceRenderer<T> renderer, final boolean allowOrder) {
+ final IChoiceRenderer<T> renderer, final boolean allowOrder, final boolean allowMoveAll) {
- return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder) {
+ return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder, false) {
private static final long serialVersionUID = -3415146226879212841L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java b/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
index e3bedce..2576a60 100644
--- a/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
+++ b/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
@@ -27,6 +27,8 @@ import org.apache.syncope.common.to.AttributeTO;
import org.apache.syncope.common.to.ConfTO;
import org.apache.syncope.common.util.CollectionWrapper;
import org.apache.syncope.common.wrap.MailTemplate;
+import org.apache.syncope.console.commons.AttrLayoutType;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@@ -34,6 +36,9 @@ public class ConfigurationRestClient extends BaseRestClient {
private static final long serialVersionUID = 7692363064029538722L;
+ @Autowired
+ private SchemaRestClient schemaRestClient;
+
public ConfTO list() {
return getService(ConfigurationService.class).list();
}
@@ -47,6 +52,19 @@ public class ConfigurationRestClient extends BaseRestClient {
return null;
}
+ public AttributeTO readAttrLayout(final AttrLayoutType type) {
+ AttributeTO attrLayout = read(type.getConfKey());
+ if (attrLayout == null) {
+ attrLayout = new AttributeTO();
+ attrLayout.setSchema(type.getConfKey());
+ }
+ if (attrLayout.getValues().isEmpty()) {
+ attrLayout.getValues().addAll(schemaRestClient.getSchemaNames(type.getAttrType()));
+ }
+
+ return attrLayout;
+ }
+
public void set(final AttributeTO attributeTO) {
getService(ConfigurationService.class).set(attributeTO.getSchema(), attributeTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java b/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
index 64402db..023d3fa 100644
--- a/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
+++ b/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
@@ -55,11 +55,6 @@ public class SchemaRestClient extends BaseRestClient {
return schemas;
}
- /**
- * Get schemas.
- *
- * @return List of schemas.
- */
public List<SchemaTO> getSchemas(final AttributableType type) {
List<SchemaTO> schemas = null;
@@ -87,11 +82,6 @@ public class SchemaRestClient extends BaseRestClient {
return schemaNames;
}
- /**
- * Get schema names.
- *
- * @return List of schema names.
- */
public List<String> getSchemaNames(final AttributableType type) {
final List<String> schemaNames = new ArrayList<String>();
@@ -107,12 +97,6 @@ public class SchemaRestClient extends BaseRestClient {
return schemaNames;
}
- /**
- * Get derived schemas.
- *
- * @return List of derived schemas.
- */
- @SuppressWarnings("unchecked")
public List<DerSchemaTO> getDerSchemas(final AttributableType type) {
List<DerSchemaTO> userDerSchemas = null;
@@ -125,11 +109,6 @@ public class SchemaRestClient extends BaseRestClient {
return userDerSchemas;
}
- /**
- * Get derived schema names.
- *
- * @return List of derived schema names.
- */
public List<String> getDerSchemaNames(final AttributableType type) {
final List<String> userDerSchemasNames = new ArrayList<String>();
@@ -146,12 +125,6 @@ public class SchemaRestClient extends BaseRestClient {
return userDerSchemasNames;
}
- /**
- * Get virtual schemas.
- *
- * @return List of virtual schemas.
- */
- @SuppressWarnings("unchecked")
public List<VirSchemaTO> getVirSchemas(final AttributableType type) {
List<VirSchemaTO> userVirSchemas = null;
@@ -164,11 +137,6 @@ public class SchemaRestClient extends BaseRestClient {
return userVirSchemas;
}
- /**
- * Get virtual schema names.
- *
- * @return List of virtual schema names.
- */
public List<String> getVirSchemaNames(final AttributableType type) {
final List<String> userVirSchemasNames = new ArrayList<String>();
@@ -185,21 +153,10 @@ public class SchemaRestClient extends BaseRestClient {
return userVirSchemasNames;
}
- /**
- * Create new user schema.
- *
- * @param schemaTO
- */
public void createSchema(final AttributableType type, final SchemaTO schemaTO) {
getService(SchemaService.class).create(type, SchemaType.NORMAL, schemaTO);
}
- /**
- * Load an already existent user schema by its name.
- *
- * @param name (e.g.:surname)
- * @return schemaTO
- */
public SchemaTO readSchema(final AttributableType type, final String name) {
SchemaTO schema = null;
@@ -211,51 +168,20 @@ public class SchemaRestClient extends BaseRestClient {
return schema;
}
- /**
- * Update an already existent user schema.
- *
- * @param schemaTO updated
- */
public void updateSchema(final AttributableType type, final SchemaTO schemaTO) {
getService(SchemaService.class).update(type, SchemaType.NORMAL, schemaTO.getName(), schemaTO);
}
- /**
- * Delete an already existent user schema by its name.
- *
- * @param name (e.g.:surname)
- * @return schemaTO
- */
public SchemaTO deleteSchema(final AttributableType type, final String name) {
SchemaTO response = getService(SchemaService.class).read(type, SchemaType.NORMAL, name);
getService(SchemaService.class).delete(type, SchemaType.NORMAL, name);
return response;
}
- /**
- * Create new derived user schema.
- *
- * @param schemaTO
- */
public void createDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
getService(SchemaService.class).create(type, SchemaType.DERIVED, schemaTO);
}
- /**
- * Create new derived user schema.
- *
- * @param schemaTO
- */
- public void createVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
- getService(SchemaService.class).create(type, SchemaType.VIRTUAL, schemaTO);
- }
-
- /**
- * Load an already existent user derived schema by its name.
- *
- * @param name (e.g.:surname)
- * @return DerSchemaTO
- */
public DerSchemaTO readDerSchema(final AttributableType type, final String name) {
DerSchemaTO derivedSchemaTO = null;
try {
@@ -266,40 +192,24 @@ public class SchemaRestClient extends BaseRestClient {
return derivedSchemaTO;
}
- /**
- * Update an already existent user derived schema.
- *
- * @param schemaTO updated
- */
- public void updateDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
- getService(SchemaService.class).update(type, SchemaType.DERIVED, schemaTO.getName(), schemaTO);
- }
-
- /**
- * Update an already existent user derived schema.
- *
- * @param schemaTO updated
- */
public void updateVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
getService(SchemaService.class).update(type, SchemaType.VIRTUAL, schemaTO.getName(), schemaTO);
}
- /**
- * Delete an already existent user derived schema by its name.
- *
- * @param name (e.g.:surname)
- */
public DerSchemaTO deleteDerSchema(final AttributableType type, final String name) {
DerSchemaTO schemaTO = getService(SchemaService.class).read(type, SchemaType.DERIVED, name);
getService(SchemaService.class).delete(type, SchemaType.DERIVED, name);
return schemaTO;
}
- /**
- * Delete an already existent user virtual schema by its name.
- *
- * @param name (e.g.:surname)
- */
+ public void createVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
+ getService(SchemaService.class).create(type, SchemaType.VIRTUAL, schemaTO);
+ }
+
+ public void updateDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
+ getService(SchemaService.class).update(type, SchemaType.DERIVED, schemaTO.getName(), schemaTO);
+ }
+
public VirSchemaTO deleteVirSchema(final AttributableType type, final String name) {
VirSchemaTO schemaTO = getService(SchemaService.class).read(type, SchemaType.VIRTUAL, name);
getService(SchemaService.class).delete(type, SchemaType.VIRTUAL, name);
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
index 3386cc4..c020765 100644
--- a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
+++ b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
@@ -39,23 +39,23 @@ public class AjaxPalettePanel<T> extends AbstractFieldPanel<List<T>> {
public AjaxPalettePanel(final String id, final IModel<List<T>> model, final ListModel<T> choices,
final boolean allowOrder) {
- this(id, model, choices, new SelectChoiceRenderer<T>(), allowOrder);
+ this(id, model, choices, new SelectChoiceRenderer<T>(), allowOrder, false);
}
public AjaxPalettePanel(final String id, final IModel<List<T>> model, final ListModel<T> choices,
- final IChoiceRenderer<T> renderer, final boolean allowOrder) {
+ final IChoiceRenderer<T> renderer, final boolean allowOrder, final boolean allowMoveAll) {
super(id, model);
- this.palette = createPalette(model, choices, renderer, allowOrder);
+ this.palette = createPalette(model, choices, renderer, allowOrder, allowMoveAll);
add(palette.setOutputMarkupId(true));
setOutputMarkupId(true);
}
protected Palette<T> createPalette(final IModel<List<T>> model, final ListModel<T> choices,
- final IChoiceRenderer<T> renderer, final boolean allowOrder) {
+ final IChoiceRenderer<T> renderer, final boolean allowOrder, final boolean allowMoveAll) {
- return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder);
+ return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder, allowMoveAll);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
index 5a602f1..6b4ab5d 100644
--- a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
+++ b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
@@ -29,18 +29,12 @@ public class NonI18nPalette<T> extends Palette<T> {
private static final long serialVersionUID = 2659070187837941889L;
public NonI18nPalette(final String id,
- final IModel<? extends Collection<? extends T>> choicesModel,
- final IChoiceRenderer<T> choiceRenderer, final int rows, final boolean allowOrder) {
-
- super(id, choicesModel, choiceRenderer, rows, allowOrder);
- }
-
- public NonI18nPalette(final String id,
final IModel<? extends List<? extends T>> model,
final IModel<? extends Collection<? extends T>> choicesModel,
- final IChoiceRenderer<T> choiceRenderer, final int rows, final boolean allowOrder) {
+ final IChoiceRenderer<T> choiceRenderer, final int rows,
+ final boolean allowOrder, final boolean allowMoveAll) {
- super(id, model, choicesModel, choiceRenderer, rows, allowOrder);
+ super(id, model, choicesModel, choiceRenderer, rows, allowOrder, allowMoveAll);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
----------------------------------------------------------------------
diff --git a/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html b/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
index 112ca49..5800d77 100644
--- a/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
+++ b/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
@@ -39,18 +39,24 @@
<select class="choicesSelect" style="min-width: 100px;" wicket:id="choices">[choices]</select>
</div>
- <div id="buttons" style="display: table-cell; width: 30px; vertical-align: middle; padding-left: 5px;">
- <div style="padding-bottom: 5px;">
- <a wicket:id="addButton"><img src="img/right-icon.png" alt="add icon"/></a>
+ <div id="buttons" style="display: table-cell; width: 30px; text-align: center; vertical-align: middle;">
+ <div style="padding-bottom: 2px;">
+ <a wicket:id="addAllButton"><img src="img/addAll.png" alt="remove icon"/></a>
</div>
- <div>
- <a wicket:id="removeButton"><img src="img/left-icon.png" alt="remove icon"/></a>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="removeAllButton"><img src="img/removeAll.png" alt="move up icon"/></a>
</div>
- <div>
- <a wicket:id="moveUpButton"><img src="img/up-icon.png" alt="move up icon"/></a>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="addButton"><img src="img/add.png" alt="add icon"/></a>
</div>
- <div style="padding-top: 5px;">
- <a wicket:id="moveDownButton"><img src="img/down-icon.png" alt="move down icon"/></a>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="removeButton"><img src="img/remove.png" alt="remove icon"/></a>
+ </div>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="moveUpButton"><img src="img/moveUp.png" alt="move up icon"/></a>
+ </div>
+ <div style="padding-top: 2px;">
+ <a wicket:id="moveDownButton"><img src="img/moveDown.png" alt="move down icon"/></a>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/add.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/add.png b/console/src/main/webapp/img/add.png
new file mode 100644
index 0000000..043aba8
Binary files /dev/null and b/console/src/main/webapp/img/add.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/addAll.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/addAll.png b/console/src/main/webapp/img/addAll.png
new file mode 100644
index 0000000..86633fc
Binary files /dev/null and b/console/src/main/webapp/img/addAll.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/moveDown.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/moveDown.png b/console/src/main/webapp/img/moveDown.png
new file mode 100644
index 0000000..d6ce523
Binary files /dev/null and b/console/src/main/webapp/img/moveDown.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/moveUp.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/moveUp.png b/console/src/main/webapp/img/moveUp.png
new file mode 100644
index 0000000..d9b2790
Binary files /dev/null and b/console/src/main/webapp/img/moveUp.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/remove.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/remove.png b/console/src/main/webapp/img/remove.png
new file mode 100644
index 0000000..de5a5cf
Binary files /dev/null and b/console/src/main/webapp/img/remove.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/removeAll.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/removeAll.png b/console/src/main/webapp/img/removeAll.png
new file mode 100644
index 0000000..f293962
Binary files /dev/null and b/console/src/main/webapp/img/removeAll.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java b/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
index 8fe7136..b64d224 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
@@ -29,8 +29,10 @@ import org.apache.syncope.core.init.ImplementationClassNamesLoader;
import org.apache.syncope.core.init.WorkflowAdapterLoader;
import org.apache.syncope.core.notification.NotificationManager;
import org.apache.syncope.core.persistence.beans.conf.CAttr;
+import org.apache.syncope.core.persistence.beans.conf.CSchema;
import org.apache.syncope.core.persistence.dao.ConfDAO;
import org.apache.syncope.core.persistence.dao.NotFoundException;
+import org.apache.syncope.core.persistence.dao.SchemaDAO;
import org.apache.syncope.core.persistence.validation.attrvalue.Validator;
import org.apache.syncope.core.rest.data.ConfigurationDataBinder;
import org.apache.syncope.core.util.ContentExporter;
@@ -48,6 +50,9 @@ public class ConfigurationController extends AbstractTransactionalController<Con
private ConfDAO confDAO;
@Autowired
+ private SchemaDAO schemaDAO;
+
+ @Autowired
private ConfigurationDataBinder binder;
@Autowired
@@ -74,12 +79,22 @@ public class ConfigurationController extends AbstractTransactionalController<Con
@PreAuthorize("isAuthenticated()")
public AttributeTO read(final String key) {
+ AttributeTO result;
+
CAttr conf = confDAO.find(key);
if (conf == null) {
- throw new NotFoundException("Configuration key " + key);
+ CSchema schema = schemaDAO.find(key, CSchema.class);
+ if (schema == null) {
+ throw new NotFoundException("Configuration key " + key);
+ }
+
+ result = new AttributeTO();
+ result.setSchema(key);
+ } else {
+ result = binder.getAttributeTO(conf);
}
- return binder.getAttributeTO(conf);
+ return result;
}
@PreAuthorize("hasRole('CONFIGURATION_SET')")
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/core/src/main/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/content.xml b/core/src/main/resources/content.xml
index af45517..827e6c9 100644
--- a/core/src/main/resources/content.xml
+++ b/core/src/main/resources/content.xml
@@ -77,7 +77,21 @@ under the License.
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CAttr id="11" owner_id="1" schema_name="log.lastlogindate"/>
<CAttrValue id="11" attribute_id="11" booleanValue="1"/>
-
+
+ <!-- For usage with admin console -->
+ <CSchema name="admin.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+
<!-- User pre-defined schemas -->
<USchema name="email" type="String"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/core/src/test/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/content.xml b/core/src/test/resources/content.xml
index b57c5cd..d5c4c99 100644
--- a/core/src/test/resources/content.xml
+++ b/core/src/test/resources/content.xml
@@ -76,6 +76,20 @@ under the License.
<CAttr id="11" owner_id="1" schema_name="log.lastlogindate"/>
<CAttrValue id="11" attribute_id="11" booleanValue="1"/>
+ <!-- For usage with admin console -->
+ <CSchema name="admin.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+
<!-- sample policies -->
<Policy DTYPE="SyncPolicy" id="1" description="global sync policy" type="GLOBAL_SYNC"
specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
[4/5] git commit: [SYNCOPE-558] Fixing ordering issue
Posted by il...@apache.org.
[SYNCOPE-558] Fixing ordering issue
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/0a768e4f
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/0a768e4f
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/0a768e4f
Branch: refs/heads/1_2_X
Commit: 0a768e4f9f95407e1ae9e370deda6789331f4dcb
Parents: 1551f17
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 24 17:02:03 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 24 17:02:03 2014 +0200
----------------------------------------------------------------------
.../common/types/ClientExceptionType.java | 1 +
.../syncope/console/commons/AttrLayoutType.java | 98 +++++++++++++++
.../syncope/console/commons/LayoutType.java | 43 -------
.../syncope/console/pages/Configuration.java | 18 +--
.../org/apache/syncope/console/pages/Login.java | 3 +-
.../pages/panels/AttrTemplatesPanel.java | 2 +-
.../console/pages/panels/AttributesPanel.java | 118 +++++++++----------
.../console/pages/panels/LayoutsPanel.java | 77 +++---------
.../console/pages/panels/ResourcesPanel.java | 6 +-
.../console/rest/ConfigurationRestClient.java | 18 +++
.../syncope/console/rest/SchemaRestClient.java | 106 ++---------------
.../markup/html/form/AjaxPalettePanel.java | 10 +-
.../wicket/markup/html/form/NonI18nPalette.java | 12 +-
.../wicket/markup/html/form/NonI18nPalette.html | 24 ++--
console/src/main/webapp/img/add.png | Bin 0 -> 814 bytes
console/src/main/webapp/img/addAll.png | Bin 0 -> 1037 bytes
console/src/main/webapp/img/moveDown.png | Bin 0 -> 833 bytes
console/src/main/webapp/img/moveUp.png | Bin 0 -> 834 bytes
console/src/main/webapp/img/remove.png | Bin 0 -> 825 bytes
console/src/main/webapp/img/removeAll.png | Bin 0 -> 1034 bytes
.../controller/ConfigurationController.java | 19 ++-
core/src/main/resources/content.xml | 16 ++-
core/src/test/resources/content.xml | 14 +++
23 files changed, 281 insertions(+), 304 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java b/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
index a4545f3..4113ff9 100644
--- a/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
+++ b/common/src/main/java/org/apache/syncope/common/types/ClientExceptionType.java
@@ -33,6 +33,7 @@ public enum ClientExceptionType {
InvalidConnInstance(Response.Status.BAD_REQUEST),
InvalidConnIdConf(Response.Status.BAD_REQUEST),
InvalidPolicy(Response.Status.BAD_REQUEST),
+ InvalidSyncopeConf(Response.Status.BAD_REQUEST),
InvalidSyncopeRole(Response.Status.BAD_REQUEST),
InvalidReportExec(Response.Status.BAD_REQUEST),
InvalidRoles(Response.Status.BAD_REQUEST),
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java b/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java
new file mode 100644
index 0000000..38a51f8
--- /dev/null
+++ b/console/src/main/java/org/apache/syncope/console/commons/AttrLayoutType.java
@@ -0,0 +1,98 @@
+/*
+ * 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.commons;
+
+import org.apache.syncope.common.types.AttributableType;
+
+public enum AttrLayoutType {
+
+ ADMIN_USER("admin.user.layout", Mode.ADMIN, AttributableType.USER),
+ SELF_USER("self.user.layout", Mode.SELF, AttributableType.USER),
+ ADMIN_ROLE("admin.role.layout", Mode.ADMIN, AttributableType.ROLE),
+ SELF_ROLE("self.role.layout", Mode.SELF, AttributableType.ROLE),
+ ADMIN_MEMBERSHIP("admin.membership.layout", Mode.ADMIN, AttributableType.MEMBERSHIP),
+ SELF_MEMBERSHIP("self.membership.layout", Mode.SELF, AttributableType.MEMBERSHIP);
+
+ private final String confKey;
+
+ private final Mode mode;
+
+ private final AttributableType attrType;
+
+ AttrLayoutType(final String confKey, final Mode mode, final AttributableType attrType) {
+ this.confKey = confKey;
+ this.mode = mode;
+ this.attrType = attrType;
+ }
+
+ public String getConfKey() {
+ return confKey;
+ }
+
+ public Mode getMode() {
+ return mode;
+ }
+
+ public AttributableType getAttrType() {
+ return attrType;
+ }
+
+ public static AttrLayoutType valueOf(final Mode mode, final AttributableType attrType) {
+ AttrLayoutType result = null;
+ if (mode == Mode.ADMIN) {
+ switch (attrType) {
+ case USER:
+ result = ADMIN_USER;
+ break;
+
+ case MEMBERSHIP:
+ result = ADMIN_MEMBERSHIP;
+ break;
+
+ case ROLE:
+ result = ADMIN_ROLE;
+ break;
+
+ default:
+ }
+ } else if (mode == Mode.SELF) {
+ switch (attrType) {
+ case USER:
+ result = SELF_USER;
+ break;
+
+ case MEMBERSHIP:
+ result = SELF_MEMBERSHIP;
+ break;
+
+ case ROLE:
+ result = SELF_ROLE;
+ break;
+
+ default:
+ }
+ }
+
+ if (result == null) {
+ throw new IllegalArgumentException("Could not find any valid instance for " + mode + " and " + attrType);
+ }
+
+ return result;
+ }
+}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java b/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java
deleted file mode 100644
index 057a1c6..0000000
--- a/console/src/main/java/org/apache/syncope/console/commons/LayoutType.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * 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.commons;
-
-public enum LayoutType {
-
- ADMIN_USER("admin.user.layout"),
- SELF_USER("self.user.layout"),
- ADMIN_ROLE("admin.role.layout"),
- SELF_ROLE("self.role.layout"),
- ADMIN_MEMBERSHIP("admin.membership.layout"),
- SELF_MEMBERSHIP("self.membership.layout");
-
- private final String parameter;
-
- LayoutType(final String parameter) {
- this.parameter = parameter;
- }
-
- public String getParameter() {
- return parameter;
- }
-
- public static LayoutType fromString(final String value) {
- return LayoutType.valueOf(value.toUpperCase());
- }
-}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/Configuration.java b/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
index 00c087b..fffe657 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/Configuration.java
@@ -36,7 +36,7 @@ import org.apache.syncope.common.to.ConfTO;
import org.apache.syncope.common.to.LoggerTO;
import org.apache.syncope.common.to.NotificationTO;
import org.apache.syncope.common.to.SecurityQuestionTO;
-import org.apache.syncope.console.commons.LayoutType;
+import org.apache.syncope.console.commons.AttrLayoutType;
import org.apache.syncope.common.types.LoggerLevel;
import org.apache.syncope.common.types.PolicyType;
import org.apache.syncope.console.commons.Constants;
@@ -245,12 +245,12 @@ public class Configuration extends BasePage {
"Configuration", "logList"));
add(consoleLoggerContainer);
- add(new LayoutsPanel("adminUserLayoutPanel", LayoutType.ADMIN_USER, feedbackPanel));
- add(new LayoutsPanel("selfUserLayoutPanel", LayoutType.SELF_USER, feedbackPanel));
- add(new LayoutsPanel("adminRoleLayoutPanel", LayoutType.ADMIN_ROLE, feedbackPanel));
- add(new LayoutsPanel("selfRoleLayoutPanel", LayoutType.SELF_ROLE, feedbackPanel));
- add(new LayoutsPanel("adminMembershipLayoutPanel", LayoutType.ADMIN_MEMBERSHIP, feedbackPanel));
- add(new LayoutsPanel("selfMembershipLayoutPanel", LayoutType.SELF_MEMBERSHIP, feedbackPanel));
+ add(new LayoutsPanel("adminUserLayoutPanel", AttrLayoutType.ADMIN_USER, feedbackPanel));
+ add(new LayoutsPanel("selfUserLayoutPanel", AttrLayoutType.SELF_USER, feedbackPanel));
+ add(new LayoutsPanel("adminRoleLayoutPanel", AttrLayoutType.ADMIN_ROLE, feedbackPanel));
+ add(new LayoutsPanel("selfRoleLayoutPanel", AttrLayoutType.SELF_ROLE, feedbackPanel));
+ add(new LayoutsPanel("adminMembershipLayoutPanel", AttrLayoutType.ADMIN_MEMBERSHIP, feedbackPanel));
+ add(new LayoutsPanel("selfMembershipLayoutPanel", AttrLayoutType.SELF_MEMBERSHIP, feedbackPanel));
}
@SuppressWarnings({ "unchecked", "rawtypes" })
@@ -264,8 +264,8 @@ public class Configuration extends BasePage {
for (Iterator<AttributeTO> it = conf.getAttrs().iterator(); it.hasNext();) {
AttributeTO attr = it.next();
- for (LayoutType type : LayoutType.values()) {
- if (type.getParameter().equals(attr.getSchema())) {
+ for (AttrLayoutType type : AttrLayoutType.values()) {
+ if (type.getConfKey().equals(attr.getSchema())) {
it.remove();
}
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/Login.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/Login.java b/console/src/main/java/org/apache/syncope/console/pages/Login.java
index 0b0bd54..d01ec41 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/Login.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/Login.java
@@ -170,8 +170,7 @@ public class Login extends WebPage {
// anonymous authentication needed for self-registration
authenticate(anonymousUser, anonymousKey);
- return new UserSelfModalPage(
- Login.this.getPageReference(), selfRegModalWin, new UserTO());
+ return new UserSelfModalPage(Login.this.getPageReference(), selfRegModalWin, new UserTO());
}
});
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
index 2d84719..d3e91db 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
@@ -96,7 +96,7 @@ public class AttrTemplatesPanel extends Panel {
ListModel<String> availableSchemas = new ListModel<String>(allSchemas);
return new NonI18nPalette<String>(type.name(), new PropertyModel<List<String>>(roleTO, type.name()),
- availableSchemas, new SelectChoiceRenderer<String>(), 8, false) {
+ availableSchemas, new SelectChoiceRenderer<String>(), 8, false, true) {
private static final long serialVersionUID = 2295567122085510330L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
index 9fc33d7..c59658f 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
@@ -20,6 +20,8 @@ package org.apache.syncope.console.pages.panels;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
@@ -42,7 +44,7 @@ import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.common.types.AttributeSchemaType;
import org.apache.syncope.console.commons.JexlHelpUtil;
-import org.apache.syncope.console.commons.LayoutType;
+import org.apache.syncope.console.commons.AttrLayoutType;
import org.apache.syncope.console.commons.Mode;
import org.apache.syncope.console.markup.html.list.AltListView;
import org.apache.syncope.console.pages.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
@@ -65,7 +67,6 @@ import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.IChoiceRenderer;
import org.apache.wicket.markup.html.list.ListItem;
-import org.apache.wicket.markup.html.list.ListView;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
@@ -90,8 +91,6 @@ public class AttributesPanel extends Panel {
private final AttrTemplatesPanel attrTemplates;
- private AttributeTO confAttributeTO;
-
private Map<String, SchemaTO> schemas = new LinkedHashMap<String, SchemaTO>();
public <T extends AbstractAttributableTO> AttributesPanel(final String id, final T entityTO, final Form form,
@@ -112,41 +111,38 @@ public class AttributesPanel extends Panel {
setSchemas();
setAttrs();
- final ListView<AttributeTO> attributeView = new AltListView<AttributeTO>("schemas",
- new PropertyModel<List<? extends AttributeTO>>(entityTO, "attrs")) {
+ add(new AltListView<AttributeTO>("schemas", new PropertyModel<List<? extends AttributeTO>>(entityTO, "attrs")) {
- private static final long serialVersionUID = 9101744072914090143L;
+ private static final long serialVersionUID = 9101744072914090143L;
- @Override
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected void populateItem(final ListItem<AttributeTO> item) {
- final AttributeTO attributeTO = (AttributeTO) item.getDefaultModelObject();
+ @Override
+ @SuppressWarnings({ "unchecked", "rawtypes" })
+ protected void populateItem(final ListItem<AttributeTO> item) {
+ final AttributeTO attributeTO = (AttributeTO) item.getDefaultModelObject();
- final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
+ final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");
- final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp,
- "questionMarkJexlHelp");
- item.add(questionMarkJexlHelp);
- questionMarkJexlHelp.add(jexlHelp);
+ final AjaxLink<Void> questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
+ item.add(questionMarkJexlHelp);
+ questionMarkJexlHelp.add(jexlHelp);
- if (mode != Mode.TEMPLATE) {
- questionMarkJexlHelp.setVisible(false);
- }
+ if (mode != Mode.TEMPLATE) {
+ questionMarkJexlHelp.setVisible(false);
+ }
- item.add(new Label("name", attributeTO.getSchema()));
+ item.add(new Label("name", attributeTO.getSchema()));
- final FieldPanel panel = getFieldPanel(schemas.get(attributeTO.getSchema()), form, attributeTO);
+ final FieldPanel panel = getFieldPanel(schemas.get(attributeTO.getSchema()), form, attributeTO);
- if (mode == Mode.TEMPLATE || !schemas.get(attributeTO.getSchema()).isMultivalue()) {
- item.add(panel);
- } else {
- item.add(new MultiFieldPanel<String>(
- "panel", new PropertyModel<List<String>>(attributeTO, "values"), panel));
- }
- }
- };
-
- add(attributeView);
+ if (mode == Mode.TEMPLATE || !schemas.get(attributeTO.getSchema()).isMultivalue()) {
+ item.add(panel);
+ } else {
+ item.add(new MultiFieldPanel<String>(
+ "panel", new PropertyModel<List<String>>(attributeTO, "values"), panel));
+ }
+ }
+ }
+ );
}
private void filter(final List<SchemaTO> schemaTOs, final Collection<String> allowed) {
@@ -159,12 +155,13 @@ public class AttributesPanel extends Panel {
}
private void setSchemas() {
+ AttributeTO attrLayout = null;
List<SchemaTO> schemaTOs;
if (entityTO instanceof RoleTO) {
final RoleTO roleTO = (RoleTO) entityTO;
- setLayoutConfiguration(mode, AttributableType.ROLE);
+ attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.ROLE));
schemaTOs = schemaRestClient.getSchemas(AttributableType.ROLE);
Set<String> allowed;
if (attrTemplates == null) {
@@ -177,11 +174,11 @@ public class AttributesPanel extends Panel {
}
filter(schemaTOs, allowed);
} else if (entityTO instanceof UserTO) {
+ attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.USER));
schemaTOs = schemaRestClient.getSchemas(AttributableType.USER);
- setLayoutConfiguration(mode, AttributableType.USER);
} else if (entityTO instanceof MembershipTO) {
+ attrLayout = confRestClient.readAttrLayout(AttrLayoutType.valueOf(mode, AttributableType.MEMBERSHIP));
schemaTOs = schemaRestClient.getSchemas(AttributableType.MEMBERSHIP);
- setLayoutConfiguration(mode, AttributableType.MEMBERSHIP);
Set<String> allowed = new HashSet<String>(
roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMAttrTemplates());
filter(schemaTOs, allowed);
@@ -190,8 +187,8 @@ public class AttributesPanel extends Panel {
schemaTOs = schemaRestClient.getSchemas(AttributableType.CONFIGURATION);
for (Iterator<SchemaTO> it = schemaTOs.iterator(); it.hasNext();) {
SchemaTO schemaTO = it.next();
- for (LayoutType type : LayoutType.values()) {
- if (type.getParameter().equals(schemaTO.getName())) {
+ for (AttrLayoutType type : AttrLayoutType.values()) {
+ if (type.getConfKey().equals(schemaTO.getName())) {
it.remove();
}
}
@@ -200,30 +197,32 @@ public class AttributesPanel extends Panel {
schemas.clear();
- if (confAttributeTO != null && mode != Mode.TEMPLATE && !(entityTO instanceof ConfTO)) {
- filter(schemaTOs, confAttributeTO.getValues());
- }
- for (SchemaTO schemaTO : schemaTOs) {
- schemas.put(schemaTO.getName(), schemaTO);
- }
- }
+ if (attrLayout != null && mode != Mode.TEMPLATE && !(entityTO instanceof ConfTO)) {
+ // 1. remove attributes not selected for display
+ filter(schemaTOs, attrLayout.getValues());
+ // 2. sort remainig attributes according to configuration, e.g. attrLayout
+ final Map<String, Integer> attrLayoutMap = new HashMap<String, Integer>(attrLayout.getValues().size());
+ for (int i = 0; i < attrLayout.getValues().size(); i++) {
+ attrLayoutMap.put(attrLayout.getValues().get(i), i);
+ }
+ Collections.sort(schemaTOs, new Comparator<SchemaTO>() {
- private void setLayoutConfiguration(final Mode mode, final AttributableType type) {
- switch (type) {
- case ROLE:
- confAttributeTO = confRestClient.read(mode == Mode.ADMIN
- ? LayoutType.ADMIN_ROLE.getParameter() : LayoutType.SELF_ROLE.getParameter());
- break;
+ @Override
+ public int compare(final SchemaTO schema1, final SchemaTO schema2) {
+ int value = 0;
- case MEMBERSHIP:
- confAttributeTO = confRestClient.read(mode == Mode.ADMIN
- ? LayoutType.ADMIN_MEMBERSHIP.getParameter() : LayoutType.SELF_MEMBERSHIP.getParameter());
- break;
+ if (attrLayoutMap.get(schema1.getName()) > attrLayoutMap.get(schema2.getName())) {
+ value = 1;
+ } else if (attrLayoutMap.get(schema1.getName()) < attrLayoutMap.get(schema2.getName())) {
+ value = -1;
+ }
- case USER:
- default:
- confAttributeTO = confRestClient.read(mode == Mode.ADMIN
- ? LayoutType.ADMIN_USER.getParameter() : LayoutType.SELF_USER.getParameter());
+ return value;
+ }
+ });
+ }
+ for (SchemaTO schemaTO : schemaTOs) {
+ schemas.put(schemaTO.getName(), schemaTO);
}
}
@@ -253,8 +252,9 @@ public class AttributesPanel extends Panel {
@SuppressWarnings({ "rawtypes", "unchecked" })
private FieldPanel getFieldPanel(final SchemaTO schemaTO, final Form form, final AttributeTO attributeTO) {
- final boolean required = mode == Mode.TEMPLATE ? false : schemaTO.getMandatoryCondition().equalsIgnoreCase(
- "true");
+ final boolean required = mode == Mode.TEMPLATE
+ ? false
+ : schemaTO.getMandatoryCondition().equalsIgnoreCase("true");
final boolean readOnly = mode == Mode.TEMPLATE ? false : schemaTO.isReadonly();
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
index c061ea9..07b0bf8 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/LayoutsPanel.java
@@ -18,14 +18,11 @@
*/
package org.apache.syncope.console.pages.panels;
-import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.common.to.AttributeTO;
-import org.apache.syncope.common.to.SchemaTO;
-import org.apache.syncope.common.types.AttributableType;
-import org.apache.syncope.common.types.AttributeSchemaType;
-import org.apache.syncope.console.commons.LayoutType;
+import org.apache.syncope.console.commons.AttrLayoutType;
import org.apache.syncope.console.commons.Constants;
+import org.apache.syncope.console.commons.SelectChoiceRenderer;
import org.apache.syncope.console.commons.XMLRolesReader;
import org.apache.syncope.console.rest.ConfigurationRestClient;
import org.apache.syncope.console.rest.SchemaRestClient;
@@ -66,7 +63,7 @@ public class LayoutsPanel extends Panel {
private ConfigurationRestClient confRestClient;
@SuppressWarnings("unchecked")
- public LayoutsPanel(final String id, final LayoutType layoutType, final NotificationPanel feedbackPanel) {
+ public LayoutsPanel(final String id, final AttrLayoutType attrLayoutType, final NotificationPanel feedbackPanel) {
super(id);
final WebMarkupContainer container = new WebMarkupContainer("container");
@@ -75,28 +72,16 @@ public class LayoutsPanel extends Panel {
final Form<String> form = new Form<String>("form");
form.setOutputMarkupId(true);
- final AttributableType type;
- final AttributeTO attributeTO;
- if (layoutType == LayoutType.ADMIN_USER || layoutType == layoutType.SELF_USER) {
- attributeTO = getConfiguration(layoutType, AttributableType.USER);
- type = AttributableType.USER;
- } else if (layoutType == LayoutType.ADMIN_ROLE || layoutType == layoutType.SELF_ROLE) {
- attributeTO = getConfiguration(layoutType, AttributableType.ROLE);
- type = AttributableType.ROLE;
- } else {
- attributeTO = getConfiguration(layoutType, AttributableType.MEMBERSHIP);
- type = AttributableType.MEMBERSHIP;
- }
-
- form.setModel(new CompoundPropertyModel(attributeTO.getValues()));
-
- final List<String> fields = getAllFields(type);
-
- final ListModel<String> selectedFields = new ListModel<String>(!attributeTO.getValues().isEmpty()
- ? attributeTO.getValues() : fields);
+ final AttributeTO attrLayout = confRestClient.readAttrLayout(attrLayoutType);
+ form.setModel(new CompoundPropertyModel(attrLayout.getValues()));
+
+ final List<String> fields = schemaRestClient.getSchemaNames(attrLayoutType.getAttrType());
+ final ListModel<String> selectedFields =
+ new ListModel<String>(attrLayout.getValues().isEmpty() ? fields : attrLayout.getValues());
final ListModel<String> availableFields = new ListModel<String>(fields);
- form.add(new AjaxPalettePanel<String>("fields", selectedFields, availableFields, true));
+ form.add(new AjaxPalettePanel<String>("fields", selectedFields, availableFields,
+ new SelectChoiceRenderer<String>(), true, true));
final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(APPLY)) {
@@ -105,18 +90,10 @@ public class LayoutsPanel extends Panel {
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
try {
- if (schemaRestClient.readSchema(
- AttributableType.CONFIGURATION, layoutType.getParameter()) == null) {
- final SchemaTO confSchemaTO = new SchemaTO();
- confSchemaTO.setName(layoutType.getParameter());
- confSchemaTO.setMultivalue(true);
- confSchemaTO.setType(AttributeSchemaType.String);
- schemaRestClient.createSchema(AttributableType.CONFIGURATION, confSchemaTO);
- }
- confRestClient.set(attributeTO);
+ confRestClient.set(attrLayout);
info(getString(Constants.OPERATION_SUCCEEDED));
} catch (Exception e) {
- LOG.error("While save layout configuration", e);
+ LOG.error("While saving layout configuration", e);
error(getString(Constants.ERROR) + ": " + e.getMessage());
}
feedbackPanel.refresh(target);
@@ -124,8 +101,7 @@ public class LayoutsPanel extends Panel {
@Override
protected void onError(final AjaxRequestTarget target, final Form<?> form) {
- LOG.error("While save layout configuration");
- error(getString(Constants.ERROR) + ": While save layout configuration");
+ error(getString(Constants.ERROR) + ": While saving layout configuration");
feedbackPanel.refresh(target);
}
};
@@ -151,29 +127,4 @@ public class LayoutsPanel extends Panel {
container.add(form);
add(container);
}
-
- private AttributeTO getConfiguration(final LayoutType layoutType, final AttributableType type) {
- AttributeTO attributeTO = null;
- try {
- attributeTO = confRestClient.read(layoutType.getParameter());
- } catch (Exception e) {
- // ignore
- }
-
- if (attributeTO == null) {
- attributeTO = new AttributeTO();
- attributeTO.setSchema(layoutType.getParameter());
- attributeTO.getValues().addAll(getAllFields(type));
- }
-
- return attributeTO;
- }
-
- private List<String> getAllFields(final AttributableType type) {
- final List<String> fields = new ArrayList<String>();
- for (SchemaTO item : schemaRestClient.getSchemas(type)) {
- fields.add(item.getName());
- }
- return fields;
- }
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java b/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
index bf29a5b..a4ab67f 100644
--- a/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
+++ b/console/src/main/java/org/apache/syncope/console/pages/panels/ResourcesPanel.java
@@ -125,15 +125,15 @@ public class ResourcesPanel extends Panel {
public AjaxRecordingPalettePanel(final String id, final IModel<List<T>> model, final ListModel<T> choices,
final StatusPanel statusPanel) {
- super(id, model, choices, new SelectChoiceRenderer<T>(), false);
+ super(id, model, choices, new SelectChoiceRenderer<T>(), false, false);
this.statusPanel = statusPanel;
}
@Override
protected Palette<T> createPalette(final IModel<List<T>> model, final ListModel<T> choices,
- final IChoiceRenderer<T> renderer, final boolean allowOrder) {
+ final IChoiceRenderer<T> renderer, final boolean allowOrder, final boolean allowMoveAll) {
- return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder) {
+ return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder, false) {
private static final long serialVersionUID = -3415146226879212841L;
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java b/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
index e3bedce..2576a60 100644
--- a/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
+++ b/console/src/main/java/org/apache/syncope/console/rest/ConfigurationRestClient.java
@@ -27,6 +27,8 @@ import org.apache.syncope.common.to.AttributeTO;
import org.apache.syncope.common.to.ConfTO;
import org.apache.syncope.common.util.CollectionWrapper;
import org.apache.syncope.common.wrap.MailTemplate;
+import org.apache.syncope.console.commons.AttrLayoutType;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
@@ -34,6 +36,9 @@ public class ConfigurationRestClient extends BaseRestClient {
private static final long serialVersionUID = 7692363064029538722L;
+ @Autowired
+ private SchemaRestClient schemaRestClient;
+
public ConfTO list() {
return getService(ConfigurationService.class).list();
}
@@ -47,6 +52,19 @@ public class ConfigurationRestClient extends BaseRestClient {
return null;
}
+ public AttributeTO readAttrLayout(final AttrLayoutType type) {
+ AttributeTO attrLayout = read(type.getConfKey());
+ if (attrLayout == null) {
+ attrLayout = new AttributeTO();
+ attrLayout.setSchema(type.getConfKey());
+ }
+ if (attrLayout.getValues().isEmpty()) {
+ attrLayout.getValues().addAll(schemaRestClient.getSchemaNames(type.getAttrType()));
+ }
+
+ return attrLayout;
+ }
+
public void set(final AttributeTO attributeTO) {
getService(ConfigurationService.class).set(attributeTO.getSchema(), attributeTO);
}
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java b/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
index 64402db..023d3fa 100644
--- a/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
+++ b/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
@@ -55,11 +55,6 @@ public class SchemaRestClient extends BaseRestClient {
return schemas;
}
- /**
- * Get schemas.
- *
- * @return List of schemas.
- */
public List<SchemaTO> getSchemas(final AttributableType type) {
List<SchemaTO> schemas = null;
@@ -87,11 +82,6 @@ public class SchemaRestClient extends BaseRestClient {
return schemaNames;
}
- /**
- * Get schema names.
- *
- * @return List of schema names.
- */
public List<String> getSchemaNames(final AttributableType type) {
final List<String> schemaNames = new ArrayList<String>();
@@ -107,12 +97,6 @@ public class SchemaRestClient extends BaseRestClient {
return schemaNames;
}
- /**
- * Get derived schemas.
- *
- * @return List of derived schemas.
- */
- @SuppressWarnings("unchecked")
public List<DerSchemaTO> getDerSchemas(final AttributableType type) {
List<DerSchemaTO> userDerSchemas = null;
@@ -125,11 +109,6 @@ public class SchemaRestClient extends BaseRestClient {
return userDerSchemas;
}
- /**
- * Get derived schema names.
- *
- * @return List of derived schema names.
- */
public List<String> getDerSchemaNames(final AttributableType type) {
final List<String> userDerSchemasNames = new ArrayList<String>();
@@ -146,12 +125,6 @@ public class SchemaRestClient extends BaseRestClient {
return userDerSchemasNames;
}
- /**
- * Get virtual schemas.
- *
- * @return List of virtual schemas.
- */
- @SuppressWarnings("unchecked")
public List<VirSchemaTO> getVirSchemas(final AttributableType type) {
List<VirSchemaTO> userVirSchemas = null;
@@ -164,11 +137,6 @@ public class SchemaRestClient extends BaseRestClient {
return userVirSchemas;
}
- /**
- * Get virtual schema names.
- *
- * @return List of virtual schema names.
- */
public List<String> getVirSchemaNames(final AttributableType type) {
final List<String> userVirSchemasNames = new ArrayList<String>();
@@ -185,21 +153,10 @@ public class SchemaRestClient extends BaseRestClient {
return userVirSchemasNames;
}
- /**
- * Create new user schema.
- *
- * @param schemaTO
- */
public void createSchema(final AttributableType type, final SchemaTO schemaTO) {
getService(SchemaService.class).create(type, SchemaType.NORMAL, schemaTO);
}
- /**
- * Load an already existent user schema by its name.
- *
- * @param name (e.g.:surname)
- * @return schemaTO
- */
public SchemaTO readSchema(final AttributableType type, final String name) {
SchemaTO schema = null;
@@ -211,51 +168,20 @@ public class SchemaRestClient extends BaseRestClient {
return schema;
}
- /**
- * Update an already existent user schema.
- *
- * @param schemaTO updated
- */
public void updateSchema(final AttributableType type, final SchemaTO schemaTO) {
getService(SchemaService.class).update(type, SchemaType.NORMAL, schemaTO.getName(), schemaTO);
}
- /**
- * Delete an already existent user schema by its name.
- *
- * @param name (e.g.:surname)
- * @return schemaTO
- */
public SchemaTO deleteSchema(final AttributableType type, final String name) {
SchemaTO response = getService(SchemaService.class).read(type, SchemaType.NORMAL, name);
getService(SchemaService.class).delete(type, SchemaType.NORMAL, name);
return response;
}
- /**
- * Create new derived user schema.
- *
- * @param schemaTO
- */
public void createDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
getService(SchemaService.class).create(type, SchemaType.DERIVED, schemaTO);
}
- /**
- * Create new derived user schema.
- *
- * @param schemaTO
- */
- public void createVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
- getService(SchemaService.class).create(type, SchemaType.VIRTUAL, schemaTO);
- }
-
- /**
- * Load an already existent user derived schema by its name.
- *
- * @param name (e.g.:surname)
- * @return DerSchemaTO
- */
public DerSchemaTO readDerSchema(final AttributableType type, final String name) {
DerSchemaTO derivedSchemaTO = null;
try {
@@ -266,40 +192,24 @@ public class SchemaRestClient extends BaseRestClient {
return derivedSchemaTO;
}
- /**
- * Update an already existent user derived schema.
- *
- * @param schemaTO updated
- */
- public void updateDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
- getService(SchemaService.class).update(type, SchemaType.DERIVED, schemaTO.getName(), schemaTO);
- }
-
- /**
- * Update an already existent user derived schema.
- *
- * @param schemaTO updated
- */
public void updateVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
getService(SchemaService.class).update(type, SchemaType.VIRTUAL, schemaTO.getName(), schemaTO);
}
- /**
- * Delete an already existent user derived schema by its name.
- *
- * @param name (e.g.:surname)
- */
public DerSchemaTO deleteDerSchema(final AttributableType type, final String name) {
DerSchemaTO schemaTO = getService(SchemaService.class).read(type, SchemaType.DERIVED, name);
getService(SchemaService.class).delete(type, SchemaType.DERIVED, name);
return schemaTO;
}
- /**
- * Delete an already existent user virtual schema by its name.
- *
- * @param name (e.g.:surname)
- */
+ public void createVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
+ getService(SchemaService.class).create(type, SchemaType.VIRTUAL, schemaTO);
+ }
+
+ public void updateDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
+ getService(SchemaService.class).update(type, SchemaType.DERIVED, schemaTO.getName(), schemaTO);
+ }
+
public VirSchemaTO deleteVirSchema(final AttributableType type, final String name) {
VirSchemaTO schemaTO = getService(SchemaService.class).read(type, SchemaType.VIRTUAL, name);
getService(SchemaService.class).delete(type, SchemaType.VIRTUAL, name);
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
index 3386cc4..c020765 100644
--- a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
+++ b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
@@ -39,23 +39,23 @@ public class AjaxPalettePanel<T> extends AbstractFieldPanel<List<T>> {
public AjaxPalettePanel(final String id, final IModel<List<T>> model, final ListModel<T> choices,
final boolean allowOrder) {
- this(id, model, choices, new SelectChoiceRenderer<T>(), allowOrder);
+ this(id, model, choices, new SelectChoiceRenderer<T>(), allowOrder, false);
}
public AjaxPalettePanel(final String id, final IModel<List<T>> model, final ListModel<T> choices,
- final IChoiceRenderer<T> renderer, final boolean allowOrder) {
+ final IChoiceRenderer<T> renderer, final boolean allowOrder, final boolean allowMoveAll) {
super(id, model);
- this.palette = createPalette(model, choices, renderer, allowOrder);
+ this.palette = createPalette(model, choices, renderer, allowOrder, allowMoveAll);
add(palette.setOutputMarkupId(true));
setOutputMarkupId(true);
}
protected Palette<T> createPalette(final IModel<List<T>> model, final ListModel<T> choices,
- final IChoiceRenderer<T> renderer, final boolean allowOrder) {
+ final IChoiceRenderer<T> renderer, final boolean allowOrder, final boolean allowMoveAll) {
- return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder);
+ return new NonI18nPalette<T>("paletteField", model, choices, renderer, 8, allowOrder, allowMoveAll);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
----------------------------------------------------------------------
diff --git a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
index 5a602f1..6b4ab5d 100644
--- a/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
+++ b/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.java
@@ -29,18 +29,12 @@ public class NonI18nPalette<T> extends Palette<T> {
private static final long serialVersionUID = 2659070187837941889L;
public NonI18nPalette(final String id,
- final IModel<? extends Collection<? extends T>> choicesModel,
- final IChoiceRenderer<T> choiceRenderer, final int rows, final boolean allowOrder) {
-
- super(id, choicesModel, choiceRenderer, rows, allowOrder);
- }
-
- public NonI18nPalette(final String id,
final IModel<? extends List<? extends T>> model,
final IModel<? extends Collection<? extends T>> choicesModel,
- final IChoiceRenderer<T> choiceRenderer, final int rows, final boolean allowOrder) {
+ final IChoiceRenderer<T> choiceRenderer, final int rows,
+ final boolean allowOrder, final boolean allowMoveAll) {
- super(id, model, choicesModel, choiceRenderer, rows, allowOrder);
+ super(id, model, choicesModel, choiceRenderer, rows, allowOrder, allowMoveAll);
}
@Override
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
----------------------------------------------------------------------
diff --git a/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html b/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
index 112ca49..5800d77 100644
--- a/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
+++ b/console/src/main/resources/org/apache/syncope/console/wicket/markup/html/form/NonI18nPalette.html
@@ -39,18 +39,24 @@
<select class="choicesSelect" style="min-width: 100px;" wicket:id="choices">[choices]</select>
</div>
- <div id="buttons" style="display: table-cell; width: 30px; vertical-align: middle; padding-left: 5px;">
- <div style="padding-bottom: 5px;">
- <a wicket:id="addButton"><img src="img/right-icon.png" alt="add icon"/></a>
+ <div id="buttons" style="display: table-cell; width: 30px; text-align: center; vertical-align: middle;">
+ <div style="padding-bottom: 2px;">
+ <a wicket:id="addAllButton"><img src="img/addAll.png" alt="remove icon"/></a>
</div>
- <div>
- <a wicket:id="removeButton"><img src="img/left-icon.png" alt="remove icon"/></a>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="removeAllButton"><img src="img/removeAll.png" alt="move up icon"/></a>
</div>
- <div>
- <a wicket:id="moveUpButton"><img src="img/up-icon.png" alt="move up icon"/></a>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="addButton"><img src="img/add.png" alt="add icon"/></a>
</div>
- <div style="padding-top: 5px;">
- <a wicket:id="moveDownButton"><img src="img/down-icon.png" alt="move down icon"/></a>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="removeButton"><img src="img/remove.png" alt="remove icon"/></a>
+ </div>
+ <div style="padding-top: 2px; padding-bottom: 2px;">
+ <a wicket:id="moveUpButton"><img src="img/moveUp.png" alt="move up icon"/></a>
+ </div>
+ <div style="padding-top: 2px;">
+ <a wicket:id="moveDownButton"><img src="img/moveDown.png" alt="move down icon"/></a>
</div>
</div>
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/add.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/add.png b/console/src/main/webapp/img/add.png
new file mode 100644
index 0000000..043aba8
Binary files /dev/null and b/console/src/main/webapp/img/add.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/addAll.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/addAll.png b/console/src/main/webapp/img/addAll.png
new file mode 100644
index 0000000..86633fc
Binary files /dev/null and b/console/src/main/webapp/img/addAll.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/moveDown.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/moveDown.png b/console/src/main/webapp/img/moveDown.png
new file mode 100644
index 0000000..d6ce523
Binary files /dev/null and b/console/src/main/webapp/img/moveDown.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/moveUp.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/moveUp.png b/console/src/main/webapp/img/moveUp.png
new file mode 100644
index 0000000..d9b2790
Binary files /dev/null and b/console/src/main/webapp/img/moveUp.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/remove.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/remove.png b/console/src/main/webapp/img/remove.png
new file mode 100644
index 0000000..de5a5cf
Binary files /dev/null and b/console/src/main/webapp/img/remove.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/console/src/main/webapp/img/removeAll.png
----------------------------------------------------------------------
diff --git a/console/src/main/webapp/img/removeAll.png b/console/src/main/webapp/img/removeAll.png
new file mode 100644
index 0000000..f293962
Binary files /dev/null and b/console/src/main/webapp/img/removeAll.png differ
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java b/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
index 8fe7136..b64d224 100644
--- a/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
+++ b/core/src/main/java/org/apache/syncope/core/rest/controller/ConfigurationController.java
@@ -29,8 +29,10 @@ import org.apache.syncope.core.init.ImplementationClassNamesLoader;
import org.apache.syncope.core.init.WorkflowAdapterLoader;
import org.apache.syncope.core.notification.NotificationManager;
import org.apache.syncope.core.persistence.beans.conf.CAttr;
+import org.apache.syncope.core.persistence.beans.conf.CSchema;
import org.apache.syncope.core.persistence.dao.ConfDAO;
import org.apache.syncope.core.persistence.dao.NotFoundException;
+import org.apache.syncope.core.persistence.dao.SchemaDAO;
import org.apache.syncope.core.persistence.validation.attrvalue.Validator;
import org.apache.syncope.core.rest.data.ConfigurationDataBinder;
import org.apache.syncope.core.util.ContentExporter;
@@ -48,6 +50,9 @@ public class ConfigurationController extends AbstractTransactionalController<Con
private ConfDAO confDAO;
@Autowired
+ private SchemaDAO schemaDAO;
+
+ @Autowired
private ConfigurationDataBinder binder;
@Autowired
@@ -74,12 +79,22 @@ public class ConfigurationController extends AbstractTransactionalController<Con
@PreAuthorize("isAuthenticated()")
public AttributeTO read(final String key) {
+ AttributeTO result;
+
CAttr conf = confDAO.find(key);
if (conf == null) {
- throw new NotFoundException("Configuration key " + key);
+ CSchema schema = schemaDAO.find(key, CSchema.class);
+ if (schema == null) {
+ throw new NotFoundException("Configuration key " + key);
+ }
+
+ result = new AttributeTO();
+ result.setSchema(key);
+ } else {
+ result = binder.getAttributeTO(conf);
}
- return binder.getAttributeTO(conf);
+ return result;
}
@PreAuthorize("hasRole('CONFIGURATION_SET')")
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/core/src/main/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/src/main/resources/content.xml b/core/src/main/resources/content.xml
index af45517..827e6c9 100644
--- a/core/src/main/resources/content.xml
+++ b/core/src/main/resources/content.xml
@@ -77,7 +77,21 @@ under the License.
mandatoryCondition="true" multivalue="0" uniqueConstraint="0" readonly="0"/>
<CAttr id="11" owner_id="1" schema_name="log.lastlogindate"/>
<CAttrValue id="11" attribute_id="11" booleanValue="1"/>
-
+
+ <!-- For usage with admin console -->
+ <CSchema name="admin.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+
<!-- User pre-defined schemas -->
<USchema name="email" type="String"
mandatoryCondition="false" multivalue="0" uniqueConstraint="0" readonly="0"
http://git-wip-us.apache.org/repos/asf/syncope/blob/0a768e4f/core/src/test/resources/content.xml
----------------------------------------------------------------------
diff --git a/core/src/test/resources/content.xml b/core/src/test/resources/content.xml
index b57c5cd..d5c4c99 100644
--- a/core/src/test/resources/content.xml
+++ b/core/src/test/resources/content.xml
@@ -76,6 +76,20 @@ under the License.
<CAttr id="11" owner_id="1" schema_name="log.lastlogindate"/>
<CAttrValue id="11" attribute_id="11" booleanValue="1"/>
+ <!-- For usage with admin console -->
+ <CSchema name="admin.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.user.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.role.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="admin.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+ <CSchema name="self.membership.layout" type="String"
+ mandatoryCondition="false" multivalue="1" uniqueConstraint="0" readonly="0"/>
+
<!-- sample policies -->
<Policy DTYPE="SyncPolicy" id="1" description="global sync policy" type="GLOBAL_SYNC"
specification='{"userJavaRule":null,"roleJavaRule":null,"conflictResolutionAction":"IGNORE","userAltSearchSchemas":[],"roleAltSearchSchemas":[]}'/>
[2/5] git commit: Some deps upgrades: log4j, aspectj, selenium
Posted by il...@apache.org.
Some deps upgrades: log4j, aspectj, selenium
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo
Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1551f170
Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1551f170
Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1551f170
Branch: refs/heads/master
Commit: 1551f1704184c6f7d35165f65cc537a8e3dc91c2
Parents: 7c714f3
Author: Francesco Chicchiriccò <il...@apache.org>
Authored: Fri Oct 24 17:01:39 2014 +0200
Committer: Francesco Chicchiriccò <il...@apache.org>
Committed: Fri Oct 24 17:01:39 2014 +0200
----------------------------------------------------------------------
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/syncope/blob/1551f170/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index ee4d4a7..d7315e3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -323,7 +323,7 @@ under the License.
<activiti.version>5.16.4</activiti.version>
- <aspectj.version>1.8.2</aspectj.version>
+ <aspectj.version>1.8.3</aspectj.version>
<cxf.version>3.0.2</cxf.version>
<spring.version>4.0.7.RELEASE</spring.version>
@@ -346,12 +346,12 @@ under the License.
<h2.version>1.4.182</h2.version>
- <log4j.version>2.0</log4j.version>
+ <log4j.version>2.1</log4j.version>
<slf4j.version>1.7.7</slf4j.version>
<disruptor.version>3.3.0</disruptor.version>
<junit.version>4.11</junit.version>
- <selenium.version>2.43.1</selenium.version>
+ <selenium.version>2.44.0</selenium.version>
<apacheds.version>1.5.7</apacheds.version>