Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ protected class Step extends WizardStep {
Step(final T modelObject) {
model.setObject(modelObject);
model.setInitialModelObject(modelObject);
add(new BeanPanel<>("bean", model).setRenderBodyOnly(true));
add(new BeanPanel<>("bean", model, pageRef).setRenderBodyOnly(true));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ private class Profile extends AbstractModalPanel<T> {

PropertyModel<UsernameAttributeProviderConf> beanPanelModel =
new PropertyModel<>(clientAppTO, "usernameAttributeProviderConf");
BeanPanel<UsernameAttributeProviderConf> bean = new BeanPanel<>(
"bean",
beanPanelModel,
Constants.NAME_FIELD_NAME,
"reportlet");
BeanPanel<UsernameAttributeProviderConf> bean = new BeanPanel<>("bean", beanPanelModel, pageRef);
add(bean.setRenderBodyOnly(false));

conf.add(new AjaxEventBehavior(Constants.ON_CHANGE) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public AccessPolicyModalPanel(
super(modal, pageRef);
this.model = model;

add(new BeanPanel<>("bean", new PropertyModel<>(model, "conf")).setRenderBodyOnly(true));
add(new BeanPanel<>("bean", new PropertyModel<>(model, "conf"), pageRef).setRenderBodyOnly(true));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ protected void onUpdate(final AjaxRequestTarget target) {
});
add(enable);

add(new BeanPanel<>("bean." + field, beanPanelModel).setRenderBodyOnly(true));
add(new BeanPanel<>("bean." + field, beanPanelModel, pageRef).setRenderBodyOnly(true));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected class Configuration extends WizardStep {
private static final long serialVersionUID = -785981096328637758L;

Configuration(final AttrRepoTO attrRepo) {
add(new BeanPanel<>("bean", new PropertyModel<>(attrRepo, "conf")).setRenderBodyOnly(true));
add(new BeanPanel<>("bean", new PropertyModel<>(attrRepo, "conf"), pageRef).setRenderBodyOnly(true));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ protected class Configuration extends WizardStep {
private static final long serialVersionUID = -785981096328637758L;

Configuration(final AuthModuleTO authModule) {
add(new BeanPanel<>("bean", new PropertyModel<>(authModule, "conf"), "ldap").setRenderBodyOnly(true));
add(new BeanPanel<>("bean", new PropertyModel<>(authModule, "conf"), pageRef, "ldap").
setRenderBodyOnly(true));
}
}

Expand Down Expand Up @@ -210,7 +211,7 @@ protected void onUpdate(final AjaxRequestTarget target) {
});
add(enable);

add(new BeanPanel<>("bean", beanPanelModel).setRenderBodyOnly(true));
add(new BeanPanel<>("bean", beanPanelModel, pageRef).setRenderBodyOnly(true));
setOutputMarkupId(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.apache.syncope.client.console;

import java.util.HashSet;
import java.util.List;
import org.apache.syncope.client.console.commons.AccessPolicyConfProvider;
import org.apache.syncope.client.console.commons.AnyDirectoryPanelAdditionalActionLinksProvider;
import org.apache.syncope.client.console.commons.AnyDirectoryPanelAdditionalActionsProvider;
Expand All @@ -44,7 +44,6 @@
import org.apache.syncope.client.console.init.ClassPathScanImplementationLookup;
import org.apache.syncope.client.ui.commons.MIMETypesLoader;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

Expand All @@ -54,10 +53,11 @@ public class IdRepoConsoleContext {
@ConditionalOnMissingBean
@Bean
public ClassPathScanImplementationLookup classPathScanImplementationLookup(
final ApplicationContext ctx, final ConsoleProperties props) {
final ConsoleProperties props,
final List<ClassPathScanImplementationContributor> classPathScanImplementationContributors) {

ClassPathScanImplementationLookup lookup = new ClassPathScanImplementationLookup(
new HashSet<>(ctx.getBeansOfType(ClassPathScanImplementationContributor.class).values()), props);
ClassPathScanImplementationLookup lookup =
new ClassPathScanImplementationLookup(classPathScanImplementationContributors, props);
lookup.load();
return lookup;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.apache.syncope.client.console;

import com.giffing.wicket.spring.boot.starter.web.config.WicketWebInitializerAutoConfig.WebSocketWicketWebInitializerAutoConfiguration;
import java.util.List;
import java.util.Map;
import org.apache.syncope.client.console.actuate.SyncopeConsoleInfoContributor;
import org.apache.syncope.client.console.commons.AccessPolicyConfProvider;
Expand All @@ -27,6 +28,7 @@
import org.apache.syncope.client.console.commons.AnyWizardBuilderAdditionalSteps;
import org.apache.syncope.client.console.commons.ExternalResourceProvider;
import org.apache.syncope.client.console.commons.ImplementationInfoProvider;
import org.apache.syncope.client.console.commons.PolicyTabProvider;
import org.apache.syncope.client.console.commons.StatusProvider;
import org.apache.syncope.client.console.commons.VirSchemaDetailsPanelProvider;
import org.apache.syncope.client.console.init.ClassPathScanImplementationLookup;
Expand All @@ -42,7 +44,6 @@
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

@SpringBootApplication(exclude = {
Expand Down Expand Up @@ -79,7 +80,7 @@ public SyncopeWebApplication syncopeWebApplication(
final VirSchemaDetailsPanelProvider virSchemaDetailsPanelProvider,
final ImplementationInfoProvider implementationInfoProvider,
final AccessPolicyConfProvider accessPolicyConfProvider,
final ApplicationContext ctx) {
final List<PolicyTabProvider> policyTabProviders) {

return new SyncopeWebApplication(
props,
Expand All @@ -92,7 +93,7 @@ public SyncopeWebApplication syncopeWebApplication(
virSchemaDetailsPanelProvider,
implementationInfoProvider,
accessPolicyConfProvider,
ctx);
policyTabProviders);
}

@ConditionalOnMissingBean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
import org.apache.wicket.request.resource.ResourceReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.util.ClassUtils;

Expand Down Expand Up @@ -106,7 +105,7 @@ public static SyncopeWebApplication get() {

protected final AccessPolicyConfProvider accessPolicyConfProvider;

protected final ApplicationContext ctx;
protected final List<PolicyTabProvider> policyTabProviders;

public SyncopeWebApplication(
final ConsoleProperties props,
Expand All @@ -120,7 +119,7 @@ public SyncopeWebApplication(
final VirSchemaDetailsPanelProvider virSchemaDetailsPanelProvider,
final ImplementationInfoProvider implementationInfoProvider,
final AccessPolicyConfProvider accessPolicyConfProvider,
final ApplicationContext ctx) {
final List<PolicyTabProvider> policyTabProviders) {

this.props = props;
this.lookup = lookup;
Expand All @@ -133,7 +132,7 @@ public SyncopeWebApplication(
this.virSchemaDetailsPanelProvider = virSchemaDetailsPanelProvider;
this.implementationInfoProvider = implementationInfoProvider;
this.accessPolicyConfProvider = accessPolicyConfProvider;
this.ctx = ctx;
this.policyTabProviders = policyTabProviders;
}

@Override
Expand Down Expand Up @@ -344,7 +343,7 @@ public ImplementationInfoProvider getImplementationInfoProvider() {
}

public Collection<PolicyTabProvider> getPolicyTabProviders() {
return ctx.getBeansOfType(PolicyTabProvider.class).values();
return policyTabProviders;
}

public List<UserFormFinalizer> getFormFinalizers(final AjaxWizard.Mode mode) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ private AjaxDataTablePanel(final String id, final Builder<T, S> builder) {
super(id);

batchModal = new BaseModal<>("batchModal");
batchModal.size(Modal.Size.Default);
batchModal.size(Modal.Size.Extra_large);
add(batchModal);

batchModal.setWindowClosedCallback(target -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,18 @@
import java.util.Optional;
import java.util.stream.Collectors;
import org.apache.commons.lang3.time.DateFormatUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.syncope.client.console.SyncopeConsoleSession;
import org.apache.syncope.client.console.SyncopeWebApplication;
import org.apache.syncope.client.console.panels.search.AnyObjectSearchPanel;
import org.apache.syncope.client.console.panels.search.GroupSearchPanel;
import org.apache.syncope.client.console.panels.search.SearchClause;
import org.apache.syncope.client.console.panels.search.SearchUtils;
import org.apache.syncope.client.console.panels.search.UserSearchPanel;
import org.apache.syncope.client.console.rest.SchemaRestClient;
import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel;
import org.apache.syncope.client.lib.SyncopeClient;
import org.apache.syncope.client.ui.commons.DateOps;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxCheckBoxPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDateTimeFieldPanel;
Expand All @@ -48,8 +55,11 @@
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxSpinnerFieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.AjaxTextFieldPanel;
import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel;
import org.apache.syncope.common.lib.report.SearchCondition;
import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;
import org.apache.syncope.common.lib.to.SchemaTO;
import org.apache.syncope.common.lib.types.SchemaType;
import org.apache.wicket.PageReference;
import org.apache.wicket.core.util.lang.PropertyResolver;
import org.apache.wicket.core.util.lang.PropertyResolverConverter;
import org.apache.wicket.markup.html.basic.Label;
Expand All @@ -65,6 +75,8 @@
import org.apache.wicket.model.util.ListModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanWrapper;
import org.springframework.beans.PropertyAccessorFactory;
import org.springframework.util.ClassUtils;
import org.springframework.util.ReflectionUtils;

Expand All @@ -76,10 +88,24 @@ public class BeanPanel<T extends Serializable> extends Panel {

private final List<String> excluded;

public BeanPanel(final String id, final IModel<T> bean, final String... excluded) {
private final Map<String, Pair<AbstractFiqlSearchConditionBuilder<?, ?, ?>, List<SearchClause>>> sCondWrapper;

public BeanPanel(final String id, final IModel<T> bean, final PageReference pageRef, final String... excluded) {
this(id, bean, null, pageRef, excluded);
}

public BeanPanel(
final String id,
final IModel<T> bean,
final Map<String, Pair<AbstractFiqlSearchConditionBuilder<?, ?, ?>, List<SearchClause>>> sCondWrapper,
final PageReference pageRef,
final String... excluded) {

super(id, bean);
setOutputMarkupId(true);

this.sCondWrapper = sCondWrapper;

this.excluded = new ArrayList<>(List.of(excluded));
this.excluded.add("serialVersionUID");
this.excluded.add("class");
Expand Down Expand Up @@ -148,7 +174,37 @@ protected void populateItem(final ListItem<String> item) {

Panel panel;

if (List.class.equals(field.getType())) {
SearchCondition scondAnnot = field.getAnnotation(SearchCondition.class);
if (scondAnnot != null) {
BeanWrapper wrapper = PropertyAccessorFactory.forBeanPropertyAccess(bean.getObject());
String fiql = (String) wrapper.getPropertyValue(fieldName);

List<SearchClause> clauses = SearchUtils.getSearchClauses(fiql);

AbstractFiqlSearchConditionBuilder<?, ?, ?> builder;
switch (scondAnnot.type()) {
case "USER":
panel = new UserSearchPanel.Builder(
new ListModel<>(clauses), pageRef).required(false).build("value");
builder = SyncopeClient.getUserSearchConditionBuilder();
break;

case "GROUP":
panel = new GroupSearchPanel.Builder(
new ListModel<>(clauses), pageRef).required(false).build("value");
builder = SyncopeClient.getGroupSearchConditionBuilder();
break;

default:
panel = new AnyObjectSearchPanel.Builder(
scondAnnot.type(),
new ListModel<>(clauses), pageRef).required(false).build("value");
builder = SyncopeClient.getAnyObjectSearchConditionBuilder(scondAnnot.type());
}

Optional.ofNullable(BeanPanel.this.sCondWrapper).
ifPresent(scw -> scw.put(fieldName, Pair.of(builder, clauses)));
} else if (List.class.equals(field.getType())) {
Class<?> listItemType = field.getGenericType() instanceof ParameterizedType
? (Class<?>) ((ParameterizedType) field.getGenericType()).getActualTypeArguments()[0]
: String.class;
Expand Down Expand Up @@ -206,8 +262,8 @@ protected void populateItem(final ListItem<String> item) {
} else if (Map.class.equals(field.getType())) {
panel = new AjaxGridFieldPanel(
"value", fieldName, new PropertyModel<>(bean, fieldName)).hideLabel();
Optional.ofNullable(field.getAnnotation(io.swagger.v3.oas.annotations.media.Schema.class))
.ifPresent(annot -> setDescription(item, annot.description()));
Optional.ofNullable(field.getAnnotation(io.swagger.v3.oas.annotations.media.Schema.class)).
ifPresent(annot -> setDescription(item, annot.description()));
} else {
Triple<FieldPanel, Boolean, Optional<String>> single =
buildSinglePanel(bean.getObject(), field.getType(), field.getName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protected Serializable load() {
return rule.getConf();
}
};
add(new BeanPanel<>("bean", bean).setRenderBodyOnly(true));
add(new BeanPanel<>("bean", bean, pageRef).setRenderBodyOnly(true));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.client.console.reports;

import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.syncope.client.console.panels.search.SearchClause;
import org.apache.syncope.common.lib.report.ReportConf;
import org.apache.syncope.common.lib.search.AbstractFiqlSearchConditionBuilder;

public class ReportConfWrapper implements Serializable {

private static final long serialVersionUID = -1817829104060261892L;

private ReportConf conf;

private final Map<String, Pair<AbstractFiqlSearchConditionBuilder<?, ?, ?>, List<SearchClause>>> scondWrapper;

public ReportConfWrapper() {
this.scondWrapper = new HashMap<>();
}

public ReportConf getConf() {
return conf;
}

public ReportConfWrapper setConf(final ReportConf conf) {
this.conf = conf;
return this;
}

public Map<String, Pair<AbstractFiqlSearchConditionBuilder<?, ?, ?>, List<SearchClause>>> getSCondWrapper() {
return scondWrapper;
}
}
Loading