(syncope) branch master updated: [SYNCOPE-1816] Enables LDAP parameters configuration for SPNEGO authentication module (#699)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new 7475ec83dc [SYNCOPE-1816] Enables LDAP parameters configuration for SPNEGO authentication module (#699) 7475ec83dc is described below commit 7475ec83dca1b71cbf06ec30a44aacddae5d6ea2 Author: Fabio Martelli AuthorDate: Wed Apr 24 17:48:57 2024 +0200 [SYNCOPE-1816] Enables LDAP parameters configuration for SPNEGO authentication module (#699) --- .../console/wizards/AuthModuleWizardBuilder.java | 22 - ...uthModuleWizardBuilder$AuthModuleConfLDAP.html} | 0 ...uleWizardBuilder$AuthModuleConfLDAP.properties} | 0 ...ardBuilder$AuthModuleConfLDAP_fr_CA.properties} | 0 ...WizardBuilder$AuthModuleConfLDAP_it.properties} | 0 ...WizardBuilder$AuthModuleConfLDAP_ja.properties} | 0 ...ardBuilder$AuthModuleConfLDAP_pt_BR.properties} | 0 ...WizardBuilder$AuthModuleConfLDAP_ru.properties} | 0 .../syncope/common/lib/auth/AuthModuleConf.java| 2 +- .../common/lib/auth/GoogleMfaAuthModuleConf.java | 7 +++- .../lib/auth/LDAPDependantAuthModuleConf.java | 28 ...thModuleConf.java => SpnegoAuthModuleConf.java} | 37 -- .../common/lib/auth/X509AuthModuleConf.java| 7 +++- .../mapping/AuthModulePropertySourceMapper.java| 13 ++-- 14 files changed, 101 insertions(+), 15 deletions(-) diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java index 195e6e3234..f42f6d0b7c 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java @@ -33,8 +33,9 @@ import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoiceP 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.wizards.AjaxWizard; +import org.apache.syncope.common.lib.AbstractLDAPConf; import org.apache.syncope.common.lib.auth.AuthModuleConf; -import org.apache.syncope.common.lib.auth.GoogleMfaAuthModuleConf; +import org.apache.syncope.common.lib.auth.LDAPDependantAuthModuleConf; import org.apache.syncope.common.lib.to.AuthModuleTO; import org.apache.syncope.common.lib.types.AuthModuleState; import org.apache.wicket.PageReference; @@ -90,7 +91,7 @@ public class AuthModuleWizardBuilder extends BaseAjaxWizardBuilder protected WizardModel buildModelSteps(final AuthModuleTO modelObject, final WizardModel wizardModel) { wizardModel.add(new Profile(modelObject, authModuleConfs, authModuleConfClass)); wizardModel.add(new Configuration(modelObject)); -wizardModel.add(new GoogleMfaAuthModuleConfLDAP(modelObject, authModuleConfClass)); +wizardModel.add(new AuthModuleConfLDAP(modelObject, authModuleConfClass)); wizardModel.add(new Mapping(modelObject)); return wizardModel; } @@ -174,19 +175,19 @@ public class AuthModuleWizardBuilder extends BaseAjaxWizardBuilder } } -protected class GoogleMfaAuthModuleConfLDAP extends WizardStep implements WizardModel.ICondition { +protected class AuthModuleConfLDAP extends WizardStep implements WizardModel.ICondition { private static final long serialVersionUID = 5328049907748683944L; private final Model> authModuleConfClass; -GoogleMfaAuthModuleConfLDAP( +AuthModuleConfLDAP( final AuthModuleTO authModule, final Model> authModuleConfClass) { this.authModuleConfClass = authModuleConfClass; -PropertyModel beanPanelModel = new PropertyModel<>(authModule, "conf.ldap"); +PropertyModel beanPanelModel = new PropertyModel<>(authModule, "conf.ldap"); AjaxCheckBoxPanel enable = new AjaxCheckBoxPanel("enable", "enableLDAP", new IModel() { @@ -209,11 +210,16 @@ public class AuthModuleWizardBuilder extends BaseAjaxWizardBuilder @Override protected void onUpdate(final AjaxRequestTarget target) { if (beanPanelModel.getObject() == null) { -beanPanelModel.setObject(new GoogleMfaAuthModuleConf.LDAP()); +try { +beanPanelModel.setObject((AbstractLDAPConf) authModuleConfClass.getObject(). +getMethod("ldapInstance", new Class[] {}).invok
(syncope) branch 3_0_X updated: [SYNCOPE-1816] Enables LDAP parameters configuration for SPNEGO authentication module (#699)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/3_0_X by this push: new dd732de5fe [SYNCOPE-1816] Enables LDAP parameters configuration for SPNEGO authentication module (#699) dd732de5fe is described below commit dd732de5fe9d38f0fec09662d7e15511adf8a850 Author: Fabio Martelli AuthorDate: Wed Apr 24 17:48:57 2024 +0200 [SYNCOPE-1816] Enables LDAP parameters configuration for SPNEGO authentication module (#699) --- .../console/wizards/AuthModuleWizardBuilder.java | 22 - ...uthModuleWizardBuilder$AuthModuleConfLDAP.html} | 0 ...uleWizardBuilder$AuthModuleConfLDAP.properties} | 0 ...ardBuilder$AuthModuleConfLDAP_fr_CA.properties} | 0 ...WizardBuilder$AuthModuleConfLDAP_it.properties} | 0 ...WizardBuilder$AuthModuleConfLDAP_ja.properties} | 0 ...ardBuilder$AuthModuleConfLDAP_pt_BR.properties} | 0 ...WizardBuilder$AuthModuleConfLDAP_ru.properties} | 0 .../syncope/common/lib/auth/AuthModuleConf.java| 2 +- .../common/lib/auth/GoogleMfaAuthModuleConf.java | 7 +++- .../lib/auth/LDAPDependantAuthModuleConf.java | 28 ...thModuleConf.java => SpnegoAuthModuleConf.java} | 37 -- .../common/lib/auth/X509AuthModuleConf.java| 7 +++- .../mapping/AuthModulePropertySourceMapper.java| 13 ++-- 14 files changed, 101 insertions(+), 15 deletions(-) diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java index 195e6e3234..f42f6d0b7c 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/wizards/AuthModuleWizardBuilder.java @@ -33,8 +33,9 @@ import org.apache.syncope.client.ui.commons.markup.html.form.AjaxDropDownChoiceP 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.wizards.AjaxWizard; +import org.apache.syncope.common.lib.AbstractLDAPConf; import org.apache.syncope.common.lib.auth.AuthModuleConf; -import org.apache.syncope.common.lib.auth.GoogleMfaAuthModuleConf; +import org.apache.syncope.common.lib.auth.LDAPDependantAuthModuleConf; import org.apache.syncope.common.lib.to.AuthModuleTO; import org.apache.syncope.common.lib.types.AuthModuleState; import org.apache.wicket.PageReference; @@ -90,7 +91,7 @@ public class AuthModuleWizardBuilder extends BaseAjaxWizardBuilder protected WizardModel buildModelSteps(final AuthModuleTO modelObject, final WizardModel wizardModel) { wizardModel.add(new Profile(modelObject, authModuleConfs, authModuleConfClass)); wizardModel.add(new Configuration(modelObject)); -wizardModel.add(new GoogleMfaAuthModuleConfLDAP(modelObject, authModuleConfClass)); +wizardModel.add(new AuthModuleConfLDAP(modelObject, authModuleConfClass)); wizardModel.add(new Mapping(modelObject)); return wizardModel; } @@ -174,19 +175,19 @@ public class AuthModuleWizardBuilder extends BaseAjaxWizardBuilder } } -protected class GoogleMfaAuthModuleConfLDAP extends WizardStep implements WizardModel.ICondition { +protected class AuthModuleConfLDAP extends WizardStep implements WizardModel.ICondition { private static final long serialVersionUID = 5328049907748683944L; private final Model> authModuleConfClass; -GoogleMfaAuthModuleConfLDAP( +AuthModuleConfLDAP( final AuthModuleTO authModule, final Model> authModuleConfClass) { this.authModuleConfClass = authModuleConfClass; -PropertyModel beanPanelModel = new PropertyModel<>(authModule, "conf.ldap"); +PropertyModel beanPanelModel = new PropertyModel<>(authModule, "conf.ldap"); AjaxCheckBoxPanel enable = new AjaxCheckBoxPanel("enable", "enableLDAP", new IModel() { @@ -209,11 +210,16 @@ public class AuthModuleWizardBuilder extends BaseAjaxWizardBuilder @Override protected void onUpdate(final AjaxRequestTarget target) { if (beanPanelModel.getObject() == null) { -beanPanelModel.setObject(new GoogleMfaAuthModuleConf.LDAP()); +try { +beanPanelModel.setObject((AbstractLDAPConf) authModuleConfClass.getObject(). +getMethod("ldapInstance", new Class[] {}).invok
(syncope) 02/02: [SYNCOPE-1816] removes ntlm parameter because not available anymore on CAS 7
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit 2c9e1b54ac232bc9f86bc0742033b22da192b774 Author: fabio AuthorDate: Thu Apr 18 12:35:57 2024 +0200 [SYNCOPE-1816] removes ntlm parameter because not available anymore on CAS 7 --- .../syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java | 13 - .../bootstrap/mapping/AuthModulePropertySourceMapper.java | 3 +-- 2 files changed, 1 insertion(+), 15 deletions(-) diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java index 06ef008a91..712ca3e18d 100644 --- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java @@ -135,11 +135,6 @@ public class JcifsSpnegoAuthModuleConf implements AuthModuleConf { */ private String spnegoAttributeName = "distinguishedName"; -/** - * Determines the header to set and the message prefix when negotiating spnego. - */ -private boolean ntlm; - /** * If true, does not terminate authentication and allows CAS to resume * and fallback to normal authentication means such as uid/psw via the login page. @@ -292,14 +287,6 @@ public class JcifsSpnegoAuthModuleConf implements AuthModuleConf { this.spnegoAttributeName = spnegoAttributeName; } -public boolean isNtlm() { -return ntlm; -} - -public void setNtlm(final boolean ntlm) { -this.ntlm = ntlm; -} - public boolean isMixedModeAuthentication() { return mixedModeAuthentication; } diff --git a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java index 5b619a5418..e3b66c34e4 100644 --- a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java +++ b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java @@ -460,7 +460,6 @@ public class AuthModulePropertySourceMapper extends PropertySourceMapper impleme props.setDnsTimeout(conf.getDnsTimeout()); props.setHostNameClientActionStrategy(conf.getHostNameClientActionStrategy()); props.setHostNamePatternString(conf.getHostNamePatternString()); -props.setNtlm(conf.isNtlm()); props.setNtlmAllowed(conf.isNtlmAllowed()); props.setPoolSize(conf.getPoolSize()); props.setPoolTimeout(conf.getPoolTimeout()); @@ -481,6 +480,6 @@ public class AuthModulePropertySourceMapper extends PropertySourceMapper impleme props.setLdap(ldapProps); } -return prefix("cas.authn.spnego.", CasCoreConfigurationUtils.asMap(props)); +return prefix("cas.authn.spnego.", WAConfUtils.asMap(props)); } }
(syncope) branch master updated (669715aa8a -> 2c9e1b54ac)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git from 669715aa8a [SYNCOPE-1817] Fixing Standalone new 6c7bf91ad8 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler (#691) new 2c9e1b54ac [SYNCOPE-1816] removes ntlm parameter because not available anymore on CAS 7 The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../syncope/common/lib/auth/AuthModuleConf.java| 2 + .../common/lib/auth/JcifsSpnegoAuthModuleConf.java | 326 + .../mapping/AuthModulePropertySourceMapper.java| 39 +++ 3 files changed, 367 insertions(+) create mode 100644 common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java
(syncope) 01/02: [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler (#691)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit 6c7bf91ad8deae696c056c1a4a958215085aa681 Author: Fabio Martelli AuthorDate: Thu Apr 18 12:09:59 2024 +0200 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler (#691) --- .../syncope/common/lib/auth/AuthModuleConf.java| 2 + .../common/lib/auth/JcifsSpnegoAuthModuleConf.java | 339 + .../mapping/AuthModulePropertySourceMapper.java| 40 +++ 3 files changed, 381 insertions(+) diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java index 6d476ea748..0e1208d3a7 100644 --- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java @@ -59,6 +59,8 @@ public interface AuthModuleConf extends BaseBean { Map map(AuthModuleTO authModule, DuoMfaAuthModuleConf conf); Map map(AuthModuleTO authModule, SimpleMfaAuthModuleConf conf); + +Map map(AuthModuleTO authModule, JcifsSpnegoAuthModuleConf conf); } Map map(AuthModuleTO authModule, Mapper mapper); diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java new file mode 100644 index 00..06ef008a91 --- /dev/null +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java @@ -0,0 +1,339 @@ +/* + * 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.common.lib.auth; + +import java.io.Serializable; +import java.util.Map; +import org.apache.syncope.common.lib.AbstractLDAPConf; +import org.apache.syncope.common.lib.to.AuthModuleTO; + +/** + * SPNEGO is an authentication technology that is primarily used to provide transparent CAS authentication to browsers + * running on Windows running under Active Directory domain credentials. There are three actors involved: the client, + * the CAS server, and the Active Directory Domain Controller/KDC. + */ +public class JcifsSpnegoAuthModuleConf implements AuthModuleConf { + +private static final long serialVersionUID = -7775771400312303131L; + +public static class LDAP extends AbstractLDAPConf implements Serializable { + +private static final long serialVersionUID = -7274446267090678730L; + +} + +/** + * The Login conf.Absolute path to the jaas login configuration file. + * This should define the spnego authentication details. + * Make sure you have at least specified the JCIFS Service Principal defined. + */ +private String loginConf; + +/** + * The Kerberos conf. + * As with all Kerberos installations, a Kerberos Key Distribution Center (KDC) is required. + * It needs to contain the user name and password you will use to be authenticated to Kerberos. + * As with most Kerberos installations, a Kerberos configuration file krb5.conf is + * consulted to determine such things as the default realm and KDC. + * Typically, the default realm and the KDC for that realm are indicated in + * the Kerberos krb5.conf configuration file. + * The path to the configuration file must typically be defined + * as an absolute path. + */ +private String kerberosConf; + +/** + * The Kerberos kdc. + */ +private String kerberosKdc = "172.10.1.10"; + +/** + * The Kerberos realm. + */ +private String kerberosRealm = "EXAMPLE.COM"; + +/** + * The Kerberos debug. + */ +private boolean kerberosDebug; + +/** + * The Use subject creds only. + */ +private boolean useSubjectCredsOnly; + +/** + * If specified, will create the principal by ths name on successful authentication. + */ +private boolean principalWithDomainName; + +/** + * Allows authe
(syncope) branch 3_0_X updated: [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler (#691)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/3_0_X by this push: new 97b8605519 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler (#691) 97b8605519 is described below commit 97b8605519daae5d38a21504c8b5a18e9863d66c Author: Fabio Martelli AuthorDate: Thu Apr 18 12:09:59 2024 +0200 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler (#691) --- .../syncope/common/lib/auth/AuthModuleConf.java| 2 + .../common/lib/auth/JcifsSpnegoAuthModuleConf.java | 339 + .../mapping/AuthModulePropertySourceMapper.java| 40 +++ 3 files changed, 381 insertions(+) diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java index c5e1d36975..8414ba9a6e 100644 --- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java @@ -61,6 +61,8 @@ public interface AuthModuleConf extends BaseBean { Map map(AuthModuleTO authModule, U2FAuthModuleConf conf); Map map(AuthModuleTO authModule, SimpleMfaAuthModuleConf conf); + +Map map(AuthModuleTO authModule, JcifsSpnegoAuthModuleConf conf); } Map map(AuthModuleTO authModule, Mapper mapper); diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java new file mode 100644 index 00..06ef008a91 --- /dev/null +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java @@ -0,0 +1,339 @@ +/* + * 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.common.lib.auth; + +import java.io.Serializable; +import java.util.Map; +import org.apache.syncope.common.lib.AbstractLDAPConf; +import org.apache.syncope.common.lib.to.AuthModuleTO; + +/** + * SPNEGO is an authentication technology that is primarily used to provide transparent CAS authentication to browsers + * running on Windows running under Active Directory domain credentials. There are three actors involved: the client, + * the CAS server, and the Active Directory Domain Controller/KDC. + */ +public class JcifsSpnegoAuthModuleConf implements AuthModuleConf { + +private static final long serialVersionUID = -7775771400312303131L; + +public static class LDAP extends AbstractLDAPConf implements Serializable { + +private static final long serialVersionUID = -7274446267090678730L; + +} + +/** + * The Login conf.Absolute path to the jaas login configuration file. + * This should define the spnego authentication details. + * Make sure you have at least specified the JCIFS Service Principal defined. + */ +private String loginConf; + +/** + * The Kerberos conf. + * As with all Kerberos installations, a Kerberos Key Distribution Center (KDC) is required. + * It needs to contain the user name and password you will use to be authenticated to Kerberos. + * As with most Kerberos installations, a Kerberos configuration file krb5.conf is + * consulted to determine such things as the default realm and KDC. + * Typically, the default realm and the KDC for that realm are indicated in + * the Kerberos krb5.conf configuration file. + * The path to the configuration file must typically be defined + * as an absolute path. + */ +private String kerberosConf; + +/** + * The Kerberos kdc. + */ +private String kerberosKdc = "172.10.1.10"; + +/** + * The Kerberos realm. + */ +private String kerberosRealm = "EXAMPLE.COM"; + +/** + * The Kerberos debug. + */ +private boolean kerberosDebug; + +/** + * The Use subject creds only. + */
(syncope) branch SYNCOPE-1816 deleted (was 2f973e7c36)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch SYNCOPE-1816 in repository https://gitbox.apache.org/repos/asf/syncope.git was 2f973e7c36 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler This change permanently discards the following revisions: discard 2f973e7c36 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler
(syncope) branch SYNCOPE-1816 created (now 2f973e7c36)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch SYNCOPE-1816 in repository https://gitbox.apache.org/repos/asf/syncope.git at 2f973e7c36 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler This branch includes the following new commits: new 2f973e7c36 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference.
(syncope) 01/01: [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch SYNCOPE-1816 in repository https://gitbox.apache.org/repos/asf/syncope.git commit 2f973e7c36a009afb3bb5b1be54506aae044e85a Author: fabio AuthorDate: Thu Apr 18 10:53:56 2024 +0200 [SYNCOPE-1816] Provides the possibility to add a JcifsSpnegoAuthenticationHandler --- .../syncope/common/lib/auth/AuthModuleConf.java| 2 + .../common/lib/auth/JcifsSpnegoAuthModuleConf.java | 339 + .../mapping/AuthModulePropertySourceMapper.java| 40 +++ 3 files changed, 381 insertions(+) diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java index c5e1d36975..8414ba9a6e 100644 --- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/AuthModuleConf.java @@ -61,6 +61,8 @@ public interface AuthModuleConf extends BaseBean { Map map(AuthModuleTO authModule, U2FAuthModuleConf conf); Map map(AuthModuleTO authModule, SimpleMfaAuthModuleConf conf); + +Map map(AuthModuleTO authModule, JcifsSpnegoAuthModuleConf conf); } Map map(AuthModuleTO authModule, Mapper mapper); diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java new file mode 100644 index 00..06ef008a91 --- /dev/null +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/JcifsSpnegoAuthModuleConf.java @@ -0,0 +1,339 @@ +/* + * 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.common.lib.auth; + +import java.io.Serializable; +import java.util.Map; +import org.apache.syncope.common.lib.AbstractLDAPConf; +import org.apache.syncope.common.lib.to.AuthModuleTO; + +/** + * SPNEGO is an authentication technology that is primarily used to provide transparent CAS authentication to browsers + * running on Windows running under Active Directory domain credentials. There are three actors involved: the client, + * the CAS server, and the Active Directory Domain Controller/KDC. + */ +public class JcifsSpnegoAuthModuleConf implements AuthModuleConf { + +private static final long serialVersionUID = -7775771400312303131L; + +public static class LDAP extends AbstractLDAPConf implements Serializable { + +private static final long serialVersionUID = -7274446267090678730L; + +} + +/** + * The Login conf.Absolute path to the jaas login configuration file. + * This should define the spnego authentication details. + * Make sure you have at least specified the JCIFS Service Principal defined. + */ +private String loginConf; + +/** + * The Kerberos conf. + * As with all Kerberos installations, a Kerberos Key Distribution Center (KDC) is required. + * It needs to contain the user name and password you will use to be authenticated to Kerberos. + * As with most Kerberos installations, a Kerberos configuration file krb5.conf is + * consulted to determine such things as the default realm and KDC. + * Typically, the default realm and the KDC for that realm are indicated in + * the Kerberos krb5.conf configuration file. + * The path to the configuration file must typically be defined + * as an absolute path. + */ +private String kerberosConf; + +/** + * The Kerberos kdc. + */ +private String kerberosKdc = "172.10.1.10"; + +/** + * The Kerberos realm. + */ +private String kerberosRealm = "EXAMPLE.COM"; + +/** + * The Kerberos debug. + */ +private boolean kerberosDebug; + +/** + * The Use subject creds only. + */ +private boolean useSubjectCredsOnly; + +/** + * If specified, will create the principal by ths name on successful authentication. + */ +private boolean principalWithDomainName; + +/** + * Allows authenticatio
(syncope) branch master updated: [SYNCOPE-1802] provides missing delegated SAML2 IdP configuration parameters (#614)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new caeb361d44 [SYNCOPE-1802] provides missing delegated SAML2 IdP configuration parameters (#614) caeb361d44 is described below commit caeb361d44e3597590ebe50e7cc49b0b8622e773 Author: fabio AuthorDate: Mon Feb 5 08:57:51 2024 +0100 [SYNCOPE-1802] provides missing delegated SAML2 IdP configuration parameters (#614) --- .../common/lib/auth/SAML2IdPAuthModuleConf.java| 39 ++ .../mapping/AuthModulePropertySourceMapper.java| 4 +++ 2 files changed, 43 insertions(+) diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java index 44ba4dab30..b78b3a2010 100644 --- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java @@ -41,6 +41,16 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM */ protected SAML2BindingType destinationBinding = SAML2BindingType.REDIRECT; +/** + * The Service Provider metadata path. + */ +protected String serviceProviderMetadataPath; + +/** + * The path to the keystore. + */ +protected String keystorePath; + /** * The password to use when generating the SP keystore. */ @@ -113,6 +123,11 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM */ protected String nameIdPolicyFormat; +/** + * Whether metadata should be marked to request response signed. + */ +protected boolean responsesSigned; + /** * Whether metadata should be marked to request sign assertions. */ @@ -197,6 +212,22 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM this.destinationBinding = destinationBinding; } +public String getServiceProviderMetadataPath() { +return serviceProviderMetadataPath; +} + +public void setServiceProviderMetadataPath(final String serviceProviderMetadataPath) { +this.serviceProviderMetadataPath = serviceProviderMetadataPath; +} + +public String getKeystorePath() { +return keystorePath; +} + +public void setKeystorePath(final String keystorePath) { +this.keystorePath = keystorePath; +} + public String getKeystorePassword() { return keystorePassword; } @@ -289,6 +320,14 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM this.nameIdPolicyFormat = nameIdPolicyFormat; } +public boolean isResponsesSigned() { +return responsesSigned; +} + +public void setResponsesSigned(final boolean responsesSigned) { +this.responsesSigned = responsesSigned; +} + public boolean isWantsAssertionsSigned() { return wantsAssertionsSigned; } diff --git a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java index 23e0d02116..05e8655c16 100644 --- a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java +++ b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java @@ -276,6 +276,10 @@ public class AuthModulePropertySourceMapper extends PropertySourceMapper impleme props.setBlockedSignatureSigningAlgorithms(conf.getBlockedSignatureSigningAlgorithms()); props.setDestinationBinding(conf.getDestinationBinding().getUri()); props.getMetadata().setIdentityProviderMetadataPath(conf.getIdentityProviderMetadataPath()); + props.getMetadata().getServiceProvider().getFileSystem().setLocation(conf.getServiceProviderMetadataPath()); +props.setKeystorePath(conf.getKeystorePath()); +props.setWantsAssertionsSigned(conf.isWantsAssertionsSigned()); +props.setWantsResponsesSigned(conf.isResponsesSigned()); props.setKeystorePassword(conf.getKeystorePassword()); props.setMaximumAuthenticationLifetime(conf.getMaximumAuthenticationLifetime()); props.setNameIdPolicyFormat(conf.getNameIdPolicyFormat());
(syncope) branch 3_0_X updated: [SYNCOPE-1802] provides missing configuration paramneters (#614)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/3_0_X by this push: new 44f617ef04 [SYNCOPE-1802] provides missing configuration paramneters (#614) 44f617ef04 is described below commit 44f617ef048d9e1e782cc7890dc0871d5ba6a04e Author: Fabio Martelli AuthorDate: Fri Feb 2 16:47:50 2024 +0100 [SYNCOPE-1802] provides missing configuration paramneters (#614) --- .../common/lib/auth/SAML2IdPAuthModuleConf.java| 39 ++ .../mapping/AuthModulePropertySourceMapper.java| 4 +++ 2 files changed, 43 insertions(+) diff --git a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java index be32854221..f4a3c1e983 100644 --- a/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java +++ b/common/am/lib/src/main/java/org/apache/syncope/common/lib/auth/SAML2IdPAuthModuleConf.java @@ -41,6 +41,16 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM */ protected SAML2BindingType destinationBinding = SAML2BindingType.REDIRECT; +/** + * The Service Provider metadata path. + */ +protected String serviceProviderMetadataPath; + +/** + * The path to the keystore. + */ +protected String keystorePath; + /** * The password to use when generating the SP keystore. */ @@ -118,6 +128,11 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM */ protected String nameIdPolicyFormat; +/** + * Whether metadata should be marked to request response signed. + */ +protected boolean responsesSigned; + /** * Whether metadata should be marked to request sign assertions. */ @@ -202,6 +217,22 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM this.destinationBinding = destinationBinding; } +public String getServiceProviderMetadataPath() { +return serviceProviderMetadataPath; +} + +public void setServiceProviderMetadataPath(final String serviceProviderMetadataPath) { +this.serviceProviderMetadataPath = serviceProviderMetadataPath; +} + +public String getKeystorePath() { +return keystorePath; +} + +public void setKeystorePath(final String keystorePath) { +this.keystorePath = keystorePath; +} + public String getKeystorePassword() { return keystorePassword; } @@ -302,6 +333,14 @@ public class SAML2IdPAuthModuleConf extends Pac4jAuthModuleConf implements AuthM this.nameIdPolicyFormat = nameIdPolicyFormat; } +public boolean isResponsesSigned() { +return responsesSigned; +} + +public void setResponsesSigned(final boolean responsesSigned) { +this.responsesSigned = responsesSigned; +} + public boolean isWantsAssertionsSigned() { return wantsAssertionsSigned; } diff --git a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java index 251e1e2318..b90e83f317 100644 --- a/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java +++ b/wa/bootstrap/src/main/java/org/apache/syncope/wa/bootstrap/mapping/AuthModulePropertySourceMapper.java @@ -280,6 +280,10 @@ public class AuthModulePropertySourceMapper extends PropertySourceMapper impleme props.setBlockedSignatureSigningAlgorithms(conf.getBlockedSignatureSigningAlgorithms()); props.setDestinationBinding(conf.getDestinationBinding().getUri()); props.setIdentityProviderMetadataPath(conf.getIdentityProviderMetadataPath()); + props.setServiceProviderMetadataPath(conf.getServiceProviderMetadataPath()); +props.setKeystorePath(conf.getKeystorePath()); +props.setWantsAssertionsSigned(conf.isWantsAssertionsSigned()); +props.setWantsResponsesSigned(conf.isResponsesSigned()); props.setKeystoreAlias(conf.getKeystoreAlias()); props.setKeystorePassword(conf.getKeystorePassword()); props.setMaximumAuthenticationLifetime(conf.getMaximumAuthenticationLifetime());
[syncope] branch master updated: Change logic in order to permit to override PullJobDelegate implementation body (#465)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new e076c5cec1 Change logic in order to permit to override PullJobDelegate implementation body (#465) e076c5cec1 is described below commit e076c5cec116e9ec787fe572cbaf9b175aa34d88 Author: Fabio Martelli AuthorDate: Fri May 26 09:07:22 2023 +0200 Change logic in order to permit to override PullJobDelegate implementation body (#465) --- .../syncope/core/provisioning/java/data/TaskDataBinderImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java index fb6202645b..f6e876c3ee 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java @@ -125,7 +125,7 @@ public class TaskDataBinderImpl extends AbstractExecutableDatabinder implements Implementation jobDelegate = pushTaskTO.getJobDelegate() == null ? implementationDAO.findByType(IdRepoImplementationType.TASKJOB_DELEGATE).stream(). -filter(impl -> PushJobDelegate.class.getName().equals(impl.getBody())). +filter(impl -> PushJobDelegate.class.getSimpleName().equals(impl.getKey())). findFirst().orElse(null) : implementationDAO.find(pushTaskTO.getJobDelegate()); if (jobDelegate == null) { @@ -164,7 +164,7 @@ public class TaskDataBinderImpl extends AbstractExecutableDatabinder implements Implementation jobDelegate = pullTaskTO.getJobDelegate() == null ? implementationDAO.findByType(IdRepoImplementationType.TASKJOB_DELEGATE).stream(). -filter(impl -> PullJobDelegate.class.getName().equals(impl.getBody())). +filter(impl -> PullJobDelegate.class.getSimpleName().equals(impl.getKey())). findFirst().orElse(null) : implementationDAO.find(pullTaskTO.getJobDelegate()); if (jobDelegate == null) {
[syncope] branch 3_0_X updated: Change logic in order to permit to override PullJobDelegate implementation body (#465)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/3_0_X by this push: new f644deaa9d Change logic in order to permit to override PullJobDelegate implementation body (#465) f644deaa9d is described below commit f644deaa9dbd4e5738f7846031dfe562f82c32cf Author: Fabio Martelli AuthorDate: Fri May 26 09:07:22 2023 +0200 Change logic in order to permit to override PullJobDelegate implementation body (#465) --- .../syncope/core/provisioning/java/data/TaskDataBinderImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java index fb6202645b..f6e876c3ee 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/TaskDataBinderImpl.java @@ -125,7 +125,7 @@ public class TaskDataBinderImpl extends AbstractExecutableDatabinder implements Implementation jobDelegate = pushTaskTO.getJobDelegate() == null ? implementationDAO.findByType(IdRepoImplementationType.TASKJOB_DELEGATE).stream(). -filter(impl -> PushJobDelegate.class.getName().equals(impl.getBody())). +filter(impl -> PushJobDelegate.class.getSimpleName().equals(impl.getKey())). findFirst().orElse(null) : implementationDAO.find(pushTaskTO.getJobDelegate()); if (jobDelegate == null) { @@ -164,7 +164,7 @@ public class TaskDataBinderImpl extends AbstractExecutableDatabinder implements Implementation jobDelegate = pullTaskTO.getJobDelegate() == null ? implementationDAO.findByType(IdRepoImplementationType.TASKJOB_DELEGATE).stream(). -filter(impl -> PullJobDelegate.class.getName().equals(impl.getBody())). +filter(impl -> PullJobDelegate.class.getSimpleName().equals(impl.getKey())). findFirst().orElse(null) : implementationDAO.find(pullTaskTO.getJobDelegate()); if (jobDelegate == null) {
[syncope] branch master updated: [SYNCOPE-1757] provides type info during SyncToken value serialization (#460)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new 75da26743a [SYNCOPE-1757] provides type info during SyncToken value serialization (#460) 75da26743a is described below commit 75da26743a88e34d813399304aba5ef9223670d8 Author: Fabio Martelli AuthorDate: Mon May 8 16:49:46 2023 +0200 [SYNCOPE-1757] provides type info during SyncToken value serialization (#460) --- .../api/serialization/SyncTokenDeserializer.java | 69 ++ .../api/serialization/SyncTokenSerializer.java | 21 --- .../api/serialization/SyncTokenSerializerTest.java | 20 --- 3 files changed, 70 insertions(+), 40 deletions(-) diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java index 413bbb66f2..3bfe9f6384 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java @@ -36,31 +36,54 @@ class SyncTokenDeserializer extends JsonDeserializer { ObjectNode tree = jp.readValueAsTree(); -Object value = null; -if (tree.has("value")) { -JsonNode node = tree.get("value"); -if (node.isBoolean()) { -value = node.asBoolean(); -} else if (node.isDouble()) { -value = node.asDouble(); -} else if (node.isLong()) { -value = node.asLong(); -} else if (node.isInt()) { -value = node.asInt(); -} else { -value = node.asText(); -} +Object value = tree.has("value") +? tree.has("type") +? deserialize(tree.get("value"), tree.get("type")) +: deserialize(tree.get("value")) +: null; -if (value instanceof String) { -String base64 = (String) value; -try { -value = Base64.getDecoder().decode(base64); -} catch (RuntimeException e) { -value = base64; -} -} +return new SyncToken(Objects.requireNonNull(value)); +} + +private Object deserialize(final JsonNode value, final JsonNode type) { +if (Boolean.class.getSimpleName().equals(type.asText())) { +return value.asBoolean(); } -return new SyncToken(Objects.requireNonNull(value)); +if (Double.class.getSimpleName().equals(type.asText())) { +return value.asDouble(); +} +if (Long.class.getSimpleName().equals(type.asText())) { +return value.asLong(); +} +if (Integer.class.getSimpleName().equals(type.asText())) { +return value.asInt(); +} + +return value.asText(); +} + +private Object deserialize(final JsonNode value) { +if (value.isBoolean()) { +return value.asBoolean(); +} + +if (value.isDouble()) { +return value.asDouble(); +} + +if (value.isLong()) { +return value.asLong(); +} + +if (value.isInt()) { +return value.asInt(); +} + +try { +return Base64.getDecoder().decode(value.asText()); +} catch (RuntimeException e) { +return value.asText(); +} } } diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java index b96c6d26b5..ef964ed3d1 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java @@ -33,22 +33,25 @@ class SyncTokenSerializer extends JsonSerializer { jgen.writeStartObject(); -jgen.writeFieldName("value"); - if (source.getValue() == null) { -jgen.writeNull(); +jgen.writeNullField("value"); } else if (source.getValue() instanceof Boolean) { -jgen.writeBoolean((Boolean) source.getValue()); +jgen.writeStringField("type", Boolean.class.getSimpleName()); +jgen.writeBooleanField("value", (Boolean) source
[syncope] branch 3_0_X updated: [SYNCOPE-1757] provides type info during SyncToken value serialization (#460)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/3_0_X by this push: new c0ca6ed665 [SYNCOPE-1757] provides type info during SyncToken value serialization (#460) c0ca6ed665 is described below commit c0ca6ed6654b27d73c0736bfa7307369162a0c42 Author: Fabio Martelli AuthorDate: Mon May 8 16:49:46 2023 +0200 [SYNCOPE-1757] provides type info during SyncToken value serialization (#460) --- .../api/serialization/SyncTokenDeserializer.java | 69 ++ .../api/serialization/SyncTokenSerializer.java | 21 --- .../api/serialization/SyncTokenSerializerTest.java | 20 --- 3 files changed, 70 insertions(+), 40 deletions(-) diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java index 413bbb66f2..3bfe9f6384 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenDeserializer.java @@ -36,31 +36,54 @@ class SyncTokenDeserializer extends JsonDeserializer { ObjectNode tree = jp.readValueAsTree(); -Object value = null; -if (tree.has("value")) { -JsonNode node = tree.get("value"); -if (node.isBoolean()) { -value = node.asBoolean(); -} else if (node.isDouble()) { -value = node.asDouble(); -} else if (node.isLong()) { -value = node.asLong(); -} else if (node.isInt()) { -value = node.asInt(); -} else { -value = node.asText(); -} +Object value = tree.has("value") +? tree.has("type") +? deserialize(tree.get("value"), tree.get("type")) +: deserialize(tree.get("value")) +: null; -if (value instanceof String) { -String base64 = (String) value; -try { -value = Base64.getDecoder().decode(base64); -} catch (RuntimeException e) { -value = base64; -} -} +return new SyncToken(Objects.requireNonNull(value)); +} + +private Object deserialize(final JsonNode value, final JsonNode type) { +if (Boolean.class.getSimpleName().equals(type.asText())) { +return value.asBoolean(); } -return new SyncToken(Objects.requireNonNull(value)); +if (Double.class.getSimpleName().equals(type.asText())) { +return value.asDouble(); +} +if (Long.class.getSimpleName().equals(type.asText())) { +return value.asLong(); +} +if (Integer.class.getSimpleName().equals(type.asText())) { +return value.asInt(); +} + +return value.asText(); +} + +private Object deserialize(final JsonNode value) { +if (value.isBoolean()) { +return value.asBoolean(); +} + +if (value.isDouble()) { +return value.asDouble(); +} + +if (value.isLong()) { +return value.asLong(); +} + +if (value.isInt()) { +return value.asInt(); +} + +try { +return Base64.getDecoder().decode(value.asText()); +} catch (RuntimeException e) { +return value.asText(); +} } } diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java index b96c6d26b5..ef964ed3d1 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/serialization/SyncTokenSerializer.java @@ -33,22 +33,25 @@ class SyncTokenSerializer extends JsonSerializer { jgen.writeStartObject(); -jgen.writeFieldName("value"); - if (source.getValue() == null) { -jgen.writeNull(); +jgen.writeNullField("value"); } else if (source.getValue() instanceof Boolean) { -jgen.writeBoolean((Boolean) source.getValue()); +jgen.writeStringField("type", Boolean.class.getSimpleName()); +jgen.writeBooleanField("value", (Boolean) source
[syncope] branch 3_0_X updated: [SYNCOPE-1755] Skip delete operation in case of NO_MATCH (#457)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/3_0_X by this push: new f257752a0e [SYNCOPE-1755] Skip delete operation in case of NO_MATCH (#457) f257752a0e is described below commit f257752a0e5be2f1dd917263d24e4aa00d0ee2be Author: Fabio Martelli AuthorDate: Fri May 5 12:28:21 2023 +0200 [SYNCOPE-1755] Skip delete operation in case of NO_MATCH (#457) --- .../core/provisioning/java/pushpull/AbstractPullResultHandler.java| 3 ++- .../core/provisioning/java/pushpull/DefaultUserPullResultHandler.java | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java index 1f1199ddde..5768f3a103 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/AbstractPullResultHandler.java @@ -810,7 +810,8 @@ public abstract class AbstractPullResultHandler break; case DELETE: -result = delete(delta, matches, provision); +// Skip DELETE in case of PullCorrelationRule.NO_MATCH +result = matches.get(0).getAny() == null ? Result.SUCCESS : delete(delta, matches, provision); break; default: diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultUserPullResultHandler.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultUserPullResultHandler.java index e0e49c54e4..80da10702b 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultUserPullResultHandler.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/DefaultUserPullResultHandler.java @@ -147,11 +147,11 @@ public class DefaultUserPullResultHandler extends AbstractPullResultHandler impl Result global = Result.SUCCESS; for (PullMatch match : matches) { -User user = (User) match.getAny(); -if (user == null) { +if (match.getAny() == null) { LOG.error("Could not find linking user, cannot process match {}", match); return Result.FAILURE; } +User user = (User) match.getAny(); Optional found = user.getLinkedAccount(profile.getTask().getResource().getKey(), delta.getUid().getUidValue());
[syncope] branch 3_0_X updated: [SYNCOPE-1753] Provides changes' history management for several relevant WA objects (#444)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 3_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/3_0_X by this push: new 3ee4079cd0 [SYNCOPE-1753] Provides changes' history management for several relevant WA objects (#444) 3ee4079cd0 is described below commit 3ee4079cd0750e8ee42ceb5193e28739ee03cdcf Author: Fabio Martelli AuthorDate: Thu Apr 20 12:08:20 2023 +0200 [SYNCOPE-1753] Provides changes' history management for several relevant WA objects (#444) --- .../clientapps/ClientAppDirectoryPanel.java| 49 ++ .../console/panels/AttrRepoDirectoryPanel.java | 51 +++ .../console/panels/AuthModuleDirectoryPanel.java | 51 +++ .../clientapps/ClientAppDirectoryPanel.properties | 1 + .../ClientAppDirectoryPanel_fr_CA.properties | 1 + .../ClientAppDirectoryPanel_it.properties | 1 + .../ClientAppDirectoryPanel_ja.properties | 1 + .../ClientAppDirectoryPanel_pt_BR.properties | 1 + .../ClientAppDirectoryPanel_ru.properties | 1 + .../panels/AttrRepoDirectoryPanel.properties | 1 + .../panels/AttrRepoDirectoryPanel_fr_CA.properties | 1 + .../panels/AttrRepoDirectoryPanel_it.properties| 2 + .../panels/AttrRepoDirectoryPanel_ja.properties| 1 + .../panels/AttrRepoDirectoryPanel_pt_BR.properties | 1 + .../panels/AttrRepoDirectoryPanel_ru.properties| 1 + .../panels/AuthModuleDirectoryPanel.properties | 1 + .../AuthModuleDirectoryPanel_fr_CA.properties | 1 + .../panels/AuthModuleDirectoryPanel_it.properties | 2 + .../panels/AuthModuleDirectoryPanel_ja.properties | 1 + .../AuthModuleDirectoryPanel_pt_BR.properties | 1 + .../panels/AuthModuleDirectoryPanel_ru.properties | 1 + .../topology/TopologyTogglePanel_fr_CA.properties | 1 + .../console/policies/PolicyDirectoryPanel.java | 56 +++- .../panels/UserDirectoryPanel_it.properties| 2 +- .../policies/PolicyDirectoryPanel.properties | 1 + .../policies/PolicyDirectoryPanel_fr_CA.properties | 1 + .../policies/PolicyDirectoryPanel_it.properties| 1 + .../policies/PolicyDirectoryPanel_ja.properties| 1 + .../policies/PolicyDirectoryPanel_pt_BR.properties | 1 + .../policies/PolicyDirectoryPanel_ru.properties| 1 + .../apache/syncope/core/logic/AttrRepoLogic.java | 34 +- .../apache/syncope/core/logic/AuthModuleLogic.java | 34 +- .../apache/syncope/core/logic/ClientAppLogic.java | 76 +- .../org/apache/syncope/core/logic/PolicyLogic.java | 40 +++- .../apache/syncope/fit/console/PoliciesITCase.java | 12 ++-- 35 files changed, 339 insertions(+), 93 deletions(-) diff --git a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.java b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.java index b6c1f4492e..13496661c2 100644 --- a/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.java +++ b/client/am/console/src/main/java/org/apache/syncope/client/console/clientapps/ClientAppDirectoryPanel.java @@ -19,14 +19,17 @@ package org.apache.syncope.client.console.clientapps; import de.agilecoders.wicket.core.markup.html.bootstrap.dialog.Modal; +import java.io.Serializable; import java.util.ArrayList; import java.util.Collection; import java.util.Iterator; import java.util.List; import org.apache.commons.lang3.SerializationUtils; import org.apache.syncope.client.console.SyncopeConsoleSession; +import org.apache.syncope.client.console.audit.AuditHistoryModal; import org.apache.syncope.client.console.commons.AMConstants; import org.apache.syncope.client.console.commons.SortableDataProviderComparator; +import org.apache.syncope.client.console.pages.BasePage; import org.apache.syncope.client.console.panels.DirectoryPanel; import org.apache.syncope.client.console.panels.ModalDirectoryPanel; import org.apache.syncope.client.console.rest.ClientAppRestClient; @@ -42,7 +45,9 @@ import org.apache.syncope.client.ui.commons.wizards.AjaxWizard; import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.ClientAppTO; import org.apache.syncope.common.lib.types.AMEntitlement; +import org.apache.syncope.common.lib.types.AuditElements; import org.apache.syncope.common.lib.types.ClientAppType; +import org.apache.syncope.common.lib.types.IdRepoEntitlement; import org.apache.wicket.PageReference; import org.apache.wicket.ajax.AjaxRequestTarget; import org.apache.wicket.event.Broadcast; @@ -63,6 +68,8 @@ public abstract class ClientAppDirectoryPanel protected final BaseModal propertiesModal; +protected final BaseModal historyModal; + public ClientAppDirectoryPanel(final String id
[syncope] branch 2_0_X updated: fixes bad configuration filename
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new 1d1f417 fixes bad configuration filename 1d1f417 is described below commit 1d1f4179e8a6f01c5613caa78b93b75de43613ae Author: fabio AuthorDate: Tue Oct 20 11:36:03 2020 +0200 fixes bad configuration filename --- .../workingwithapachesyncope/systemadministration/keystore.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc index 10d0cf5..1c39eab 100644 --- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc +++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc @@ -112,7 +112,7 @@ This command will import the signed certificate from the `cert.pem` file into th = Finalize The keystore file `saml2sp.jks` must be now placed in the <>; the -relevant part of the `saml2sp-agent.properties` file should be: +relevant part of the `saml2sp-logic.properties` file should be: keystore.name=saml2sp.jks
[syncope] branch 2_1_X updated: fixes bad configuration filename
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_1_X by this push: new 92eec76 fixes bad configuration filename 92eec76 is described below commit 92eec761d804717ff87c6c9eec834f0f02eded4a Author: fabio AuthorDate: Tue Oct 20 11:36:43 2020 +0200 fixes bad configuration filename --- .../workingwithapachesyncope/systemadministration/keystore.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc index 5af3fed..cfe23ff 100644 --- a/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc +++ b/src/main/asciidoc/reference-guide/workingwithapachesyncope/systemadministration/keystore.adoc @@ -112,7 +112,7 @@ This command will import the signed certificate from the `cert.pem` file into th = Finalize The keystore file `saml2sp.jks` must be now placed in the <>; the -relevant part of the `saml2sp-agent.properties` file should be: +relevant part of the `saml2sp-logic.properties` file should be: keystore.name=saml2sp.jks
[syncope] branch 2_1_X updated: [SYNCOPE-957] provides the possibility to specify a layout for linked account management
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_1_X by this push: new 6c8824e [SYNCOPE-957] provides the possibility to specify a layout for linked account management 6c8824e is described below commit 6c8824e20016b9dd8025e3c7a62580dbcbb00fc8 Author: fmartelli AuthorDate: Fri Apr 17 09:40:04 2020 +0200 [SYNCOPE-957] provides the possibility to specify a layout for linked account management --- .../syncope/client/console/layout/AnyLayout.java | 2 +- .../client/console/layout/LinkedAccountForm.java | 25 +++ .../layout/LinkedAccountFormLayoutInfo.java| 86 ++ .../client/console/layout/UserFormLayoutInfo.java | 13 .../console/panels/LinkedAccountModalPanel.java| 24 +- .../wizards/any/LinkedAccountCredentialsPanel.java | 14 +++- .../wizards/any/LinkedAccountPlainAttrsPanel.java | 7 +- .../wizards/any/LinkedAccountWizardBuilder.java| 29 ++-- 8 files changed, 185 insertions(+), 15 deletions(-) diff --git a/client/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java b/client/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java index 1978f78..2750851 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/layout/AnyLayout.java @@ -30,7 +30,7 @@ public class AnyLayout implements Serializable { private static final long serialVersionUID = 488645029994410970L; private String anyPanelClass = AnyPanel.class.getName(); - + @JsonProperty("USER") private UserFormLayoutInfo user; diff --git a/client/console/src/main/java/org/apache/syncope/client/console/layout/LinkedAccountForm.java b/client/console/src/main/java/org/apache/syncope/client/console/layout/LinkedAccountForm.java new file mode 100644 index 000..21bc0a3 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/layout/LinkedAccountForm.java @@ -0,0 +1,25 @@ +/* + * 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.layout; + +import org.apache.syncope.client.console.wizards.ModalPanelBuilder; +import org.apache.syncope.common.lib.to.LinkedAccountTO; + +public interface LinkedAccountForm extends ModalPanelBuilder { +} diff --git a/client/console/src/main/java/org/apache/syncope/client/console/layout/LinkedAccountFormLayoutInfo.java b/client/console/src/main/java/org/apache/syncope/client/console/layout/LinkedAccountFormLayoutInfo.java new file mode 100644 index 000..5ba9115 --- /dev/null +++ b/client/console/src/main/java/org/apache/syncope/client/console/layout/LinkedAccountFormLayoutInfo.java @@ -0,0 +1,86 @@ +/* + * 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.layout; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; +import org.apache.syncope.client.console.wizards.any.LinkedAccountWizardBuilder; + +public class LinkedAccountFormLayoutInfo implements Serializable { + +private static final long serialVersionUID = -5573691733739618511L; + +private Class formClass; + +private boo
[syncope] branch master updated: [SYNCOPE-1476] keep code aligned between 'membership' and 'own' plain attributes
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new 4ae39ce [SYNCOPE-1476] keep code aligned between 'membership' and 'own' plain attributes 4ae39ce is described below commit 4ae39ce664b27bdcc9df39490f37592f8c8069d1 Author: fmartelli AuthorDate: Wed Feb 12 15:39:16 2020 +0100 [SYNCOPE-1476] keep code aligned between 'membership' and 'own' plain attributes --- .../client/console/wizards/any/PlainAttrs.java | 29 +- .../client/enduser/wizards/any/PlainAttrs.java | 26 --- 2 files changed, 12 insertions(+), 43 deletions(-) diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java index 127923d..0907c22 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java @@ -25,9 +25,6 @@ import java.util.Map; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.ui.commons.wicket.markup.html.bootstrap.tabs.Accordion; -import org.apache.syncope.client.ui.commons.markup.html.form.AbstractFieldPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel; -import org.apache.syncope.client.ui.commons.markup.html.form.FieldPanel; import org.apache.syncope.client.ui.commons.wizards.AjaxWizard; import org.apache.syncope.client.ui.commons.wizards.any.UserWrapper; import org.apache.syncope.client.ui.commons.wizards.any.AnyWrapper; @@ -233,32 +230,8 @@ public class PlainAttrs extends AbstractAttrs { private static final long serialVersionUID = 5306618783986001008L; @Override -@SuppressWarnings({ "unchecked", "rawtypes" }) protected void populateItem(final ListItem item) { -Attr attrTO = item.getModelObject(); - -AbstractFieldPanel panel = getFieldPanel(schemas.get(attrTO.getSchema())); -if (mode == AjaxWizard.Mode.TEMPLATE || !schemas.get(attrTO.getSchema()).isMultivalue()) { - FieldPanel.class.cast(panel).setNewModel(attributableTO.getObject(), attrTO.getSchema()); -} else { -// SYNCOPE-1476 set form as multipart to properly manage membership attributes -panel = new MultiFieldPanel.Builder<>(new ListModel() { - -private static final long serialVersionUID = -1765231556272935141L; - -@Override -public List getObject() { -return attributableTO.getObject().getPlainAttr(attrTO.getSchema()).get().getValues(); -} -}).build("panel", -attrTO.getSchema(), - FieldPanel.class.cast(panel)).setFormAsMultipart(true); -// SYNCOPE-1215 the entire multifield panel must be readonly, not only its field -((MultiFieldPanel) panel).setReadOnly(schemas.get(attrTO.getSchema()).isReadonly()); -} -item.add(panel); - -setExternalAction(attrTO, panel); +setPanel(schemas, item, false); } }); } diff --git a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java index 52c833b..8d57bc3 100644 --- a/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java +++ b/client/idrepo/enduser/src/main/java/org/apache/syncope/client/enduser/wizards/any/PlainAttrs.java @@ -413,21 +413,17 @@ public class PlainAttrs extends AbstractAttrs { } AbstractFieldPanel panel = getFieldPanel(schemas.get(attrTO.getSchema())); - -panel = new MultiFieldPanel.Builder<>(new ListModel() { - -private static final long serialVersionUID = -1765231556272935141L; - -@Override -public List getObject() { -return attributableTO.getObject().getPlainAttr(attrTO.getSchema()).get().getValues(); -} -}).build("panel", -attrTO.getSchema(), -
[syncope] branch 2_1_X updated: [SYNCOPE-1476] keep code aligned between 'membership' and 'own' plain attributes
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_1_X by this push: new abdb195 [SYNCOPE-1476] keep code aligned between 'membership' and 'own' plain attributes abdb195 is described below commit abdb19555d906d9b0a1aafd527e3ecd4756464db Author: fmartelli AuthorDate: Wed Feb 12 12:10:53 2020 +0100 [SYNCOPE-1476] keep code aligned between 'membership' and 'own' plain attributes --- .../client/console/wizards/any/PlainAttrs.java | 38 -- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java index 488e40e..03d7ee8 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java @@ -25,9 +25,6 @@ import java.util.Map; import java.util.stream.Collectors; import org.apache.commons.lang3.StringUtils; import org.apache.syncope.client.console.wicket.markup.html.bootstrap.tabs.Accordion; -import org.apache.syncope.client.console.wicket.markup.html.form.AbstractFieldPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.FieldPanel; -import org.apache.syncope.client.console.wicket.markup.html.form.MultiFieldPanel; import org.apache.syncope.client.console.wizards.AjaxWizard; import org.apache.syncope.common.lib.EntityTOUtils; import org.apache.syncope.common.lib.to.AnyObjectTO; @@ -170,11 +167,11 @@ public class PlainAttrs extends AbstractAttrs { @Override protected void setAttrs(final MembershipTO membershipTO) { -Map attrMap = - GroupableRelatableTO.class.cast(anyTO).getMembership(membershipTO.getGroupKey()).isPresent() -? EntityTOUtils.buildAttrMap(GroupableRelatableTO.class.cast(anyTO). - getMembership(membershipTO.getGroupKey()).get().getPlainAttrs()) -: new HashMap<>(); +Map attrMap = GroupableRelatableTO.class.cast(anyTO).getMembership(membershipTO.getGroupKey()). +isPresent() +? EntityTOUtils.buildAttrMap(GroupableRelatableTO.class.cast(anyTO). + getMembership(membershipTO.getGroupKey()).get().getPlainAttrs()) +: new HashMap<>(); List attrs = membershipSchemas.get(membershipTO.getGroupKey()).values().stream().map(schema -> { AttrTO attrTO = new AttrTO(); @@ -233,30 +230,7 @@ public class PlainAttrs extends AbstractAttrs { @Override @SuppressWarnings({ "unchecked", "rawtypes" }) protected void populateItem(final ListItem item) { -AttrTO attrTO = item.getModelObject(); - -AbstractFieldPanel panel = getFieldPanel(schemas.get(attrTO.getSchema())); -if (mode == AjaxWizard.Mode.TEMPLATE || !schemas.get(attrTO.getSchema()).isMultivalue()) { - FieldPanel.class.cast(panel).setNewModel(attributableTO.getObject(), attrTO.getSchema()); -} else { -// SYNCOPE-1476 set form as multipart to properly manage membership attributes -panel = new MultiFieldPanel.Builder<>(new ListModel() { - -private static final long serialVersionUID = -1765231556272935141L; - -@Override -public List getObject() { -return attributableTO.getObject().getPlainAttr(attrTO.getSchema()).get().getValues(); -} -}).build("panel", -attrTO.getSchema(), - FieldPanel.class.cast(panel)).setFormAsMultipart(true); -// SYNCOPE-1215 the entire multifield panel must be readonly, not only its field -((MultiFieldPanel) panel).setReadOnly(schemas.get(attrTO.getSchema()).isReadonly()); -} -item.add(panel); - -setExternalAction(attrTO, panel); +setPanel(schemas, item, false); } }); }
[syncope] branch 2_0_X updated: [SYNCOPE-1436] set fetch type to LAZY
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new aa03363 [SYNCOPE-1436] set fetch type to LAZY aa03363 is described below commit aa03363284f6f445ae75ae164299aac8ddf5da38 Author: fmartelli AuthorDate: Mon Feb 18 14:59:23 2019 +0100 [SYNCOPE-1436] set fetch type to LAZY --- .../core/persistence/jpa/entity/resource/JPAExternalResource.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAExternalResource.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAExternalResource.java index 4fdf42f..01bd6cf 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAExternalResource.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/entity/resource/JPAExternalResource.java @@ -127,13 +127,13 @@ public class JPAExternalResource extends AbstractProvidedKeyEntity implements Ex @NotNull private TraceLevel provisioningTraceLevel; -@ManyToOne(fetch = FetchType.EAGER) +@ManyToOne(fetch = FetchType.LAZY) private JPAPasswordPolicy passwordPolicy; -@ManyToOne(fetch = FetchType.EAGER) +@ManyToOne(fetch = FetchType.LAZY) private JPAAccountPolicy accountPolicy; -@ManyToOne(fetch = FetchType.EAGER) +@ManyToOne(fetch = FetchType.LAZY) private JPAPullPolicy pullPolicy; /**
[syncope] branch master updated: [SYNCOPE-1433] disable flag during schema editing
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new 7482239 [SYNCOPE-1433] disable flag during schema editing 7482239 is described below commit 7482239477327eb9e758694e94514b9f8a5e0b02 Author: fmartelli AuthorDate: Thu Feb 7 17:46:55 2019 +0100 [SYNCOPE-1433] disable flag during schema editing --- .../apache/syncope/client/console/panels/PlainSchemaDetails.java | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java index c91e436..af555dc 100644 --- a/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java +++ b/client/idrepo/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java @@ -73,8 +73,10 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { type = new AjaxDropDownChoicePanel<>("type", getString("type"), new PropertyModel<>(schemaTO, "type")); +boolean isCreate = schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty(); + type.setChoices(Arrays.asList(AttrSchemaType.values())); -type.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty()); +type.setEnabled(isCreate); type.addRequiredLabel(); add(type); @@ -286,7 +288,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { "readonly", getString("readonly"), new PropertyModel<>(schemaTO, "readonly"))); add(new AjaxCheckBoxPanel("uniqueConstraint", -getString("uniqueConstraint"), new PropertyModel<>(schemaTO, "uniqueConstraint"))); +getString("uniqueConstraint"), new PropertyModel<>(schemaTO, "uniqueConstraint")). +setEnabled(isCreate)); } private void showHide(final PlainSchemaTO schema, final AjaxDropDownChoicePanel type,
[syncope] branch 2_1_X updated: [SYNCOPE-1433] disable flag during schema editing
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_1_X by this push: new 6505964 [SYNCOPE-1433] disable flag during schema editing 6505964 is described below commit 6505964dc025f9aea1c1f8eaa82cc5e712b4f0a0 Author: fmartelli AuthorDate: Thu Feb 7 17:46:55 2019 +0100 [SYNCOPE-1433] disable flag during schema editing --- .../apache/syncope/client/console/panels/PlainSchemaDetails.java | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java index 310864d..c6e3c88 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java @@ -74,8 +74,10 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { type = new AjaxDropDownChoicePanel<>("type", getString("type"), new PropertyModel<>(schemaTO, "type")); +boolean isCreate = schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty(); + type.setChoices(Arrays.asList(AttrSchemaType.values())); -type.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty()); +type.setEnabled(isCreate); type.addRequiredLabel(); add(type); @@ -287,7 +289,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { "readonly", getString("readonly"), new PropertyModel<>(schemaTO, "readonly"))); add(new AjaxCheckBoxPanel("uniqueConstraint", -getString("uniqueConstraint"), new PropertyModel<>(schemaTO, "uniqueConstraint"))); +getString("uniqueConstraint"), new PropertyModel<>(schemaTO, "uniqueConstraint")). +setEnabled(isCreate)); } private void showHide(final PlainSchemaTO schema, final AjaxDropDownChoicePanel type,
[syncope] branch 2_0_X updated: [SYNCOPE-1433] disable flag during schema editing
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new d6fc589 [SYNCOPE-1433] disable flag during schema editing d6fc589 is described below commit d6fc58934b5d430967828d6dc19b3f61994c1c28 Author: fmartelli AuthorDate: Thu Feb 7 17:46:55 2019 +0100 [SYNCOPE-1433] disable flag during schema editing --- .../syncope/client/console/panels/PlainSchemaDetails.java| 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java index dc85323..eeff2c6 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/panels/PlainSchemaDetails.java @@ -62,7 +62,7 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { private final MultiFieldPanel enumerationKeys; private final AjaxDropDownChoicePanel validatorClass; - + private final AjaxDropDownChoicePanel type; public PlainSchemaDetails( @@ -71,12 +71,14 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { final PlainSchemaTO schemaTO) { super(id, pageReference, schemaTO); - + +boolean isCreate = schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty(); + type = new AjaxDropDownChoicePanel<>( "type", getString("type"), new PropertyModel(schemaTO, "type")); type.setChoices(Arrays.asList(AttrSchemaType.values())); -type.setEnabled(schemaTO == null || schemaTO.getKey() == null || schemaTO.getKey().isEmpty()); +type.setEnabled(isCreate); type.addRequiredLabel(); schemaForm.add(type); @@ -286,8 +288,8 @@ public class PlainSchemaDetails extends AbstractSchemaDetailsPanel { "readonly", getString("readonly"), new PropertyModel(schemaTO, "readonly"))); schemaForm.add(new AjaxCheckBoxPanel("uniqueConstraint", -getString("uniqueConstraint"), new PropertyModel(schemaTO, "uniqueConstraint"))); - +getString("uniqueConstraint"), new PropertyModel(schemaTO, "uniqueConstraint")). +setEnabled(isCreate)); } private void showHide(final PlainSchemaTO schema, final AjaxDropDownChoicePanel type,
[syncope] branch 2_0_X updated: [SYNCOPE-1434] provides check for null object
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new 7354f0d [SYNCOPE-1434] provides check for null object 7354f0d is described below commit 7354f0d9a28b2051b9236f9776d25d9906da3d8b Author: fmartelli AuthorDate: Wed Feb 6 18:45:30 2019 +0100 [SYNCOPE-1434] provides check for null object --- .../propagation/AbstractPropagationTaskExecutor.java | 20 +--- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java index e1935c0..a3db9ca 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/AbstractPropagationTaskExecutor.java @@ -668,14 +668,20 @@ public abstract class AbstractPropagationTaskExecutor implements PropagationTask MappingUtils.getPropagationItems(provision.getMapping().getItems()).iterator(), linkingMappingItems.iterator(; -for (MappingItem item : linkingMappingItems) { -Attribute attr = obj.getAttributeByName(item.getExtAttrName()); -if (attr == null) { +if (obj == null) { +for (MappingItem item : linkingMappingItems) { virAttrCache.expire(task.getAnyType(), task.getEntityKey(), item.getIntAttrName()); -} else { -VirAttrCacheValue cacheValue = new VirAttrCacheValue(); -cacheValue.setValues(attr.getValue()); -virAttrCache.put(task.getAnyType(), task.getEntityKey(), item.getIntAttrName(), cacheValue); +} +} else { +for (MappingItem item : linkingMappingItems) { +Attribute attr = obj.getAttributeByName(item.getExtAttrName()); +if (attr == null) { +virAttrCache.expire(task.getAnyType(), task.getEntityKey(), item.getIntAttrName()); +} else { +VirAttrCacheValue cacheValue = new VirAttrCacheValue(); +cacheValue.setValues(attr.getValue()); +virAttrCache.put(task.getAnyType(), task.getEntityKey(), item.getIntAttrName(), cacheValue); +} } } } catch (TimeoutException toe) {
[syncope] branch SYNCOPE-1400_SYNCOPE-1401 updated: [SYNCOPE-1401] fix json search DAO for mysql
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch SYNCOPE-1400_SYNCOPE-1401 in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/SYNCOPE-1400_SYNCOPE-1401 by this push: new f9ad5d0 [SYNCOPE-1401] fix json search DAO for mysql f9ad5d0 is described below commit f9ad5d0d7799c4f3a56279cf49d50d543d958b57 Author: fmartelli AuthorDate: Thu Jan 24 17:55:22 2019 +0100 [SYNCOPE-1401] fix json search DAO for mysql --- .../persistence/jpa/dao/MyJPAJSONAnySearchDAO.java| 19 --- .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java| 8 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MyJPAJSONAnySearchDAO.java b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MyJPAJSONAnySearchDAO.java index d33701f..a4fa998 100644 --- a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MyJPAJSONAnySearchDAO.java +++ b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/MyJPAJSONAnySearchDAO.java @@ -61,20 +61,25 @@ public class MyJPAJSONAnySearchDAO extends AbstractJPAJSONAnySearchDAO { } else { attrWhere.append(" OR "); } -attrWhere.append("JSON_CONTAINS(plainAttrs, '[{\"schema\":\"").append(field).append("\"}]'"); +attrWhere.append("JSON_CONTAINS(plainAttrs, '[{\"schema\":\"").append(field).append("\"}]')"); nullAttrWhere.append(" UNION SELECT DISTINCT any_id,").append(svs.table().alias).append(".*, "). -append("JSON('{\"schema\": \""). -append(field). -append("\"})' as attrs, JSON('{}') as attrValues"). + append("\"").append(field).append("\"").append(" AS plainShema, "). +append("null AS binaryValue, "). +append("null AS booleanValue, "). +append("null AS dateValue, "). +append("null AS doubleValue, "). +append("null AS longValue, "). +append("null AS stringValue, "). +append("null AS attrUniqueValue"). append(" FROM ").append(svs.table().name).append(" ").append(svs.table().alias). append(", ").append(svs.field().name). -append(" WHERE "). -append("any_id NOT IN "). +append(" WHERE any_id=").append(svs.table().alias).append(".id"). +append(" AND any_id NOT IN "). append("(SELECT distinct any_id FROM "). append(svs.field().name). append(" WHERE ").append(svs.table().alias).append(".id=any_id AND "). -append("JSON_CONTAINS(plainAttrs, '[{\"schema\":\"").append(field).append("\"}]')"); +append("JSON_CONTAINS(plainAttrs, '[{\"schema\":\"").append(field).append("\"}]'))"); }); where.append(attrWhere).append(nullAttrWhere); } diff --git a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java index bd29bf3..b715bc0 100644 --- a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java +++ b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java @@ -127,10 +127,6 @@ public class PGJPAJSONAnySearchDAO extends AbstractJPAJSONAnySearchDAO { fillAttrQuery(anyUtils, query, attrValue, schema, cond, false, parameters, svs); query.append(")"); } else { -String key = key(schema.getType()); -boolean lower = (schema.getType() == AttrSchemaType.String || schema.getType() == Att
[syncope] branch master updated: [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new f07a31c [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses f07a31c is described below commit f07a31cdba32df0ced32e9583d6a1c4237ebb57e Author: fmartelli AuthorDate: Tue Jan 8 15:57:57 2019 +0100 [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses --- .../core/persistence/jpa/dao/JPATaskDAO.java | 92 +++--- .../resources/mariadb/domains/Master.properties| 2 +- .../main/resources/mysql/domains/Master.properties | 2 +- .../syncope/fit/core/PropagationTaskITCase.java| 6 +- .../apache/syncope/fit/core/PullTaskITCase.java| 3 +- 5 files changed, 54 insertions(+), 51 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java index 9e71908..3e8f80e 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java @@ -231,22 +231,28 @@ public class JPATaskDAO extends AbstractDAO implements TaskDAO { throw new IllegalArgumentException(type + " is not related to notifications"); } -StringBuilder queryString = new StringBuilder("SELECT "). -append(AbstractTask.TABLE). -append(".id FROM "). -append(AbstractTask.TABLE); +StringBuilder queryString = new StringBuilder("SELECT ").append(AbstractTask.TABLE).append(".*"); + if (orderByTaskExecInfo) { -queryString.append(" LEFT OUTER JOIN "). -append(JPATaskExec.TABLE). -append(" ON "). -append(AbstractTask.TABLE). -append(".id = "). -append(JPATaskExec.TABLE). -append(".task_id"); + queryString.append(",").append(JPATaskExec.TABLE).append(".startDate AS startDate"). +append(",").append(JPATaskExec.TABLE).append(".endDate AS endDate"). +append(",").append(JPATaskExec.TABLE).append(".status AS status"). +append(" FROM ").append(AbstractTask.TABLE). + append(",").append(JPATaskExec.TABLE).append(",").append("(SELECT "). +append(JPATaskExec.TABLE).append(".task_id, "). + append("MAX(").append(JPATaskExec.TABLE).append(".startDate) AS startDate"). +append(" FROM ").append(JPATaskExec.TABLE). +append(" GROUP BY ").append(JPATaskExec.TABLE).append(".task_id) GRP"). +append(" WHERE "). + append(AbstractTask.TABLE).append(".id=").append(JPATaskExec.TABLE).append(".task_id"). +append(" AND ").append(AbstractTask.TABLE).append(".id=").append("GRP.task_id"). +append(" AND ").append(JPATaskExec.TABLE).append(".startDate=").append("GRP.startDate"). +append(" AND ").append(AbstractTask.TABLE).append(".DTYPE = ?1"); +} else { +queryString.append(", null AS startDate, null AS endDate, null AS status FROM ").append(AbstractTask.TABLE). +append(" WHERE ").append(AbstractTask.TABLE).append(".DTYPE = ?1"); } -queryString.append(" WHERE "). -append(AbstractTask.TABLE). -append(".DTYPE = ?1"); + queryParameters.add(getEntityTableName(type)); if (type == TaskType.SCHEDULED) { queryString.append(" AND "). @@ -294,34 +300,15 @@ public class JPATaskDAO extends AbstractDAO implements TaskDAO { return queryString; } -private String toOrderByStatement( -final Class beanClass, -final List orderByClauses, -final boolean orderByTaskExecInfo) { +private String toOrderByStatement(final Class beanClass, final List orderByClauses) { StringBuilder statement = new StringBuilder(); -if (orderByTaskExecInfo) { -statement.append(" AND ("). -append(JPATaskExec.TABLE)
[syncope] branch 2_1_X updated: [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_1_X by this push: new 7f07c58 [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses 7f07c58 is described below commit 7f07c5851c4d1bdd163a0f46f0bd68e28f5114eb Author: fmartelli AuthorDate: Tue Jan 8 15:57:57 2019 +0100 [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses --- .../core/persistence/jpa/dao/JPATaskDAO.java | 92 +++--- .../resources/mariadb/domains/Master.properties| 2 +- .../main/resources/mysql/domains/Master.properties | 2 +- .../syncope/fit/core/PropagationTaskITCase.java| 6 +- .../apache/syncope/fit/core/PullTaskITCase.java| 3 +- 5 files changed, 54 insertions(+), 51 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java index 9e71908..3e8f80e 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java @@ -231,22 +231,28 @@ public class JPATaskDAO extends AbstractDAO implements TaskDAO { throw new IllegalArgumentException(type + " is not related to notifications"); } -StringBuilder queryString = new StringBuilder("SELECT "). -append(AbstractTask.TABLE). -append(".id FROM "). -append(AbstractTask.TABLE); +StringBuilder queryString = new StringBuilder("SELECT ").append(AbstractTask.TABLE).append(".*"); + if (orderByTaskExecInfo) { -queryString.append(" LEFT OUTER JOIN "). -append(JPATaskExec.TABLE). -append(" ON "). -append(AbstractTask.TABLE). -append(".id = "). -append(JPATaskExec.TABLE). -append(".task_id"); + queryString.append(",").append(JPATaskExec.TABLE).append(".startDate AS startDate"). +append(",").append(JPATaskExec.TABLE).append(".endDate AS endDate"). +append(",").append(JPATaskExec.TABLE).append(".status AS status"). +append(" FROM ").append(AbstractTask.TABLE). + append(",").append(JPATaskExec.TABLE).append(",").append("(SELECT "). +append(JPATaskExec.TABLE).append(".task_id, "). + append("MAX(").append(JPATaskExec.TABLE).append(".startDate) AS startDate"). +append(" FROM ").append(JPATaskExec.TABLE). +append(" GROUP BY ").append(JPATaskExec.TABLE).append(".task_id) GRP"). +append(" WHERE "). + append(AbstractTask.TABLE).append(".id=").append(JPATaskExec.TABLE).append(".task_id"). +append(" AND ").append(AbstractTask.TABLE).append(".id=").append("GRP.task_id"). +append(" AND ").append(JPATaskExec.TABLE).append(".startDate=").append("GRP.startDate"). +append(" AND ").append(AbstractTask.TABLE).append(".DTYPE = ?1"); +} else { +queryString.append(", null AS startDate, null AS endDate, null AS status FROM ").append(AbstractTask.TABLE). +append(" WHERE ").append(AbstractTask.TABLE).append(".DTYPE = ?1"); } -queryString.append(" WHERE "). -append(AbstractTask.TABLE). -append(".DTYPE = ?1"); + queryParameters.add(getEntityTableName(type)); if (type == TaskType.SCHEDULED) { queryString.append(" AND "). @@ -294,34 +300,15 @@ public class JPATaskDAO extends AbstractDAO implements TaskDAO { return queryString; } -private String toOrderByStatement( -final Class beanClass, -final List orderByClauses, -final boolean orderByTaskExecInfo) { +private String toOrderByStatement(final Class beanClass, final List orderByClauses) { StringBuilder statement = new StringBuilder(); -if (orderByTaskExecInfo) { -statement.append(" AND ("). -append(JPATaskExec.TABLE)
[syncope] branch 2_0_X updated: [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new 5c5c0ab [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses 5c5c0ab is described below commit 5c5c0ab1a6651e430b78f15460b23f681fa228ad Author: fmartelli AuthorDate: Tue Jan 8 15:57:57 2019 +0100 [SYNCOPE-1424] changes the way to build the task search query and fixes some test weeknesses --- .../core/persistence/jpa/dao/JPATaskDAO.java | 91 +++--- .../resources/mariadb/domains/Master.properties| 2 +- .../main/resources/mysql/domains/Master.properties | 2 +- .../syncope/fit/core/PropagationTaskITCase.java| 6 +- .../apache/syncope/fit/core/PullTaskITCase.java| 3 +- 5 files changed, 53 insertions(+), 51 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java index c79260a..497044d 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPATaskDAO.java @@ -183,22 +183,28 @@ public class JPATaskDAO extends AbstractDAO implements TaskDAO { throw new IllegalArgumentException(type + " is not related to notifications"); } -StringBuilder queryString = new StringBuilder("SELECT "). -append(AbstractTask.TABLE). -append(".id FROM "). -append(AbstractTask.TABLE); +StringBuilder queryString = new StringBuilder("SELECT ").append(AbstractTask.TABLE).append(".*"); + if (orderByTaskExecInfo) { -queryString.append(" LEFT OUTER JOIN "). -append(JPATaskExec.TABLE). -append(" ON "). -append(AbstractTask.TABLE). -append(".id = "). -append(JPATaskExec.TABLE). -append(".task_id"); + queryString.append(",").append(JPATaskExec.TABLE).append(".startDate AS startDate"). +append(",").append(JPATaskExec.TABLE).append(".endDate AS endDate"). +append(",").append(JPATaskExec.TABLE).append(".status AS status"). +append(" FROM ").append(AbstractTask.TABLE). + append(",").append(JPATaskExec.TABLE).append(",").append("(SELECT "). +append(JPATaskExec.TABLE).append(".task_id, "). + append("MAX(").append(JPATaskExec.TABLE).append(".startDate) AS startDate"). +append(" FROM ").append(JPATaskExec.TABLE). +append(" GROUP BY ").append(JPATaskExec.TABLE).append(".task_id) GRP"). +append(" WHERE "). + append(AbstractTask.TABLE).append(".id=").append(JPATaskExec.TABLE).append(".task_id"). +append(" AND ").append(AbstractTask.TABLE).append(".id=").append("GRP.task_id"). +append(" AND ").append(JPATaskExec.TABLE).append(".startDate=").append("GRP.startDate"). +append(" AND ").append(AbstractTask.TABLE).append(".DTYPE = ?1"); +} else { +queryString.append(", null AS startDate, null AS endDate, null AS status FROM ").append(AbstractTask.TABLE). +append(" WHERE ").append(AbstractTask.TABLE).append(".DTYPE = ?1"); } -queryString.append(" WHERE "). -append(AbstractTask.TABLE). -append(".DTYPE = ?1"); + queryParameters.add(getEntityTableName(type)); if (type == TaskType.SCHEDULED) { queryString.append(" AND "). @@ -246,34 +252,15 @@ public class JPATaskDAO extends AbstractDAO implements TaskDAO { return queryString; } -private String toOrderByStatement( -final Class beanClass, -final List orderByClauses, -final boolean orderByTaskExecInfo) { +private String toOrderByStatement(final Class beanClass, final List orderByClauses) { StringBuilder statement = new StringBuilder(); -if (orderByTaskExecInfo) { -statement.append(" AND ("). -append(JPATaskExec.TABLE)
[syncope] branch master updated: [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new f3102d9 [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation f3102d9 is described below commit f3102d93c9a65e38d255e80cca6ba1079799e2a2 Author: fmartelli AuthorDate: Fri Dec 28 11:11:28 2018 +0100 [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation --- .../core/provisioning/api/notification/NotificationManager.java| 2 ++ .../java/{AuditManagerImpl.java => DefaultAuditManagerImpl.java} | 4 +--- .../core/provisioning/java/job/AbstractSchedTaskJobDelegate.java | 1 + .../java/job/notification/DefaultNotificationJobDelegate.java | 2 ++ ...icationManagerImpl.java => DefaultNotificationManagerImpl.java} | 7 --- .../java/propagation/AbstractPropagationTaskExecutor.java | 6 +- .../core/provisioning/java/pushpull/AbstractPullResultHandler.java | 4 +++- .../provisioning/java/pushpull/DefaultRealmPullResultHandler.java | 4 +++- core/provisioning-java/src/main/resources/provisioning.properties | 2 ++ core/provisioning-java/src/main/resources/provisioningContext.xml | 2 ++ .../provisioning-camel/src/main/resources/provisioning.properties | 2 ++ .../main/java/org/apache/syncope/core/flowable/task/Notify.java| 2 ++ fit/core-reference/src/main/resources/all/provisioning.properties | 2 ++ .../src/main/resources/mariadb/provisioning.properties | 2 ++ .../src/main/resources/mysql/provisioning.properties | 2 ++ .../src/main/resources/oracle/provisioning.properties | 2 ++ .../src/main/resources/postgres/provisioning.properties| 2 ++ fit/core-reference/src/main/resources/provisioning.properties | 2 ++ .../src/main/resources/sqlserver/provisioning.properties | 2 ++ 19 files changed, 43 insertions(+), 9 deletions(-) diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java index 548ed93..e20fa8d 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java @@ -65,6 +65,7 @@ public interface NotificationManager { /** * Create notification tasks for each notification matching provided conditions. * + * @param who user triggering the event * @param type event category type * @param category event category * @param subcategory event subcategory @@ -76,6 +77,7 @@ public interface NotificationManager { * @return created notification tasks */ List createTasks( +String who, AuditElements.EventCategoryType type, String category, String subcategory, diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java similarity index 97% rename from core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java rename to core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java index 180685f..12398a5 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java @@ -30,12 +30,10 @@ import org.apache.syncope.core.spring.security.AuthContextUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Transactional(readOnly = true) -@Component -public class AuditManagerImpl implements AuditManager { +public class DefaultAuditManagerImpl implements AuditManager { @Autowired private LoggerDAO loggerDAO; diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java index 91b9b2a..cf309e2 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/ja
[syncope] branch 2_1_X updated: [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_1_X by this push: new 49a6f86 [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation 49a6f86 is described below commit 49a6f86edcc1e250b999dcdad1ff9e9f4f02107f Author: fmartelli AuthorDate: Fri Dec 28 11:11:28 2018 +0100 [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation --- .../core/provisioning/api/notification/NotificationManager.java| 2 ++ .../java/{AuditManagerImpl.java => DefaultAuditManagerImpl.java} | 4 +--- .../core/provisioning/java/job/AbstractSchedTaskJobDelegate.java | 1 + .../java/job/notification/DefaultNotificationJobDelegate.java | 2 ++ ...icationManagerImpl.java => DefaultNotificationManagerImpl.java} | 7 --- .../java/propagation/AbstractPropagationTaskExecutor.java | 6 +- .../core/provisioning/java/pushpull/AbstractPullResultHandler.java | 4 +++- .../provisioning/java/pushpull/DefaultRealmPullResultHandler.java | 4 +++- core/provisioning-java/src/main/resources/provisioning.properties | 2 ++ core/provisioning-java/src/main/resources/provisioningContext.xml | 2 ++ .../provisioning-camel/src/main/resources/provisioning.properties | 2 ++ .../main/java/org/apache/syncope/core/flowable/task/Notify.java| 2 ++ fit/core-reference/src/main/resources/all/provisioning.properties | 2 ++ .../src/main/resources/mariadb/provisioning.properties | 2 ++ .../src/main/resources/mysql/provisioning.properties | 2 ++ .../src/main/resources/oracle/provisioning.properties | 2 ++ .../src/main/resources/postgres/provisioning.properties| 2 ++ fit/core-reference/src/main/resources/provisioning.properties | 2 ++ .../src/main/resources/sqlserver/provisioning.properties | 2 ++ 19 files changed, 43 insertions(+), 9 deletions(-) diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java index 548ed93..e20fa8d 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java @@ -65,6 +65,7 @@ public interface NotificationManager { /** * Create notification tasks for each notification matching provided conditions. * + * @param who user triggering the event * @param type event category type * @param category event category * @param subcategory event subcategory @@ -76,6 +77,7 @@ public interface NotificationManager { * @return created notification tasks */ List createTasks( +String who, AuditElements.EventCategoryType type, String category, String subcategory, diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java similarity index 97% rename from core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java rename to core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java index 180685f..12398a5 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java @@ -30,12 +30,10 @@ import org.apache.syncope.core.spring.security.AuthContextUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Transactional(readOnly = true) -@Component -public class AuditManagerImpl implements AuditManager { +public class DefaultAuditManagerImpl implements AuditManager { @Autowired private LoggerDAO loggerDAO; diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java index 91b9b2a..cf309e2 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/ja
[syncope] branch 2_0_X updated: [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new 5fc4fe1 [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation 5fc4fe1 is described below commit 5fc4fe1399e0218c5ced4e13ef47c559b222651f Author: fmartelli AuthorDate: Fri Dec 28 11:11:28 2018 +0100 [SYNCOPE-1422] permits to provide custom AuditManager/NotificationManager implementation --- .../core/provisioning/api/notification/NotificationManager.java| 2 ++ .../java/{AuditManagerImpl.java => DefaultAuditManagerImpl.java} | 4 +--- .../core/provisioning/java/job/AbstractSchedTaskJobDelegate.java | 1 + .../java/job/notification/DefaultNotificationJobDelegate.java | 2 ++ ...icationManagerImpl.java => DefaultNotificationManagerImpl.java} | 7 --- .../java/propagation/AbstractPropagationTaskExecutor.java | 6 +- .../core/provisioning/java/pushpull/AbstractPullResultHandler.java | 4 +++- .../provisioning/java/pushpull/DefaultRealmPullResultHandler.java | 4 +++- core/provisioning-java/src/main/resources/provisioning.properties | 2 ++ core/provisioning-java/src/main/resources/provisioningContext.xml | 2 ++ .../org/apache/syncope/core/workflow/activiti/task/Notify.java | 3 +++ .../org/apache/syncope/core/workflow/flowable/task/Notify.java | 3 +++ .../provisioning-camel/src/main/resources/provisioning.properties | 2 ++ fit/core-reference/src/main/resources/all/provisioning.properties | 2 ++ .../src/main/resources/mariadb/provisioning.properties | 2 ++ .../src/main/resources/mysql/provisioning.properties | 2 ++ .../src/main/resources/oracle/provisioning.properties | 2 ++ .../src/main/resources/postgres/provisioning.properties| 2 ++ fit/core-reference/src/main/resources/provisioning.properties | 2 ++ .../src/main/resources/sqlserver/provisioning.properties | 2 ++ 20 files changed, 47 insertions(+), 9 deletions(-) diff --git a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java index 548ed93..e20fa8d 100644 --- a/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java +++ b/core/provisioning-api/src/main/java/org/apache/syncope/core/provisioning/api/notification/NotificationManager.java @@ -65,6 +65,7 @@ public interface NotificationManager { /** * Create notification tasks for each notification matching provided conditions. * + * @param who user triggering the event * @param type event category type * @param category event category * @param subcategory event subcategory @@ -76,6 +77,7 @@ public interface NotificationManager { * @return created notification tasks */ List createTasks( +String who, AuditElements.EventCategoryType type, String category, String subcategory, diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java similarity index 97% rename from core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java rename to core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java index 3a2877f..5cfa627 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AuditManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/DefaultAuditManagerImpl.java @@ -30,12 +30,10 @@ import org.apache.syncope.core.spring.security.AuthContextUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @Transactional(readOnly = true) -@Component -public class AuditManagerImpl implements AuditManager { +public class DefaultAuditManagerImpl implements AuditManager { @Autowired private LoggerDAO loggerDAO; diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java index 91b9b2a..cf309e2 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/job/AbstractSchedTaskJobDelegate.java +++ b/core/provisionin
[syncope] branch master updated: [SYNCOPE-1416] fixes searches for unique attributes
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new e0d5229 [SYNCOPE-1416] fixes searches for unique attributes e0d5229 is described below commit e0d5229a7e9a7535b3dd9013dd4a842b79883e35 Author: fmartelli AuthorDate: Thu Dec 27 12:28:03 2018 +0100 [SYNCOPE-1416] fixes searches for unique attributes --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 12 -- .../core/persistence/jpa/inner/AnySearchTest.java | 19 ++ .../org/apache/syncope/fit/core/SearchITCase.java | 43 -- 3 files changed, 58 insertions(+), 16 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index def529c..d0b958b 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -974,8 +974,10 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). - append("'").append(checked.getLeft().getKey()).append("'"); +query.append(checked.getLeft().isUniqueConstraint() +? svs.asSearchViewSupport().uniqueAttr().name +: svs.asSearchViewSupport().attr().name). +append(" WHERE schema_id=").append("'").append(checked.getLeft().getKey()).append("'"); break; case ISNULL: @@ -983,8 +985,10 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { append(" WHERE any_id NOT IN "). append("("). append("SELECT DISTINCT any_id FROM "). -append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). - append("'").append(checked.getLeft().getKey()).append("'"). +append(checked.getLeft().isUniqueConstraint() +? svs.asSearchViewSupport().uniqueAttr().name +: svs.asSearchViewSupport().attr().name). +append(" WHERE schema_id=").append("'").append(checked.getLeft().getKey()).append("'"). append(")"); break; diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java index 1dae5c1..4223282 100644 --- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java +++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java @@ -769,6 +769,25 @@ public class AnySearchTest extends AbstractTest { assertEquals( searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, AnyTypeKind.USER), users.size()); + +// search by attribute with unique constraint +AttributeCond fullnameCond = new AttributeCond(AttributeCond.Type.ISNOTNULL); +fullnameCond.setSchema("fullname"); + +SearchCond cond = SearchCond.getLeafCond(fullnameCond); +assertTrue(cond.isValid()); + +users = searchDAO.search(cond, AnyTypeKind.USER); +assertEquals(5, users.size()); + +fullnameCond = new AttributeCond(AttributeCond.Type.ISNULL); +fullnameCond.setSchema("fullname"); + +cond = SearchCond.getLeafCond(fullnameCond); +assertTrue(cond.isValid()); + +users = searchDAO.search(cond, AnyTypeKind.USER); +assertTrue(users.isEmpty()); } @Test diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java index fa7c5ac..cc88ad8 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java @@ -290,17 +290,6 @@ public class SearchITCase extends AbstractITCase { and("username")
[syncope] branch 2_1_X updated: [SYNCOPE-1416] fixes searches for unique attributes
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_1_X by this push: new b7c49f3 [SYNCOPE-1416] fixes searches for unique attributes b7c49f3 is described below commit b7c49f3eb03ea168fb883202860c7d26589afe1d Author: fmartelli AuthorDate: Thu Dec 27 12:28:03 2018 +0100 [SYNCOPE-1416] fixes searches for unique attributes --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 12 -- .../core/persistence/jpa/inner/AnySearchTest.java | 19 ++ .../org/apache/syncope/fit/core/SearchITCase.java | 43 -- 3 files changed, 58 insertions(+), 16 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index def529c..d0b958b 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -974,8 +974,10 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). - append("'").append(checked.getLeft().getKey()).append("'"); +query.append(checked.getLeft().isUniqueConstraint() +? svs.asSearchViewSupport().uniqueAttr().name +: svs.asSearchViewSupport().attr().name). +append(" WHERE schema_id=").append("'").append(checked.getLeft().getKey()).append("'"); break; case ISNULL: @@ -983,8 +985,10 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { append(" WHERE any_id NOT IN "). append("("). append("SELECT DISTINCT any_id FROM "). -append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). - append("'").append(checked.getLeft().getKey()).append("'"). +append(checked.getLeft().isUniqueConstraint() +? svs.asSearchViewSupport().uniqueAttr().name +: svs.asSearchViewSupport().attr().name). +append(" WHERE schema_id=").append("'").append(checked.getLeft().getKey()).append("'"). append(")"); break; diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java index 1dae5c1..4223282 100644 --- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java +++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java @@ -769,6 +769,25 @@ public class AnySearchTest extends AbstractTest { assertEquals( searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, AnyTypeKind.USER), users.size()); + +// search by attribute with unique constraint +AttributeCond fullnameCond = new AttributeCond(AttributeCond.Type.ISNOTNULL); +fullnameCond.setSchema("fullname"); + +SearchCond cond = SearchCond.getLeafCond(fullnameCond); +assertTrue(cond.isValid()); + +users = searchDAO.search(cond, AnyTypeKind.USER); +assertEquals(5, users.size()); + +fullnameCond = new AttributeCond(AttributeCond.Type.ISNULL); +fullnameCond.setSchema("fullname"); + +cond = SearchCond.getLeafCond(fullnameCond); +assertTrue(cond.isValid()); + +users = searchDAO.search(cond, AnyTypeKind.USER); +assertTrue(users.isEmpty()); } @Test diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java index b93463f..53cc50a 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java @@ -287,17 +287,6 @@ public class SearchITCase extends AbstractITCase { and("username")
[syncope] branch 2_0_X updated: [SYNCOPE-1416] fixes searches for unique attributes
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new dbd6d8c [SYNCOPE-1416] fixes searches for unique attributes dbd6d8c is described below commit dbd6d8c9ef09b2f665fb16ccae856af561101919 Author: fmartelli AuthorDate: Thu Dec 27 12:28:03 2018 +0100 [SYNCOPE-1416] fixes searches for unique attributes --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 9 +++-- .../core/persistence/jpa/inner/AnySearchTest.java | 19 ++ .../org/apache/syncope/fit/core/SearchITCase.java | 43 -- 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 7762937..2afe7f8 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -892,16 +892,17 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.attr().name).append(" WHERE schema_id="). - append("'").append(checked.getLeft().getKey()).append("'"); +query.append(checked.getLeft().isUniqueConstraint() ? svs.uniqueAttr().name : svs.attr().name). +append(" WHERE schema_id=").append("'").append(checked.getLeft().getKey()).append("'"); break; case ISNULL: query.append(svs.field().name). append(" WHERE any_id NOT IN "). append("("). -append("SELECT DISTINCT any_id FROM ").append(svs.attr().name).append(" WHERE schema_id="). - append("'").append(checked.getLeft().getKey()).append("'"). +append("SELECT DISTINCT any_id FROM "). +append(checked.getLeft().isUniqueConstraint() ? svs.uniqueAttr().name : svs.attr().name). +append(" WHERE schema_id=").append("'").append(checked.getLeft().getKey()).append("'"). append(")"); break; diff --git a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java index bb37273..ac43c15 100644 --- a/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java +++ b/core/persistence-jpa/src/test/java/org/apache/syncope/core/persistence/jpa/inner/AnySearchTest.java @@ -803,6 +803,25 @@ public class AnySearchTest extends AbstractTest { assertEquals( searchDAO.count(SyncopeConstants.FULL_ADMIN_REALMS, searchCondition, AnyTypeKind.USER), users.size()); + +// search by attribute with unique constraint +AttributeCond fullnameCond = new AttributeCond(AttributeCond.Type.ISNOTNULL); +fullnameCond.setSchema("fullname"); + +SearchCond cond = SearchCond.getLeafCond(fullnameCond); +assertTrue(cond.isValid()); + +users = searchDAO.search(cond, AnyTypeKind.USER); +assertEquals(5, users.size()); + +fullnameCond = new AttributeCond(AttributeCond.Type.ISNULL); +fullnameCond.setSchema("fullname"); + +cond = SearchCond.getLeafCond(fullnameCond); +assertTrue(cond.isValid()); + +users = searchDAO.search(cond, AnyTypeKind.USER); +assertTrue(users.isEmpty()); } @Test diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java index 49b1723..696d8c2 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java @@ -308,17 +308,6 @@ public class SearchITCase extends AbstractITCase { and("username").equalTo("bellini").query()). build()); assertEquals(users, issueSYNCOPE1321); - -// SYNCOPE-1416 (check the search for attributes of type different from stringvalue) -PagedResult iss
[syncope] branch master updated (614d81e -> deb4429)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git. from 614d81e Upgrading Elasticsearch new b8114cf [SYNCOPE-1419] provides the correct behavior in case of multivalue fields for json implementation as well new f4adfd2 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields new deb4429 [SYNCOPE-1419] minox style fixes The 3 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 177 + .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 209 +++-- .../core/persistence/jpa/inner/AnySearchTest.java | 14 ++ 3 files changed, 225 insertions(+), 175 deletions(-)
[syncope] 01/03: [SYNCOPE-1419] provides the correct behavior in case of multivalue fields for json implementation as well
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit b8114cf1cfadd6a9730adca4301663b4dd86db19 Author: fmartelli AuthorDate: Thu Dec 20 23:52:09 2018 +0100 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields for json implementation as well --- .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 177 +++-- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 24 +-- 2 files changed, 111 insertions(+), 90 deletions(-) diff --git a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java index 1c465e9..884a40b 100644 --- a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java +++ b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java @@ -28,6 +28,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.AttrSchemaType; +import org.apache.syncope.core.persistence.api.dao.search.AnyCond; import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; import org.apache.syncope.core.persistence.api.entity.AnyUtils; @@ -153,94 +154,106 @@ public class PGJPAJSONAnySearchDAO extends JPAAnySearchDAO { final PlainSchema schema, final AttributeCond cond, final boolean not, -final List parameters) { +final List parameters, +final SearchSupport svs) { -String key = key(schema.getType()); -boolean lower = (schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) -&& (cond.getType() == AttributeCond.Type.IEQ || cond.getType() == AttributeCond.Type.ILIKE); +// This first branch is required for handling with not conditions given on multivalue fields (SYNCOPE-1419) +if (not && !(cond instanceof AnyCond) +&& schema.isMultivalue() +&& cond.getType() != AttributeCond.Type.ISNULL +&& cond.getType() != AttributeCond.Type.ISNOTNULL) { +query.append("id NOT IN (SELECT DISTINCT any_id FROM "); +query.append(svs.field().name).append(" WHERE "); +fillAttrQuery(anyUtils, query, attrValue, schema, cond, false, parameters, svs); +query.append(")"); +} else { +String key = key(schema.getType()); +boolean lower = (schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) +&& (cond.getType() == AttributeCond.Type.IEQ || cond.getType() == AttributeCond.Type.ILIKE); + +if (!not && cond.getType() == AttributeCond.Type.EQ) { +PlainAttr container = anyUtils.newPlainAttr(); +container.setSchema(schema); +if (attrValue instanceof PlainAttrUniqueValue) { +container.setUniqueValue((PlainAttrUniqueValue) attrValue); +} else { +((JSONPlainAttr) container).add(attrValue); +} -if (!not && cond.getType() == AttributeCond.Type.EQ) { -PlainAttr container = anyUtils.newPlainAttr(); -container.setSchema(schema); -if (attrValue instanceof PlainAttrUniqueValue) { -container.setUniqueValue((PlainAttrUniqueValue) attrValue); +query.append("plainAttrs @> '"). +append(POJOHelper.serialize(Arrays.asList(container))). +append("'::jsonb"); } else { -((JSONPlainAttr) container).add(attrValue); -} +query.append("attrs ->> 'schema' = ?").append(setParameter(parameters, cond.getSchema())). +append(" AND "). +append(lower ? "LOWER(" : ""). +append(schema.isUniqueConstraint() +? "attrs -> 'uniqueValue'" : "attrValues"). +append(" ->> '").append(key).append("'"). +append(lower ? ")" : ""); + +switch (cond.getType()) { +case LIKE: +case ILIKE: +if (not) { +query.ap
[syncope] 02/03: [SYNCOPE-1419] provides the correct behavior in case of multivalue fields
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit f4adfd2fc6e11ac33c556356db4bc066f4895565 Author: fmartelli AuthorDate: Thu Dec 20 15:19:16 2018 +0100 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 197 +++-- .../core/persistence/jpa/inner/AnySearchTest.java | 14 ++ 2 files changed, 120 insertions(+), 91 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index c669690..84f463e 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -834,111 +834,126 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { final boolean not, final List parameters, final SearchSupport svs) { +// This first branch is required for handling with not conditions given on multivalue fields (SYNCOPE-1419) +if (not && !(cond instanceof AnyCond) +&& schema.isMultivalue() +&& cond.getType() != AttributeCond.Type.ISNULL +&& cond.getType() != AttributeCond.Type.ISNOTNULL) { +query.append("any_id NOT IN (SELECT DISTINCT any_id FROM "); +if (schema.isUniqueConstraint()) { +query.append(svs.asSearchViewSupport().uniqueAttr().name); +} else { +query.append(svs.asSearchViewSupport().attr().name); +} +query.append(" WHERE schema_id='").append(schema.getKey()); +fillAttrQuery(query, attrValue, schema, cond, false, parameters, svs); +query.append(")"); +} else { +// activate ignoreCase only for EQ and LIKE operators +boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); -// activate ignoreCase only for EQ and LIKE operators -boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); - -String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); -if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { -column = "LOWER (" + column + ")"; -} -if (!(cond instanceof AnyCond)) { -column = "' AND " + column; -} - -switch (cond.getType()) { - -case ISNULL: -query.append(column).append(not -? " IS NOT NULL" -: " IS NULL"); -break; +String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); +if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { +column = "LOWER (" + column + ")"; +} +if (!(cond instanceof AnyCond)) { +column = "' AND " + column; +} -case ISNOTNULL: -query.append(column).append(not -? " IS NULL" -: " IS NOT NULL"); -break; +switch (cond.getType()) { + +case ISNULL: +query.append(column).append(not +? " IS NOT NULL" +: " IS NULL"); +break; + +case ISNOTNULL: +query.append(column).append(not +? " IS NULL" +: " IS NOT NULL"); +break; + +case ILIKE: +case LIKE: +if (schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) { +query.append(column); +if (not) { +query.append(" NOT "); +} +query.append(" LIKE "); +if (ignoreCase) { + query.append("LOWER(?").append(setParameter(parameters, cond.getExpression())).append(')'); +} else { +
[syncope] 03/03: [SYNCOPE-1419] minox style fixes
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit deb442998b579a3855940b26c16a5aedcdc6ab05 Author: fmartelli AuthorDate: Fri Dec 21 00:20:32 2018 +0100 [SYNCOPE-1419] minox style fixes --- .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java| 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 84f463e..81c0376 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -130,8 +130,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -Pair> queryInfo = getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, -svs); +Pair> queryInfo = +getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); StringBuilder queryString = queryInfo.getLeft(); @@ -167,8 +167,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -Pair> queryInfo = getQuery(buildEffectiveCond(cond, filter.getRight()), -parameters, svs); +Pair> queryInfo = +getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); StringBuilder queryString = queryInfo.getLeft(); @@ -384,8 +384,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { orderByNonUniquePlainSchemas.add(schema.getKey()); } if (orderByUniquePlainSchemas.size() > 1 || orderByNonUniquePlainSchemas.size() > 1) { -SyncopeClientException invalidSearch = SyncopeClientException.build( -ClientExceptionType.InvalidSearchExpression); +SyncopeClientException invalidSearch = + SyncopeClientException.build(ClientExceptionType.InvalidSearchExpression); invalidSearch.getElements().add("Order by more than one attribute is not allowed; " + "remove one from " + (orderByUniquePlainSchemas.size() > 1 ? orderByUniquePlainSchemas : orderByNonUniquePlainSchemas));
[syncope] 01/02: [SYNCOPE-1419] provides the correct behavior in case of multivalue fields
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 6a8165568da35a39295b521958ce211e2ac2f219 Author: fmartelli AuthorDate: Thu Dec 20 15:19:16 2018 +0100 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 209 +++-- .../core/persistence/jpa/inner/AnySearchTest.java | 14 ++ 2 files changed, 128 insertions(+), 95 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index da76f48..26eccfd 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -834,111 +834,126 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { final boolean not, final List parameters, final SearchSupport svs) { +// This first branch is required for handling with not conditions given on multivalue fields (SYNCOPE-1419) +if (not && !(cond instanceof AnyCond) +&& schema.isMultivalue() +&& cond.getType() != AttributeCond.Type.ISNULL +&& cond.getType() != AttributeCond.Type.ISNOTNULL) { +query.append("any_id NOT IN (SELECT DISTINCT any_id FROM "); +if (schema.isUniqueConstraint()) { +query.append(svs.asSearchViewSupport().uniqueAttr().name); +} else { +query.append(svs.asSearchViewSupport().attr().name); +} +query.append(" WHERE schema_id='").append(schema.getKey()); +fillAttrQuery(query, attrValue, schema, cond, false, parameters, svs); +query.append(")"); +} else { +// activate ignoreCase only for EQ and LIKE operators +boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); -// activate ignoreCase only for EQ and LIKE operators -boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); - -String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); -if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { -column = "LOWER (" + column + ")"; -} -if (!(cond instanceof AnyCond)) { -column = "' AND " + column; -} - -switch (cond.getType()) { - -case ISNULL: -query.append(column).append(not -? " IS NOT NULL" -: " IS NULL"); -break; +String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); +if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { +column = "LOWER (" + column + ")"; +} +if (!(cond instanceof AnyCond)) { +column = "' AND " + column; +} -case ISNOTNULL: -query.append(column).append(not -? " IS NULL" -: " IS NOT NULL"); -break; +switch (cond.getType()) { + +case ISNULL: +query.append(column).append(not +? " IS NOT NULL" +: " IS NULL"); +break; + +case ISNOTNULL: +query.append(column).append(not +? " IS NULL" +: " IS NOT NULL"); +break; + +case ILIKE: +case LIKE: +if (schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) { +query.append(column); +if (not) { +query.append(" NOT "); +} +query.append(" LIKE "); +if (ignoreCase) { + query.append("LOWER(?").append(setParameter(parameters, cond.getExpression())).append(')'); +} else { +
[syncope] branch 2_1_X updated (c36eef3 -> 012d351)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git. from c36eef3 Upgrading Elasticsearch new 6a81655 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields new 012d351 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields for json implementation as well The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 177 + .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 209 +++-- .../core/persistence/jpa/inner/AnySearchTest.java | 14 ++ 3 files changed, 225 insertions(+), 175 deletions(-)
[syncope] 02/02: [SYNCOPE-1419] provides the correct behavior in case of multivalue fields for json implementation as well
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 012d351434061a13dff2c697e8f399e2a41d24fc Author: fmartelli AuthorDate: Thu Dec 20 23:52:09 2018 +0100 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields for json implementation as well --- .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 177 +++-- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 2 +- 2 files changed, 98 insertions(+), 81 deletions(-) diff --git a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java index 1c465e9..884a40b 100644 --- a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java +++ b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java @@ -28,6 +28,7 @@ import org.apache.commons.lang3.tuple.Pair; import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.types.AnyTypeKind; import org.apache.syncope.common.lib.types.AttrSchemaType; +import org.apache.syncope.core.persistence.api.dao.search.AnyCond; import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; import org.apache.syncope.core.persistence.api.entity.AnyUtils; @@ -153,94 +154,106 @@ public class PGJPAJSONAnySearchDAO extends JPAAnySearchDAO { final PlainSchema schema, final AttributeCond cond, final boolean not, -final List parameters) { +final List parameters, +final SearchSupport svs) { -String key = key(schema.getType()); -boolean lower = (schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) -&& (cond.getType() == AttributeCond.Type.IEQ || cond.getType() == AttributeCond.Type.ILIKE); +// This first branch is required for handling with not conditions given on multivalue fields (SYNCOPE-1419) +if (not && !(cond instanceof AnyCond) +&& schema.isMultivalue() +&& cond.getType() != AttributeCond.Type.ISNULL +&& cond.getType() != AttributeCond.Type.ISNOTNULL) { +query.append("id NOT IN (SELECT DISTINCT any_id FROM "); +query.append(svs.field().name).append(" WHERE "); +fillAttrQuery(anyUtils, query, attrValue, schema, cond, false, parameters, svs); +query.append(")"); +} else { +String key = key(schema.getType()); +boolean lower = (schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) +&& (cond.getType() == AttributeCond.Type.IEQ || cond.getType() == AttributeCond.Type.ILIKE); + +if (!not && cond.getType() == AttributeCond.Type.EQ) { +PlainAttr container = anyUtils.newPlainAttr(); +container.setSchema(schema); +if (attrValue instanceof PlainAttrUniqueValue) { +container.setUniqueValue((PlainAttrUniqueValue) attrValue); +} else { +((JSONPlainAttr) container).add(attrValue); +} -if (!not && cond.getType() == AttributeCond.Type.EQ) { -PlainAttr container = anyUtils.newPlainAttr(); -container.setSchema(schema); -if (attrValue instanceof PlainAttrUniqueValue) { -container.setUniqueValue((PlainAttrUniqueValue) attrValue); +query.append("plainAttrs @> '"). +append(POJOHelper.serialize(Arrays.asList(container))). +append("'::jsonb"); } else { -((JSONPlainAttr) container).add(attrValue); -} +query.append("attrs ->> 'schema' = ?").append(setParameter(parameters, cond.getSchema())). +append(" AND "). +append(lower ? "LOWER(" : ""). +append(schema.isUniqueConstraint() +? "attrs -> 'uniqueValue'" : "attrValues"). +append(" ->> '").append(key).append("'"). +append(lower ? ")" : ""); + +switch (cond.getType()) { +case LIKE: +case ILIKE: +if (not) { +query.ap
[syncope] branch 2_0_X updated: [SYNCOPE-1419] provides the correct behavior in case of multivalue fields
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new ae6a68d [SYNCOPE-1419] provides the correct behavior in case of multivalue fields ae6a68d is described below commit ae6a68d17d19c8343371968f894f694388f593f4 Author: fmartelli AuthorDate: Thu Dec 20 15:19:16 2018 +0100 [SYNCOPE-1419] provides the correct behavior in case of multivalue fields --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 209 +++-- .../core/persistence/jpa/inner/AnySearchTest.java | 14 ++ 2 files changed, 128 insertions(+), 95 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 718b0bb..6a1cd9c 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -756,111 +756,126 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { final boolean not, final List parameters, final SearchSupport svs) { +// This first branch is required for handling with not conditions given on multivalue fields (SYNCOPE-1419) +if (not && !(cond instanceof AnyCond) +&& schema.isMultivalue() +&& cond.getType() != AttributeCond.Type.ISNULL +&& cond.getType() != AttributeCond.Type.ISNOTNULL) { +query.append("any_id NOT IN (SELECT DISTINCT any_id FROM "); +if (schema.isUniqueConstraint()) { +query.append(svs.uniqueAttr().name); +} else { +query.append(svs.attr().name); +} +query.append(" WHERE schema_id='").append(schema.getKey()); +fillAttrQuery(query, attrValue, schema, cond, false, parameters, svs); +query.append(")"); +} else { +// activate ignoreCase only for EQ and LIKE operators +boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); -// activate ignoreCase only for EQ and LIKE operators -boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); - -String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); -if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { -column = "LOWER (" + column + ")"; -} -if (!(cond instanceof AnyCond)) { -column = "' AND " + column; -} - -switch (cond.getType()) { - -case ISNULL: -query.append(column).append(not -? " IS NOT NULL" -: " IS NULL"); -break; +String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); +if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { +column = "LOWER (" + column + ")"; +} +if (!(cond instanceof AnyCond)) { +column = "' AND " + column; +} -case ISNOTNULL: -query.append(column).append(not -? " IS NULL" -: " IS NOT NULL"); -break; +switch (cond.getType()) { + +case ISNULL: +query.append(column).append(not +? " IS NOT NULL" +: " IS NULL"); +break; + +case ISNOTNULL: +query.append(column).append(not +? " IS NULL" +: " IS NOT NULL"); +break; + +case ILIKE: +case LIKE: +if (schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) { +query.append(column); +if (not) { +query.append(" NOT "); +} +query.append(" LIKE "); +if (ignoreCase) { + query.append("LOWER(?").append(setPar
[syncope] branch master updated (6583c74 -> 52e62d8)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git. from 6583c74 [SYNCOPE-1417] Raise exception when more than one plain attribute is requested for ordering new 427db76 [SYNCOPE-1416] removes null attr views new 52e62d8 [SYNCOPE-1416] merge on jsonb implementation The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 105 - .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 88 ++--- .../core/persistence/jpa/dao/SearchSupport.java| 24 + .../persistence/jpa/dao/SearchViewSupport.java | 4 - core/persistence-jpa/src/main/resources/views.xml | 42 - .../core/persistence/jpa/inner/AnySearchTest.java | 23 + .../src/main/resources/postgres/views.xml | 42 - .../src/main/resources/sqlserver/views.xml | 42 - .../org/apache/syncope/fit/core/SearchITCase.java | 20 +++- 9 files changed, 221 insertions(+), 169 deletions(-)
[syncope] 02/02: [SYNCOPE-1416] merge on jsonb implementation
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit 52e62d892e1393419e5bf752ff1e970821842a2d Author: fmartelli AuthorDate: Fri Dec 14 15:38:23 2018 +0100 [SYNCOPE-1416] merge on jsonb implementation --- .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 105 - .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 11 +-- .../core/persistence/jpa/dao/SearchSupport.java| 24 + .../persistence/jpa/dao/SearchViewSupport.java | 4 - .../org/apache/syncope/fit/core/SearchITCase.java | 9 +- 5 files changed, 118 insertions(+), 35 deletions(-) diff --git a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java index f240705..75b8ff5 100644 --- a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java +++ b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java @@ -18,10 +18,16 @@ */ package org.apache.syncope.core.persistence.jpa.dao; +import java.text.ParseException; import java.util.Arrays; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import org.apache.commons.lang3.time.FastDateFormat; import org.apache.commons.lang3.tuple.Pair; +import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.types.AnyTypeKind; +import org.apache.syncope.common.lib.types.AttrSchemaType; import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; import org.apache.syncope.core.persistence.api.entity.AnyUtils; @@ -34,17 +40,60 @@ import org.apache.syncope.core.persistence.api.entity.JSONPlainAttr; public class PGJPAJSONAnySearchDAO extends JPAAnySearchDAO { +private static final FastDateFormat DATE_FORMAT = FastDateFormat.getInstance(SyncopeConstants.DEFAULT_DATE_PATTERN); + @Override SearchSupport buildSearchSupport(final AnyTypeKind kind) { return new SearchSupport(kind); } @Override -protected void processOBS(final SearchSupport svs, final OrderBySupport obs, final StringBuilder where) { +protected void processOBS( +final SearchSupport svs, +final Set involvedPlainAttrs, +final OrderBySupport obs, +final StringBuilder where) { + +Set attrs = obs.items.stream(). +map(item -> item.orderBy.substring(0, item.orderBy.indexOf(" "))).collect(Collectors.toSet()); + obs.views.forEach(searchView -> { -where.append(','). -append(searchView.name). -append(' ').append(searchView.alias); +if (searchView.name.equals(svs.field().name)) { +StringBuilder attrWhere = new StringBuilder(); +StringBuilder nullAttrWhere = new StringBuilder(); + +where.append(", (SELECT * FROM ").append(searchView.name); + +if (svs.nonMandatorySchemas || obs.nonMandatorySchemas) { +attrs.forEach(field -> { +if (attrWhere.length() == 0) { +attrWhere.append(" WHERE "); +} else { +attrWhere.append(" OR "); +} +attrWhere.append("plainAttrs @> '[{\"schema\":\"").append(field).append("\"}]'::jsonb"); + +nullAttrWhere.append(" UNION SELECT DISTINCT any_id,").append(svs.table().alias).append(".*, "). +append("'{\"schema\": \""). +append(field). +append("\"}'::jsonb as attrs, '{}'::jsonb as attrValues"). +append(" FROM ").append(svs.table().name).append(" ").append(svs.table().alias). +append(", ").append(svs.field().name). +append(" WHERE "). +append("any_id NOT IN "). +append("(SELECT distinct any_id FROM "). +append(svs.field().name). +append(" WHERE ").append(svs.table().alias).append(".id=any_id AND "). +append("plainAttrs @> '[{\"schema\":\"").append(field).append("\"}]'::jsonb)"
[syncope] branch master updated: [SYNCOPE-1416] fix for merge
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/master by this push: new 7055fe9 [SYNCOPE-1416] fix for merge 7055fe9 is described below commit 7055fe9983af8a85c23aa09359b7a87877dd5e3d Author: fmartelli AuthorDate: Fri Dec 14 16:12:53 2018 +0100 [SYNCOPE-1416] fix for merge --- .../src/test/java/org/apache/syncope/fit/core/SearchITCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java index 3c5156f..a49fc5e 100644 --- a/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java +++ b/fit/core-reference/src/test/java/org/apache/syncope/fit/core/SearchITCase.java @@ -36,7 +36,7 @@ import org.apache.syncope.common.lib.request.GroupCR; import org.apache.syncope.common.lib.request.MembershipUR; import org.apache.syncope.common.lib.request.UserCR; import org.apache.syncope.common.lib.request.UserUR; -import org.apache.syncope.common.lib.patch.AttrPatch; +import org.apache.syncope.common.lib.request.AttrPatch; import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyTypeTO; import org.apache.syncope.common.lib.to.PagedResult;
[syncope] 01/02: [SYNCOPE-1416] removes null attr views
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit 427db760a32c9989b7fd2248608286fc43037c9b Author: fmartelli AuthorDate: Fri Dec 14 10:09:16 2018 +0100 [SYNCOPE-1416] removes null attr views --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 89 ++ core/persistence-jpa/src/main/resources/views.xml | 42 -- .../core/persistence/jpa/inner/AnySearchTest.java | 23 ++ .../src/main/resources/postgres/views.xml | 42 -- .../src/main/resources/sqlserver/views.xml | 42 -- .../org/apache/syncope/fit/core/SearchITCase.java | 13 +++- 6 files changed, 110 insertions(+), 141 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index ee20e8d..11ace3a 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -130,7 +130,10 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -StringBuilder queryString = getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); +Pair> queryInfo = +getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); + +StringBuilder queryString = queryInfo.getLeft(); // 2. take into account administrative realms queryString.insert(0, "SELECT u.any_id FROM ("); @@ -164,16 +167,19 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -StringBuilder queryString = getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); +Pair> queryInfo = getQuery(buildEffectiveCond(cond, filter.getRight()), +parameters, svs); + +StringBuilder queryString = queryInfo.getLeft(); // 2. take into account realms and ordering OrderBySupport obs = parseOrderBy(kind, svs, orderBy); if (queryString.charAt(0) == '(') { queryString.insert(0, buildSelect(obs)); -queryString.append(buildWhere(svs, obs)); +queryString.append(buildWhere(svs, queryInfo.getRight(), obs)); } else { queryString.insert(0, buildSelect(obs).append('(')); -queryString.append(')').append(buildWhere(svs, obs)); +queryString.append(')').append(buildWhere(svs, queryInfo.getRight(), obs)); } queryString. append(filter.getLeft()). @@ -233,14 +239,49 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { return select; } -protected void processOBS(final SearchSupport svs, final OrderBySupport obs, final StringBuilder where) { +protected void processOBS( +final SearchSupport svs, +final Set involvedPlainAttrs, +final OrderBySupport obs, +final StringBuilder where) { + +Set attrs = new HashSet<>(involvedPlainAttrs); +for (OrderBySupport.Item item : obs.items) { +attrs.add(item.orderBy.substring(0, item.orderBy.indexOf(" "))); +} + obs.views.forEach(searchView -> { where.append(','); if (searchView.name.equals(svs.asSearchViewSupport().attr().name)) { +StringBuilder attrWhere = new StringBuilder(); +StringBuilder nullAttrWhere = new StringBuilder(); + where.append(" (SELECT * FROM ").append(searchView.name); if (svs.nonMandatorySchemas || obs.nonMandatorySchemas) { -where.append(" UNION SELECT * FROM ").append(svs.asSearchViewSupport().nullAttr().name); +attrs.forEach(field -> { +if (attrWhere.length() == 0) { +attrWhere.append(" WHERE schema_id='").append(field).append("'"); +} else { +attrWhere.append(" OR ").append("schema_id='").append(field).append("'"); +} + +nullAttrWhere.append(" UNION SELECT any_id, "). +append("'"). +app
[syncope] 01/02: [SYNCOPE-1416] removes null attr views
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 772936c5275f2e504a67bad9639e9fc34d94df59 Author: fmartelli AuthorDate: Fri Dec 14 10:09:16 2018 +0100 [SYNCOPE-1416] removes null attr views --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 89 ++ core/persistence-jpa/src/main/resources/views.xml | 42 -- .../core/persistence/jpa/inner/AnySearchTest.java | 23 ++ .../src/main/resources/postgres/views.xml | 42 -- .../src/main/resources/sqlserver/views.xml | 42 -- .../org/apache/syncope/fit/core/SearchITCase.java | 12 +++ 6 files changed, 110 insertions(+), 140 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index ee20e8d..11ace3a 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -130,7 +130,10 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -StringBuilder queryString = getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); +Pair> queryInfo = +getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); + +StringBuilder queryString = queryInfo.getLeft(); // 2. take into account administrative realms queryString.insert(0, "SELECT u.any_id FROM ("); @@ -164,16 +167,19 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -StringBuilder queryString = getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); +Pair> queryInfo = getQuery(buildEffectiveCond(cond, filter.getRight()), +parameters, svs); + +StringBuilder queryString = queryInfo.getLeft(); // 2. take into account realms and ordering OrderBySupport obs = parseOrderBy(kind, svs, orderBy); if (queryString.charAt(0) == '(') { queryString.insert(0, buildSelect(obs)); -queryString.append(buildWhere(svs, obs)); +queryString.append(buildWhere(svs, queryInfo.getRight(), obs)); } else { queryString.insert(0, buildSelect(obs).append('(')); -queryString.append(')').append(buildWhere(svs, obs)); +queryString.append(')').append(buildWhere(svs, queryInfo.getRight(), obs)); } queryString. append(filter.getLeft()). @@ -233,14 +239,49 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { return select; } -protected void processOBS(final SearchSupport svs, final OrderBySupport obs, final StringBuilder where) { +protected void processOBS( +final SearchSupport svs, +final Set involvedPlainAttrs, +final OrderBySupport obs, +final StringBuilder where) { + +Set attrs = new HashSet<>(involvedPlainAttrs); +for (OrderBySupport.Item item : obs.items) { +attrs.add(item.orderBy.substring(0, item.orderBy.indexOf(" "))); +} + obs.views.forEach(searchView -> { where.append(','); if (searchView.name.equals(svs.asSearchViewSupport().attr().name)) { +StringBuilder attrWhere = new StringBuilder(); +StringBuilder nullAttrWhere = new StringBuilder(); + where.append(" (SELECT * FROM ").append(searchView.name); if (svs.nonMandatorySchemas || obs.nonMandatorySchemas) { -where.append(" UNION SELECT * FROM ").append(svs.asSearchViewSupport().nullAttr().name); +attrs.forEach(field -> { +if (attrWhere.length() == 0) { +attrWhere.append(" WHERE schema_id='").append(field).append("'"); +} else { +attrWhere.append(" OR ").append("schema_id='").append(field).append("'"); +} + +nullAttrWhere.append(" UNION SELECT any_id, "). +append("'"). +app
[syncope] 02/02: [SYNCOPE-1416] merge on jsonb implementation
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 40fc384f9851868c4db267457d49fb7757b23a77 Author: fmartelli AuthorDate: Fri Dec 14 15:38:23 2018 +0100 [SYNCOPE-1416] merge on jsonb implementation --- .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 105 - .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 11 +-- .../core/persistence/jpa/dao/SearchSupport.java| 24 + .../persistence/jpa/dao/SearchViewSupport.java | 4 - .../org/apache/syncope/fit/core/SearchITCase.java | 9 +- 5 files changed, 118 insertions(+), 35 deletions(-) diff --git a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java index f240705..75b8ff5 100644 --- a/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java +++ b/core/persistence-jpa-json/src/main/java/org/apache/syncope/core/persistence/jpa/dao/PGJPAJSONAnySearchDAO.java @@ -18,10 +18,16 @@ */ package org.apache.syncope.core.persistence.jpa.dao; +import java.text.ParseException; import java.util.Arrays; import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; +import org.apache.commons.lang3.time.FastDateFormat; import org.apache.commons.lang3.tuple.Pair; +import org.apache.syncope.common.lib.SyncopeConstants; import org.apache.syncope.common.lib.types.AnyTypeKind; +import org.apache.syncope.common.lib.types.AttrSchemaType; import org.apache.syncope.core.persistence.api.dao.search.AttributeCond; import org.apache.syncope.core.persistence.api.dao.search.OrderByClause; import org.apache.syncope.core.persistence.api.entity.AnyUtils; @@ -34,17 +40,60 @@ import org.apache.syncope.core.persistence.api.entity.JSONPlainAttr; public class PGJPAJSONAnySearchDAO extends JPAAnySearchDAO { +private static final FastDateFormat DATE_FORMAT = FastDateFormat.getInstance(SyncopeConstants.DEFAULT_DATE_PATTERN); + @Override SearchSupport buildSearchSupport(final AnyTypeKind kind) { return new SearchSupport(kind); } @Override -protected void processOBS(final SearchSupport svs, final OrderBySupport obs, final StringBuilder where) { +protected void processOBS( +final SearchSupport svs, +final Set involvedPlainAttrs, +final OrderBySupport obs, +final StringBuilder where) { + +Set attrs = obs.items.stream(). +map(item -> item.orderBy.substring(0, item.orderBy.indexOf(" "))).collect(Collectors.toSet()); + obs.views.forEach(searchView -> { -where.append(','). -append(searchView.name). -append(' ').append(searchView.alias); +if (searchView.name.equals(svs.field().name)) { +StringBuilder attrWhere = new StringBuilder(); +StringBuilder nullAttrWhere = new StringBuilder(); + +where.append(", (SELECT * FROM ").append(searchView.name); + +if (svs.nonMandatorySchemas || obs.nonMandatorySchemas) { +attrs.forEach(field -> { +if (attrWhere.length() == 0) { +attrWhere.append(" WHERE "); +} else { +attrWhere.append(" OR "); +} +attrWhere.append("plainAttrs @> '[{\"schema\":\"").append(field).append("\"}]'::jsonb"); + +nullAttrWhere.append(" UNION SELECT DISTINCT any_id,").append(svs.table().alias).append(".*, "). +append("'{\"schema\": \""). +append(field). +append("\"}'::jsonb as attrs, '{}'::jsonb as attrValues"). +append(" FROM ").append(svs.table().name).append(" ").append(svs.table().alias). +append(", ").append(svs.field().name). +append(" WHERE "). +append("any_id NOT IN "). +append("(SELECT distinct any_id FROM "). +append(svs.field().name). +append(" WHERE ").append(svs.table().alias).append(".id=any_id AND "). +append("plainAttrs @> '[{\"schema\":\"").append(field).append("\"}]'::jsonb)"
[syncope] branch 2_1_X updated (3e6f71c -> 40fc384)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git. from 3e6f71c [SYNCOPE-1417] Raise exception when more than one plain attribute is requested for ordering new 772936c [SYNCOPE-1416] removes null attr views new 40fc384 [SYNCOPE-1416] merge on jsonb implementation The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../persistence/jpa/dao/PGJPAJSONAnySearchDAO.java | 105 - .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 88 ++--- .../core/persistence/jpa/dao/SearchSupport.java| 24 + .../persistence/jpa/dao/SearchViewSupport.java | 4 - core/persistence-jpa/src/main/resources/views.xml | 42 - .../core/persistence/jpa/inner/AnySearchTest.java | 23 + .../src/main/resources/postgres/views.xml | 42 - .../src/main/resources/sqlserver/views.xml | 42 - .../org/apache/syncope/fit/core/SearchITCase.java | 19 +++- 9 files changed, 221 insertions(+), 168 deletions(-)
[syncope] branch 2_0_X updated: [SYNCOPE-1416] removes null attr views
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new a6af009 [SYNCOPE-1416] removes null attr views a6af009 is described below commit a6af009915b5516a5744c773529ee336a1e61686 Author: fmartelli AuthorDate: Fri Dec 14 10:09:16 2018 +0100 [SYNCOPE-1416] removes null attr views --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java | 84 ++ core/persistence-jpa/src/main/resources/views.xml | 42 --- .../core/persistence/jpa/inner/AnySearchTest.java | 23 ++ .../src/main/resources/postgres/views.xml | 42 --- .../src/main/resources/sqlserver/views.xml | 42 --- .../org/apache/syncope/fit/core/SearchITCase.java | 12 6 files changed, 106 insertions(+), 139 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index c9b3c87..1fcd907 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -127,7 +127,10 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -StringBuilder queryString = getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); +Pair> queryInfo = +getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); + +StringBuilder queryString = queryInfo.getLeft(); // 2. take into account administrative realms queryString.insert(0, "SELECT u.any_id FROM ("); @@ -161,16 +164,19 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { Pair> filter = getAdminRealmsFilter(adminRealms, svs, parameters); // 1. get the query string from the search condition -StringBuilder queryString = getQuery(buildEffectiveCond(cond, filter.getRight()), parameters, svs); +Pair> queryInfo = getQuery(buildEffectiveCond(cond, filter.getRight()), +parameters, svs); + +StringBuilder queryString = queryInfo.getLeft(); // 2. take into account realms and ordering OrderBySupport obs = parseOrderBy(kind, svs, orderBy); if (queryString.charAt(0) == '(') { queryString.insert(0, buildSelect(obs)); -queryString.append(buildWhere(svs, obs)); +queryString.append(buildWhere(svs, queryInfo.getRight(), obs)); } else { queryString.insert(0, buildSelect(obs).append('(')); -queryString.append(')').append(buildWhere(svs, obs)); +queryString.append(')').append(buildWhere(svs, queryInfo.getRight(), obs)); } queryString. append(filter.getLeft()). @@ -233,15 +239,48 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { return select; } -private StringBuilder buildWhere(final SearchSupport svs, final OrderBySupport obs) { +private StringBuilder buildWhere( +final SearchSupport svs, final Set involvedPlainAttrs, final OrderBySupport obs) { + +Set attrs = new HashSet<>(involvedPlainAttrs); +for (OrderBySupport.Item item : obs.items) { +attrs.add(item.orderBy.substring(0, item.orderBy.indexOf(" "))); +} + StringBuilder where = new StringBuilder(" u"); + for (SearchSupport.SearchView searchView : obs.views) { where.append(','); if (searchView.name.equals(svs.attr().name)) { +StringBuilder attrWhere = new StringBuilder(); +StringBuilder nullAttrWhere = new StringBuilder(); + where.append(" (SELECT * FROM ").append(searchView.name); if (svs.nonMandatorySchemas || obs.nonMandatorySchemas) { -where.append(" UNION SELECT * FROM ").append(svs.nullAttr().name); +for (String field : attrs) { +if (attrWhere.length() == 0) { +attrWhere.append(" WHERE schema_id='").append(field).append("'"); +} else { +attrWhere.append(" OR ").append("schema_id='").append(field).append("'"); +} + +nullAttrWhere.append(
[syncope] 01/02: [SYNCOPE-1412] removes debug statement
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 4192f1d437d969e6011386fda9ebc9bf9d4df98a Author: fmartelli AuthorDate: Mon Dec 10 16:27:38 2018 +0100 [SYNCOPE-1412] removes debug statement --- .../org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java| 2 -- 1 file changed, 2 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 725d6b7..c9b3c87 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -176,8 +176,6 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { append(filter.getLeft()). append(buildOrderBy(obs)); -System.out.println("AA " + queryString.toString()); - // 3. prepare the search query Query query = entityManager().createNativeQuery(queryString.toString());
[syncope] 02/02: [SYNCOPE-1411] code improvement
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 7aa1cb9d74f79046aff300317417ade569eca44d Author: fmartelli AuthorDate: Mon Dec 10 16:28:01 2018 +0100 [SYNCOPE-1411] code improvement --- .../core/provisioning/java/data/AnyObjectDataBinderImpl.java | 7 ++- .../syncope/core/provisioning/java/data/UserDataBinderImpl.java| 6 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java index 902b502..11d2464 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java @@ -369,11 +369,10 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An if (membership != null) { anyObject.getMemberships().remove(membership); membership.setLeftEnd(null); -Set membAttrKeys = new HashSet<>(); for (APlainAttr attr : anyObject.getPlainAttrs(membership)) { anyObject.remove(attr); attr.setOwner(null); -membAttrKeys.add(attr.getKey()); +attr.setMembership(null); if (attr.getSchema().isUniqueConstraint()) { plainAttrValueDAO.delete(attr.getUniqueValue().getKey(), anyUtils.plainAttrValueClass()); } else { @@ -383,9 +382,7 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An plainAttrValueDAO.delete(attrValueKey, anyUtils.plainAttrValueClass()); } } -} -for (String attrKey : membAttrKeys) { -plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); +plainAttrDAO.delete(attr); } if (membPatch.getOperation() == PatchOperation.DELETE) { diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java index 4efe304..cdef516 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java @@ -437,12 +437,10 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat if (membership != null) { user.getMemberships().remove(membership); membership.setLeftEnd(null); -Set membAttrKeys = new HashSet<>(); for (UPlainAttr attr : user.getPlainAttrs(membership)) { user.remove(attr); attr.setOwner(null); attr.setMembership(null); -membAttrKeys.add(attr.getKey()); if (attr.getSchema().isUniqueConstraint()) { plainAttrValueDAO.delete(attr.getUniqueValue().getKey(), anyUtils.plainAttrValueClass()); } else { @@ -452,9 +450,7 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat plainAttrValueDAO.delete(attrValueKey, anyUtils.plainAttrValueClass()); } } -} -for (String attrKey : membAttrKeys) { -plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); +plainAttrDAO.delete(attr); } if (membPatch.getOperation() == PatchOperation.DELETE) {
[syncope] branch 2_0_X updated (4253fe0 -> 7aa1cb9)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git. from 4253fe0 [SYNCOPE-1412] changes in order to avoid null_attr views new 4192f1d [SYNCOPE-1412] removes debug statement new 7aa1cb9 [SYNCOPE-1411] code improvement The 2 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 2 -- .../core/provisioning/java/data/AnyObjectDataBinderImpl.java | 7 ++- .../syncope/core/provisioning/java/data/UserDataBinderImpl.java| 6 +- 3 files changed, 3 insertions(+), 12 deletions(-)
[syncope] 03/04: [SYNCOPE-1412] removes debug statement
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit 1f4686455d7ca6d973d9f898f6c86ee1d0ae73ff Author: fmartelli AuthorDate: Mon Dec 10 15:38:10 2018 +0100 [SYNCOPE-1412] removes debug statement --- .../org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 942cc95..0688100 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -877,7 +877,7 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.attr().name).append(" WHERE schema_id="). +query.append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). append("'").append(checked.getLeft().getKey()).append("'"); break; @@ -885,7 +885,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { query.append(svs.field().name). append(" WHERE any_id NOT IN "). append("("). -append("SELECT DISTINCT any_id FROM ").append(svs.attr().name).append(" WHERE schema_id="). +append("SELECT DISTINCT any_id FROM "). +append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). append("'").append(checked.getLeft().getKey()).append("'"). append(")"); break;
[syncope] 04/04: [SYNCOPE-1411] fixes merge from 2_0_X
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit 0377b6b1c39fae4878ed2b77e19d290fe62797da Author: fmartelli AuthorDate: Mon Dec 10 15:38:49 2018 +0100 [SYNCOPE-1411] fixes merge from 2_0_X --- .../core/provisioning/java/data/AnyObjectDataBinderImpl.java| 6 -- .../syncope/core/provisioning/java/data/UserDataBinderImpl.java | 6 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java index c13052c..a6e3f17 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java @@ -54,7 +54,6 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource; import org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder; -import org.apache.syncope.core.provisioning.api.utils.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -342,17 +341,12 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An anyObject.getMembership(membPatch.getGroup()).ifPresent(membership -> { anyObject.remove(membership); membership.setLeftEnd(null); -Set membAttrKeys = new HashSet<>(); anyObject.getPlainAttrs(membership).forEach(attr -> { anyObject.remove(attr); attr.setOwner(null); attr.setMembership(null); -membAttrKeys.add(attr.getKey()); plainAttrValueDAO.deleteAll(attr, anyUtils); }); -membAttrKeys.forEach(attrKey -> { -plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); -}); if (membPatch.getOperation() == PatchOperation.DELETE) { groupDAO.findAllResourceKeys(membership.getRightEnd().getKey()).stream(). diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java index f629f8b..c31 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java @@ -414,16 +414,12 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat user.getMembership(membPatch.getGroup()).ifPresent(membership -> { user.remove(membership); membership.setLeftEnd(null); -Set membAttrKeys = new HashSet<>(); user.getPlainAttrs(membership).forEach(attr -> { user.remove(attr); attr.setOwner(null); attr.setMembership(null); -membAttrKeys.add(attr.getKey()); plainAttrValueDAO.deleteAll(attr, anyUtils); -}); -membAttrKeys.forEach(attrKey -> { -plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); +plainAttrDAO.delete(attr); }); if (membPatch.getOperation() == PatchOperation.DELETE) {
[syncope] 02/04: [SYNCOPE-1412] changes in order to avoid null_attr views
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit 4c9fba59559f8f9e583bce3733db590124c082e6 Author: fmartelli AuthorDate: Mon Dec 10 14:37:22 2018 +0100 [SYNCOPE-1412] changes in order to avoid null_attr views --- .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 02e2535..942cc95 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -877,15 +877,17 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.field().name). -append(" WHERE any_id NOT IN (SELECT any_id FROM "). -append(svs.asSearchViewSupport().nullAttr().name). -append(" WHERE schema_id='").append(checked.getLeft().getKey()).append("')"); +query.append(svs.attr().name).append(" WHERE schema_id="). + append("'").append(checked.getLeft().getKey()).append("'"); break; case ISNULL: -query.append(svs.asSearchViewSupport().nullAttr().name). -append(" WHERE schema_id='").append(checked.getLeft().getKey()).append("'"); +query.append(svs.field().name). +append(" WHERE any_id NOT IN "). +append("("). +append("SELECT DISTINCT any_id FROM ").append(svs.attr().name).append(" WHERE schema_id="). + append("'").append(checked.getLeft().getKey()).append("'"). +append(")"); break; default:
[syncope] branch master updated (8340ea4 -> 0377b6b)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git. from 8340ea4 [SYNCOPE-1410] Renaming [User,Group,AnyObject]Patch -> [\1]UR new c1879cc [SYNCOPE-1411] force cascade new 4c9fba5 [SYNCOPE-1412] changes in order to avoid null_attr views new 1f46864 [SYNCOPE-1412] removes debug statement new 0377b6b [SYNCOPE-1411] fixes merge from 2_0_X The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 15 +-- .../provisioning/java/data/AnyObjectDataBinderImpl.java | 2 ++ .../core/provisioning/java/data/UserDataBinderImpl.java | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-)
[syncope] 01/04: [SYNCOPE-1411] force cascade
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/syncope.git commit c1879cc2023a32e7d7b60d8389165ea17024b2e2 Author: fmartelli AuthorDate: Mon Dec 10 14:24:30 2018 +0100 [SYNCOPE-1411] force cascade --- .../core/provisioning/java/data/AnyObjectDataBinderImpl.java | 8 .../syncope/core/provisioning/java/data/UserDataBinderImpl.java | 8 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java index 714cfb6..c13052c 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java @@ -54,6 +54,7 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource; import org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder; +import org.apache.syncope.core.provisioning.api.utils.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -341,9 +342,16 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An anyObject.getMembership(membPatch.getGroup()).ifPresent(membership -> { anyObject.remove(membership); membership.setLeftEnd(null); +Set membAttrKeys = new HashSet<>(); anyObject.getPlainAttrs(membership).forEach(attr -> { anyObject.remove(attr); attr.setOwner(null); +attr.setMembership(null); +membAttrKeys.add(attr.getKey()); +plainAttrValueDAO.deleteAll(attr, anyUtils); +}); +membAttrKeys.forEach(attrKey -> { +plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); }); if (membPatch.getOperation() == PatchOperation.DELETE) { diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java index d7d5f1a..f629f8b 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java @@ -414,12 +414,18 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat user.getMembership(membPatch.getGroup()).ifPresent(membership -> { user.remove(membership); membership.setLeftEnd(null); +Set membAttrKeys = new HashSet<>(); user.getPlainAttrs(membership).forEach(attr -> { user.remove(attr); attr.setOwner(null); attr.setMembership(null); +membAttrKeys.add(attr.getKey()); +plainAttrValueDAO.deleteAll(attr, anyUtils); }); - +membAttrKeys.forEach(attrKey -> { +plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); +}); + if (membPatch.getOperation() == PatchOperation.DELETE) { groupDAO.findAllResourceKeys(membership.getRightEnd().getKey()).stream(). filter(resource -> reasons.containsKey(resource)).
[syncope] 01/04: [SYNCOPE-1411] force cascade
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 1dabd4bf1dc4e618342a4161da88a8018d390bba Author: fmartelli AuthorDate: Mon Dec 10 14:24:30 2018 +0100 [SYNCOPE-1411] force cascade --- .../core/provisioning/java/data/AnyObjectDataBinderImpl.java | 8 .../syncope/core/provisioning/java/data/UserDataBinderImpl.java | 8 +++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java index e4ec82f..7e8fbf8 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java @@ -54,6 +54,7 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource; import org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder; +import org.apache.syncope.core.provisioning.api.utils.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -341,9 +342,16 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An anyObject.getMembership(membPatch.getGroup()).ifPresent(membership -> { anyObject.remove(membership); membership.setLeftEnd(null); +Set membAttrKeys = new HashSet<>(); anyObject.getPlainAttrs(membership).forEach(attr -> { anyObject.remove(attr); attr.setOwner(null); +attr.setMembership(null); +membAttrKeys.add(attr.getKey()); +plainAttrValueDAO.deleteAll(attr, anyUtils); +}); +membAttrKeys.forEach(attrKey -> { +plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); }); if (membPatch.getOperation() == PatchOperation.DELETE) { diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java index 3ff0f2e..7eabd7f 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java @@ -414,12 +414,18 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat user.getMembership(membPatch.getGroup()).ifPresent(membership -> { user.remove(membership); membership.setLeftEnd(null); +Set membAttrKeys = new HashSet<>(); user.getPlainAttrs(membership).forEach(attr -> { user.remove(attr); attr.setOwner(null); attr.setMembership(null); +membAttrKeys.add(attr.getKey()); +plainAttrValueDAO.deleteAll(attr, anyUtils); }); - +membAttrKeys.forEach(attrKey -> { +plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); +}); + if (membPatch.getOperation() == PatchOperation.DELETE) { groupDAO.findAllResourceKeys(membership.getRightEnd().getKey()).stream(). filter(resource -> reasons.containsKey(resource)).
[syncope] 02/04: [SYNCOPE-1412] changes in order to avoid null_attr views
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 497d6fcc03ffc304df58dfdfe93922d88fca275a Author: fmartelli AuthorDate: Mon Dec 10 14:37:22 2018 +0100 [SYNCOPE-1412] changes in order to avoid null_attr views --- .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 02e2535..942cc95 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -877,15 +877,17 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.field().name). -append(" WHERE any_id NOT IN (SELECT any_id FROM "). -append(svs.asSearchViewSupport().nullAttr().name). -append(" WHERE schema_id='").append(checked.getLeft().getKey()).append("')"); +query.append(svs.attr().name).append(" WHERE schema_id="). + append("'").append(checked.getLeft().getKey()).append("'"); break; case ISNULL: -query.append(svs.asSearchViewSupport().nullAttr().name). -append(" WHERE schema_id='").append(checked.getLeft().getKey()).append("'"); +query.append(svs.field().name). +append(" WHERE any_id NOT IN "). +append("("). +append("SELECT DISTINCT any_id FROM ").append(svs.attr().name).append(" WHERE schema_id="). + append("'").append(checked.getLeft().getKey()).append("'"). +append(")"); break; default:
[syncope] 03/04: [SYNCOPE-1412] removes debug statement
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit aa71d844226cd1a44ff134546583e8bd892ec95f Author: fmartelli AuthorDate: Mon Dec 10 15:38:10 2018 +0100 [SYNCOPE-1412] removes debug statement --- .../org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 942cc95..0688100 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -877,7 +877,7 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.attr().name).append(" WHERE schema_id="). +query.append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). append("'").append(checked.getLeft().getKey()).append("'"); break; @@ -885,7 +885,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { query.append(svs.field().name). append(" WHERE any_id NOT IN "). append("("). -append("SELECT DISTINCT any_id FROM ").append(svs.attr().name).append(" WHERE schema_id="). +append("SELECT DISTINCT any_id FROM "). +append(svs.asSearchViewSupport().attr().name).append(" WHERE schema_id="). append("'").append(checked.getLeft().getKey()).append("'"). append(")"); break;
[syncope] branch 2_1_X updated (fbda7da -> 6e80336)
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a change to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git. from fbda7da [SYNCOPE-1409] Avoid double read either before and afterwards new 1dabd4b [SYNCOPE-1411] force cascade new 497d6fc [SYNCOPE-1412] changes in order to avoid null_attr views new aa71d84 [SYNCOPE-1412] removes debug statement new 6e80336 [SYNCOPE-1411] fixes merge from 2_0_X The 4 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "add" were already present in the repository and have only been added to this reference. Summary of changes: .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 15 +-- .../provisioning/java/data/AnyObjectDataBinderImpl.java | 2 ++ .../core/provisioning/java/data/UserDataBinderImpl.java | 4 +++- 3 files changed, 14 insertions(+), 7 deletions(-)
[syncope] 04/04: [SYNCOPE-1411] fixes merge from 2_0_X
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_1_X in repository https://gitbox.apache.org/repos/asf/syncope.git commit 6e80336e27978a6c38a787c4a6ac71ab3ca7b0d1 Author: fmartelli AuthorDate: Mon Dec 10 15:38:49 2018 +0100 [SYNCOPE-1411] fixes merge from 2_0_X --- .../core/provisioning/java/data/AnyObjectDataBinderImpl.java| 6 -- .../syncope/core/provisioning/java/data/UserDataBinderImpl.java | 6 +- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java index 7e8fbf8..0002836 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java @@ -54,7 +54,6 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource; import org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder; -import org.apache.syncope.core.provisioning.api.utils.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -342,17 +341,12 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An anyObject.getMembership(membPatch.getGroup()).ifPresent(membership -> { anyObject.remove(membership); membership.setLeftEnd(null); -Set membAttrKeys = new HashSet<>(); anyObject.getPlainAttrs(membership).forEach(attr -> { anyObject.remove(attr); attr.setOwner(null); attr.setMembership(null); -membAttrKeys.add(attr.getKey()); plainAttrValueDAO.deleteAll(attr, anyUtils); }); -membAttrKeys.forEach(attrKey -> { -plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); -}); if (membPatch.getOperation() == PatchOperation.DELETE) { groupDAO.findAllResourceKeys(membership.getRightEnd().getKey()).stream(). diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java index 7eabd7f..5771d6f 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java @@ -414,16 +414,12 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat user.getMembership(membPatch.getGroup()).ifPresent(membership -> { user.remove(membership); membership.setLeftEnd(null); -Set membAttrKeys = new HashSet<>(); user.getPlainAttrs(membership).forEach(attr -> { user.remove(attr); attr.setOwner(null); attr.setMembership(null); -membAttrKeys.add(attr.getKey()); plainAttrValueDAO.deleteAll(attr, anyUtils); -}); -membAttrKeys.forEach(attrKey -> { -plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); +plainAttrDAO.delete(attr); }); if (membPatch.getOperation() == PatchOperation.DELETE) {
[syncope] branch 2_0_X updated: [SYNCOPE-1412] changes in order to avoid null_attr views
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new 4253fe0 [SYNCOPE-1412] changes in order to avoid null_attr views 4253fe0 is described below commit 4253fe0749cb7f15f398d0f04bb5a7f6a6d09425 Author: fmartelli AuthorDate: Mon Dec 10 14:37:22 2018 +0100 [SYNCOPE-1412] changes in order to avoid null_attr views --- .../core/persistence/jpa/dao/JPAAnySearchDAO.java| 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 90e5fd0..725d6b7 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -176,6 +176,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { append(filter.getLeft()). append(buildOrderBy(obs)); +System.out.println("AA " + queryString.toString()); + // 3. prepare the search query Query query = entityManager().createNativeQuery(queryString.toString()); @@ -796,15 +798,17 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { StringBuilder query = new StringBuilder("SELECT DISTINCT any_id FROM "); switch (cond.getType()) { case ISNOTNULL: -query.append(svs.field().name). -append(" WHERE any_id NOT IN (SELECT any_id FROM "). -append(svs.nullAttr().name). -append(" WHERE schema_id='").append(checked.getLeft().getKey()).append("')"); +query.append(svs.attr().name).append(" WHERE schema_id="). + append("'").append(checked.getLeft().getKey()).append("'"); break; case ISNULL: -query.append(svs.nullAttr().name). -append(" WHERE schema_id='").append(checked.getLeft().getKey()).append("'"); +query.append(svs.field().name). +append(" WHERE any_id NOT IN "). +append("("). +append("SELECT DISTINCT any_id FROM ").append(svs.attr().name).append(" WHERE schema_id="). + append("'").append(checked.getLeft().getKey()).append("'"). +append(")"); break; default:
[syncope] branch 2_0_X updated: [SYNCOPE-1411] force cascade
This is an automated email from the ASF dual-hosted git repository. fmartelli pushed a commit to branch 2_0_X in repository https://gitbox.apache.org/repos/asf/syncope.git The following commit(s) were added to refs/heads/2_0_X by this push: new 6357b8b [SYNCOPE-1411] force cascade 6357b8b is described below commit 6357b8b3d9d8dd26cfdc4509e18b5e988063993f Author: fmartelli AuthorDate: Mon Dec 10 14:24:30 2018 +0100 [SYNCOPE-1411] force cascade --- .../provisioning/java/data/AnyObjectDataBinderImpl.java | 15 +++ .../core/provisioning/java/data/UserDataBinderImpl.java | 14 ++ 2 files changed, 29 insertions(+) diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java index f5cca66..902b502 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/AnyObjectDataBinderImpl.java @@ -62,6 +62,7 @@ import org.apache.syncope.core.persistence.api.entity.anyobject.AnyObject; import org.apache.syncope.core.persistence.api.entity.group.Group; import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource; import org.apache.syncope.core.provisioning.api.data.AnyObjectDataBinder; +import org.apache.syncope.core.provisioning.api.utils.EntityUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -368,9 +369,23 @@ public class AnyObjectDataBinderImpl extends AbstractAnyDataBinder implements An if (membership != null) { anyObject.getMemberships().remove(membership); membership.setLeftEnd(null); +Set membAttrKeys = new HashSet<>(); for (APlainAttr attr : anyObject.getPlainAttrs(membership)) { anyObject.remove(attr); attr.setOwner(null); +membAttrKeys.add(attr.getKey()); +if (attr.getSchema().isUniqueConstraint()) { + plainAttrValueDAO.delete(attr.getUniqueValue().getKey(), anyUtils.plainAttrValueClass()); +} else { +Collection valuesToBeRemoved = +CollectionUtils.collect(attr.getValues(), EntityUtils.keyTransformer()); +for (String attrValueKey : valuesToBeRemoved) { +plainAttrValueDAO.delete(attrValueKey, anyUtils.plainAttrValueClass()); +} +} +} +for (String attrKey : membAttrKeys) { +plainAttrDAO.delete(attrKey, anyUtils.plainAttrClass()); } if (membPatch.getOperation() == PatchOperation.DELETE) { diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java index 175375c..4efe304 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/data/UserDataBinderImpl.java @@ -437,10 +437,24 @@ public class UserDataBinderImpl extends AbstractAnyDataBinder implements UserDat if (membership != null) { user.getMemberships().remove(membership); membership.setLeftEnd(null); +Set membAttrKeys = new HashSet<>(); for (UPlainAttr attr : user.getPlainAttrs(membership)) { user.remove(attr); attr.setOwner(null); attr.setMembership(null); +membAttrKeys.add(attr.getKey()); +if (attr.getSchema().isUniqueConstraint()) { + plainAttrValueDAO.delete(attr.getUniqueValue().getKey(), anyUtils.plainAttrValueClass()); +} else { +Collection valuesToBeRemoved = +CollectionUtils.collect(attr.getValues(), EntityUtils.keyTransformer()); +for (String attrValueKey : valuesToBeRemoved) { +plainAttrValueDAO.delete(attrValueKey, anyUtils.plainAttrValueClass()); +} +} +} +for (St
syncope git commit: [SYNCOPE-1389] provides the fix
Repository: syncope Updated Branches: refs/heads/master fed7c97c8 -> 6d285b201 [SYNCOPE-1389] provides the fix Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/6d285b20 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/6d285b20 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/6d285b20 Branch: refs/heads/master Commit: 6d285b20104369f1afcb85f162386b1eae827038 Parents: fed7c97 Author: fmartelli Authored: Wed Oct 24 16:46:22 2018 +0200 Committer: fmartelli Committed: Wed Oct 24 16:46:22 2018 +0200 -- .../provisioning/java/propagation/PropagationManagerImpl.java| 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/6d285b20/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java index deac6a4..cd851d5 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java @@ -352,7 +352,9 @@ public class PropagationManagerImpl implements PropagationManager { } values.add(AttributeBuilder.build(schema.getExtAttrName(), vAttr.getValues())); -propByRes.add(ResourceOperation.UPDATE, schema.getProvision().getResource().getKey()); +if (!propByRes.contains(ResourceOperation.CREATE, schema.getProvision().getResource().getKey())) { +propByRes.add(ResourceOperation.UPDATE, schema.getProvision().getResource().getKey()); +} } else { LOG.warn("{} not owned by or {} not allowed for {}", schema.getProvision().getResource(), schema, any);
syncope git commit: [SYNCOPE-1389] provides the fix
Repository: syncope Updated Branches: refs/heads/2_1_X 6bb67afe2 -> e55941787 [SYNCOPE-1389] provides the fix Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e5594178 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e5594178 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e5594178 Branch: refs/heads/2_1_X Commit: e559417870aa7fa1330147b4d238538a4350f30b Parents: 6bb67af Author: fmartelli Authored: Wed Oct 24 16:44:22 2018 +0200 Committer: fmartelli Committed: Wed Oct 24 16:44:22 2018 +0200 -- .../provisioning/java/propagation/PropagationManagerImpl.java| 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/e5594178/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java index deac6a4..cd851d5 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java @@ -352,7 +352,9 @@ public class PropagationManagerImpl implements PropagationManager { } values.add(AttributeBuilder.build(schema.getExtAttrName(), vAttr.getValues())); -propByRes.add(ResourceOperation.UPDATE, schema.getProvision().getResource().getKey()); +if (!propByRes.contains(ResourceOperation.CREATE, schema.getProvision().getResource().getKey())) { +propByRes.add(ResourceOperation.UPDATE, schema.getProvision().getResource().getKey()); +} } else { LOG.warn("{} not owned by or {} not allowed for {}", schema.getProvision().getResource(), schema, any);
syncope git commit: [SYNCOPE-1389] provides the fix
Repository: syncope Updated Branches: refs/heads/2_0_X 5e854e117 -> f6d4d5d00 [SYNCOPE-1389] provides the fix Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/f6d4d5d0 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/f6d4d5d0 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/f6d4d5d0 Branch: refs/heads/2_0_X Commit: f6d4d5d00f758ad49eb45771856d59a8cf211c1c Parents: 5e854e1 Author: fmartelli Authored: Wed Oct 24 16:41:24 2018 +0200 Committer: fmartelli Committed: Wed Oct 24 16:41:24 2018 +0200 -- .../provisioning/java/propagation/PropagationManagerImpl.java| 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/f6d4d5d0/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java index 0fee2cc..1e5ab43 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PropagationManagerImpl.java @@ -357,7 +357,9 @@ public class PropagationManagerImpl implements PropagationManager { } values.add(AttributeBuilder.build(schema.getExtAttrName(), vAttr.getValues())); -propByRes.add(ResourceOperation.UPDATE, schema.getProvision().getResource().getKey()); +if (!propByRes.contains(ResourceOperation.CREATE, schema.getProvision().getResource().getKey())) { +propByRes.add(ResourceOperation.UPDATE, schema.getProvision().getResource().getKey()); +} } else { LOG.warn("{} not owned by or {} not allowed for {}", schema.getProvision().getResource(), schema, any);
syncope git commit: [SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector connection request timeout
Repository: syncope Updated Branches: refs/heads/master fd24dd8b4 -> b570430ca [SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector connection request timeout Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/b570430c Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b570430c Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b570430c Branch: refs/heads/master Commit: b570430ca160d0f27ec67e80a1bb6b09709f61bd Parents: fd24dd8 Author: fmartelli Authored: Mon Oct 15 17:16:51 2018 +0200 Committer: fmartelli Committed: Mon Oct 15 17:17:22 2018 +0200 -- .../PriorityPropagationTaskExecutor.java| 27 +++- 1 file changed, 21 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/b570430c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java index 77581a9..84339c8 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java @@ -19,6 +19,7 @@ package org.apache.syncope.core.provisioning.java.propagation; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -31,7 +32,6 @@ import java.util.concurrent.CompletionService; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.function.Function; import java.util.stream.Collectors; import javax.annotation.Resource; import org.apache.syncope.common.lib.to.PropagationTaskTO; @@ -83,11 +83,26 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec final PropagationReporter reporter, final boolean nullPriorityAsync) { -Map taskToResource = tasks.stream(). -collect(Collectors.toMap(Function.identity(), task -> resourceDAO.find(task.getResource(; +Map taskToResource = new HashMap<>(tasks.size()); +List prioritizedTasks = new ArrayList<>(); + +int[] connRequestTimeout = { 60 }; + +tasks.forEach(task -> { +ExternalResource resource = resourceDAO.find(task.getResource()); +taskToResource.put(task, resource); + +if (resource.getPropagationPriority() != null) { +prioritizedTasks.add(task); + +if (resource.getConnector().getConnRequestTimeout() != null +&& connRequestTimeout[0] < resource.getConnector().getConnRequestTimeout()) { +connRequestTimeout[0] = resource.getConnector().getConnRequestTimeout(); +LOG.debug("Upgrade request connection timeout to {}", connRequestTimeout); +} +} +}); -List prioritizedTasks = tasks.stream(). -filter(task -> taskToResource.get(task).getPropagationPriority() != null).collect(Collectors.toList()); Collections.sort(prioritizedTasks, new PriorityComparator(taskToResource)); LOG.debug("Propagation tasks sorted by priority, for serial execution: {}", prioritizedTasks); @@ -140,7 +155,7 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec LOG.error("Unexpected exception", e); } } -}).get(60, TimeUnit.SECONDS); +}).get(connRequestTimeout[0], TimeUnit.SECONDS); } catch (Exception e) { LOG.error("Unexpected exception", e); } finally {
syncope git commit: [SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector connection request timeout
Repository: syncope Updated Branches: refs/heads/2_1_X 0c03ecba9 -> e7102cd3b [SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector connection request timeout Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e7102cd3 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e7102cd3 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e7102cd3 Branch: refs/heads/2_1_X Commit: e7102cd3b074a8f3e7cecb2dccfaa3e2fb959cfb Parents: 0c03ecb Author: fmartelli Authored: Mon Oct 15 17:16:51 2018 +0200 Committer: fmartelli Committed: Mon Oct 15 17:16:51 2018 +0200 -- .../PriorityPropagationTaskExecutor.java| 27 +++- 1 file changed, 21 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/e7102cd3/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java index 77581a9..84339c8 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java @@ -19,6 +19,7 @@ package org.apache.syncope.core.provisioning.java.propagation; import java.io.Serializable; +import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -31,7 +32,6 @@ import java.util.concurrent.CompletionService; import java.util.concurrent.ExecutorCompletionService; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; -import java.util.function.Function; import java.util.stream.Collectors; import javax.annotation.Resource; import org.apache.syncope.common.lib.to.PropagationTaskTO; @@ -83,11 +83,26 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec final PropagationReporter reporter, final boolean nullPriorityAsync) { -Map taskToResource = tasks.stream(). -collect(Collectors.toMap(Function.identity(), task -> resourceDAO.find(task.getResource(; +Map taskToResource = new HashMap<>(tasks.size()); +List prioritizedTasks = new ArrayList<>(); + +int[] connRequestTimeout = { 60 }; + +tasks.forEach(task -> { +ExternalResource resource = resourceDAO.find(task.getResource()); +taskToResource.put(task, resource); + +if (resource.getPropagationPriority() != null) { +prioritizedTasks.add(task); + +if (resource.getConnector().getConnRequestTimeout() != null +&& connRequestTimeout[0] < resource.getConnector().getConnRequestTimeout()) { +connRequestTimeout[0] = resource.getConnector().getConnRequestTimeout(); +LOG.debug("Upgrade request connection timeout to {}", connRequestTimeout); +} +} +}); -List prioritizedTasks = tasks.stream(). -filter(task -> taskToResource.get(task).getPropagationPriority() != null).collect(Collectors.toList()); Collections.sort(prioritizedTasks, new PriorityComparator(taskToResource)); LOG.debug("Propagation tasks sorted by priority, for serial execution: {}", prioritizedTasks); @@ -140,7 +155,7 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec LOG.error("Unexpected exception", e); } } -}).get(60, TimeUnit.SECONDS); +}).get(connRequestTimeout[0], TimeUnit.SECONDS); } catch (Exception e) { LOG.error("Unexpected exception", e); } finally {
syncope git commit: [SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector connection request timeout
Repository: syncope Updated Branches: refs/heads/2_0_X 59b806731 -> 28812f7d1 [SYNCOPE-1385] makes PriorityPropagationTaskExecutor timeout closer to the maximum connector connection request timeout Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/28812f7d Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/28812f7d Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/28812f7d Branch: refs/heads/2_0_X Commit: 28812f7d168b054eae78909092fa42840dd97ef2 Parents: 59b8067 Author: fmartelli Authored: Mon Oct 15 16:21:59 2018 +0200 Committer: fmartelli Committed: Mon Oct 15 16:21:59 2018 +0200 -- .../PriorityPropagationTaskExecutor.java| 23 1 file changed, 14 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/28812f7d/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java index 4535802..9fc95ca 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/propagation/PriorityPropagationTaskExecutor.java @@ -34,7 +34,6 @@ import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import javax.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; -import org.apache.commons.collections4.Predicate; import org.apache.syncope.common.lib.to.PropagationTaskTO; import org.apache.syncope.common.lib.types.PropagationTaskExecStatus; import org.apache.syncope.core.persistence.api.entity.resource.ExternalResource; @@ -85,17 +84,23 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec final boolean nullPriorityAsync) { final Map taskToResource = new HashMap<>(tasks.size()); +List prioritizedTasks = new ArrayList<>(); +int connRequestTimeout = 60; for (PropagationTaskTO task : tasks) { -taskToResource.put(task, resourceDAO.find(task.getResource())); -} +ExternalResource resource = resourceDAO.find(task.getResource()); +taskToResource.put(task, resource); -List prioritizedTasks = CollectionUtils.select(tasks, new Predicate() { +if (resource.getPropagationPriority() != null) { +prioritizedTasks.add(task); -@Override -public boolean evaluate(final PropagationTaskTO task) { -return taskToResource.get(task).getPropagationPriority() != null; +if (resource.getConnector().getConnRequestTimeout() != null +&& connRequestTimeout < resource.getConnector().getConnRequestTimeout()) { +connRequestTimeout = resource.getConnector().getConnRequestTimeout(); +LOG.debug("Upgrade request connection timeout to {}", connRequestTimeout); +} } -}, new ArrayList()); +} + Collections.sort(prioritizedTasks, new PriorityComparator(taskToResource)); LOG.debug("Propagation tasks sorted by priority, for serial execution: {}", prioritizedTasks); @@ -152,7 +157,7 @@ public class PriorityPropagationTaskExecutor extends AbstractPropagationTaskExec } } } -}).get(60, TimeUnit.SECONDS); +}).get(connRequestTimeout, TimeUnit.SECONDS); } catch (Exception e) { LOG.error("Unexpected exception", e); } finally {
syncope git commit: [SYNCOPE-1383] missing some fixes for class cast exception
Repository: syncope Updated Branches: refs/heads/master 7cd359731 -> 4492950f3 [SYNCOPE-1383] missing some fixes for class cast exception Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4492950f Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4492950f Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4492950f Branch: refs/heads/master Commit: 4492950f380214122eb03308c608ac7167f2be78 Parents: 7cd3597 Author: fmartelli Authored: Thu Oct 11 17:19:34 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 17:19:34 2018 +0200 -- .../java/org/apache/syncope/core/logic/ResourceLogic.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/4492950f/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java -- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java index 4d6a4c2..60818ba 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java @@ -75,6 +75,7 @@ import org.identityconnectors.framework.common.objects.OperationOptions; import org.identityconnectors.framework.common.objects.ResultsHandler; import org.identityconnectors.framework.common.objects.SearchResult; import org.identityconnectors.framework.common.objects.Uid; +import org.identityconnectors.framework.spi.SearchResultsHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; @@ -387,7 +388,8 @@ public class ResourceLogic extends AbstractTransactionalLogic { final List connObjects = new ArrayList<>(); -SearchResult searchResult = connFactory.getConnector(resource).search(objectClass, null, new ResultsHandler() { +SearchResult searchResult = connFactory.getConnector(resource).search( +objectClass, null, new SearchResultsHandler() { private int count; @@ -398,6 +400,11 @@ public class ResourceLogic extends AbstractTransactionalLogic { count++; return count < size; } + +@Override +public void handleResult(final SearchResult sr) { +// do nothing +} }, size, pagedResultsCookie, orderBy, options); return ImmutablePair.of(searchResult, connObjects);
syncope git commit: [SYNCOPE-1383] missing some fixes for class cast exception
Repository: syncope Updated Branches: refs/heads/2_1_X 9e56cf510 -> 5f55de6b5 [SYNCOPE-1383] missing some fixes for class cast exception Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/5f55de6b Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/5f55de6b Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/5f55de6b Branch: refs/heads/2_1_X Commit: 5f55de6b5f2765c204e85ea06bb60a27921b07c2 Parents: 9e56cf5 Author: fmartelli Authored: Thu Oct 11 17:18:19 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 17:18:19 2018 +0200 -- .../java/org/apache/syncope/core/logic/ResourceLogic.java | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/5f55de6b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java -- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java index 4d6a4c2..60818ba 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java @@ -75,6 +75,7 @@ import org.identityconnectors.framework.common.objects.OperationOptions; import org.identityconnectors.framework.common.objects.ResultsHandler; import org.identityconnectors.framework.common.objects.SearchResult; import org.identityconnectors.framework.common.objects.Uid; +import org.identityconnectors.framework.spi.SearchResultsHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; @@ -387,7 +388,8 @@ public class ResourceLogic extends AbstractTransactionalLogic { final List connObjects = new ArrayList<>(); -SearchResult searchResult = connFactory.getConnector(resource).search(objectClass, null, new ResultsHandler() { +SearchResult searchResult = connFactory.getConnector(resource).search( +objectClass, null, new SearchResultsHandler() { private int count; @@ -398,6 +400,11 @@ public class ResourceLogic extends AbstractTransactionalLogic { count++; return count < size; } + +@Override +public void handleResult(final SearchResult sr) { +// do nothing +} }, size, pagedResultsCookie, orderBy, options); return ImmutablePair.of(searchResult, connObjects);
syncope git commit: [SYNCOPE-1383] missing some fixes for class cast exception
Repository: syncope Updated Branches: refs/heads/2_0_X cfa980833 -> 03b0c294a [SYNCOPE-1383] missing some fixes for class cast exception Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/03b0c294 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/03b0c294 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/03b0c294 Branch: refs/heads/2_0_X Commit: 03b0c294a51ca61ed776aba4fae9195e699c302d Parents: cfa9808 Author: fmartelli Authored: Thu Oct 11 17:15:11 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 17:15:11 2018 +0200 -- .../java/org/apache/syncope/core/logic/ResourceLogic.java | 9 - .../core/provisioning/java/ConnectorFacadeProxy.java| 7 ++- .../syncope/core/provisioning/java/pushpull/PullUtils.java | 9 - 3 files changed, 22 insertions(+), 3 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/03b0c294/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java -- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java index a993450..7883558 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/ResourceLogic.java @@ -79,6 +79,7 @@ import org.identityconnectors.framework.common.objects.OperationOptions; import org.identityconnectors.framework.common.objects.ResultsHandler; import org.identityconnectors.framework.common.objects.SearchResult; import org.identityconnectors.framework.common.objects.Uid; +import org.identityconnectors.framework.spi.SearchResultsHandler; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.stereotype.Component; @@ -406,7 +407,8 @@ public class ResourceLogic extends AbstractTransactionalLogic { final List connObjects = new ArrayList<>(); -SearchResult searchResult = connFactory.getConnector(resource).search(objectClass, null, new ResultsHandler() { +SearchResult searchResult = connFactory.getConnector(resource).search( +objectClass, null, new SearchResultsHandler() { private int count; @@ -417,6 +419,11 @@ public class ResourceLogic extends AbstractTransactionalLogic { count++; return count < size; } + +@Override +public void handleResult(final SearchResult sr) { +// do nothing +} }, size, pagedResultsCookie, orderBy, options); return ImmutablePair.of(searchResult, connObjects); http://git-wip-us.apache.org/repos/asf/syncope/blob/03b0c294/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java index aea4e27..d50ddb1 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/ConnectorFacadeProxy.java @@ -329,7 +329,7 @@ public class ConnectorFacadeProxy implements Connector { actualOptions = filterBuilder.build(actualOptions); } -search(objectClass, filter, new ResultsHandler() { +search(objectClass, filter, new SearchResultsHandler() { @Transactional @Override @@ -341,6 +341,11 @@ public class ConnectorFacadeProxy implements Connector { setToken(new SyncToken("")). build()); } + +@Override +public void handleResult(final SearchResult sr) { +// do nothing +} }, actualOptions); } http://git-wip-us.apache.org/repos/asf/syncope/blob/03b0c294/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/pushpull/PullUtils.java index 28c31d1..be656d4 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/
[1/2] syncope git commit: [SYNCOPE-1383] fixes the class cast exception by using a real SearchResultHandler
Repository: syncope Updated Branches: refs/heads/master 794416c94 -> 3c3c00877 [SYNCOPE-1383] fixes the class cast exception by using a real SearchResultHandler Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7de2d08e Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7de2d08e Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7de2d08e Branch: refs/heads/master Commit: 7de2d08eb3ea65a17d3598ef12ea7c654f9b6f6e Parents: 794416c Author: fmartelli Authored: Thu Oct 11 10:31:54 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 10:33:00 2018 +0200 -- .../provisioning/java/AsyncConnectorFacade.java | 20 1 file changed, 16 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/7de2d08e/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java index 22cc25d..e778639 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java @@ -28,9 +28,11 @@ import org.identityconnectors.framework.common.objects.ConnectorObject; import org.identityconnectors.framework.common.objects.ObjectClass; import org.identityconnectors.framework.common.objects.ObjectClassInfo; import org.identityconnectors.framework.common.objects.OperationOptions; +import org.identityconnectors.framework.common.objects.SearchResult; import org.identityconnectors.framework.common.objects.SyncToken; import org.identityconnectors.framework.common.objects.Uid; import org.identityconnectors.framework.common.objects.filter.FilterBuilder; +import org.identityconnectors.framework.spi.SearchResultsHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; @@ -107,10 +109,20 @@ public class AsyncConnectorFacade { connector.search( objectClass, ignoreCaseMatch ? FilterBuilder.equalsIgnoreCase(connObjectKey) : FilterBuilder.equalTo(connObjectKey), -connectorObject -> { -objects[0] = connectorObject; -return false; -}, options); +new SearchResultsHandler() { + +@Override +public boolean handle(final ConnectorObject connectorObject) { +objects[0] = connectorObject; +return false; +} + +@Override +public void handleResult(final SearchResult sr) { +// do nothing +} +}, +options); return new AsyncResult<>(objects[0]); }
[2/2] syncope git commit: [SYNCOPE-1382] improves string check conditions
[SYNCOPE-1382] improves string check conditions Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/3c3c0087 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/3c3c0087 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/3c3c0087 Branch: refs/heads/master Commit: 3c3c00877e8249f52f64aa3ba4b71c9635b27717 Parents: 7de2d08 Author: fmartelli Authored: Thu Oct 11 10:15:21 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 10:33:13 2018 +0200 -- .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/3c3c0087/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java -- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 3ce2702..c6ebca1 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -715,7 +715,7 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); -if (ignoreCase) { +if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { column = "LOWER (" + column + ")"; } if (!(cond instanceof AnyCond)) { @@ -766,7 +766,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { } else { query.append('='); } -if (ignoreCase) { +if ((schema.getType() == AttrSchemaType.String +|| schema.getType() == AttrSchemaType.Enum) && ignoreCase) { query.append("LOWER(?").append(setParameter(parameters, attrValue.getValue())).append(')'); } else { query.append('?').append(setParameter(parameters, attrValue.getValue()));
[2/2] syncope git commit: [SYNCOPE-1383] fixes the class cast exception by using a real SearchResultHandler
[SYNCOPE-1383] fixes the class cast exception by using a real SearchResultHandler Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/31595e4e Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/31595e4e Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/31595e4e Branch: refs/heads/2_1_X Commit: 31595e4e7a522d9fcf912e73ca89d0123857cd59 Parents: 8705dac Author: fmartelli Authored: Thu Oct 11 10:31:54 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 10:31:54 2018 +0200 -- .../provisioning/java/AsyncConnectorFacade.java | 20 1 file changed, 16 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/31595e4e/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java index 22cc25d..e778639 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java @@ -28,9 +28,11 @@ import org.identityconnectors.framework.common.objects.ConnectorObject; import org.identityconnectors.framework.common.objects.ObjectClass; import org.identityconnectors.framework.common.objects.ObjectClassInfo; import org.identityconnectors.framework.common.objects.OperationOptions; +import org.identityconnectors.framework.common.objects.SearchResult; import org.identityconnectors.framework.common.objects.SyncToken; import org.identityconnectors.framework.common.objects.Uid; import org.identityconnectors.framework.common.objects.filter.FilterBuilder; +import org.identityconnectors.framework.spi.SearchResultsHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; @@ -107,10 +109,20 @@ public class AsyncConnectorFacade { connector.search( objectClass, ignoreCaseMatch ? FilterBuilder.equalsIgnoreCase(connObjectKey) : FilterBuilder.equalTo(connObjectKey), -connectorObject -> { -objects[0] = connectorObject; -return false; -}, options); +new SearchResultsHandler() { + +@Override +public boolean handle(final ConnectorObject connectorObject) { +objects[0] = connectorObject; +return false; +} + +@Override +public void handleResult(final SearchResult sr) { +// do nothing +} +}, +options); return new AsyncResult<>(objects[0]); }
[1/2] syncope git commit: [SYNCOPE-1382] improves string check conditions
Repository: syncope Updated Branches: refs/heads/2_1_X 15255c18a -> 31595e4e7 [SYNCOPE-1382] improves string check conditions Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/8705dac3 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/8705dac3 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/8705dac3 Branch: refs/heads/2_1_X Commit: 8705dac32415147afd704787fe047b4fdf93fa53 Parents: 15255c1 Author: fmartelli Authored: Thu Oct 11 10:15:21 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 10:16:19 2018 +0200 -- .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/8705dac3/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java -- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 3ce2702..c6ebca1 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -715,7 +715,7 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); -if (ignoreCase) { +if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { column = "LOWER (" + column + ")"; } if (!(cond instanceof AnyCond)) { @@ -766,7 +766,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { } else { query.append('='); } -if (ignoreCase) { +if ((schema.getType() == AttrSchemaType.String +|| schema.getType() == AttrSchemaType.Enum) && ignoreCase) { query.append("LOWER(?").append(setParameter(parameters, attrValue.getValue())).append(')'); } else { query.append('?').append(setParameter(parameters, attrValue.getValue()));
[1/2] syncope git commit: [SYNCOPE-1382] improves string check conditions
Repository: syncope Updated Branches: refs/heads/2_0_X dd09c8a20 -> f092044c4 [SYNCOPE-1382] improves string check conditions Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/4242ae52 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/4242ae52 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/4242ae52 Branch: refs/heads/2_0_X Commit: 4242ae52944ae764b1613b83a943c017c95879da Parents: dd09c8a Author: fmartelli Authored: Thu Oct 11 10:15:21 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 10:15:21 2018 +0200 -- .../syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/4242ae52/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java -- diff --git a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java index 3dbca69..90e5fd0 100644 --- a/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java +++ b/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java @@ -680,7 +680,7 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { boolean ignoreCase = AttributeCond.Type.ILIKE == cond.getType() || AttributeCond.Type.IEQ == cond.getType(); String column = (cond instanceof AnyCond) ? cond.getSchema() : svs.fieldName(schema.getType()); -if (ignoreCase) { +if ((schema.getType() == AttrSchemaType.String || schema.getType() == AttrSchemaType.Enum) && ignoreCase) { column = "LOWER (" + column + ")"; } if (!(cond instanceof AnyCond)) { @@ -731,7 +731,8 @@ public class JPAAnySearchDAO extends AbstractAnySearchDAO { } else { query.append('='); } -if (ignoreCase) { +if ((schema.getType() == AttrSchemaType.String +|| schema.getType() == AttrSchemaType.Enum) && ignoreCase) { query.append("LOWER(?").append(setParameter(parameters, attrValue.getValue())).append(')'); } else { query.append('?').append(setParameter(parameters, attrValue.getValue()));
[2/2] syncope git commit: [SYNCOPE-1383] fixes the class cast exception by using a real SearchResultHandler
[SYNCOPE-1383] fixes the class cast exception by using a real SearchResultHandler Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/f092044c Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/f092044c Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/f092044c Branch: refs/heads/2_0_X Commit: f092044c44cb8fa99f9e6aef5d429e1a9920afea Parents: 4242ae5 Author: fmartelli Authored: Thu Oct 11 10:15:34 2018 +0200 Committer: fmartelli Committed: Thu Oct 11 10:15:34 2018 +0200 -- .../core/provisioning/java/AsyncConnectorFacade.java | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/f092044c/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java index a655fc4..2ccb078 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/AsyncConnectorFacade.java @@ -28,10 +28,11 @@ import org.identityconnectors.framework.common.objects.ConnectorObject; import org.identityconnectors.framework.common.objects.ObjectClass; import org.identityconnectors.framework.common.objects.ObjectClassInfo; import org.identityconnectors.framework.common.objects.OperationOptions; -import org.identityconnectors.framework.common.objects.ResultsHandler; +import org.identityconnectors.framework.common.objects.SearchResult; import org.identityconnectors.framework.common.objects.SyncToken; import org.identityconnectors.framework.common.objects.Uid; import org.identityconnectors.framework.common.objects.filter.FilterBuilder; +import org.identityconnectors.framework.spi.SearchResultsHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.scheduling.annotation.Async; @@ -104,13 +105,18 @@ public class AsyncConnectorFacade { final OperationOptions options) { final ConnectorObject[] objects = new ConnectorObject[1]; -connector.search(objectClass, FilterBuilder.equalTo(connObjectKey), new ResultsHandler() { +connector.search(objectClass, FilterBuilder.equalTo(connObjectKey), new SearchResultsHandler() { @Override public boolean handle(final ConnectorObject connectorObject) { objects[0] = connectorObject; return false; } + +@Override +public void handleResult(final SearchResult sr) { +// do nothing +} }, options); return new AsyncResult<>(objects[0]);
syncope git commit: [SYNCOPE-1379] provide the possibility to configure check connection timeouts (console side) + properties to customize resource connection checks thread pool
Repository: syncope Updated Branches: refs/heads/master f0398c7d7 -> 1302734d3 [SYNCOPE-1379] provide the possibility to configure check connection timeouts (console side) + properties to customize resource connection checks thread pool Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/1302734d Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/1302734d Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/1302734d Branch: refs/heads/master Commit: 1302734d34336558948205e0bfb17ecadaa24ede Parents: f0398c7 Author: fmartelli Authored: Mon Oct 8 15:55:42 2018 +0200 Committer: fmartelli Committed: Mon Oct 8 15:59:58 2018 +0200 -- .../console/SyncopeConsoleApplication.java | 23 ++ .../client/console/SyncopeConsoleSession.java | 6 +- .../topology/TopologyWebSocketBehavior.java | 211 +++ .../src/main/resources/console.properties | 4 + .../src/main/resources/console.properties | 4 + .../src/test/resources/console.properties | 5 + 6 files changed, 211 insertions(+), 42 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/1302734d/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java index cb866c0..2e15b19 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java @@ -104,6 +104,12 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { private Integer maxWaitTime; +private Integer corePoolSize; + +private Integer maxPoolSize; + +private Integer queueCapacity; + private List domains; private Map> pageClasses; @@ -159,6 +165,11 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { maxWaitTime = Integer.valueOf(props.getProperty("maxWaitTimeOnApplyChanges", "30")); +// Resource connections check thread pool size +corePoolSize = Integer.valueOf(props.getProperty("topology.corePoolSize", "5")); +maxPoolSize = Integer.valueOf(props.getProperty("topology.maxPoolSize", "10")); +queueCapacity = Integer.valueOf(props.getProperty("topology.queueCapacity", "50")); + String csrf = props.getProperty("csrf"); // process page properties @@ -276,6 +287,18 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { return maxWaitTime; } +public Integer getCorePoolSize() { +return corePoolSize; +} + +public Integer getMaxPoolSize() { +return maxPoolSize; +} + +public Integer getQueueCapacity() { +return queueCapacity; +} + public SyncopeClientFactoryBean newClientFactory() { return new SyncopeClientFactoryBean(). setAddress(scheme + "://" + host + ":" + port + StringUtils.prependIfMissing(rootPath, "/")). http://git-wip-us.apache.org/repos/asf/syncope/blob/1302734d/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java index 2f952ee..d793da2 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java @@ -104,9 +104,9 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession { executor = new ThreadPoolTaskExecutor(); executor.setWaitForTasksToCompleteOnShutdown(false); -executor.setCorePoolSize(5); -executor.setMaxPoolSize(10); -executor.setQueueCapacity(50); + executor.setCorePoolSize(SyncopeConsoleApplication.get().getCorePoolSize()); + executor.setMaxPoolSize(SyncopeConsoleApplication.get().getMaxPoolSize()); + executor.setQueueCapacity(SyncopeConsoleApplication.get().getQueueCapacity()); executor.initialize(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/1302734d/client/console/src/main/java/org/apache/syncope/client/console/topol
syncope git commit: [SYNCOPE-1379] provide the possibility to configure check connection timeouts (console side) + properties to customize resource connection checks thread pool
Repository: syncope Updated Branches: refs/heads/2_1_X 56ee47a22 -> e1b88c219 [SYNCOPE-1379] provide the possibility to configure check connection timeouts (console side) + properties to customize resource connection checks thread pool Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e1b88c21 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e1b88c21 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e1b88c21 Branch: refs/heads/2_1_X Commit: e1b88c21913f24c0e574080f6f7464e3a755b35a Parents: 56ee47a Author: fmartelli Authored: Mon Oct 8 15:55:42 2018 +0200 Committer: fmartelli Committed: Mon Oct 8 15:59:16 2018 +0200 -- .../console/SyncopeConsoleApplication.java | 23 ++ .../client/console/SyncopeConsoleSession.java | 6 +- .../topology/TopologyWebSocketBehavior.java | 211 +++ .../src/main/resources/console.properties | 4 + .../src/main/resources/console.properties | 4 + .../src/test/resources/console.properties | 5 + 6 files changed, 211 insertions(+), 42 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/e1b88c21/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java index cb866c0..2e15b19 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java @@ -104,6 +104,12 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { private Integer maxWaitTime; +private Integer corePoolSize; + +private Integer maxPoolSize; + +private Integer queueCapacity; + private List domains; private Map> pageClasses; @@ -159,6 +165,11 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { maxWaitTime = Integer.valueOf(props.getProperty("maxWaitTimeOnApplyChanges", "30")); +// Resource connections check thread pool size +corePoolSize = Integer.valueOf(props.getProperty("topology.corePoolSize", "5")); +maxPoolSize = Integer.valueOf(props.getProperty("topology.maxPoolSize", "10")); +queueCapacity = Integer.valueOf(props.getProperty("topology.queueCapacity", "50")); + String csrf = props.getProperty("csrf"); // process page properties @@ -276,6 +287,18 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { return maxWaitTime; } +public Integer getCorePoolSize() { +return corePoolSize; +} + +public Integer getMaxPoolSize() { +return maxPoolSize; +} + +public Integer getQueueCapacity() { +return queueCapacity; +} + public SyncopeClientFactoryBean newClientFactory() { return new SyncopeClientFactoryBean(). setAddress(scheme + "://" + host + ":" + port + StringUtils.prependIfMissing(rootPath, "/")). http://git-wip-us.apache.org/repos/asf/syncope/blob/e1b88c21/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java index 2f952ee..d793da2 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java @@ -104,9 +104,9 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession { executor = new ThreadPoolTaskExecutor(); executor.setWaitForTasksToCompleteOnShutdown(false); -executor.setCorePoolSize(5); -executor.setMaxPoolSize(10); -executor.setQueueCapacity(50); + executor.setCorePoolSize(SyncopeConsoleApplication.get().getCorePoolSize()); + executor.setMaxPoolSize(SyncopeConsoleApplication.get().getMaxPoolSize()); + executor.setQueueCapacity(SyncopeConsoleApplication.get().getQueueCapacity()); executor.initialize(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/e1b88c21/client/console/src/main/java/org/apache/syncope/client/console/topology/Topo
syncope git commit: [SYNCOPE-1379] provide the possibility to configure check connection timeouts (console side) + properties to customize resource connection checks thread pool
Repository: syncope Updated Branches: refs/heads/2_0_X 8c1a4f315 -> 11e88868b [SYNCOPE-1379] provide the possibility to configure check connection timeouts (console side) + properties to customize resource connection checks thread pool Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/11e88868 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/11e88868 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/11e88868 Branch: refs/heads/2_0_X Commit: 11e88868b1bf88d3b3ab0d6cb25261d7686d9a8e Parents: 8c1a4f3 Author: fmartelli Authored: Mon Oct 8 15:55:42 2018 +0200 Committer: fmartelli Committed: Mon Oct 8 15:55:42 2018 +0200 -- .../console/SyncopeConsoleApplication.java | 23 ++ .../client/console/SyncopeConsoleSession.java | 6 +- .../topology/TopologyWebSocketBehavior.java | 209 +++ .../src/main/resources/console.properties | 4 + .../src/main/resources/console.properties | 4 + .../src/test/resources/console.properties | 5 + 6 files changed, 211 insertions(+), 40 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/11e88868/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java index eeaf602..e160f1f 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleApplication.java @@ -111,6 +111,12 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { private Integer maxWaitTime; +private Integer corePoolSize; + +private Integer maxPoolSize; + +private Integer queueCapacity; + private List domains; private Map> pageClasses; @@ -166,6 +172,11 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { maxWaitTime = Integer.valueOf(props.getProperty("maxWaitTimeOnApplyChanges", "30")); +// Resource connections check thread pool size +corePoolSize = Integer.valueOf(props.getProperty("topology.corePoolSize", "5")); +maxPoolSize = Integer.valueOf(props.getProperty("topology.maxPoolSize", "10")); +queueCapacity = Integer.valueOf(props.getProperty("topology.queueCapacity", "50")); + String csrf = props.getProperty("csrf"); // process page properties @@ -322,6 +333,18 @@ public class SyncopeConsoleApplication extends AuthenticatedWebApplication { return maxWaitTime; } +public Integer getCorePoolSize() { +return corePoolSize; +} + +public Integer getMaxPoolSize() { +return maxPoolSize; +} + +public Integer getQueueCapacity() { +return queueCapacity; +} + public SyncopeClientFactoryBean newClientFactory() { return new SyncopeClientFactoryBean(). setAddress(scheme + "://" + host + ":" + port + "/" + rootPath). http://git-wip-us.apache.org/repos/asf/syncope/blob/11e88868/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java index bda14db..f312ca5 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/SyncopeConsoleSession.java @@ -103,9 +103,9 @@ public class SyncopeConsoleSession extends AuthenticatedWebSession { executor = new ThreadPoolTaskExecutor(); executor.setWaitForTasksToCompleteOnShutdown(false); -executor.setCorePoolSize(5); -executor.setMaxPoolSize(10); -executor.setQueueCapacity(50); + executor.setCorePoolSize(SyncopeConsoleApplication.get().getCorePoolSize()); + executor.setMaxPoolSize(SyncopeConsoleApplication.get().getMaxPoolSize()); + executor.setQueueCapacity(SyncopeConsoleApplication.get().getQueueCapacity()); executor.initialize(); } http://git-wip-us.apache.org/repos/asf/syncope/blob/11e88868/client/console/src/main/java/org/apache/syncope/client/console/topology/TopologyWebSocketBehavior.jav
syncope git commit: [SYNCOPE-1375] provides membership creation just in case external attribute mappend on membership attribut is really provided
Repository: syncope Updated Branches: refs/heads/master 46a8a2fd4 -> 7811bdb2d [SYNCOPE-1375] provides membership creation just in case external attribute mappend on membership attribut is really provided Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7811bdb2 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7811bdb2 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7811bdb2 Branch: refs/heads/master Commit: 7811bdb2d352ecd4f09b971ea38320814c03d0e8 Parents: 46a8a2f Author: fmartelli Authored: Wed Sep 26 11:40:19 2018 +0200 Committer: fmartelli Committed: Wed Sep 26 12:00:14 2018 +0200 -- .../syncope/core/provisioning/java/MappingManagerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/7811bdb2/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java index 4fc8fec..b6c63e3 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java @@ -769,7 +769,7 @@ public class MappingManagerImpl implements MappingManager { default: } -} else if (intAttrName.getSchemaType() != null) { +} else if (intAttrName.getSchemaType() != null && attr != null) { GroupableRelatableTO groupableTO = null; Group group = null; if (anyTO instanceof GroupableRelatableTO && intAttrName.getMembershipOfGroup() != null) { @@ -829,7 +829,7 @@ public class MappingManagerImpl implements MappingManager { attrTO.setSchema(intAttrName.getSchemaName()); // virtual attributes don't get transformed, iterate over original attr.getValue() -if (attr != null && attr.getValue() != null && !attr.getValue().isEmpty()) { +if (attr.getValue() != null && !attr.getValue().isEmpty()) { attr.getValue().stream(). filter(value -> value != null). forEachOrdered(value -> attrTO.getValues().add(value.toString()));
syncope git commit: [SYNCOPE-1375] provides membership creation just in case external attribute mappend on membership attribut is really provided
Repository: syncope Updated Branches: refs/heads/2_1_X 5564d51aa -> df5fe6c19 [SYNCOPE-1375] provides membership creation just in case external attribute mappend on membership attribut is really provided Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/df5fe6c1 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/df5fe6c1 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/df5fe6c1 Branch: refs/heads/2_1_X Commit: df5fe6c19556c66c32f054cb664f65e2e901d76c Parents: 5564d51 Author: fmartelli Authored: Wed Sep 26 11:40:19 2018 +0200 Committer: fmartelli Committed: Wed Sep 26 11:59:39 2018 +0200 -- .../syncope/core/provisioning/java/MappingManagerImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/df5fe6c1/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java index 4fc8fec..b6c63e3 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java @@ -769,7 +769,7 @@ public class MappingManagerImpl implements MappingManager { default: } -} else if (intAttrName.getSchemaType() != null) { +} else if (intAttrName.getSchemaType() != null && attr != null) { GroupableRelatableTO groupableTO = null; Group group = null; if (anyTO instanceof GroupableRelatableTO && intAttrName.getMembershipOfGroup() != null) { @@ -829,7 +829,7 @@ public class MappingManagerImpl implements MappingManager { attrTO.setSchema(intAttrName.getSchemaName()); // virtual attributes don't get transformed, iterate over original attr.getValue() -if (attr != null && attr.getValue() != null && !attr.getValue().isEmpty()) { +if (attr.getValue() != null && !attr.getValue().isEmpty()) { attr.getValue().stream(). filter(value -> value != null). forEachOrdered(value -> attrTO.getValues().add(value.toString()));
syncope git commit: [SYNCOPE-1375] provides membership creation just in case external attribute mappend on membership attribut is really provided
Repository: syncope Updated Branches: refs/heads/2_0_X 4a7ebffdc -> f6eda62e2 [SYNCOPE-1375] provides membership creation just in case external attribute mappend on membership attribut is really provided Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/f6eda62e Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/f6eda62e Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/f6eda62e Branch: refs/heads/2_0_X Commit: f6eda62e25aca51fdee08050e6eb3a11d5f6247f Parents: 4a7ebff Author: fmartelli Authored: Wed Sep 26 11:40:19 2018 +0200 Committer: fmartelli Committed: Wed Sep 26 11:40:19 2018 +0200 -- .../syncope/core/provisioning/java/MappingManagerImpl.java | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/f6eda62e/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java -- diff --git a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java index 4a66677..ad34038 100644 --- a/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java +++ b/core/provisioning-java/src/main/java/org/apache/syncope/core/provisioning/java/MappingManagerImpl.java @@ -761,7 +761,7 @@ public class MappingManagerImpl implements MappingManager { default: } -} else if (intAttrName.getSchemaType() != null) { +} else if (intAttrName.getSchemaType() != null && attr != null) { GroupableRelatableTO groupableTO = null; Group group = null; if (anyTO instanceof GroupableRelatableTO && intAttrName.getMembershipOfGroup() != null) { @@ -819,9 +819,7 @@ public class MappingManagerImpl implements MappingManager { attrTO.setSchema(intAttrName.getSchemaName()); // virtual attributes don't get transformed, iterate over original attr.getValue() -for (Object value : (attr == null || attr.getValue() == null) -? Collections.emptyList() : attr.getValue()) { - +for (Object value : attr.getValue() == null ? Collections.emptyList() : attr.getValue()) { if (value != null) { attrTO.getValues().add(value.toString()); }
syncope git commit: [SYNCOPE-1361] provides a fix into LoggerLoader
Repository: syncope Updated Branches: refs/heads/master d5ac34697 -> 12330a37d [SYNCOPE-1361] provides a fix into LoggerLoader Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/12330a37 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/12330a37 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/12330a37 Branch: refs/heads/master Commit: 12330a37dc7311cbfdc9dac47029ace56947e4f1 Parents: d5ac346 Author: fmartelli Authored: Wed Sep 5 16:17:38 2018 +0200 Committer: fmartelli Committed: Wed Sep 5 16:17:38 2018 +0200 -- .../java/org/apache/syncope/core/logic/init/LoggerLoader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/12330a37/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java -- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java index 0a09641..7a5e2dc 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java @@ -121,12 +121,13 @@ public class LoggerLoader implements SyncopeLoader { map(event -> AuditLoggerName.getAuditEventLoggerName(entry.getKey(), event.toLoggerName())). forEachOrdered(domainAuditLoggerName -> { LoggerConfig eventLogConf = ctx.getConfiguration().getLoggerConfig(domainAuditLoggerName); -if (LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName())) { +boolean isRootLogConf = LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName()); +if (isRootLogConf) { eventLogConf = new LoggerConfig(domainAuditLoggerName, null, false); } addAppenderToContext(ctx, auditAppender, eventLogConf); eventLogConf.setLevel(Level.DEBUG); -if (LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName())) { +if (isRootLogConf) { ctx.getConfiguration().addLogger(domainAuditLoggerName, eventLogConf); } });
syncope git commit: [SYNCOPE-1361] provides a fix into LoggerLoader
Repository: syncope Updated Branches: refs/heads/2_1_X 4918e957a -> c06920e2e [SYNCOPE-1361] provides a fix into LoggerLoader Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/c06920e2 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/c06920e2 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/c06920e2 Branch: refs/heads/2_1_X Commit: c06920e2e28ab2985763ee1996e746ece8047ae8 Parents: 4918e95 Author: fmartelli Authored: Wed Sep 5 16:11:14 2018 +0200 Committer: fmartelli Committed: Wed Sep 5 16:11:14 2018 +0200 -- .../java/org/apache/syncope/core/logic/init/LoggerLoader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/c06920e2/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java -- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java index 0a09641..7a5e2dc 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java @@ -121,12 +121,13 @@ public class LoggerLoader implements SyncopeLoader { map(event -> AuditLoggerName.getAuditEventLoggerName(entry.getKey(), event.toLoggerName())). forEachOrdered(domainAuditLoggerName -> { LoggerConfig eventLogConf = ctx.getConfiguration().getLoggerConfig(domainAuditLoggerName); -if (LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName())) { +boolean isRootLogConf = LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName()); +if (isRootLogConf) { eventLogConf = new LoggerConfig(domainAuditLoggerName, null, false); } addAppenderToContext(ctx, auditAppender, eventLogConf); eventLogConf.setLevel(Level.DEBUG); -if (LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName())) { +if (isRootLogConf) { ctx.getConfiguration().addLogger(domainAuditLoggerName, eventLogConf); } });
syncope git commit: [SYNCOPE-1361] provides a fix into LoggerLoader
Repository: syncope Updated Branches: refs/heads/2_0_X b9a5c5d1e -> 382a5a05e [SYNCOPE-1361] provides a fix into LoggerLoader Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/382a5a05 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/382a5a05 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/382a5a05 Branch: refs/heads/2_0_X Commit: 382a5a05e0676191d46fd5b31fca29471e67c017 Parents: b9a5c5d Author: fmartelli Authored: Wed Sep 5 15:46:16 2018 +0200 Committer: fmartelli Committed: Wed Sep 5 15:46:16 2018 +0200 -- .../java/org/apache/syncope/core/logic/init/LoggerLoader.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/382a5a05/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java -- diff --git a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java index 9743f50..bc9f7b9 100644 --- a/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java +++ b/core/logic/src/main/java/org/apache/syncope/core/logic/init/LoggerLoader.java @@ -122,12 +122,13 @@ public class LoggerLoader implements SyncopeLoader { AuditLoggerName.getAuditEventLoggerName(entry.getKey(), event.toLoggerName()); LoggerConfig eventLogConf = ctx.getConfiguration().getLoggerConfig(domainAuditLoggerName); -if (LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName())) { +boolean isRootLogConf = LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName()); +if (isRootLogConf) { eventLogConf = new LoggerConfig(domainAuditLoggerName, null, false); } addAppenderToContext(ctx, auditAppender, eventLogConf); eventLogConf.setLevel(Level.DEBUG); -if (LogManager.ROOT_LOGGER_NAME.equals(eventLogConf.getName())) { +if (isRootLogConf) { ctx.getConfiguration().addLogger(domainAuditLoggerName, eventLogConf); } }
syncope git commit: AD bundle version upgrade
Repository: syncope Updated Branches: refs/heads/2_1_X 87e1562ab -> a3d0345f6 AD bundle version upgrade Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/a3d0345f Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/a3d0345f Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/a3d0345f Branch: refs/heads/2_1_X Commit: a3d0345f692ccaaa782fdad4cb995a7bfa214c3b Parents: 87e1562 Author: fmartelli Authored: Mon Sep 3 12:18:35 2018 +0200 Committer: fmartelli Committed: Mon Sep 3 12:18:35 2018 +0200 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/a3d0345f/pom.xml -- diff --git a/pom.xml b/pom.xml index 3209c32..aa07ba3 100644 --- a/pom.xml +++ b/pom.xml @@ -383,7 +383,7 @@ under the License. 2.2.5 0.8.7 1.5.2 -1.3.4 +1.3.5 1.4.1 1.0.1 1.0.1
syncope git commit: AD bundle version upgrade
Repository: syncope Updated Branches: refs/heads/2_0_X 65a373151 -> 02eb5fdce AD bundle version upgrade Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/02eb5fdc Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/02eb5fdc Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/02eb5fdc Branch: refs/heads/2_0_X Commit: 02eb5fdce8c90bbb3453669b621cf96a7cfffd5b Parents: 65a3731 Author: fmartelli Authored: Mon Sep 3 12:17:49 2018 +0200 Committer: fmartelli Committed: Mon Sep 3 12:17:49 2018 +0200 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/02eb5fdc/pom.xml -- diff --git a/pom.xml b/pom.xml index 831c0a5..961d646 100644 --- a/pom.xml +++ b/pom.xml @@ -383,7 +383,7 @@ under the License. 2.2.5 0.8.7 1.5.2 -1.3.4 +1.3.5 1.4.1 1.0.1 1.0.1
syncope git commit: AD bundle version upgrade
Repository: syncope Updated Branches: refs/heads/master 78bd84649 -> 6ad136fa6 AD bundle version upgrade Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/6ad136fa Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/6ad136fa Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/6ad136fa Branch: refs/heads/master Commit: 6ad136fa611b59d292a8b05bda8aeb516781f85b Parents: 78bd846 Author: fmartelli Authored: Mon Sep 3 12:18:58 2018 +0200 Committer: fmartelli Committed: Mon Sep 3 12:18:58 2018 +0200 -- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/6ad136fa/pom.xml -- diff --git a/pom.xml b/pom.xml index b2de123..ff22dd2 100644 --- a/pom.xml +++ b/pom.xml @@ -383,7 +383,7 @@ under the License. 2.2.5 0.8.7 1.5.2 -1.3.4 +1.3.5 1.4.1 1.0.1 1.0.1
syncope git commit: [SYNCOPE-1340] just a 'not' was missing
Repository: syncope Updated Branches: refs/heads/master 0b86b374b -> e6cd20ed3 [SYNCOPE-1340] just a 'not' was missing Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/e6cd20ed Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/e6cd20ed Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/e6cd20ed Branch: refs/heads/master Commit: e6cd20ed3743b878a87185f87fec79826ff8 Parents: 0b86b37 Author: fmartelli Authored: Fri Jul 20 18:01:32 2018 +0200 Committer: fmartelli Committed: Fri Jul 20 18:01:32 2018 +0200 -- .../src/main/java/org/apache/syncope/common/lib/AnyOperations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/e6cd20ed/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java -- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java index d6b..02d3d4a 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java @@ -237,7 +237,7 @@ public final class AnyOperations { // 1. plain attributes result.getPlainAttrs().addAll(updated.getPlainAttrs().stream(). -filter(attrTO -> !attrTO.getValues().isEmpty() && NULL_SINGLETON.equals(attrTO.getValues())). +filter(attrTO -> !attrTO.getValues().isEmpty() && !NULL_SINGLETON.equals(attrTO.getValues())). collect(Collectors.toSet())); // 2. virtual attributes
syncope git commit: [SYNCOPE-1340] just a 'not' was missing
Repository: syncope Updated Branches: refs/heads/2_1_X 18b7094c2 -> d8773a4e7 [SYNCOPE-1340] just a 'not' was missing Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/d8773a4e Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/d8773a4e Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/d8773a4e Branch: refs/heads/2_1_X Commit: d8773a4e7cb1b3547c6c8154842f1ab91b9581a6 Parents: 18b7094 Author: fmartelli Authored: Fri Jul 20 17:58:18 2018 +0200 Committer: fmartelli Committed: Fri Jul 20 18:00:21 2018 +0200 -- .../src/main/java/org/apache/syncope/common/lib/AnyOperations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/d8773a4e/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java -- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java index d6b..02d3d4a 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java @@ -237,7 +237,7 @@ public final class AnyOperations { // 1. plain attributes result.getPlainAttrs().addAll(updated.getPlainAttrs().stream(). -filter(attrTO -> !attrTO.getValues().isEmpty() && NULL_SINGLETON.equals(attrTO.getValues())). +filter(attrTO -> !attrTO.getValues().isEmpty() && !NULL_SINGLETON.equals(attrTO.getValues())). collect(Collectors.toSet())); // 2. virtual attributes
syncope git commit: [SYNCOPE-1340] just a 'not' was missing
Repository: syncope Updated Branches: refs/heads/2_0_X 51d6228f5 -> af9b93169 [SYNCOPE-1340] just a 'not' was missing Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/af9b9316 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/af9b9316 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/af9b9316 Branch: refs/heads/2_0_X Commit: af9b93169062d5beb3c43ea744976b862bc5dfeb Parents: 51d6228 Author: fmartelli Authored: Fri Jul 20 17:58:18 2018 +0200 Committer: fmartelli Committed: Fri Jul 20 17:58:18 2018 +0200 -- .../src/main/java/org/apache/syncope/common/lib/AnyOperations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/af9b9316/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java -- diff --git a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java index 181fd4c..df1e7b1 100644 --- a/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java +++ b/common/lib/src/main/java/org/apache/syncope/common/lib/AnyOperations.java @@ -239,7 +239,7 @@ public final class AnyOperations { // 1. plain attributes result.getPlainAttrs().clear(); for (AttrTO attrTO : updated.getPlainAttrs()) { -if (!attrTO.getValues().isEmpty() && NULL_SINGLETON.equals(attrTO.getValues())) { +if (!attrTO.getValues().isEmpty() && !NULL_SINGLETON.equals(attrTO.getValues())) { result.getPlainAttrs().add(attrTO); } }
syncope git commit: [SYNCOPE-1333] same fix on Derived and Plain + code improving
Repository: syncope Updated Branches: refs/heads/master 2d233d197 -> 2c3754b2c [SYNCOPE-1333] same fix on Derived and Plain + code improving Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/2c3754b2 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/2c3754b2 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/2c3754b2 Branch: refs/heads/master Commit: 2c3754b2c195e414dd1c6c28604a6a94b635fed2 Parents: 2d233d1 Author: fmartelli Authored: Tue Jul 10 12:23:52 2018 +0200 Committer: fmartelli Committed: Tue Jul 10 12:24:28 2018 +0200 -- .../syncope/client/console/wizards/any/DerAttrs.java| 10 +- .../syncope/client/console/wizards/any/PlainAttrs.java | 12 ++-- .../syncope/client/console/wizards/any/VirAttrs.java| 10 -- 3 files changed, 27 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/2c3754b2/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java index f064402..dd94bc2 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java @@ -20,6 +20,7 @@ package org.apache.syncope.client.console.wizards.any; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -31,6 +32,7 @@ import org.apache.syncope.common.lib.EntityTOUtils; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.DerSchemaTO; +import org.apache.syncope.common.lib.to.GroupableRelatableTO; import org.apache.syncope.common.lib.to.MembershipTO; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; @@ -135,7 +137,13 @@ public class DerAttrs extends AbstractAttrs { protected void setAttrs(final MembershipTO membershipTO) { List attrs = new ArrayList<>(); -Map attrMap = EntityTOUtils.buildAttrMap(anyTO.getDerAttrs()); +final Map attrMap; +if (GroupableRelatableTO.class.cast(anyTO).getMembership(membershipTO.getGroupKey()).isPresent()) { +attrMap = EntityTOUtils.buildAttrMap(GroupableRelatableTO.class.cast(anyTO) + .getMembership(membershipTO.getGroupKey()).get().getDerAttrs()); +} else { +attrMap = new HashMap<>(); +} membershipSchemas.get(membershipTO.getGroupKey()).values().forEach(schema -> { AttrTO attrTO = new AttrTO(); http://git-wip-us.apache.org/repos/asf/syncope/blob/2c3754b2/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java index 3fcecf5..722adc9 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java @@ -20,6 +20,7 @@ package org.apache.syncope.client.console.wizards.any; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -47,6 +48,7 @@ import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.GroupableRelatableTO; import org.apache.syncope.common.lib.to.MembershipTO; import org.apache.syncope.common.lib.to.PlainSchemaTO; import org.apache.syncope.common.lib.to.UserTO; @@ -189,14 +191,20 @@ public class PlainAttrs extends AbstractAttrs { protected void setAttrs(final MembershipTO membershipTO) { List attrs = new ArrayList<>(); -Map attrMap = EntityTOUtils.buildAttrMap(membershipTO.getPlainAttrs()); +final Map attrMap; +if (GroupableRelatableTO.class.cast(anyTO).getMembership(membershipTO.getGroupKey()).isPresent()) { +attrMap = EntityTOUtils.buildAttrMap(GroupableRela
syncope git commit: [SYNCOPE-1333] same fix on Derived and Plain + code improving
Repository: syncope Updated Branches: refs/heads/2_1_X 2a6138672 -> 7c6ab5e9b [SYNCOPE-1333] same fix on Derived and Plain + code improving Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/7c6ab5e9 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/7c6ab5e9 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/7c6ab5e9 Branch: refs/heads/2_1_X Commit: 7c6ab5e9b780699d50dde340611d790443426e9f Parents: 2a61386 Author: fmartelli Authored: Tue Jul 10 12:23:52 2018 +0200 Committer: fmartelli Committed: Tue Jul 10 12:23:52 2018 +0200 -- .../syncope/client/console/wizards/any/DerAttrs.java| 10 +- .../syncope/client/console/wizards/any/PlainAttrs.java | 12 ++-- .../syncope/client/console/wizards/any/VirAttrs.java| 10 -- 3 files changed, 27 insertions(+), 5 deletions(-) -- http://git-wip-us.apache.org/repos/asf/syncope/blob/7c6ab5e9/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java index f064402..dd94bc2 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/DerAttrs.java @@ -20,6 +20,7 @@ package org.apache.syncope.client.console.wizards.any; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -31,6 +32,7 @@ import org.apache.syncope.common.lib.EntityTOUtils; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.DerSchemaTO; +import org.apache.syncope.common.lib.to.GroupableRelatableTO; import org.apache.syncope.common.lib.to.MembershipTO; import org.apache.syncope.common.lib.types.SchemaType; import org.apache.wicket.extensions.markup.html.tabs.AbstractTab; @@ -135,7 +137,13 @@ public class DerAttrs extends AbstractAttrs { protected void setAttrs(final MembershipTO membershipTO) { List attrs = new ArrayList<>(); -Map attrMap = EntityTOUtils.buildAttrMap(anyTO.getDerAttrs()); +final Map attrMap; +if (GroupableRelatableTO.class.cast(anyTO).getMembership(membershipTO.getGroupKey()).isPresent()) { +attrMap = EntityTOUtils.buildAttrMap(GroupableRelatableTO.class.cast(anyTO) + .getMembership(membershipTO.getGroupKey()).get().getDerAttrs()); +} else { +attrMap = new HashMap<>(); +} membershipSchemas.get(membershipTO.getGroupKey()).values().forEach(schema -> { AttrTO attrTO = new AttrTO(); http://git-wip-us.apache.org/repos/asf/syncope/blob/7c6ab5e9/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java -- diff --git a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java index 3fcecf5..722adc9 100644 --- a/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java +++ b/client/console/src/main/java/org/apache/syncope/client/console/wizards/any/PlainAttrs.java @@ -20,6 +20,7 @@ package org.apache.syncope.client.console.wizards.any; import java.util.ArrayList; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -47,6 +48,7 @@ import org.apache.syncope.common.lib.to.AnyObjectTO; import org.apache.syncope.common.lib.to.AnyTO; import org.apache.syncope.common.lib.to.AttrTO; import org.apache.syncope.common.lib.to.GroupTO; +import org.apache.syncope.common.lib.to.GroupableRelatableTO; import org.apache.syncope.common.lib.to.MembershipTO; import org.apache.syncope.common.lib.to.PlainSchemaTO; import org.apache.syncope.common.lib.to.UserTO; @@ -189,14 +191,20 @@ public class PlainAttrs extends AbstractAttrs { protected void setAttrs(final MembershipTO membershipTO) { List attrs = new ArrayList<>(); -Map attrMap = EntityTOUtils.buildAttrMap(membershipTO.getPlainAttrs()); +final Map attrMap; +if (GroupableRelatableTO.class.cast(anyTO).getMembership(membershipTO.getGroupKey()).isPresent()) { +attrMap = EntityTOUtils.buildAttrMap(GroupableRela