Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/UserModalPage.java Thu Oct 10 14:37:56 2013
@@ -117,19 +117,19 @@ public abstract class UserModalPage exte
//--------------------------------
// Attributes panel
//--------------------------------
- form.add(new AttributesPanel("attributes", userTO, form, mode == Mode.TEMPLATE));
+ form.add(new AttributesPanel("attrs", userTO, form, mode == Mode.TEMPLATE));
//--------------------------------
//--------------------------------
// Derived attributes panel
//--------------------------------
- form.add(new DerivedAttributesPanel("derivedAttributes", userTO));
+ form.add(new DerivedAttributesPanel("derAttrs", userTO));
//--------------------------------
//--------------------------------
// Virtual attributes panel
//--------------------------------
- form.add(new VirtualAttributesPanel("virtualAttributes", userTO, mode == Mode.TEMPLATE));
+ form.add(new VirtualAttributesPanel("virAttrs", userTO, mode == Mode.TEMPLATE));
//--------------------------------
//--------------------------------
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/VirtualSchemaModalPage.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/VirtualSchemaModalPage.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/VirtualSchemaModalPage.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/VirtualSchemaModalPage.java Thu Oct 10 14:37:56 2013
@@ -77,9 +77,9 @@ public class VirtualSchemaModalPage exte
VirSchemaTO schemaTO = (VirSchemaTO) form.getDefaultModelObject();
try {
if (createFlag) {
- schemaRestClient.createVirtualSchema(kind, schemaTO);
+ schemaRestClient.createVirSchema(kind, schemaTO);
} else {
- schemaRestClient.updateVirtualSchema(kind, schemaTO);
+ schemaRestClient.updateVirSchema(kind, schemaTO);
}
if (pageRef.getPage() instanceof BasePage) {
((BasePage) pageRef.getPage()).setModalResult(true);
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AbstractSearchPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AbstractSearchPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AbstractSearchPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AbstractSearchPanel.java Thu Oct 10 14:37:56 2013
@@ -59,7 +59,7 @@ public abstract class AbstractSearchPane
*/
protected static final Logger LOG = LoggerFactory.getLogger(AbstractSearchPanel.class);
- protected static final String[] ATTRIBUTES_NOTINCLUDED = {"attributes", "derivedAttributes", "virtualAttributes",
+ protected static final String[] ATTRIBUTES_NOTINCLUDED = {"attrs", "derAttrs", "virAttrs",
"serialVersionUID", "memberships", "entitlements", "resources", "password",
"propagationTOs", "propagationStatusMap"};
Added: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java?rev=1531003&view=auto
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java (added)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java Thu Oct 10 14:37:56 2013
@@ -0,0 +1,171 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.syncope.console.pages.panels;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import org.apache.syncope.common.to.RoleTO;
+import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.common.types.SchemaType;
+import org.apache.syncope.console.commons.Constants;
+import org.apache.syncope.console.commons.SelectChoiceRenderer;
+import org.apache.syncope.console.rest.RoleRestClient;
+import org.apache.syncope.console.rest.SchemaRestClient;
+import org.apache.syncope.console.wicket.markup.html.form.NonI18nPalette;
+import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
+import org.apache.wicket.event.Broadcast;
+import org.apache.wicket.extensions.markup.html.form.palette.component.Recorder;
+import org.apache.wicket.markup.html.panel.Panel;
+import org.apache.wicket.model.PropertyModel;
+import org.apache.wicket.model.util.ListModel;
+import org.apache.wicket.spring.injection.annot.SpringBean;
+
+public class AttrTemplatesPanel extends Panel {
+
+ public enum Type {
+
+ rAttrTemplates,
+ rDerAttrTemplates,
+ rVirAttrTemplates,
+ mAttrTemplates,
+ mDerAttrTemplates,
+ mVirAttrTemplates;
+
+ }
+
+ private static final long serialVersionUID = 1016028222120619000L;
+
+ @SpringBean
+ private SchemaRestClient schemaRestClient;
+
+ @SpringBean
+ private RoleRestClient roleRestClient;
+
+ private final RoleTO roleTO;
+
+ private final NonI18nPalette<String> rAttrTemplates;
+
+ private final NonI18nPalette<String> rDerAttrTemplates;
+
+ private final NonI18nPalette<String> rVirAttrTemplates;
+
+ public AttrTemplatesPanel(final String id, final RoleTO roleTO) {
+ super(id);
+ this.roleTO = roleTO;
+
+ rAttrTemplates = buildPalette(Type.rAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.ROLE, SchemaType.NORMAL));
+ this.add(rAttrTemplates);
+ rDerAttrTemplates = buildPalette(Type.rDerAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.ROLE, SchemaType.DERIVED));
+ this.add(rDerAttrTemplates);
+ rVirAttrTemplates = buildPalette(Type.rVirAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.ROLE, SchemaType.VIRTUAL));
+ this.add(rVirAttrTemplates);
+
+ this.add(buildPalette(Type.mAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.MEMBERSHIP, SchemaType.NORMAL)));
+ this.add(buildPalette(Type.mDerAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.MEMBERSHIP, SchemaType.DERIVED)));
+ this.add(buildPalette(Type.mVirAttrTemplates,
+ schemaRestClient.getSchemaNames(AttributableType.MEMBERSHIP, SchemaType.VIRTUAL)));
+ }
+
+ private NonI18nPalette<String> buildPalette(final Type type, final List<String> allSchemas) {
+ if (allSchemas != null && !allSchemas.isEmpty()) {
+ Collections.sort(allSchemas);
+ }
+ 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) {
+
+ private static final long serialVersionUID = 2295567122085510330L;
+
+ @Override
+ protected Recorder<String> newRecorderComponent() {
+ final Recorder<String> recorder = super.newRecorderComponent();
+
+ switch (type) {
+ case rAttrTemplates:
+ case rDerAttrTemplates:
+ case rVirAttrTemplates:
+ recorder.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(type, target));
+ }
+ });
+ break;
+
+ default:
+ }
+
+ return recorder;
+ }
+ };
+ }
+
+ public Collection<String> getSelected(final Type type) {
+ Collection<String> selected;
+ switch (type) {
+ case rAttrTemplates:
+ selected = this.rAttrTemplates.getModelCollection();
+ break;
+
+ case rDerAttrTemplates:
+ selected = this.rDerAttrTemplates.getModelCollection();
+ break;
+
+ case rVirAttrTemplates:
+ selected = this.rVirAttrTemplates.getModelCollection();
+ break;
+
+ default:
+ selected = Collections.emptyList();
+ }
+
+ return selected;
+ }
+
+ public static class RoleAttrTemplatesChange {
+
+ private final Type type;
+
+ private final AjaxRequestTarget target;
+
+ public RoleAttrTemplatesChange(final Type type, final AjaxRequestTarget target) {
+ this.type = type;
+ this.target = target;
+ }
+
+ public Type getType() {
+ return type;
+ }
+
+ public AjaxRequestTarget getTarget() {
+ return target;
+ }
+ }
+}
Propchange: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttrTemplatesPanel.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/AttributesPanel.java Thu Oct 10 14:37:56 2013
@@ -19,24 +19,28 @@
package org.apache.syncope.console.pages.panels;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
+import java.util.Set;
import java.util.TreeMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.common.SyncopeConstants;
import org.apache.syncope.common.to.AbstractAttributableTO;
import org.apache.syncope.common.to.AttributeTO;
+import org.apache.syncope.common.to.MembershipTO;
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.SchemaTO;
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.Constants;
import org.apache.syncope.console.commons.JexlHelpUtil;
import org.apache.syncope.console.markup.html.list.AltListView;
+import org.apache.syncope.console.pages.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
+import org.apache.syncope.console.rest.RoleRestClient;
import org.apache.syncope.console.rest.SchemaRestClient;
import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.console.wicket.markup.html.form.AjaxDropDownChoicePanel;
@@ -46,6 +50,7 @@ import org.apache.syncope.console.wicket
import org.apache.syncope.console.wicket.markup.html.form.FieldPanel;
import org.apache.syncope.console.wicket.markup.html.form.MultiValueSelectorPanel;
import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.IEvent;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
@@ -53,8 +58,6 @@ import org.apache.wicket.markup.html.for
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.IModel;
-import org.apache.wicket.model.LoadableDetachableModel;
import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
@@ -66,43 +69,37 @@ public class AttributesPanel extends Pan
@SpringBean
private SchemaRestClient schemaRestClient;
- private final boolean templateMode;
+ @SpringBean
+ private RoleRestClient roleRestClient;
- public <T extends AbstractAttributableTO> AttributesPanel(final String id, final T entityTO, final Form form,
- final boolean templateMode) {
+ private final AbstractAttributableTO entityTO;
- super(id);
- this.templateMode = templateMode;
+ private final boolean templateMode;
- final IModel<Map<String, SchemaTO>> schemas = new LoadableDetachableModel<Map<String, SchemaTO>>() {
+ private final AttrTemplatesPanel attrTemplates;
- private static final long serialVersionUID = -2012833443695917883L;
+ private final Map<String, SchemaTO> schemas = new TreeMap<String, SchemaTO>();
- @Override
- protected Map<String, SchemaTO> load() {
- final List<SchemaTO> schemaTOs;
- if (entityTO instanceof RoleTO) {
- schemaTOs = schemaRestClient.getSchemas(AttributableType.ROLE);
- } else if (entityTO instanceof UserTO) {
- schemaTOs = schemaRestClient.getSchemas(AttributableType.USER);
- } else {
- schemaTOs = schemaRestClient.getSchemas(AttributableType.MEMBERSHIP);
- }
+ public <T extends AbstractAttributableTO> AttributesPanel(final String id, final T entityTO, final Form form,
+ final boolean templateMode) {
- final Map<String, SchemaTO> schemas = new TreeMap<String, SchemaTO>();
+ this(id, entityTO, form, templateMode, null);
+ }
- for (SchemaTO schemaTO : schemaTOs) {
- schemas.put(schemaTO.getName(), schemaTO);
- }
+ public <T extends AbstractAttributableTO> AttributesPanel(final String id, final T entityTO, final Form form,
+ final boolean templateMode, final AttrTemplatesPanel attrTemplates) {
- return schemas;
- }
- };
+ super(id);
+ this.entityTO = entityTO;
+ this.templateMode = templateMode;
+ this.attrTemplates = attrTemplates;
+ this.setOutputMarkupId(true);
- initEntityData(entityTO, schemas.getObject().values());
+ setSchemas();
+ setAttrs();
final ListView<AttributeTO> attributeView = new AltListView<AttributeTO>("schemas",
- new PropertyModel<List<? extends AttributeTO>>(entityTO, "attributes")) {
+ new PropertyModel<List<? extends AttributeTO>>(entityTO, "attrs")) {
private static final long serialVersionUID = 9101744072914090143L;
@@ -122,10 +119,9 @@ public class AttributesPanel extends Pan
item.add(new Label("name", attributeTO.getSchema()));
- final FieldPanel panel =
- getFieldPanel(schemas.getObject().get(attributeTO.getSchema()), form, attributeTO);
+ final FieldPanel panel = getFieldPanel(schemas.get(attributeTO.getSchema()), form, attributeTO);
- if (templateMode || !schemas.getObject().get(attributeTO.getSchema()).isMultivalue()) {
+ if (templateMode || !schemas.get(attributeTO.getSchema()).isMultivalue()) {
item.add(panel);
} else {
item.add(new MultiValueSelectorPanel<String>(
@@ -137,12 +133,54 @@ public class AttributesPanel extends Pan
add(attributeView);
}
- private void initEntityData(final AbstractAttributableTO entityTO, final Collection<SchemaTO> schemas) {
+ private void filter(final List<SchemaTO> schemaTOs, final Set<String> allowed) {
+ for (ListIterator<SchemaTO> itor = schemaTOs.listIterator(); itor.hasNext();) {
+ SchemaTO schema = itor.next();
+ if (!allowed.contains(schema.getName())) {
+ itor.remove();
+ }
+ }
+ }
+
+ private void setSchemas() {
+ List<SchemaTO> schemaTOs;
+
+ if (entityTO instanceof RoleTO) {
+ final RoleTO roleTO = (RoleTO) entityTO;
+
+ schemaTOs = schemaRestClient.getSchemas(AttributableType.ROLE);
+ Set<String> allowed;
+ if (attrTemplates == null) {
+ allowed = new HashSet<String>(roleTO.getRAttrTemplates());
+ } else {
+ allowed = new HashSet<String>(attrTemplates.getSelected(AttrTemplatesPanel.Type.rAttrTemplates));
+ if (roleTO.isInheritTemplates() && roleTO.getParent() != 0) {
+ allowed.addAll(roleRestClient.read(roleTO.getParent()).getRAttrTemplates());
+ }
+ }
+ filter(schemaTOs, allowed);
+ } else if (entityTO instanceof UserTO) {
+ schemaTOs = schemaRestClient.getSchemas(AttributableType.USER);
+ } else {
+ schemaTOs = schemaRestClient.getSchemas(AttributableType.MEMBERSHIP);
+ Set<String> allowed = new HashSet<String>(
+ roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMAttrTemplates());
+ filter(schemaTOs, allowed);
+ }
+
+ schemas.clear();
+
+ for (SchemaTO schemaTO : schemaTOs) {
+ schemas.put(schemaTO.getName(), schemaTO);
+ }
+ }
+
+ private void setAttrs() {
final List<AttributeTO> entityData = new ArrayList<AttributeTO>();
- final Map<String, AttributeTO> attrMap = entityTO.getAttributeMap();
+ final Map<String, AttributeTO> attrMap = entityTO.getAttrMap();
- for (SchemaTO schema : schemas) {
+ for (SchemaTO schema : schemas.values()) {
AttributeTO attributeTO = new AttributeTO();
attributeTO.setSchema(schema.getName());
@@ -157,8 +195,8 @@ public class AttributesPanel extends Pan
entityData.add(attributeTO);
}
- entityTO.getAttributes().clear();
- entityTO.getAttributes().addAll(entityData);
+ entityTO.getAttrs().clear();
+ entityTO.getAttrs().addAll(entityData);
}
@SuppressWarnings({"rawtypes", "unchecked"})
@@ -245,11 +283,11 @@ public class AttributesPanel extends Pan
final String[] values = StringUtils.isBlank(schemaTO.getEnumerationValues())
? new String[0]
- : schemaTO.getEnumerationValues().split(Constants.ENUM_VALUES_SEPARATOR);
+ : schemaTO.getEnumerationValues().split(SyncopeConstants.ENUM_VALUES_SEPARATOR);
final String[] keys = StringUtils.isBlank(schemaTO.getEnumerationKeys())
? new String[0]
- : schemaTO.getEnumerationKeys().split(Constants.ENUM_VALUES_SEPARATOR);
+ : schemaTO.getEnumerationKeys().split(SyncopeConstants.ENUM_VALUES_SEPARATOR);
for (int i = 0; i < values.length; i++) {
res.put(values[i].trim(), keys.length > i ? keys[i].trim() : null);
@@ -263,7 +301,7 @@ public class AttributesPanel extends Pan
final String[] values = StringUtils.isBlank(schemaTO.getEnumerationValues())
? new String[0]
- : schemaTO.getEnumerationValues().split(Constants.ENUM_VALUES_SEPARATOR);
+ : schemaTO.getEnumerationValues().split(SyncopeConstants.ENUM_VALUES_SEPARATOR);
for (String value : values) {
res.add(value.trim());
@@ -271,4 +309,16 @@ public class AttributesPanel extends Pan
return res;
}
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ if ((event.getPayload() instanceof RoleAttrTemplatesChange)) {
+ final RoleAttrTemplatesChange update = (RoleAttrTemplatesChange) event.getPayload();
+ if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.rAttrTemplates) {
+ setSchemas();
+ setAttrs();
+ update.getTarget().add(this);
+ }
+ }
+ }
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/DerivedAttributesPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/DerivedAttributesPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/DerivedAttributesPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/DerivedAttributesPanel.java Thu Oct 10 14:37:56 2013
@@ -18,13 +18,17 @@
*/
package org.apache.syncope.console.pages.panels;
+import java.util.ArrayList;
import java.util.List;
import org.apache.syncope.common.to.AbstractAttributableTO;
import org.apache.syncope.common.to.AttributeTO;
+import org.apache.syncope.common.to.MembershipTO;
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.console.commons.Constants;
+import org.apache.syncope.console.pages.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
+import org.apache.syncope.console.rest.RoleRestClient;
import org.apache.syncope.console.rest.SchemaRestClient;
import org.apache.syncope.console.wicket.markup.html.form.AjaxDecoratedCheckbox;
import org.apache.wicket.Component;
@@ -34,6 +38,7 @@ import org.apache.wicket.ajax.attributes
import org.apache.wicket.ajax.attributes.IAjaxCallListener;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.event.IEvent;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.DropDownChoice;
@@ -48,44 +53,57 @@ import org.apache.wicket.model.Model;
import org.apache.wicket.model.PropertyModel;
import org.apache.wicket.model.ResourceModel;
import org.apache.wicket.spring.injection.annot.SpringBean;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
public class DerivedAttributesPanel extends Panel {
- /**
- * Logger.
- */
- protected static final Logger LOG = LoggerFactory.getLogger(DerivedAttributesPanel.class);
-
private static final long serialVersionUID = -5387344116983102292L;
@SpringBean
private SchemaRestClient schemaRestClient;
+ @SpringBean
+ private RoleRestClient roleRestClient;
+
+ private final AttrTemplatesPanel attrTemplates;
+
public <T extends AbstractAttributableTO> DerivedAttributesPanel(final String id, final T entityTO) {
+ this(id, entityTO, null);
+ }
+
+ public <T extends AbstractAttributableTO> DerivedAttributesPanel(final String id, final T entityTO,
+ final AttrTemplatesPanel attrTemplates) {
+
super(id);
+ this.attrTemplates = attrTemplates;
setOutputMarkupId(true);
- final IModel<List<String>> derivedSchemaNames = new LoadableDetachableModel<List<String>>() {
+ final IModel<List<String>> derSchemas = new LoadableDetachableModel<List<String>>() {
private static final long serialVersionUID = 5275935387613157437L;
@Override
protected List<String> load() {
- List<String> derivedSchemaNames;
+ List<String> derSchemaNames;
+
if (entityTO instanceof RoleTO) {
- derivedSchemaNames = getDerivedSchemaNames(AttributableType.ROLE);
+ final RoleTO roleTO = (RoleTO) entityTO;
+
+ if (attrTemplates == null) {
+ derSchemaNames = roleTO.getRDerAttrTemplates();
+ } else {
+ derSchemaNames = new ArrayList<String>(
+ attrTemplates.getSelected(AttrTemplatesPanel.Type.rDerAttrTemplates));
+ if (roleTO.isInheritTemplates() && roleTO.getParent() != 0) {
+ derSchemaNames.addAll(roleRestClient.read(roleTO.getParent()).getRDerAttrTemplates());
+ }
+ }
} else if (entityTO instanceof UserTO) {
- derivedSchemaNames = getDerivedSchemaNames(AttributableType.USER);
+ derSchemaNames = schemaRestClient.getDerSchemaNames(AttributableType.USER);
} else {
- derivedSchemaNames = getDerivedSchemaNames(AttributableType.MEMBERSHIP);
+ derSchemaNames = roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMDerAttrTemplates();
}
- return derivedSchemaNames;
- }
- private List<String> getDerivedSchemaNames(final AttributableType type) {
- return schemaRestClient.getDerivedSchemaNames(type);
+ return derSchemaNames;
}
};
@@ -100,7 +118,7 @@ public class DerivedAttributesPanel exte
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- entityTO.getDerivedAttributes().add(new AttributeTO());
+ entityTO.getDerAttrs().add(new AttributeTO());
target.add(attributesContainer);
}
@@ -112,8 +130,8 @@ public class DerivedAttributesPanel exte
add(addAttributeBtn.setDefaultFormProcessing(Boolean.FALSE));
- final ListView<AttributeTO> attributes = new ListView<AttributeTO>("attributes",
- new PropertyModel<List<? extends AttributeTO>>(entityTO, "derivedAttributes")) {
+ ListView<AttributeTO> attributes = new ListView<AttributeTO>("attrs",
+ new PropertyModel<List<? extends AttributeTO>>(entityTO, "derAttrs")) {
private static final long serialVersionUID = 9101744072914090143L;
@@ -127,7 +145,7 @@ public class DerivedAttributesPanel exte
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- entityTO.getDerivedAttributes().remove(attributeTO);
+ entityTO.getDerAttrs().remove(attributeTO);
target.add(attributesContainer);
}
@@ -149,15 +167,14 @@ public class DerivedAttributesPanel exte
});
final DropDownChoice<String> schemaChoice = new DropDownChoice<String>("schema",
- new PropertyModel<String>(attributeTO, "schema"), derivedSchemaNames);
+ new PropertyModel<String>(attributeTO, "schema"), derSchemas);
schemaChoice.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_BLUR) {
private static final long serialVersionUID = -1107858522700306810L;
@Override
- protected void onUpdate(final AjaxRequestTarget art) {
-
+ protected void onUpdate(final AjaxRequestTarget target) {
attributeTO.setSchema(schemaChoice.getModelObject());
}
});
@@ -181,4 +198,14 @@ public class DerivedAttributesPanel exte
attributesContainer.add(attributes);
}
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ if ((event.getPayload() instanceof RoleAttrTemplatesChange)) {
+ final RoleAttrTemplatesChange update = (RoleAttrTemplatesChange) event.getPayload();
+ if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.rDerAttrTemplates) {
+ update.getTarget().add(this);
+ }
+ }
+ }
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/ResourceMappingPanel.java Thu Oct 10 14:37:56 2013
@@ -577,13 +577,13 @@ public class ResourceMappingPanel extend
case UserDerivedSchema:
case RoleDerivedSchema:
case MembershipDerivedSchema:
- toBeUpdated.setChoices(schemaRestClient.getDerivedSchemaNames(type.getAttributableType()));
+ toBeUpdated.setChoices(schemaRestClient.getDerSchemaNames(type.getAttributableType()));
break;
case UserVirtualSchema:
case RoleVirtualSchema:
case MembershipVirtualSchema:
- toBeUpdated.setChoices(schemaRestClient.getVirtualSchemaNames(type.getAttributableType()));
+ toBeUpdated.setChoices(schemaRestClient.getVirSchemaNames(type.getAttributableType()));
break;
case UserId:
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RoleDetailsPanel.java Thu Oct 10 14:37:56 2013
@@ -21,16 +21,21 @@ package org.apache.syncope.console.pages
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.types.AttributableType;
+import org.apache.syncope.console.commons.Constants;
import org.apache.syncope.console.commons.JexlHelpUtil;
import org.apache.syncope.console.pages.RoleSelectModalPage;
import org.apache.syncope.console.pages.UserOwnerSelectModalPage;
+import org.apache.syncope.console.pages.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
+import org.apache.syncope.console.pages.panels.AttrTemplatesPanel.Type;
import org.apache.syncope.console.rest.RoleRestClient;
import org.apache.syncope.console.rest.UserRestClient;
import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
import org.apache.wicket.Page;
import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.AjaxLink;
+import org.apache.wicket.event.Broadcast;
import org.apache.wicket.event.IEvent;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxLink;
import org.apache.wicket.extensions.ajax.markup.html.modal.ModalWindow;
@@ -109,7 +114,7 @@ public class RoleDetailsPanel extends Pa
}
};
parentFragment.add(parentSelect);
- final IndicatingAjaxLink parentReset = new IndicatingAjaxLink("parentReset") {
+ final IndicatingAjaxLink<Void> parentReset = new IndicatingAjaxLink<Void>("parentReset") {
private static final long serialVersionUID = -7978723352517770644L;
@@ -146,7 +151,7 @@ public class RoleDetailsPanel extends Pa
userOwner.setReadOnly(true);
userOwner.setOutputMarkupId(true);
ownerContainer.add(userOwner);
- final IndicatingAjaxLink userOwnerSelect = new IndicatingAjaxLink("userOwnerSelect") {
+ final IndicatingAjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") {
private static final long serialVersionUID = -7978723352517770644L;
@@ -165,7 +170,7 @@ public class RoleDetailsPanel extends Pa
}
};
ownerContainer.add(userOwnerSelect);
- final IndicatingAjaxLink userOwnerReset = new IndicatingAjaxLink("userOwnerReset") {
+ final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") {
private static final long serialVersionUID = -7978723352517770644L;
@@ -182,7 +187,7 @@ public class RoleDetailsPanel extends Pa
roleOwner.setReadOnly(true);
roleOwner.setOutputMarkupId(true);
ownerContainer.add(roleOwner);
- final IndicatingAjaxLink roleOwnerSelect = new IndicatingAjaxLink("roleOwnerSelect") {
+ final IndicatingAjaxLink<Void> roleOwnerSelect = new IndicatingAjaxLink<Void>("roleOwnerSelect") {
private static final long serialVersionUID = -7978723352517770644L;
@@ -202,7 +207,7 @@ public class RoleDetailsPanel extends Pa
}
};
ownerContainer.add(roleOwnerSelect);
- final IndicatingAjaxLink roleOwnerReset = new IndicatingAjaxLink("roleOwnerReset") {
+ final IndicatingAjaxLink<Void> roleOwnerReset = new IndicatingAjaxLink<Void>("roleOwnerReset") {
private static final long serialVersionUID = -7978723352517770644L;
@@ -217,6 +222,21 @@ public class RoleDetailsPanel extends Pa
final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner",
new PropertyModel<Boolean>(roleTO, "inheritOwner"));
this.add(inhOwner);
+
+ final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates",
+ new PropertyModel<Boolean>(roleTO, "inheritTemplates"));
+ inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {
+
+ private static final long serialVersionUID = -1107858522700306810L;
+
+ @Override
+ protected void onUpdate(final AjaxRequestTarget target) {
+ send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rAttrTemplates, target));
+ send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rDerAttrTemplates, target));
+ send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rVirAttrTemplates, target));
+ }
+ });
+ this.add(inhTemplates);
}
/**
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/RolePanel.java Thu Oct 10 14:37:56 2013
@@ -31,6 +31,8 @@ import org.apache.syncope.console.common
import org.apache.syncope.console.commons.XMLRolesReader;
import org.apache.syncope.console.pages.RoleModalPage;
import org.apache.syncope.console.rest.AuthRestClient;
+import org.apache.syncope.console.rest.RoleRestClient;
+import org.apache.syncope.console.rest.SchemaRestClient;
import org.apache.syncope.console.wicket.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.console.wicket.markup.html.form.AjaxPalettePanel;
import org.apache.wicket.PageReference;
@@ -47,12 +49,15 @@ public class RolePanel extends Panel {
private static final long serialVersionUID = 4216376097320768369L;
@SpringBean
- private AuthRestClient entitlementRestClient;
+ private AuthRestClient authRestClient;
+
+ @SpringBean
+ private SchemaRestClient schemaRestClient;
@SpringBean
private XMLRolesReader xmlRolesReader;
- private final AjaxPalettePanel<String> entitlementsPalette;
+ private final AjaxPalettePanel<String> entitlements;
public static class Builder implements Serializable {
@@ -117,70 +122,75 @@ public class RolePanel extends Panel {
this.add(new SysInfoPanel("systeminformation", builder.roleTO));
//--------------------------------
+ // Attribute templates panel
+ //--------------------------------
+ AttrTemplatesPanel attrTemplates = new AttrTemplatesPanel("templates", builder.roleTO);
+ this.add(attrTemplates);
+
+ //--------------------------------
// Attributes panel
+ //--------------------------------
this.add(new AttributesPanel(
- "attributes", builder.roleTO, builder.form, builder.mode == RoleModalPage.Mode.TEMPLATE));
+ "attrs", builder.roleTO, builder.form, builder.mode == RoleModalPage.Mode.TEMPLATE, attrTemplates));
- final AjaxCheckBoxPanel inhAttributes = new AjaxCheckBoxPanel("inheritAttributes", "inheritAttributes",
- new PropertyModel<Boolean>(builder.roleTO, "inheritAttributes"));
+ final AjaxCheckBoxPanel inhAttributes = new AjaxCheckBoxPanel("inheritAttrs", "inheritAttrs",
+ new PropertyModel<Boolean>(builder.roleTO, "inheritAttrs"));
inhAttributes.setOutputMarkupId(true);
this.add(inhAttributes);
//--------------------------------
//--------------------------------
- // Derived attributes container
+ // Derived attributes panel
//--------------------------------
- this.add(new DerivedAttributesPanel("derivedAttributes", builder.roleTO));
+ this.add(new DerivedAttributesPanel("derAttrs", builder.roleTO, attrTemplates));
- final AjaxCheckBoxPanel inhDerivedAttributes = new AjaxCheckBoxPanel("inheritDerivedAttributes",
- "inheritDerivedAttributes", new PropertyModel<Boolean>(builder.roleTO, "inheritDerivedAttributes"));
- inhDerivedAttributes.setOutputMarkupId(true);
+ final AjaxCheckBoxPanel inhDerivedAttributes = new AjaxCheckBoxPanel("inheritDerAttrs",
+ "inheritDerAttrs", new PropertyModel<Boolean>(builder.roleTO, "inheritDerAttrs"));
inhDerivedAttributes.setOutputMarkupId(true);
this.add(inhDerivedAttributes);
//--------------------------------
//--------------------------------
- // Virtual attributes container
+ // Virtual attributes panel
//--------------------------------
this.add(new VirtualAttributesPanel(
- "virtualAttributes", builder.roleTO, builder.mode == RoleModalPage.Mode.TEMPLATE));
+ "virAttrs", builder.roleTO, builder.mode == RoleModalPage.Mode.TEMPLATE, attrTemplates));
- final AjaxCheckBoxPanel inhVirtualAttributes = new AjaxCheckBoxPanel("inheritVirtualAttributes",
- "inheritVirtualAttributes", new PropertyModel<Boolean>(builder.roleTO, "inheritVirtualAttributes"));
- inhVirtualAttributes.setOutputMarkupId(true);
+ final AjaxCheckBoxPanel inhVirtualAttributes = new AjaxCheckBoxPanel("inheritVirAttrs",
+ "inheritVirAttrs", new PropertyModel<Boolean>(builder.roleTO, "inheritVirAttrs"));
inhVirtualAttributes.setOutputMarkupId(true);
this.add(inhVirtualAttributes);
//--------------------------------
//--------------------------------
- // Security container
+ // Resources panel
//--------------------------------
-
- this.add(new RoleSecurityPanel("security", builder.roleTO).setOutputMarkupId(true));
+ this.add(new ResourcesPanel.Builder("resources").attributableTO(builder.roleTO).build().
+ setOutputMarkupId(true));
//--------------------------------
//--------------------------------
- // Resources container
- //--------------------------------
-
- this.add(new ResourcesPanel.Builder("resources").attributableTO(builder.roleTO).build()
- .setOutputMarkupId(true));
+ // Entitlements
//--------------------------------
-
ListModel<String> selectedEntitlements = new ListModel<String>(builder.roleTO.getEntitlements());
- List<String> allEntitlements = entitlementRestClient.getAllEntitlements();
+ List<String> allEntitlements = authRestClient.getAllEntitlements();
if (allEntitlements != null && !allEntitlements.isEmpty()) {
Collections.sort(allEntitlements);
}
ListModel<String> availableEntitlements = new ListModel<String>(allEntitlements);
- entitlementsPalette =
- new AjaxPalettePanel<String>("entitlementsPalette", selectedEntitlements, availableEntitlements);
- this.add(entitlementsPalette);
+ entitlements = new AjaxPalettePanel<String>("entitlements", selectedEntitlements, availableEntitlements);
+ this.add(entitlements);
+
+ //--------------------------------
+ // Security panel
+ //--------------------------------
+ this.add(new RoleSecurityPanel("security", builder.roleTO).setOutputMarkupId(true));
+ //--------------------------------
}
public Collection<String> getSelectedEntitlements() {
- return this.entitlementsPalette.getModelCollection();
+ return this.entitlements.getModelCollection();
}
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SyncTasks.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SyncTasks.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SyncTasks.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/SyncTasks.java Thu Oct 10 14:37:56 2013
@@ -264,6 +264,7 @@ public class SyncTasks extends AbstractT
Form paginatorForm = new Form("PaginatorForm");
+ @SuppressWarnings({"unchecked", "rawtypes"})
final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser", new PropertyModel(this, "paginatorRows"),
prefMan.getPaginatorChoices());
@@ -292,7 +293,7 @@ public class SyncTasks extends AbstractT
add(paginatorForm);
// create new user
- AjaxLink createLink = new ClearIndicatingAjaxLink("createLink", pageRef) {
+ AjaxLink<Void> createLink = new ClearIndicatingAjaxLink<Void>("createLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchResultPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchResultPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchResultPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/UserSearchResultPanel.java Thu Oct 10 14:37:56 2013
@@ -79,8 +79,8 @@ public class UserSearchResultPanel exten
super(id, filtered, searchCond, callerRef, restClient);
this.schemaNames = schemaRestClient.getSchemaNames(AttributableType.USER);
- this.dSchemaNames = schemaRestClient.getDerivedSchemaNames(AttributableType.USER);
- this.vSchemaNames = schemaRestClient.getVirtualSchemaNames(AttributableType.USER);
+ this.dSchemaNames = schemaRestClient.getDerSchemaNames(AttributableType.USER);
+ this.vSchemaNames = schemaRestClient.getVirSchemaNames(AttributableType.USER);
initResultTable();
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/VirtualAttributesPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/VirtualAttributesPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/VirtualAttributesPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/pages/panels/VirtualAttributesPanel.java Thu Oct 10 14:37:56 2013
@@ -19,16 +19,22 @@
package org.apache.syncope.console.pages.panels;
import java.util.ArrayList;
-import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
+import java.util.ListIterator;
import java.util.Map;
+import java.util.Set;
+import java.util.TreeMap;
import org.apache.syncope.common.to.AbstractAttributableTO;
import org.apache.syncope.common.to.AttributeTO;
+import org.apache.syncope.common.to.MembershipTO;
import org.apache.syncope.common.to.RoleTO;
import org.apache.syncope.common.to.UserTO;
import org.apache.syncope.common.to.VirSchemaTO;
import org.apache.syncope.common.types.AttributableType;
import org.apache.syncope.console.commons.Constants;
+import org.apache.syncope.console.pages.panels.AttrTemplatesPanel.RoleAttrTemplatesChange;
+import org.apache.syncope.console.rest.RoleRestClient;
import org.apache.syncope.console.rest.SchemaRestClient;
import org.apache.syncope.console.wicket.markup.html.form.AjaxDecoratedCheckbox;
import org.apache.syncope.console.wicket.markup.html.form.AjaxTextFieldPanel;
@@ -39,6 +45,7 @@ import org.apache.wicket.ajax.attributes
import org.apache.wicket.ajax.attributes.AjaxRequestAttributes;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.ajax.markup.html.form.AjaxButton;
+import org.apache.wicket.event.IEvent;
import org.apache.wicket.extensions.ajax.markup.html.IndicatingAjaxButton;
import org.apache.wicket.markup.html.WebMarkupContainer;
import org.apache.wicket.markup.html.form.ChoiceRenderer;
@@ -61,43 +68,78 @@ public class VirtualAttributesPanel exte
@SpringBean
private SchemaRestClient schemaRestClient;
+ @SpringBean
+ private RoleRestClient roleRestClient;
+
+ private final AttrTemplatesPanel attrTemplates;
+
+ private final Map<String, VirSchemaTO> schemas = new TreeMap<String, VirSchemaTO>();
+
public <T extends AbstractAttributableTO> VirtualAttributesPanel(final String id, final T entityTO,
final boolean templateMode) {
+ this(id, entityTO, templateMode, null);
+ }
+
+ public <T extends AbstractAttributableTO> VirtualAttributesPanel(final String id, final T entityTO,
+ final boolean templateMode, final AttrTemplatesPanel attrTemplates) {
+
super(id);
+ this.attrTemplates = attrTemplates;
+ this.setOutputMarkupId(true);
- setOutputMarkupId(true);
+ final IModel<List<String>> virSchemas = new LoadableDetachableModel<List<String>>() {
- final IModel<Map<String, VirSchemaTO>> schemas =
- new LoadableDetachableModel<Map<String, VirSchemaTO>>() {
+ private static final long serialVersionUID = 5275935387613157437L;
- private static final long serialVersionUID = -5489981430516587774L;
+ private void filter(final List<VirSchemaTO> schemaTOs, final Set<String> allowed) {
+ for (ListIterator<VirSchemaTO> itor = schemaTOs.listIterator(); itor.hasNext();) {
+ VirSchemaTO schema = itor.next();
+ if (!allowed.contains(schema.getName())) {
+ itor.remove();
+ }
+ }
+ }
@Override
- protected Map<String, VirSchemaTO> load() {
- final List<VirSchemaTO> schemaTOs;
+ protected List<String> load() {
+ List<VirSchemaTO> schemaTOs;
+
if (entityTO instanceof RoleTO) {
- schemaTOs = schemaRestClient.getVirtualSchemas(AttributableType.ROLE);
+ final RoleTO roleTO = (RoleTO) entityTO;
+
+ schemaTOs = schemaRestClient.getVirSchemas(AttributableType.ROLE);
+ Set<String> allowed;
+ if (attrTemplates == null) {
+ allowed = new HashSet<String>(roleTO.getRVirAttrTemplates());
+ } else {
+ allowed = new HashSet<String>(attrTemplates.getSelected(
+ AttrTemplatesPanel.Type.rVirAttrTemplates));
+ if (roleTO.isInheritTemplates() && roleTO.getParent() != 0) {
+ allowed.addAll(roleRestClient.read(roleTO.getParent()).getRVirAttrTemplates());
+ }
+ }
+ filter(schemaTOs, allowed);
} else if (entityTO instanceof UserTO) {
- schemaTOs = schemaRestClient.getVirtualSchemas(AttributableType.USER);
+ schemaTOs = schemaRestClient.getVirSchemas(AttributableType.USER);
} else {
- schemaTOs = schemaRestClient.getVirtualSchemas(AttributableType.MEMBERSHIP);
+ schemaTOs = schemaRestClient.getVirSchemas(AttributableType.MEMBERSHIP);
+ Set<String> allowed = new HashSet<String>(
+ roleRestClient.read(((MembershipTO) entityTO).getRoleId()).getMVirAttrTemplates());
+ filter(schemaTOs, allowed);
}
- final Map<String, VirSchemaTO> schemas = new HashMap<String, VirSchemaTO>();
+ schemas.clear();
for (VirSchemaTO schemaTO : schemaTOs) {
schemas.put(schemaTO.getName(), schemaTO);
}
- return schemas;
+ return new ArrayList<String>(schemas.keySet());
}
};
- final List<String> virtualSchemaNames = new ArrayList<String>(schemas.getObject().keySet());
-
final WebMarkupContainer attributesContainer = new WebMarkupContainer("virAttrContainer");
-
attributesContainer.setOutputMarkupId(true);
add(attributesContainer);
@@ -107,7 +149,7 @@ public class VirtualAttributesPanel exte
@Override
protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
- entityTO.getVirtualAttributes().add(new AttributeTO());
+ entityTO.getVirAttrs().add(new AttributeTO());
target.add(attributesContainer);
}
@@ -119,12 +161,13 @@ public class VirtualAttributesPanel exte
add(addAttributeBtn.setDefaultFormProcessing(Boolean.FALSE));
- ListView<AttributeTO> attributes = new ListView<AttributeTO>("attributes",
- new PropertyModel<List<? extends AttributeTO>>(entityTO, "virtualAttributes")) {
+ ListView<AttributeTO> attributes = new ListView<AttributeTO>("attrs",
+ new PropertyModel<List<? extends AttributeTO>>(entityTO, "virAttrs")) {
private static final long serialVersionUID = 9101744072914090143L;
@Override
+ @SuppressWarnings("unchecked")
protected void populateItem(final ListItem<AttributeTO> item) {
final AttributeTO attributeTO = item.getModelObject();
@@ -134,7 +177,7 @@ public class VirtualAttributesPanel exte
@Override
protected void onUpdate(final AjaxRequestTarget target) {
- entityTO.getVirtualAttributes().add(attributeTO);
+ entityTO.getVirAttrs().remove(attributeTO);
target.add(attributesContainer);
}
@@ -160,7 +203,7 @@ public class VirtualAttributesPanel exte
}
if (attributeTO.getSchema() != null) {
- VirSchemaTO attributeSchema = schemas.getObject().get(attributeTO.getSchema());
+ VirSchemaTO attributeSchema = schemas.get(attributeTO.getSchema());
if (attributeSchema != null) {
attributeTO.setReadonly(attributeSchema.isReadonly());
}
@@ -175,12 +218,12 @@ public class VirtualAttributesPanel exte
} else {
panel = new AjaxTextFieldPanel("panel", "values", new Model<String>(null));
panel.setReadOnly(attributeTO.isReadonly());
- multiPanel = new MultiValueSelectorPanel("values", new PropertyModel<List<String>>(attributeTO,
- "values"), panel);
+ multiPanel = new MultiValueSelectorPanel("values",
+ new PropertyModel<List<String>>(attributeTO, "values"), panel);
}
final DropDownChoice<String> schemaChoice = new DropDownChoice<String>("schema",
- new PropertyModel<String>(attributeTO, "schema"), virtualSchemaNames,
+ new PropertyModel<String>(attributeTO, "schema"), virSchemas,
new ChoiceRenderer<String>() {
private static final long serialVersionUID = 3109256773218160485L;
@@ -201,13 +244,11 @@ public class VirtualAttributesPanel exte
@Override
protected void onUpdate(final AjaxRequestTarget target) {
-
attributeTO.setSchema(schemaChoice.getModelObject());
- VirSchemaTO attributeSchema =
- schemas.getObject().get(attributeTO.getSchema());
- if (attributeSchema != null) {
- attributeTO.setReadonly(attributeSchema.isReadonly());
+ VirSchemaTO virSchema = schemas.get(attributeTO.getSchema());
+ if (virSchema != null) {
+ attributeTO.setReadonly(virSchema.isReadonly());
panel.setReadOnly(attributeTO.isReadonly());
}
@@ -241,4 +282,14 @@ public class VirtualAttributesPanel exte
attributesContainer.add(attributes);
}
+
+ @Override
+ public void onEvent(final IEvent<?> event) {
+ if ((event.getPayload() instanceof RoleAttrTemplatesChange)) {
+ final RoleAttrTemplatesChange update = (RoleAttrTemplatesChange) event.getPayload();
+ if (attrTemplates != null && update.getType() == AttrTemplatesPanel.Type.rVirAttrTemplates) {
+ update.getTarget().add(this);
+ }
+ }
+ }
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/rest/SchemaRestClient.java Thu Oct 10 14:37:56 2013
@@ -60,7 +60,6 @@ public class SchemaRestClient extends Ba
*
* @return List of schemas.
*/
- @SuppressWarnings("unchecked")
public List<SchemaTO> getSchemas(final AttributableType type) {
List<SchemaTO> schemas = null;
@@ -73,6 +72,21 @@ public class SchemaRestClient extends Ba
return schemas;
}
+ public List<String> getSchemaNames(final AttributableType attrType, final SchemaType schemaType) {
+ final List<String> schemaNames = new ArrayList<String>();
+
+ try {
+ final List<? extends AbstractSchemaTO> schemas = getSchemas(attrType, schemaType);
+ for (AbstractSchemaTO schemaTO : schemas) {
+ schemaNames.add(schemaTO.getName());
+ }
+ } catch (SyncopeClientCompositeException e) {
+ LOG.error("While getting all user schema names", e);
+ }
+
+ return schemaNames;
+ }
+
/**
* Get schema names.
*
@@ -82,8 +96,7 @@ public class SchemaRestClient extends Ba
final List<String> schemaNames = new ArrayList<String>();
try {
- @SuppressWarnings("unchecked")
- final List<SchemaTO> schemas = getService(SchemaService.class).list(type, SchemaType.NORMAL);
+ final List<SchemaTO> schemas = getSchemas(type);
for (SchemaTO schemaTO : schemas) {
schemaNames.add(schemaTO.getName());
}
@@ -100,17 +113,16 @@ public class SchemaRestClient extends Ba
* @return List of derived schemas.
*/
@SuppressWarnings("unchecked")
- public List<DerSchemaTO> getDerivedSchemas(final AttributableType type) {
-
- List<DerSchemaTO> userDerivedSchemas = null;
+ public List<DerSchemaTO> getDerSchemas(final AttributableType type) {
+ List<DerSchemaTO> userDerSchemas = null;
try {
- userDerivedSchemas = getService(SchemaService.class).list(type, SchemaType.DERIVED);
+ userDerSchemas = getService(SchemaService.class).list(type, SchemaType.DERIVED);
} catch (SyncopeClientCompositeException e) {
LOG.error("While getting all user derived schemas", e);
}
- return userDerivedSchemas;
+ return userDerSchemas;
}
/**
@@ -118,21 +130,20 @@ public class SchemaRestClient extends Ba
*
* @return List of derived schema names.
*/
- public List<String> getDerivedSchemaNames(final AttributableType type) {
- final List<String> userDerivedSchemasNames = new ArrayList<String>();
+ public List<String> getDerSchemaNames(final AttributableType type) {
+ final List<String> userDerSchemasNames = new ArrayList<String>();
try {
- @SuppressWarnings("unchecked")
final List<DerSchemaTO> userDerSchemas = getService(SchemaService.class).list(type, SchemaType.DERIVED);
for (DerSchemaTO schemaTO : userDerSchemas) {
- userDerivedSchemasNames.add(schemaTO.getName());
+ userDerSchemasNames.add(schemaTO.getName());
}
} catch (SyncopeClientCompositeException e) {
LOG.error("While getting all user derived schema names", e);
}
- return userDerivedSchemasNames;
+ return userDerSchemasNames;
}
/**
@@ -141,16 +152,16 @@ public class SchemaRestClient extends Ba
* @return List of derived schemas.
*/
@SuppressWarnings("unchecked")
- public List<VirSchemaTO> getVirtualSchemas(final AttributableType type) {
- List<VirSchemaTO> userVirtualSchemas = null;
+ public List<VirSchemaTO> getVirSchemas(final AttributableType type) {
+ List<VirSchemaTO> userVirSchemas = null;
try {
- userVirtualSchemas = getService(SchemaService.class).list(type, SchemaType.VIRTUAL);
+ userVirSchemas = getService(SchemaService.class).list(type, SchemaType.VIRTUAL);
} catch (SyncopeClientCompositeException e) {
LOG.error("While getting all user derived schemas", e);
}
- return userVirtualSchemas;
+ return userVirSchemas;
}
/**
@@ -158,20 +169,20 @@ public class SchemaRestClient extends Ba
*
* @return List of virtual schema names.
*/
- public List<String> getVirtualSchemaNames(final AttributableType type) {
- final List<String> userVirtualSchemasNames = new ArrayList<String>();
+ public List<String> getVirSchemaNames(final AttributableType type) {
+ final List<String> userVirSchemasNames = new ArrayList<String>();
try {
@SuppressWarnings("unchecked")
final List<VirSchemaTO> userVirSchemas = getService(SchemaService.class).list(type, SchemaType.VIRTUAL);
for (VirSchemaTO schemaTO : userVirSchemas) {
- userVirtualSchemasNames.add(schemaTO.getName());
+ userVirSchemasNames.add(schemaTO.getName());
}
} catch (SyncopeClientCompositeException e) {
LOG.error("While getting all user derived schema names", e);
}
- return userVirtualSchemasNames;
+ return userVirSchemasNames;
}
/**
@@ -226,7 +237,7 @@ public class SchemaRestClient extends Ba
*
* @param schemaTO
*/
- public void createDerivedSchema(final AttributableType type, final DerSchemaTO schemaTO) {
+ public void createDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
getService(SchemaService.class).create(type, SchemaType.DERIVED, schemaTO);
}
@@ -235,7 +246,7 @@ public class SchemaRestClient extends Ba
*
* @param schemaTO
*/
- public void createVirtualSchema(final AttributableType type, final VirSchemaTO schemaTO) {
+ public void createVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
getService(SchemaService.class).create(type, SchemaType.VIRTUAL, schemaTO);
}
@@ -243,9 +254,9 @@ public class SchemaRestClient extends Ba
* Load an already existent user derived schema by its name.
*
* @param name (e.g.:surname)
- * @return DerivedSchemaTO
+ * @return DerSchemaTO
*/
- public DerSchemaTO readDerivedSchema(final AttributableType type, final String name) {
+ public DerSchemaTO readDerSchema(final AttributableType type, final String name) {
DerSchemaTO derivedSchemaTO = null;
try {
derivedSchemaTO = getService(SchemaService.class).read(type, SchemaType.DERIVED, name);
@@ -260,7 +271,7 @@ public class SchemaRestClient extends Ba
*
* @param schemaTO updated
*/
- public void updateDerivedSchema(final AttributableType type, final DerSchemaTO schemaTO) {
+ public void updateDerSchema(final AttributableType type, final DerSchemaTO schemaTO) {
getService(SchemaService.class).update(type, SchemaType.DERIVED, schemaTO.getName(), schemaTO);
}
@@ -269,7 +280,7 @@ public class SchemaRestClient extends Ba
*
* @param schemaTO updated
*/
- public void updateVirtualSchema(final AttributableType type, final VirSchemaTO schemaTO) {
+ public void updateVirSchema(final AttributableType type, final VirSchemaTO schemaTO) {
getService(SchemaService.class).update(type, SchemaType.VIRTUAL, schemaTO.getName(), schemaTO);
}
@@ -278,7 +289,7 @@ public class SchemaRestClient extends Ba
*
* @param name (e.g.:surname)
*/
- public DerSchemaTO deleteDerivedSchema(final AttributableType type, final String name) {
+ 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;
@@ -289,7 +300,7 @@ public class SchemaRestClient extends Ba
*
* @param name (e.g.:surname)
*/
- public VirSchemaTO deleteVirtualSchema(final AttributableType type, final String name) {
+ 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);
return schemaTO;
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/extensions/markup/html/repeater/data/table/AttrColumn.java Thu Oct 10 14:37:56 2013
@@ -53,22 +53,20 @@ public class AttrColumn extends Abstract
switch (schemaType) {
case NORMAL:
- if (rowModel.getObject().getAttributeMap().containsKey(name)) {
- values = rowModel.getObject().getAttributeMap().get(name).getValues();
+ if (rowModel.getObject().getAttrMap().containsKey(name)) {
+ values = rowModel.getObject().getAttrMap().get(name).getValues();
}
break;
case VIRTUAL:
- if (rowModel.getObject().getVirtualAttributeMap().containsKey(name)) {
-
- values = rowModel.getObject().getVirtualAttributeMap().get(name).getValues();
+ if (rowModel.getObject().getVirAttrMap().containsKey(name)) {
+ values = rowModel.getObject().getVirAttrMap().get(name).getValues();
}
break;
case DERIVED:
- if (rowModel.getObject().getDerivedAttributeMap().containsKey(name)) {
-
- values = rowModel.getObject().getDerivedAttributeMap().get(name).getValues();
+ if (rowModel.getObject().getDerAttrMap().containsKey(name)) {
+ values = rowModel.getObject().getDerAttrMap().get(name).getValues();
}
break;
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxCheckBoxPanel.java Thu Oct 10 14:37:56 2013
@@ -20,13 +20,13 @@ package org.apache.syncope.console.wicke
import java.io.Serializable;
import java.util.List;
+import org.apache.commons.lang3.StringUtils;
import org.apache.syncope.console.commons.Constants;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.AjaxFormComponentUpdatingBehavior;
import org.apache.wicket.markup.html.form.CheckBox;
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
-import org.springframework.util.StringUtils;
public class AjaxCheckBoxPanel extends FieldPanel<Boolean> {
@@ -73,7 +73,7 @@ public class AjaxCheckBoxPanel extends F
public Serializable getObject() {
Boolean value = null;
- if (list != null && !list.isEmpty() && StringUtils.hasText(list.get(0).toString())) {
+ if (list != null && !list.isEmpty() && StringUtils.isNotBlank(list.get(0).toString())) {
value = "true".equalsIgnoreCase(list.get(0).toString());
}
@@ -82,7 +82,7 @@ public class AjaxCheckBoxPanel extends F
@Override
public void setObject(final Serializable object) {
- if (object != null && object instanceof Boolean) {
+ if (object instanceof Boolean) {
list.clear();
list.add(((Boolean) object).toString());
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/AjaxPalettePanel.java Thu Oct 10 14:37:56 2013
@@ -31,7 +31,7 @@ public class AjaxPalettePanel<T> extends
private static final long serialVersionUID = 7738499668258805567L;
- final Palette<T> palette;
+ protected final Palette<T> palette;
public AjaxPalettePanel(final String id, final IModel<List<T>> model, final ListModel<T> choices) {
this(id, model, choices, false);
@@ -60,7 +60,7 @@ public class AjaxPalettePanel<T> extends
}
@Override
- public AbstractFieldPanel setModelObject(final Serializable object) {
+ public AjaxPalettePanel<T> setModelObject(final Serializable object) {
palette.setDefaultModelObject(object);
return this;
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/form/FieldPanel.java Thu Oct 10 14:37:56 2013
@@ -28,15 +28,15 @@ import org.apache.wicket.markup.html.pan
import org.apache.wicket.model.IModel;
import org.apache.wicket.model.Model;
-public abstract class FieldPanel<T extends Serializable> extends AbstractFieldPanel<T> {
+public abstract class FieldPanel<T extends Serializable> extends AbstractFieldPanel<T> implements Cloneable {
private static final long serialVersionUID = -198988924922541273L;
protected FormComponent<T> field = null;
- final protected String id;
+ protected final String id;
- final protected String name;
+ protected final String name;
protected String title = null;
@@ -58,7 +58,7 @@ public abstract class FieldPanel<T exten
return field;
}
- public FieldPanel setTitle(final String title) {
+ public FieldPanel<T> setTitle(final String title) {
this.title = title;
field.add(AttributeModifier.replace("title", title != null
? title
@@ -67,7 +67,7 @@ public abstract class FieldPanel<T exten
return this;
}
- public FieldPanel setStyleSheet(final String classes) {
+ public FieldPanel<T> setStyleSheet(final String classes) {
field.add(AttributeModifier.replace("class", classes != null
? classes
: ""));
@@ -75,25 +75,25 @@ public abstract class FieldPanel<T exten
return this;
}
- public FieldPanel setRequired(boolean required) {
+ public FieldPanel<T> setRequired(boolean required) {
field.setRequired(required);
return this;
}
- public FieldPanel setReadOnly(boolean readOnly) {
+ public FieldPanel<T> setReadOnly(boolean readOnly) {
field.setEnabled(!readOnly);
return this;
}
- public FieldPanel setNewModel(final IModel<T> model) {
+ public FieldPanel<T> setNewModel(final IModel<T> model) {
field.setModel(model);
return this;
}
@Override
- public FieldPanel setModelObject(T object) {
+ public FieldPanel<T> setModelObject(T object) {
field.setModelObject(object);
return this;
}
@@ -116,36 +116,37 @@ public abstract class FieldPanel<T exten
* @param item item to attach.
* @return updated FieldPanel object.
*/
- public FieldPanel setNewModel(final ListItem<T> item) {
- setNewModel(new Model() {
+ public FieldPanel<T> setNewModel(final ListItem<T> item) {
+ setNewModel(new Model<T>() {
private static final long serialVersionUID = 6799404673615637845L;
@Override
- public Serializable getObject() {
+ public T getObject() {
return item.getModelObject();
}
@Override
- public void setObject(final Serializable object) {
+ public void setObject(final T object) {
if (object != null && !object.toString().isEmpty()) {
- item.setModelObject((T) object);
+ item.setModelObject(object);
}
}
});
return this;
}
- public FieldPanel setNewModel(final List<Serializable> list) {
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public FieldPanel<T> setNewModel(final List<Serializable> list) {
setNewModel(new Model() {
private static final long serialVersionUID = 1088212074765051906L;
@Override
public Serializable getObject() {
- return list != null && !list.isEmpty()
- ? list.get(0)
- : null;
+ return list == null || list.isEmpty()
+ ? null
+ : list.get(0);
}
@Override
@@ -162,11 +163,12 @@ public abstract class FieldPanel<T exten
}
@Override
- public FieldPanel clone() {
- final FieldPanel panel;
+ @SuppressWarnings("unchecked")
+ public FieldPanel<T> clone() {
+ final FieldPanel<T> panel;
try {
- panel = this.getClass().getConstructor(new Class[]{String.class, String.class, IModel.class})
- .newInstance(id, name, new Model(null));
+ panel = this.getClass().getConstructor(new Class<?>[] {String.class, String.class, IModel.class})
+ .newInstance(id, name, new Model<T>(null));
} catch (Exception e) {
LOG.error("Error cloning field panel", e);
return null;
@@ -183,7 +185,7 @@ public abstract class FieldPanel<T exten
return panel;
}
- public FieldPanel addRequiredLabel() {
+ public FieldPanel<T> addRequiredLabel() {
if (!isRequired()) {
setRequired(true);
}
@@ -199,7 +201,7 @@ public abstract class FieldPanel<T exten
return this;
}
- public FieldPanel removeRequiredLabel() {
+ public FieldPanel<T> removeRequiredLabel() {
if (isRequired()) {
setRequired(false);
}
Modified: syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java (original)
+++ syncope/trunk/console/src/main/java/org/apache/syncope/console/wicket/markup/html/tree/TreeActionLinkPanel.java Thu Oct 10 14:37:56 2013
@@ -51,7 +51,7 @@ public class TreeActionLinkPanel extends
@SpringBean
private XMLRolesReader xmlRolesReader;
- private Fragment fragment;
+ private final Fragment fragment;
public TreeActionLinkPanel(final String id, final long idRole, final ModalWindow window,
final PageReference pageRef) {
@@ -61,10 +61,9 @@ public class TreeActionLinkPanel extends
fragment = new Fragment("menuPanel", idRole == 0
? "fakerootFrag"
: "roleFrag", this);
-
fragment.setOutputMarkupId(true);
- final AjaxLink createRoleLink = new ClearIndicatingAjaxLink("createRoleLink", pageRef) {
+ final AjaxLink<Void> createRoleLink = new ClearIndicatingAjaxLink<Void>("createRoleLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@@ -78,8 +77,7 @@ public class TreeActionLinkPanel extends
public Page createPage() {
RoleTO roleTO = new RoleTO();
roleTO.setParent(idRole);
- RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
- return form;
+ return new RoleModalPage(pageRef, window, roleTO);
}
});
@@ -87,14 +85,14 @@ public class TreeActionLinkPanel extends
}
};
- MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles("Roles",
- "create"));
+ MetaDataRoleAuthorizationStrategy.authorize(createRoleLink, ENABLE,
+ xmlRolesReader.getAllAllowedRoles("Roles", "create"));
createRoleLink.setOutputMarkupId(true);
fragment.add(createRoleLink);
if (idRole != 0) {
- final AjaxLink updateRoleLink = new ClearIndicatingAjaxLink("updateRoleLink", pageRef) {
+ final AjaxLink<Void> updateRoleLink = new ClearIndicatingAjaxLink<Void>("updateRoleLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@@ -106,9 +104,7 @@ public class TreeActionLinkPanel extends
@Override
public Page createPage() {
- RoleTO roleTO = restClient.read(idRole);
- RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
- return form;
+ return new RoleModalPage(pageRef, window, restClient.read(idRole));
}
});
@@ -116,20 +112,20 @@ public class TreeActionLinkPanel extends
}
};
- MetaDataRoleAuthorizationStrategy.authorize(updateRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles(
- "Roles", "read"));
+ MetaDataRoleAuthorizationStrategy.authorize(updateRoleLink, ENABLE,
+ xmlRolesReader.getAllAllowedRoles("Roles", "read"));
updateRoleLink.setOutputMarkupId(true);
fragment.add(updateRoleLink);
- final AjaxLink dropRoleLink = new IndicatingOnConfirmAjaxLink("dropRoleLink", pageRef) {
+ final AjaxLink<Void> dropRoleLink = new IndicatingOnConfirmAjaxLink<Void>("dropRoleLink", pageRef) {
private static final long serialVersionUID = -7978723352517770644L;
@Override
protected void onClickInternal(final AjaxRequestTarget target) {
try {
- final RoleTO roleTO = (RoleTO) restClient.delete(idRole);
+ final RoleTO roleTO = restClient.delete(idRole);
((Roles) pageRef.getPage()).setModalResult(true);
@@ -151,8 +147,8 @@ public class TreeActionLinkPanel extends
}
};
- MetaDataRoleAuthorizationStrategy.authorize(dropRoleLink, ENABLE, xmlRolesReader.getAllAllowedRoles(
- "Roles", "delete"));
+ MetaDataRoleAuthorizationStrategy.authorize(dropRoleLink, ENABLE,
+ xmlRolesReader.getAllAllowedRoles("Roles", "delete"));
dropRoleLink.setOutputMarkupId(true);
fragment.add(dropRoleLink);
Modified: syncope/trunk/console/src/main/resources/log4j2.xml
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/log4j2.xml?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/log4j2.xml (original)
+++ syncope/trunk/console/src/main/resources/log4j2.xml Thu Oct 10 14:37:56 2013
@@ -41,19 +41,19 @@ under the License.
<appender-ref ref="main"/>
</asyncLogger>
- <asyncLogger name="org.apache.syncope.console" additivity="false" level="INFO">
+ <asyncLogger name="org.apache.syncope.console" additivity="false" level="ERROR">
<appender-ref ref="main"/>
</asyncLogger>
- <asyncLogger name="org.apache.wicket" additivity="false" level="INFO">
+ <asyncLogger name="org.apache.wicket" additivity="false" level="ERROR">
<appender-ref ref="main"/>
</asyncLogger>
- <asyncLogger name="org.springframework" additivity="false" level="INFO">
+ <asyncLogger name="org.springframework" additivity="false" level="ERROR">
<appender-ref ref="main"/>
</asyncLogger>
- <asyncLogger name="org.apache.http" additivity="false" level="INFO">
+ <asyncLogger name="org.apache.http" additivity="false" level="ERROR">
<appender-ref ref="main"/>
</asyncLogger>
@@ -61,7 +61,7 @@ under the License.
<appender-ref ref="main"/>
</asyncLogger>
- <root level="INFO">
+ <root level="ERROR">
<appender-ref ref="main"/>
</root>
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BaseModalPage.html
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BaseModalPage.html?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BaseModalPage.html (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BaseModalPage.html Thu Oct 10 14:37:56 2013
@@ -27,6 +27,7 @@ under the License.
<script type="text/javascript">
$(function() {
$("#tabs").tabs();
+ $("#attrTemplateTabs").tabs();
});
</script>
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/BasePage.html Thu Oct 10 14:37:56 2013
@@ -42,6 +42,7 @@ under the License.
$(document).ready(function() {
$("#tabs").tabs();
$("#roletabs").tabs();
+ $("#attrTemplateTabs").tabs();
$("#user").tabs();
$("#role").tabs();
$("#membership").tabs();
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.html
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.html?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.html (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.html Thu Oct 10 14:37:56 2013
@@ -28,7 +28,7 @@ under the License.
</ul>
<div id="tabs-1">
<div id="formtable">
- <span wicket:id="attributes">[membership attributes]</span>
+ <span wicket:id="attrs">[membership attributes]</span>
<span wicket:id="systeminformation">[System Information]</span>
</div>
@@ -39,11 +39,11 @@ under the License.
</script>
</div>
<div id="tabs-2">
- <span wicket:id="derivedAttributes">[membership derived attributes]</span>
+ <span wicket:id="derAttrs">[membership derived attributes]</span>
</div>
<div id="tabs-3">
- <span wicket:id="virtualAttributes">[membership virtual attributes]</span>
+ <span wicket:id="virAttrs">[membership virtual attributes]</span>
</div>
</div>
<div style="margin: 20px 10px 0">
Modified: syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.properties
URL: http://svn.apache.org/viewvc/syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.properties?rev=1531003&r1=1531002&r2=1531003&view=diff
==============================================================================
--- syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.properties (original)
+++ syncope/trunk/console/src/main/resources/org/apache/syncope/console/pages/MembershipModalPage.properties Thu Oct 10 14:37:56 2013
@@ -22,14 +22,14 @@ add=+
drop=-
edit=Edit
delete=Delete
-derivedAttributes=Derived Attributes
-derivedAttributeToBeRemoved=Delete
-derivedAttributeName=Name
-derivedAttributeValue=Derived value
+derAttrs=Derived Attributes
+derAttrToRemove=Delete
+derAttrName=Name
+derAttrValue=Derived value
-virtualAttributes=Virtual Attributes
-virtualAttributeToBeRemoved=Delete
-virtualAttributeName=Name
-virtualAttributeValue=Virtual value
+virAttrs=Virtual Attributes
+virAttrToRemove=Delete
+virAttrName=Name
+virAttrValue=Virtual value
addAttributeBtn=Add
|